diff --git a/.cargo/config.toml b/.cargo/config.toml index 5b529c3dccd..18bc8e4064b 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,8 +1,13 @@ +# TODO: We shouldn't go with tokio_unstable to production + [target.aarch64-unknown-linux-musl] -rustflags = [ "-C", "target-feature=-crt-static" ] +rustflags = ["-C", "target-feature=-crt-static", "--cfg", "tokio_unstable"] [target.x86_64-unknown-linux-musl] -rustflags = [ "-C", "target-feature=-crt-static" ] +rustflags = ["-C", "target-feature=-crt-static", "--cfg", "tokio_unstable"] [target.aarch64-unknown-linux-gnu] linker = "aarch64-linux-gnu-gcc" + +[build] +rustflags = ["--cfg", "tokio_unstable"] diff --git a/.dockerignore b/.dockerignore index 2d179b88e94..d93249fec2a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -23,6 +23,7 @@ packages/*/dist packages/*/wasm packages/*/lib/wasm packages/*/node_modules +packages/*/.env !packages/platform-test-suite/test diff --git a/.github/actions/javy/action.yaml b/.github/actions/javy/action.yaml new file mode 100644 index 00000000000..668dc24445a --- /dev/null +++ b/.github/actions/javy/action.yaml @@ -0,0 +1,37 @@ +--- +name: "Setup Javy" +description: "Setup Javy binaries" +inputs: + version: + description: Javy version to use + required: false + default: "1.4.0" +runs: + using: composite + steps: + - name: Install Javy + shell: bash + run: | + set -e + + case "${{ runner.arch }}" in + "ARM64") + JAVY_ARCH="arm-linux" + ;; + "X64") + JAVY_ARCH="x86_64-linux" + ;; + *) + echo "Unsupported architecture: ${{ runner.arch }}" + exit 1 + ;; + esac + + curl -Ls "https://github.com/bytecodealliance/javy/releases/download/v${{ inputs.version }}/javy-${JAVY_ARCH}-v${{ inputs.version }}.gz" | gunzip > javy + + chmod +x javy + sudo mv javy /usr/local/bin/javy + + - name: Verify Javy installation + shell: bash + run: javy --version diff --git a/.github/actions/nodejs/action.yaml b/.github/actions/nodejs/action.yaml index 8bba2f1d714..7cb41d5955e 100644 --- a/.github/actions/nodejs/action.yaml +++ b/.github/actions/nodejs/action.yaml @@ -5,7 +5,7 @@ runs: using: composite steps: - name: Setup Node.JS - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: "20" diff --git a/.github/actions/rust/action.yaml b/.github/actions/rust/action.yaml index b01cd0a5dc8..a6aa86446e0 100644 --- a/.github/actions/rust/action.yaml +++ b/.github/actions/rust/action.yaml @@ -54,7 +54,7 @@ runs: shell: bash run: | curl -Lo /tmp/protoc.zip \ - "https://github.com/protocolbuffers/protobuf/releases/download/v22.0/protoc-22.0-linux-${{ steps.protoc_arch.outputs.arch }}.zip" + "https://github.com/protocolbuffers/protobuf/releases/download/v25.2/protoc-25.2-linux-${{ steps.protoc_arch.outputs.arch }}.zip" unzip /tmp/protoc.zip -d ${HOME}/.local echo "PROTOC=${HOME}/.local/bin/protoc" >> $GITHUB_ENV export PATH="${PATH}:${HOME}/.local/bin" diff --git a/.github/package-filters/js-packages.yml b/.github/package-filters/js-packages.yml index b9e3618155c..d158bb39f67 100644 --- a/.github/package-filters/js-packages.yml +++ b/.github/package-filters/js-packages.yml @@ -71,7 +71,12 @@ dash: &dash dashmate: - .github/workflows/tests* - packages/dashmate/** - - *dash + - *dashpay-contract + - *masternode-reward-shares-contract + - *dpns-contract + - *withdrawals-contract + - *wallet-lib + - *dapi-client '@dashevo/platform-test-suite': - .github/workflows/tests* diff --git a/.github/package-filters/rs-packages.yml b/.github/package-filters/rs-packages.yml index f23238f9afa..f50dea216d3 100644 --- a/.github/package-filters/rs-packages.yml +++ b/.github/package-filters/rs-packages.yml @@ -14,6 +14,10 @@ dpns-contract: &dpns-contract - .github/workflows/tests* - packages/dpns-contract/** +json-schema-compatibility-validator: &json-schema-compatibility-validator + - .github/workflows/tests* + - packages/rs-json-schema-compatibility-validator/** + dpp: &dpp - .github/workflows/tests* - packages/rs-dpp/** @@ -21,6 +25,7 @@ dpp: &dpp - *masternode-reward-shares-contract - *dpns-contract - *withdrawals-contract + - *json-schema-compatibility-validator - packages/rs-platform-serialization/** - packages/rs-platform-serialization-derive/** - packages/rs-platform-value/** @@ -54,7 +59,7 @@ rs-dapi-client: &dapi_client - packages/rs-dapi-client/** - *dapi_grpc -rs-sdk: +dash-sdk: - .github/workflows/tests* - packages/rs-drive-proof-verifier/** - packages/rs-sdk/** diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 7238fbec4ec..12f512b7208 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,7 +2,7 @@ name: Publish docs via GitHub Pages on: push: branches: - - master + - v1.0-dev jobs: build: diff --git a/.github/workflows/tests-dashmate.yml b/.github/workflows/tests-dashmate.yml index 99bed1134b1..0772b7f4990 100644 --- a/.github/workflows/tests-dashmate.yml +++ b/.github/workflows/tests-dashmate.yml @@ -49,10 +49,12 @@ jobs: key: build-js-artifacts/${{ github.sha }} - name: Unpack JS build artifacts archive - run: tar -xf build-js-artifacts-${{ github.sha }}.tar + run: tar -xvf build-js-artifacts-${{ github.sha }}.tar - name: Replace with pre-built images run: | + set -x + # Login to ECR DOCKER_HUB_ORG="${{ vars.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION }}.amazonaws.com" aws ecr get-login-password --region ${{ vars.AWS_REGION }} | docker login --username AWS --password-stdin $DOCKER_HUB_ORG diff --git a/.github/workflows/tests-rs-package.yml b/.github/workflows/tests-rs-package.yml index bd574fdffbc..77e28b2232f 100644 --- a/.github/workflows/tests-rs-package.yml +++ b/.github/workflows/tests-rs-package.yml @@ -41,6 +41,14 @@ jobs: with: components: clippy + - name: Setup Node.JS, required by json-schema-faker-rs + if: inputs.package == 'dpp' + uses: ./.github/actions/nodejs + + - name: Setup Javy, required by json-schema-faker-rs + if: inputs.package == 'dpp' + uses: ./.github/actions/javy + - uses: clechasseur/rs-clippy-check@v3 with: args: --package ${{ inputs.package }} --all-features --locked -- --no-deps @@ -106,6 +114,10 @@ jobs: detect_structure_changes: name: Detect immutable structure changes runs-on: ubuntu-22.04 + # FIXME: as we use `gh pr view` below, this check can only + # run on pull requests. We should find a way to run it + # when manual triggers are used. + if: github.event_name == 'pull_request' steps: - name: Checkout base commit uses: actions/checkout@v4 @@ -176,6 +188,14 @@ jobs: - name: Setup Rust uses: ./.github/actions/rust + - name: Setup Node.JS, required by json-schema-faker-rs + if: inputs.package == 'dpp' + uses: ./.github/actions/nodejs + + - name: Setup Javy, required by json-schema-faker-rs + if: inputs.package == 'dpp' + uses: ./.github/actions/javy + - name: Run tests run: cargo test --package=${{ inputs.package }} --all-features --locked env: @@ -201,7 +221,15 @@ jobs: - name: Setup Rust uses: ./.github/actions/rust - - name: Get crate ${{ inputs.package }} info + - name: Setup Node.JS, required by json-schema-faker-rs + if: inputs.package == 'dpp' + uses: ./.github/actions/nodejs + + - name: Setup Javy, required by json-schema-faker-rs + if: inputs.package == 'dpp' + uses: ./.github/actions/javy + + - name: Get crate ${{ runner.arch }} info id: crate_info uses: ./.github/actions/crate_info with: @@ -218,6 +246,7 @@ jobs: set -ex features="${{ steps.crate_info.outputs.features }}" fails="" + RUSTFLAGS="-D warnings" cargo check --no-default-features --package "${{ inputs.package }}" --locked for feature in $features ; do echo " ============== Verify feature $feature ==============" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dd65706849b..bb96fca8cb6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,7 +6,7 @@ on: types: [opened, synchronize, reopened, ready_for_review] branches: - master - - v[0-9]+\.[0-9]+-dev + - 'v[0-9]+\.[0-9]+-dev' push: branches: - master @@ -83,11 +83,13 @@ jobs: uses: ./.github/workflows/tests-rs-package.yml with: package: ${{ matrix.rs-package }} - # Run drive and drive-abci linter on self-hosted 2x - lint-runner: ${{ contains(fromJSON('["drive-abci", "drive"]'), matrix.rs-package) && '[ "self-hosted", "linux", "arm64", "ubuntu-platform" ]' || '"ubuntu-22.04"' }} + # lint-runner: ${{ contains(fromJSON('["drive-abci", "drive"]'), matrix.rs-package) && '[ "self-hosted", "linux", "arm64", "ubuntu-platform" ]' || '"ubuntu-22.04"' }} + # FIXME: Clippy fails on github hosted runners, most likely due to RAM usage. Using self-hosted runners for now. + lint-runner: '[ "self-hosted", "linux", "arm64", "ubuntu-platform" ]' # Run drive tests on self-hosted 4x test-runner: ${{ contains(fromJSON('["drive-abci"]'), matrix.rs-package) && '[ "self-hosted", "linux", "arm64", "ubuntu-platform-4x" ]' || '[ "self-hosted", "linux", "arm64", "ubuntu-platform" ]' }} - check-each-feature: ${{ contains(fromJSON('["rs-sdk","rs-dapi-client","dapi-grpc","dpp","drive-abci"]'), matrix.rs-package) }} + check-each-feature: ${{ contains(fromJSON('["dash-sdk","rs-dapi-client","dapi-grpc","dpp","drive-abci"]'), matrix.rs-package) }} + rs-crates-security: name: Rust crates security audit if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || !github.event.pull_request.draft }} @@ -126,9 +128,9 @@ jobs: uses: actions/checkout@v4 - name: Setup Node.JS - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: "18" + node-version: "20" - name: Enable corepack run: corepack enable diff --git a/.pnp.cjs b/.pnp.cjs index 7cdca897026..530331d0627 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -141,8 +141,8 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/@ampproject-remapping-npm-2.2.1-3da3d624be-e15fecbf3b.zip/node_modules/@ampproject/remapping/",\ "packageDependencies": [\ ["@ampproject/remapping", "npm:2.2.1"],\ - ["@jridgewell/gen-mapping", "npm:0.3.2"],\ - ["@jridgewell/trace-mapping", "npm:0.3.15"]\ + ["@jridgewell/gen-mapping", "npm:0.3.3"],\ + ["@jridgewell/trace-mapping", "npm:0.3.18"]\ ],\ "linkType": "HARD"\ }]\ @@ -189,7 +189,7 @@ const RAW_RUNTIME_STATE = ["commander", "npm:4.1.1"],\ ["convert-source-map", "npm:2.0.0"],\ ["fs-readdir-recursive", "npm:1.1.0"],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["make-dir", "npm:2.1.0"],\ ["slash", "npm:2.0.0"]\ ],\ @@ -201,14 +201,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/code-frame", [\ - ["npm:7.16.7", {\ - "packageLocation": "./.yarn/cache/@babel-code-frame-npm-7.16.7-093eb9e124-db2f7faa31.zip/node_modules/@babel/code-frame/",\ - "packageDependencies": [\ - ["@babel/code-frame", "npm:7.16.7"],\ - ["@babel/highlight", "npm:7.16.10"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.22.13", {\ "packageLocation": "./.yarn/cache/@babel-code-frame-npm-7.22.13-2782581d20-bf6ae6ba3a.zip/node_modules/@babel/code-frame/",\ "packageDependencies": [\ @@ -260,10 +252,10 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "SOFT"\ }],\ - ["virtual:880cda903c2a2be387819a3f857d21494004437a03c92969b9853f7bdeebdfed08d417e68364ee9e158338603a6d78d690c457a55ab11e56398bc10f0ad232fc#npm:7.23.3", {\ - "packageLocation": "./.yarn/__virtual__/@babel-eslint-parser-virtual-fb9593e0e4/0/cache/@babel-eslint-parser-npm-7.23.3-4d4192b444-bc487f67aa.zip/node_modules/@babel/eslint-parser/",\ + ["virtual:6c6296bde00603e266f7d80babe1e01aa0c19f626934f58fe08f890a291bb1a38fcee25bf30c24857d5cfba290f01209decc48384318fd6815c5a514cb48be25#npm:7.23.3", {\ + "packageLocation": "./.yarn/__virtual__/@babel-eslint-parser-virtual-6366d88438/0/cache/@babel-eslint-parser-npm-7.23.3-4d4192b444-bc487f67aa.zip/node_modules/@babel/eslint-parser/",\ "packageDependencies": [\ - ["@babel/eslint-parser", "virtual:880cda903c2a2be387819a3f857d21494004437a03c92969b9853f7bdeebdfed08d417e68364ee9e158338603a6d78d690c457a55ab11e56398bc10f0ad232fc#npm:7.23.3"],\ + ["@babel/eslint-parser", "virtual:6c6296bde00603e266f7d80babe1e01aa0c19f626934f58fe08f890a291bb1a38fcee25bf30c24857d5cfba290f01209decc48384318fd6815c5a514cb48be25#npm:7.23.3"],\ ["@babel/core", "npm:7.23.3"],\ ["@nicolo-ribaudo/eslint-scope-5-internals", "npm:5.1.1-v1"],\ ["@types/babel__core", null],\ @@ -282,16 +274,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/generator", [\ - ["npm:7.17.3", {\ - "packageLocation": "./.yarn/cache/@babel-generator-npm-7.17.3-b206625c17-9a102a87b4.zip/node_modules/@babel/generator/",\ - "packageDependencies": [\ - ["@babel/generator", "npm:7.17.3"],\ - ["@babel/types", "npm:7.17.0"],\ - ["jsesc", "npm:2.5.2"],\ - ["source-map", "npm:0.5.7"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.23.3", {\ "packageLocation": "./.yarn/cache/@babel-generator-npm-7.23.3-a2ca9dda65-0f815d275c.zip/node_modules/@babel/generator/",\ "packageDependencies": [\ @@ -412,7 +394,7 @@ const RAW_RUNTIME_STATE = ["@types/babel__core", null],\ ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ ["lodash.debounce", "npm:4.0.8"],\ - ["resolve", "patch:resolve@npm%3A1.22.0#optional!builtin::version=1.22.0&hash=c3c19d"]\ + ["resolve", "patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d"]\ ],\ "packagePeers": [\ "@babel/core",\ @@ -422,14 +404,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/helper-environment-visitor", [\ - ["npm:7.16.7", {\ - "packageLocation": "./.yarn/cache/@babel-helper-environment-visitor-npm-7.16.7-3ee2ba2019-c03a10105d.zip/node_modules/@babel/helper-environment-visitor/",\ - "packageDependencies": [\ - ["@babel/helper-environment-visitor", "npm:7.16.7"],\ - ["@babel/types", "npm:7.17.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.22.20", {\ "packageLocation": "./.yarn/cache/@babel-helper-environment-visitor-npm-7.22.20-260909e014-d80ee98ff6.zip/node_modules/@babel/helper-environment-visitor/",\ "packageDependencies": [\ @@ -439,16 +413,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/helper-function-name", [\ - ["npm:7.16.7", {\ - "packageLocation": "./.yarn/cache/@babel-helper-function-name-npm-7.16.7-aa24c7b296-12e2678236.zip/node_modules/@babel/helper-function-name/",\ - "packageDependencies": [\ - ["@babel/helper-function-name", "npm:7.16.7"],\ - ["@babel/helper-get-function-arity", "npm:7.16.7"],\ - ["@babel/template", "npm:7.16.7"],\ - ["@babel/types", "npm:7.17.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.23.0", {\ "packageLocation": "./.yarn/cache/@babel-helper-function-name-npm-7.23.0-ce38271242-7b2ae024cd.zip/node_modules/@babel/helper-function-name/",\ "packageDependencies": [\ @@ -459,25 +423,7 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ - ["@babel/helper-get-function-arity", [\ - ["npm:7.16.7", {\ - "packageLocation": "./.yarn/cache/@babel-helper-get-function-arity-npm-7.16.7-987b1b1bed-25d969fb20.zip/node_modules/@babel/helper-get-function-arity/",\ - "packageDependencies": [\ - ["@babel/helper-get-function-arity", "npm:7.16.7"],\ - ["@babel/types", "npm:7.17.0"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["@babel/helper-hoist-variables", [\ - ["npm:7.16.7", {\ - "packageLocation": "./.yarn/cache/@babel-helper-hoist-variables-npm-7.16.7-25cc3abba4-6ae1641f4a.zip/node_modules/@babel/helper-hoist-variables/",\ - "packageDependencies": [\ - ["@babel/helper-hoist-variables", "npm:7.16.7"],\ - ["@babel/types", "npm:7.17.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.22.5", {\ "packageLocation": "./.yarn/cache/@babel-helper-hoist-variables-npm-7.22.5-6db3192347-394ca191b4.zip/node_modules/@babel/helper-hoist-variables/",\ "packageDependencies": [\ @@ -545,13 +491,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/helper-plugin-utils", [\ - ["npm:7.14.5", {\ - "packageLocation": "./.yarn/cache/@babel-helper-plugin-utils-npm-7.14.5-e35eef11cb-fe20e90a24.zip/node_modules/@babel/helper-plugin-utils/",\ - "packageDependencies": [\ - ["@babel/helper-plugin-utils", "npm:7.14.5"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.22.5", {\ "packageLocation": "./.yarn/cache/@babel-helper-plugin-utils-npm-7.22.5-192e38e1de-ab220db218.zip/node_modules/@babel/helper-plugin-utils/",\ "packageDependencies": [\ @@ -631,14 +570,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/helper-split-export-declaration", [\ - ["npm:7.16.7", {\ - "packageLocation": "./.yarn/cache/@babel-helper-split-export-declaration-npm-7.16.7-5b9ae90171-e10aaf1354.zip/node_modules/@babel/helper-split-export-declaration/",\ - "packageDependencies": [\ - ["@babel/helper-split-export-declaration", "npm:7.16.7"],\ - ["@babel/types", "npm:7.17.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.22.6", {\ "packageLocation": "./.yarn/cache/@babel-helper-split-export-declaration-npm-7.22.6-e723505aef-e141cace58.zip/node_modules/@babel/helper-split-export-declaration/",\ "packageDependencies": [\ @@ -658,13 +589,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/helper-validator-identifier", [\ - ["npm:7.16.7", {\ - "packageLocation": "./.yarn/cache/@babel-helper-validator-identifier-npm-7.16.7-8599fb00fc-42b9b56c35.zip/node_modules/@babel/helper-validator-identifier/",\ - "packageDependencies": [\ - ["@babel/helper-validator-identifier", "npm:7.16.7"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.22.20", {\ "packageLocation": "./.yarn/cache/@babel-helper-validator-identifier-npm-7.22.20-18305bb306-df882d2675.zip/node_modules/@babel/helper-validator-identifier/",\ "packageDependencies": [\ @@ -707,16 +631,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/highlight", [\ - ["npm:7.16.10", {\ - "packageLocation": "./.yarn/cache/@babel-highlight-npm-7.16.10-626c03326c-1f1bdd752a.zip/node_modules/@babel/highlight/",\ - "packageDependencies": [\ - ["@babel/highlight", "npm:7.16.10"],\ - ["@babel/helper-validator-identifier", "npm:7.16.7"],\ - ["chalk", "npm:2.4.2"],\ - ["js-tokens", "npm:4.0.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.22.20", {\ "packageLocation": "./.yarn/cache/@babel-highlight-npm-7.22.20-5de7aba88d-1aabc95b2c.zip/node_modules/@babel/highlight/",\ "packageDependencies": [\ @@ -729,19 +643,11 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/parser", [\ - ["npm:7.17.3", {\ - "packageLocation": "./.yarn/cache/@babel-parser-npm-7.17.3-1c3b6747e0-2d45750cdf.zip/node_modules/@babel/parser/",\ - "packageDependencies": [\ - ["@babel/parser", "npm:7.17.3"],\ - ["@babel/types", "npm:7.17.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.23.3", {\ "packageLocation": "./.yarn/cache/@babel-parser-npm-7.23.3-8d3a021e39-284c22ec1d.zip/node_modules/@babel/parser/",\ "packageDependencies": [\ ["@babel/parser", "npm:7.23.3"],\ - ["@babel/types", "npm:7.17.0"]\ + ["@babel/types", "npm:7.23.3"]\ ],\ "linkType": "HARD"\ }]\ @@ -853,7 +759,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-async-generators", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.8.4"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -876,7 +782,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-class-properties", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.12.13"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -899,7 +805,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-class-static-block", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.14.5"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -922,7 +828,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-dynamic-import", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.8.3"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -945,7 +851,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-export-namespace-from", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.8.3"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1014,7 +920,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-import-meta", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.10.4"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1037,7 +943,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-json-strings", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.8.3"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1060,7 +966,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-logical-assignment-operators", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.10.4"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1083,7 +989,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-nullish-coalescing-operator", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.8.3"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1106,7 +1012,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-numeric-separator", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.10.4"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1129,7 +1035,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-object-rest-spread", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.8.3"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1152,7 +1058,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-optional-catch-binding", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.8.3"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1175,7 +1081,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-optional-chaining", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.8.3"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1198,7 +1104,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-private-property-in-object", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.14.5"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -1221,7 +1127,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/plugin-syntax-top-level-await", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:7.14.5"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ ["@types/babel__core", null]\ ],\ "packagePeers": [\ @@ -2526,8 +2432,8 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@babel/preset-modules", "virtual:06ad3cc0f492132e824d7a51e866fc99416784543ebe8e22dd21ed1a109e82519f799617af68c863bbb60d4e132d3b2572fd956418eb89500f47ecbe5029e03e#npm:0.1.6-no-external-plugins"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/helper-plugin-utils", "npm:7.14.5"],\ - ["@babel/types", "npm:7.17.0"],\ + ["@babel/helper-plugin-utils", "npm:7.22.5"],\ + ["@babel/types", "npm:7.23.3"],\ ["@types/babel__core", null],\ ["esutils", "npm:2.0.3"]\ ],\ @@ -2558,16 +2464,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/template", [\ - ["npm:7.16.7", {\ - "packageLocation": "./.yarn/cache/@babel-template-npm-7.16.7-a18e444be8-f35836a8cd.zip/node_modules/@babel/template/",\ - "packageDependencies": [\ - ["@babel/template", "npm:7.16.7"],\ - ["@babel/code-frame", "npm:7.16.7"],\ - ["@babel/parser", "npm:7.17.3"],\ - ["@babel/types", "npm:7.17.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.22.15", {\ "packageLocation": "./.yarn/cache/@babel-template-npm-7.22.15-0b464facb4-21e768e4ee.zip/node_modules/@babel/template/",\ "packageDependencies": [\ @@ -2580,23 +2476,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/traverse", [\ - ["npm:7.17.3", {\ - "packageLocation": "./.yarn/cache/@babel-traverse-npm-7.17.3-c2bff3e671-03aed531e0.zip/node_modules/@babel/traverse/",\ - "packageDependencies": [\ - ["@babel/traverse", "npm:7.17.3"],\ - ["@babel/code-frame", "npm:7.16.7"],\ - ["@babel/generator", "npm:7.17.3"],\ - ["@babel/helper-environment-visitor", "npm:7.16.7"],\ - ["@babel/helper-function-name", "npm:7.16.7"],\ - ["@babel/helper-hoist-variables", "npm:7.16.7"],\ - ["@babel/helper-split-export-declaration", "npm:7.16.7"],\ - ["@babel/parser", "npm:7.17.3"],\ - ["@babel/types", "npm:7.17.0"],\ - ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ - ["globals", "npm:11.12.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.23.3", {\ "packageLocation": "./.yarn/cache/@babel-traverse-npm-7.23.3-a268f4c943-522ef8eefe.zip/node_modules/@babel/traverse/",\ "packageDependencies": [\ @@ -2616,15 +2495,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@babel/types", [\ - ["npm:7.17.0", {\ - "packageLocation": "./.yarn/cache/@babel-types-npm-7.17.0-3c936b54e4-535ccef360.zip/node_modules/@babel/types/",\ - "packageDependencies": [\ - ["@babel/types", "npm:7.17.0"],\ - ["@babel/helper-validator-identifier", "npm:7.16.7"],\ - ["to-fast-properties", "npm:2.0.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.23.3", {\ "packageLocation": "./.yarn/cache/@babel-types-npm-7.23.3-77a779c6d4-05ec1527d0.zip/node_modules/@babel/types/",\ "packageDependencies": [\ @@ -2654,24 +2524,7 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ - ["@cspotcode/source-map-consumer", [\ - ["npm:0.8.0", {\ - "packageLocation": "./.yarn/cache/@cspotcode-source-map-consumer-npm-0.8.0-1f37e9e72b-dfe1399712.zip/node_modules/@cspotcode/source-map-consumer/",\ - "packageDependencies": [\ - ["@cspotcode/source-map-consumer", "npm:0.8.0"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["@cspotcode/source-map-support", [\ - ["npm:0.7.0", {\ - "packageLocation": "./.yarn/cache/@cspotcode-source-map-support-npm-0.7.0-456c3ea2ce-d58b31640c.zip/node_modules/@cspotcode/source-map-support/",\ - "packageDependencies": [\ - ["@cspotcode/source-map-support", "npm:0.7.0"],\ - ["@cspotcode/source-map-consumer", "npm:0.8.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:0.8.1", {\ "packageLocation": "./.yarn/cache/@cspotcode-source-map-support-npm-0.8.1-964f2de99d-b6e38a1712.zip/node_modules/@cspotcode/source-map-support/",\ "packageDependencies": [\ @@ -2698,7 +2551,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./packages/bench-suite/",\ "packageDependencies": [\ ["@dashevo/bench-suite", "workspace:packages/bench-suite"],\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ + ["@dashevo/dashcore-lib", "npm:0.21.1"],\ ["@dashevo/dpns-contract", "workspace:packages/dpns-contract"],\ ["@dashevo/wallet-lib", "workspace:packages/wallet-lib"],\ ["@dashevo/wasm-dpp", "workspace:packages/wasm-dpp"],\ @@ -2731,17 +2584,19 @@ const RAW_RUNTIME_STATE = "packageLocation": "./packages/dapi/",\ "packageDependencies": [\ ["@dashevo/dapi", "workspace:packages/dapi"],\ + ["@babel/core", "npm:7.23.3"],\ + ["@babel/eslint-parser", "virtual:6c6296bde00603e266f7d80babe1e01aa0c19f626934f58fe08f890a291bb1a38fcee25bf30c24857d5cfba290f01209decc48384318fd6815c5a514cb48be25#npm:7.23.3"],\ ["@dashevo/bls", "npm:1.2.9"],\ ["@dashevo/dapi-client", "workspace:packages/js-dapi-client"],\ ["@dashevo/dapi-grpc", "workspace:packages/dapi-grpc"],\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ - ["@dashevo/dashd-rpc", "npm:18.2.0"],\ + ["@dashevo/dashcore-lib", "npm:0.21.1"],\ + ["@dashevo/dashd-rpc", "npm:18.3.0"],\ ["@dashevo/dp-services-ctl", "https://github.com/dashevo/js-dp-services-ctl.git#commit=3976076b0018c5b4632ceda4c752fc597f27a640"],\ ["@dashevo/grpc-common", "workspace:packages/js-grpc-common"],\ ["@dashevo/wasm-dpp", "workspace:packages/wasm-dpp"],\ ["@grpc/grpc-js", "npm:1.4.4"],\ ["@pshenmic/zeromq", "npm:6.0.0-beta.22"],\ - ["ajv", "npm:8.8.1"],\ + ["ajv", "npm:8.12.0"],\ ["bs58", "npm:4.0.1"],\ ["cbor", "npm:8.1.0"],\ ["chai", "npm:4.3.10"],\ @@ -2766,7 +2621,7 @@ const RAW_RUNTIME_STATE = ["sinon", "npm:17.0.1"],\ ["sinon-chai", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:3.7.0"],\ ["swagger-jsdoc", "npm:3.7.0"],\ - ["ws", "virtual:7469c013e9c5baa67d67122340123f2260ba4f66d6748855fb7f2ab67ea3fe52b2c8821a105003266d54faf99a9564056fb1b532d9ae8b6985087ab5f8394bf0#npm:7.5.5"]\ + ["ws", "virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.17.1"]\ ],\ "linkType": "SOFT"\ }]\ @@ -2779,7 +2634,7 @@ const RAW_RUNTIME_STATE = ["@babel/core", "npm:7.23.3"],\ ["@dashevo/dapi-grpc", "workspace:packages/dapi-grpc"],\ ["@dashevo/dash-spv", "workspace:packages/dash-spv"],\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ + ["@dashevo/dashcore-lib", "npm:0.21.1"],\ ["@dashevo/grpc-common", "workspace:packages/js-grpc-common"],\ ["@dashevo/wasm-dpp", "workspace:packages/wasm-dpp"],\ ["assert-browserify", "npm:2.0.0"],\ @@ -2871,7 +2726,7 @@ const RAW_RUNTIME_STATE = ["@dashevo/dash-spv", "workspace:packages/dash-spv"],\ ["@dashevo/dark-gravity-wave", "npm:1.1.1"],\ ["@dashevo/dash-util", "npm:2.0.3"],\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ + ["@dashevo/dashcore-lib", "npm:0.21.1"],\ ["chai", "npm:4.3.10"],\ ["eslint", "npm:8.53.0"],\ ["eslint-config-airbnb-base", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:15.0.0"],\ @@ -2898,10 +2753,10 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@dashevo/dashcore-lib", [\ - ["npm:0.21.0", {\ - "packageLocation": "./.yarn/cache/@dashevo-dashcore-lib-npm-0.21.0-1997e852e6-fb4419623f.zip/node_modules/@dashevo/dashcore-lib/",\ + ["npm:0.21.1", {\ + "packageLocation": "./.yarn/cache/@dashevo-dashcore-lib-npm-0.21.1-2fe9b7647d-68502e4078.zip/node_modules/@dashevo/dashcore-lib/",\ "packageDependencies": [\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ + ["@dashevo/dashcore-lib", "npm:0.21.1"],\ ["@dashevo/bls", "npm:1.2.9"],\ ["@dashevo/x11-hash-js", "npm:1.0.2"],\ ["@types/node", "npm:12.20.37"],\ @@ -2919,10 +2774,10 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@dashevo/dashd-rpc", [\ - ["npm:18.2.0", {\ - "packageLocation": "./.yarn/cache/@dashevo-dashd-rpc-npm-18.2.0-194a5d4c4b-38341b8d5a.zip/node_modules/@dashevo/dashd-rpc/",\ + ["npm:18.3.0", {\ + "packageLocation": "./.yarn/cache/@dashevo-dashd-rpc-npm-18.3.0-4f165136e8-b83fbdb149.zip/node_modules/@dashevo/dashd-rpc/",\ "packageDependencies": [\ - ["@dashevo/dashd-rpc", "npm:18.2.0"],\ + ["@dashevo/dashd-rpc", "npm:18.3.0"],\ ["async", "npm:3.2.4"],\ ["bluebird", "npm:3.7.2"]\ ],\ @@ -3084,13 +2939,14 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@dashevo/platform-test-suite", "workspace:packages/platform-test-suite"],\ ["@dashevo/dapi-client", "workspace:packages/js-dapi-client"],\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ + ["@dashevo/dashcore-lib", "npm:0.21.1"],\ ["@dashevo/dpns-contract", "workspace:packages/dpns-contract"],\ ["@dashevo/feature-flags-contract", "workspace:packages/feature-flags-contract"],\ ["@dashevo/grpc-common", "workspace:packages/js-grpc-common"],\ ["@dashevo/masternode-reward-shares-contract", "workspace:packages/masternode-reward-shares-contract"],\ ["@dashevo/wallet-lib", "workspace:packages/wallet-lib"],\ ["@dashevo/wasm-dpp", "workspace:packages/wasm-dpp"],\ + ["@dashevo/withdrawals-contract", "workspace:packages/withdrawals-contract"],\ ["assert", "npm:2.0.0"],\ ["assert-browserify", "npm:2.0.0"],\ ["browserify-zlib", "npm:0.2.0"],\ @@ -3106,7 +2962,7 @@ const RAW_RUNTIME_STATE = ["eslint-config-airbnb-base", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:15.0.0"],\ ["eslint-plugin-import", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:2.29.0"],\ ["events", "npm:3.3.0"],\ - ["glob", "npm:10.3.4"],\ + ["glob", "npm:10.4.1"],\ ["https-browserify", "npm:1.0.0"],\ ["js-merkle", "npm:0.1.5"],\ ["karma", "npm:6.4.1"],\ @@ -3125,6 +2981,7 @@ const RAW_RUNTIME_STATE = ["path-browserify", "npm:1.0.1"],\ ["process", "npm:0.11.10"],\ ["semver", "npm:7.5.3"],\ + ["setimmediate", "npm:1.0.5"],\ ["sinon", "npm:17.0.1"],\ ["sinon-chai", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:3.7.0"],\ ["stream-browserify", "npm:3.0.0"],\ @@ -3135,7 +2992,7 @@ const RAW_RUNTIME_STATE = ["utf-8-validate", "npm:5.0.9"],\ ["util", "npm:0.12.4"],\ ["webpack", "virtual:01938c2be4835443e5a304e2b117c575220e96e8b7cedeb0f48d79264590b4c4babc6d1fea6367f522b1ca0149d795b42f2ab89c34a6ffe3c20f0a8cbb8b4453#npm:5.76.1"],\ - ["ws", "virtual:01938c2be4835443e5a304e2b117c575220e96e8b7cedeb0f48d79264590b4c4babc6d1fea6367f522b1ca0149d795b42f2ab89c34a6ffe3c20f0a8cbb8b4453#npm:7.5.5"]\ + ["ws", "virtual:01938c2be4835443e5a304e2b117c575220e96e8b7cedeb0f48d79264590b4c4babc6d1fea6367f522b1ca0149d795b42f2ab89c34a6ffe3c20f0a8cbb8b4453#npm:8.17.1"]\ ],\ "linkType": "SOFT"\ }]\ @@ -3159,9 +3016,9 @@ const RAW_RUNTIME_STATE = ["@types/node", "npm:13.13.52"],\ ["chalk", "npm:3.0.0"],\ ["escodegen", "npm:2.0.0"],\ - ["espree", "npm:9.1.0"],\ + ["espree", "npm:9.6.1"],\ ["estraverse", "npm:5.3.0"],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["long", "npm:4.0.0"],\ ["minimist", "npm:1.2.6"],\ ["semver", "npm:7.5.3"],\ @@ -3177,7 +3034,7 @@ const RAW_RUNTIME_STATE = ["@dashevo/wallet-lib", "workspace:packages/wallet-lib"],\ ["@dashevo/dapi-client", "workspace:packages/js-dapi-client"],\ ["@dashevo/dash-spv", "workspace:packages/dash-spv"],\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ + ["@dashevo/dashcore-lib", "npm:0.21.1"],\ ["@dashevo/grpc-common", "workspace:packages/js-grpc-common"],\ ["@dashevo/wasm-dpp", "workspace:packages/wasm-dpp"],\ ["@yarnpkg/pnpify", "npm:4.0.0-rc.42"],\ @@ -3239,12 +3096,12 @@ const RAW_RUNTIME_STATE = ["@babel/core", "npm:7.23.3"],\ ["@babel/preset-env", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:7.23.3"],\ ["@dashevo/bls", "npm:1.2.9"],\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ + ["@dashevo/dashcore-lib", "npm:0.21.1"],\ ["@dashevo/dpns-contract", "workspace:packages/dpns-contract"],\ ["@types/bs58", "npm:4.0.1"],\ ["@types/node", "npm:14.17.34"],\ ["@yarnpkg/pnpify", "npm:4.0.0-rc.42"],\ - ["ajv", "npm:8.8.1"],\ + ["ajv", "npm:8.12.0"],\ ["assert", "npm:2.0.0"],\ ["bs58", "npm:4.0.1"],\ ["buffer", "npm:6.0.3"],\ @@ -3339,13 +3196,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@eslint-community/eslint-utils", [\ - ["npm:4.2.0", {\ - "packageLocation": "./.yarn/cache/@eslint-community-eslint-utils-npm-4.2.0-434cf92d50-ef8b20b0c7.zip/node_modules/@eslint-community/eslint-utils/",\ - "packageDependencies": [\ - ["@eslint-community/eslint-utils", "npm:4.2.0"]\ - ],\ - "linkType": "SOFT"\ - }],\ ["npm:4.4.0", {\ "packageLocation": "./.yarn/cache/@eslint-community-eslint-utils-npm-4.4.0-d1791bd5a3-8d70bcdcd8.zip/node_modules/@eslint-community/eslint-utils/",\ "packageDependencies": [\ @@ -3353,13 +3203,13 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "SOFT"\ }],\ - ["virtual:2fc5c501d26c4c2fbc6a1d931e87d32adb7d9118fbcd7303a7b7faae809112bde136383859a265761a47c2852a001b7b803bf80e734ffa8ddc2ca30c129d1d76#npm:4.2.0", {\ - "packageLocation": "./.yarn/__virtual__/@eslint-community-eslint-utils-virtual-1e8778691e/0/cache/@eslint-community-eslint-utils-npm-4.2.0-434cf92d50-ef8b20b0c7.zip/node_modules/@eslint-community/eslint-utils/",\ + ["virtual:2fc5c501d26c4c2fbc6a1d931e87d32adb7d9118fbcd7303a7b7faae809112bde136383859a265761a47c2852a001b7b803bf80e734ffa8ddc2ca30c129d1d76#npm:4.4.0", {\ + "packageLocation": "./.yarn/__virtual__/@eslint-community-eslint-utils-virtual-4b69618f4d/0/cache/@eslint-community-eslint-utils-npm-4.4.0-d1791bd5a3-8d70bcdcd8.zip/node_modules/@eslint-community/eslint-utils/",\ "packageDependencies": [\ - ["@eslint-community/eslint-utils", "virtual:2fc5c501d26c4c2fbc6a1d931e87d32adb7d9118fbcd7303a7b7faae809112bde136383859a265761a47c2852a001b7b803bf80e734ffa8ddc2ca30c129d1d76#npm:4.2.0"],\ + ["@eslint-community/eslint-utils", "virtual:2fc5c501d26c4c2fbc6a1d931e87d32adb7d9118fbcd7303a7b7faae809112bde136383859a265761a47c2852a001b7b803bf80e734ffa8ddc2ca30c129d1d76#npm:4.4.0"],\ ["@types/eslint", null],\ ["eslint", "npm:8.53.0"],\ - ["eslint-visitor-keys", "npm:3.3.0"]\ + ["eslint-visitor-keys", "npm:3.4.3"]\ ],\ "packagePeers": [\ "@types/eslint",\ @@ -3373,7 +3223,7 @@ const RAW_RUNTIME_STATE = ["@eslint-community/eslint-utils", "virtual:b13453c6e327a35c05e8ce1283d4970e5e4619ba21a2fa8909367ea67136c23860ec34186acaf505374401498c777e7891702b73bbd3697c54d0993c3fd435cd#npm:4.4.0"],\ ["@types/eslint", null],\ ["eslint", null],\ - ["eslint-visitor-keys", "npm:3.3.0"]\ + ["eslint-visitor-keys", "npm:3.4.3"]\ ],\ "packagePeers": [\ "@types/eslint",\ @@ -3389,13 +3239,6 @@ const RAW_RUNTIME_STATE = ["@eslint-community/regexpp", "npm:4.10.0"]\ ],\ "linkType": "HARD"\ - }],\ - ["npm:4.4.0", {\ - "packageLocation": "./.yarn/cache/@eslint-community-regexpp-npm-4.4.0-6bee7b2314-3d9b740479.zip/node_modules/@eslint-community/regexpp/",\ - "packageDependencies": [\ - ["@eslint-community/regexpp", "npm:4.4.0"]\ - ],\ - "linkType": "HARD"\ }]\ ]],\ ["@eslint/eslintrc", [\ @@ -3431,7 +3274,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@grpc/grpc-js", "npm:1.4.4"],\ ["@grpc/proto-loader", "npm:0.6.13"],\ - ["@types/node", "npm:17.0.21"]\ + ["@types/node", "npm:18.16.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -3597,35 +3440,18 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@jridgewell/gen-mapping", [\ - ["npm:0.3.2", {\ - "packageLocation": "./.yarn/cache/@jridgewell-gen-mapping-npm-0.3.2-c64eeb4a4e-7ba0070be1.zip/node_modules/@jridgewell/gen-mapping/",\ - "packageDependencies": [\ - ["@jridgewell/gen-mapping", "npm:0.3.2"],\ - ["@jridgewell/set-array", "npm:1.1.2"],\ - ["@jridgewell/sourcemap-codec", "npm:1.4.14"],\ - ["@jridgewell/trace-mapping", "npm:0.3.15"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:0.3.3", {\ "packageLocation": "./.yarn/cache/@jridgewell-gen-mapping-npm-0.3.3-1815eba94c-072ace159c.zip/node_modules/@jridgewell/gen-mapping/",\ "packageDependencies": [\ ["@jridgewell/gen-mapping", "npm:0.3.3"],\ ["@jridgewell/set-array", "npm:1.1.2"],\ ["@jridgewell/sourcemap-codec", "npm:1.4.14"],\ - ["@jridgewell/trace-mapping", "npm:0.3.15"]\ + ["@jridgewell/trace-mapping", "npm:0.3.18"]\ ],\ "linkType": "HARD"\ }]\ ]],\ ["@jridgewell/resolve-uri", [\ - ["npm:3.0.8", {\ - "packageLocation": "./.yarn/cache/@jridgewell-resolve-uri-npm-3.0.8-94779c6a1d-ba6bb26bae.zip/node_modules/@jridgewell/resolve-uri/",\ - "packageDependencies": [\ - ["@jridgewell/resolve-uri", "npm:3.0.8"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:3.1.0", {\ "packageLocation": "./.yarn/cache/@jridgewell-resolve-uri-npm-3.1.0-6ff2351e61-320ceb37af.zip/node_modules/@jridgewell/resolve-uri/",\ "packageDependencies": [\ @@ -3648,8 +3474,8 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/@jridgewell-source-map-npm-0.3.2-6fd1f37b22-1aaa42075b.zip/node_modules/@jridgewell/source-map/",\ "packageDependencies": [\ ["@jridgewell/source-map", "npm:0.3.2"],\ - ["@jridgewell/gen-mapping", "npm:0.3.2"],\ - ["@jridgewell/trace-mapping", "npm:0.3.15"]\ + ["@jridgewell/gen-mapping", "npm:0.3.3"],\ + ["@jridgewell/trace-mapping", "npm:0.3.18"]\ ],\ "linkType": "HARD"\ }]\ @@ -3664,15 +3490,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@jridgewell/trace-mapping", [\ - ["npm:0.3.15", {\ - "packageLocation": "./.yarn/cache/@jridgewell-trace-mapping-npm-0.3.15-7357dbf648-c889039e05.zip/node_modules/@jridgewell/trace-mapping/",\ - "packageDependencies": [\ - ["@jridgewell/trace-mapping", "npm:0.3.15"],\ - ["@jridgewell/resolve-uri", "npm:3.0.8"],\ - ["@jridgewell/sourcemap-codec", "npm:1.4.14"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:0.3.18", {\ "packageLocation": "./.yarn/cache/@jridgewell-trace-mapping-npm-0.3.18-cd96571385-f4fabdddf8.zip/node_modules/@jridgewell/trace-mapping/",\ "packageDependencies": [\ @@ -3686,7 +3503,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/@jridgewell-trace-mapping-npm-0.3.9-91625cd7fb-83deafb8e7.zip/node_modules/@jridgewell/trace-mapping/",\ "packageDependencies": [\ ["@jridgewell/trace-mapping", "npm:0.3.9"],\ - ["@jridgewell/resolve-uri", "npm:3.0.8"],\ + ["@jridgewell/resolve-uri", "npm:3.1.0"],\ ["@jridgewell/sourcemap-codec", "npm:1.4.14"]\ ],\ "linkType": "HARD"\ @@ -3883,8 +3700,8 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@npmcli/map-workspaces", "npm:2.0.1"],\ ["@npmcli/name-from-folder", "npm:1.0.1"],\ - ["glob", "npm:7.2.0"],\ - ["minimatch", "npm:5.0.0"],\ + ["glob", "npm:7.2.3"],\ + ["minimatch", "npm:5.1.6"],\ ["read-package-json-fast", "npm:2.0.3"]\ ],\ "linkType": "HARD"\ @@ -4005,7 +3822,7 @@ const RAW_RUNTIME_STATE = ["clean-stack", "npm:3.0.1"],\ ["cli-progress", "npm:3.12.0"],\ ["debug", "virtual:87db25c7c5e6b25bbc12571091cdabc648b79d427ab445d1714ccfdcdfb3265c9de6561ca760cc3de470037cbedf3af4be56ba3b684b3a1c01d4c9c2fd55a741#npm:4.3.4"],\ - ["ejs", "npm:3.1.8"],\ + ["ejs", "npm:3.1.10"],\ ["get-package-type", "npm:0.1.0"],\ ["globby", "npm:11.1.0"],\ ["hyperlinker", "npm:1.0.0"],\ @@ -4019,7 +3836,7 @@ const RAW_RUNTIME_STATE = ["string-width", "npm:4.2.3"],\ ["strip-ansi", "npm:6.0.1"],\ ["supports-color", "npm:8.1.1"],\ - ["supports-hyperlinks", "npm:2.2.0"],\ + ["supports-hyperlinks", "npm:2.3.0"],\ ["ts-node", "virtual:ea55642553292d92df3b95679ce7d915309f63e183de810f329a0681dbf96348ae483bd374f89b77a6617494a51dc04338bed5fc7e9ba4255333eb598d1d96a6#npm:10.9.1"],\ ["tslib", "npm:2.6.2"],\ ["widest-line", "npm:3.1.0"],\ @@ -4039,7 +3856,7 @@ const RAW_RUNTIME_STATE = ["clean-stack", "npm:3.0.1"],\ ["cli-progress", "npm:3.12.0"],\ ["debug", "virtual:87db25c7c5e6b25bbc12571091cdabc648b79d427ab445d1714ccfdcdfb3265c9de6561ca760cc3de470037cbedf3af4be56ba3b684b3a1c01d4c9c2fd55a741#npm:4.3.4"],\ - ["ejs", "npm:3.1.8"],\ + ["ejs", "npm:3.1.10"],\ ["get-package-type", "npm:0.1.0"],\ ["globby", "npm:11.1.0"],\ ["hyperlinker", "npm:1.0.0"],\ @@ -4053,13 +3870,48 @@ const RAW_RUNTIME_STATE = ["string-width", "npm:4.2.3"],\ ["strip-ansi", "npm:6.0.1"],\ ["supports-color", "npm:8.1.1"],\ - ["supports-hyperlinks", "npm:2.2.0"],\ + ["supports-hyperlinks", "npm:2.3.0"],\ ["tsconfck", "virtual:8f21c98bfcc042ba60b788a91928a322c2913836408eca0abbbf7e052098181701b9cf262c158a547725d8391dd3ff1a933d413944d0ea9e7f920b175a28a2e9#npm:3.0.0"],\ ["widest-line", "npm:3.1.0"],\ ["wordwrap", "npm:1.0.0"],\ ["wrap-ansi", "npm:7.0.0"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:3.26.5", {\ + "packageLocation": "./.yarn/cache/@oclif-core-npm-3.26.5-02719845fd-4e2aa1a945.zip/node_modules/@oclif/core/",\ + "packageDependencies": [\ + ["@oclif/core", "npm:3.26.5"],\ + ["@types/cli-progress", "npm:3.11.5"],\ + ["ansi-escapes", "npm:4.3.2"],\ + ["ansi-styles", "npm:4.3.0"],\ + ["cardinal", "npm:2.1.1"],\ + ["chalk", "npm:4.1.2"],\ + ["clean-stack", "npm:3.0.1"],\ + ["cli-progress", "npm:3.12.0"],\ + ["color", "npm:4.2.3"],\ + ["debug", "virtual:87db25c7c5e6b25bbc12571091cdabc648b79d427ab445d1714ccfdcdfb3265c9de6561ca760cc3de470037cbedf3af4be56ba3b684b3a1c01d4c9c2fd55a741#npm:4.3.4"],\ + ["ejs", "npm:3.1.10"],\ + ["get-package-type", "npm:0.1.0"],\ + ["globby", "npm:11.1.0"],\ + ["hyperlinker", "npm:1.0.0"],\ + ["indent-string", "npm:4.0.0"],\ + ["is-wsl", "npm:2.2.0"],\ + ["js-yaml", "npm:3.14.1"],\ + ["minimatch", "npm:9.0.4"],\ + ["natural-orderby", "npm:2.0.3"],\ + ["object-treeify", "npm:1.1.33"],\ + ["password-prompt", "npm:1.1.3"],\ + ["slice-ansi", "npm:4.0.0"],\ + ["string-width", "npm:4.2.3"],\ + ["strip-ansi", "npm:6.0.1"],\ + ["supports-color", "npm:8.1.1"],\ + ["supports-hyperlinks", "npm:2.3.0"],\ + ["widest-line", "npm:3.1.0"],\ + ["wordwrap", "npm:1.0.0"],\ + ["wrap-ansi", "npm:7.0.0"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["@oclif/plugin-help", [\ @@ -4668,7 +4520,7 @@ const RAW_RUNTIME_STATE = ["@types/cacheable-request", "npm:6.0.3"],\ ["@types/http-cache-semantics", "npm:4.0.4"],\ ["@types/keyv", "npm:3.1.4"],\ - ["@types/node", "npm:17.0.21"],\ + ["@types/node", "npm:18.16.1"],\ ["@types/responselike", "npm:1.0.3"]\ ],\ "linkType": "HARD"\ @@ -4698,7 +4550,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/@types-cli-progress-npm-3.11.5-180614d1b0-cb19187637.zip/node_modules/@types/cli-progress/",\ "packageDependencies": [\ ["@types/cli-progress", "npm:3.11.5"],\ - ["@types/node", "npm:17.0.21"]\ + ["@types/node", "npm:18.16.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -4708,7 +4560,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/@types-connect-npm-3.4.35-7337eee0a3-fe81351470.zip/node_modules/@types/connect/",\ "packageDependencies": [\ ["@types/connect", "npm:3.4.35"],\ - ["@types/node", "npm:17.0.21"]\ + ["@types/node", "npm:18.16.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -4757,7 +4609,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@types/eslint", "npm:7.29.0"],\ ["@types/estree", "npm:0.0.51"],\ - ["@types/json-schema", "npm:7.0.11"]\ + ["@types/json-schema", "npm:7.0.15"]\ ],\ "linkType": "HARD"\ }],\ @@ -4766,7 +4618,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@types/eslint", "npm:8.2.0"],\ ["@types/estree", "npm:0.0.51"],\ - ["@types/json-schema", "npm:7.0.11"]\ + ["@types/json-schema", "npm:7.0.15"]\ ],\ "linkType": "HARD"\ }]\ @@ -4810,13 +4662,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@types/json-schema", [\ - ["npm:7.0.11", {\ - "packageLocation": "./.yarn/cache/@types-json-schema-npm-7.0.11-79462ae5ca-e50864a93f.zip/node_modules/@types/json-schema/",\ - "packageDependencies": [\ - ["@types/json-schema", "npm:7.0.11"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.0.15", {\ "packageLocation": "./.yarn/cache/@types-json-schema-npm-7.0.15-fd16381786-1a3c3e0623.zip/node_modules/@types/json-schema/",\ "packageDependencies": [\ @@ -4830,7 +4675,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/@types-keyv-npm-3.1.4-a8082ea56b-e009a2bfb5.zip/node_modules/@types/keyv/",\ "packageDependencies": [\ ["@types/keyv", "npm:3.1.4"],\ - ["@types/node", "npm:17.0.21"]\ + ["@types/node", "npm:18.16.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -4907,13 +4752,6 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["npm:17.0.21", {\ - "packageLocation": "./.yarn/cache/@types-node-npm-17.0.21-7d68eb6a13-2beae12b02.zip/node_modules/@types/node/",\ - "packageDependencies": [\ - ["@types/node", "npm:17.0.21"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:18.16.1", {\ "packageLocation": "./.yarn/cache/@types-node-npm-18.16.1-b36b37400b-d77a82fa40.zip/node_modules/@types/node/",\ "packageDependencies": [\ @@ -4936,19 +4774,12 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/@types-responselike-npm-1.0.3-de0150f03d-6ac4b35723.zip/node_modules/@types/responselike/",\ "packageDependencies": [\ ["@types/responselike", "npm:1.0.3"],\ - ["@types/node", "npm:17.0.21"]\ + ["@types/node", "npm:18.16.1"]\ ],\ "linkType": "HARD"\ }]\ ]],\ ["@types/semver", [\ - ["npm:7.3.13", {\ - "packageLocation": "./.yarn/cache/@types-semver-npm-7.3.13-56212b60da-0064efd7a0.zip/node_modules/@types/semver/",\ - "packageDependencies": [\ - ["@types/semver", "npm:7.3.13"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.5.5", {\ "packageLocation": "./.yarn/cache/@types-semver-npm-7.5.5-a3c0668cf4-1b0be2c4d8.zip/node_modules/@types/semver/",\ "packageDependencies": [\ @@ -5010,7 +4841,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@types/vinyl", "npm:2.0.6"],\ ["@types/expect", "npm:1.20.4"],\ - ["@types/node", "npm:17.0.21"]\ + ["@types/node", "npm:18.16.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -5020,7 +4851,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/@types-ws-npm-7.4.7-d0c95c0958-5236b6c548.zip/node_modules/@types/ws/",\ "packageDependencies": [\ ["@types/ws", "npm:7.4.7"],\ - ["@types/node", "npm:17.0.21"]\ + ["@types/node", "npm:18.16.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -5037,7 +4868,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/__virtual__/@typescript-eslint-eslint-plugin-virtual-0e22d802b6/0/cache/@typescript-eslint-eslint-plugin-npm-5.55.0-16386bf9af-05f921647a.zip/node_modules/@typescript-eslint/eslint-plugin/",\ "packageDependencies": [\ ["@typescript-eslint/eslint-plugin", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.55.0"],\ - ["@eslint-community/regexpp", "npm:4.4.0"],\ + ["@eslint-community/regexpp", "npm:4.10.0"],\ ["@types/eslint", null],\ ["@types/typescript", null],\ ["@types/typescript-eslint__parser", null],\ @@ -5276,10 +5107,10 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/__virtual__/@typescript-eslint-utils-virtual-67e332304c/0/cache/@typescript-eslint-utils-npm-5.55.0-6a927fceb5-121c5fc48c.zip/node_modules/@typescript-eslint/utils/",\ "packageDependencies": [\ ["@typescript-eslint/utils", "virtual:0e22d802b65219681b64a9f99af596d56d444fb6f03cdf776b56a06fb9ddeefe4b0a611780f0b0eea0b47a1f1fba5a366d19cd6561bbc1e55271f08c190cd76f#npm:5.55.0"],\ - ["@eslint-community/eslint-utils", "virtual:2fc5c501d26c4c2fbc6a1d931e87d32adb7d9118fbcd7303a7b7faae809112bde136383859a265761a47c2852a001b7b803bf80e734ffa8ddc2ca30c129d1d76#npm:4.2.0"],\ + ["@eslint-community/eslint-utils", "virtual:2fc5c501d26c4c2fbc6a1d931e87d32adb7d9118fbcd7303a7b7faae809112bde136383859a265761a47c2852a001b7b803bf80e734ffa8ddc2ca30c129d1d76#npm:4.4.0"],\ ["@types/eslint", null],\ - ["@types/json-schema", "npm:7.0.11"],\ - ["@types/semver", "npm:7.3.13"],\ + ["@types/json-schema", "npm:7.0.15"],\ + ["@types/semver", "npm:7.5.5"],\ ["@typescript-eslint/scope-manager", "npm:5.55.0"],\ ["@typescript-eslint/types", "npm:5.55.0"],\ ["@typescript-eslint/typescript-estree", "virtual:67e332304c8830574d5d9be2a388885a47a9962cf1d2441a6ada47207b10c98d9a1a1914d73816338b986563032864745d812b3a7df145ee8f3bb51baa4027e5#npm:5.55.0"],\ @@ -5300,7 +5131,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@typescript-eslint/visitor-keys", "npm:5.55.0"],\ ["@typescript-eslint/types", "npm:5.55.0"],\ - ["eslint-visitor-keys", "npm:3.3.0"]\ + ["eslint-visitor-keys", "npm:3.4.3"]\ ],\ "linkType": "HARD"\ }],\ @@ -5746,7 +5577,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@yarnpkg/core", "npm:4.0.0-rc.42"],\ ["@arcanis/slice-ansi", "npm:1.1.1"],\ - ["@types/semver", "npm:7.3.13"],\ + ["@types/semver", "npm:7.5.5"],\ ["@types/treeify", "npm:1.0.0"],\ ["@yarnpkg/fslib", "npm:3.0.0-rc.42"],\ ["@yarnpkg/libzip", "virtual:029d9f8b24f020bba83fc356b24f5023723ab955d802aced5e68f959eb98132b3549d03ae8c2d3187401d54ad86e275e1bf34740160f82184df9a09fcbeda7b4#npm:3.0.0-rc.42"],\ @@ -5765,10 +5596,10 @@ const RAW_RUNTIME_STATE = ["p-limit", "npm:2.3.0"],\ ["semver", "npm:7.5.3"],\ ["strip-ansi", "npm:6.0.1"],\ - ["tar", "npm:6.1.13"],\ + ["tar", "npm:6.2.1"],\ ["tinylogic", "npm:2.0.0"],\ ["treeify", "npm:1.1.0"],\ - ["tslib", "npm:2.5.0"],\ + ["tslib", "npm:2.6.2"],\ ["tunnel", "npm:0.0.6"]\ ],\ "linkType": "HARD"\ @@ -5779,7 +5610,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/@yarnpkg-fslib-npm-3.0.0-rc.42-de16b926e6-a4e4b8453c.zip/node_modules/@yarnpkg/fslib/",\ "packageDependencies": [\ ["@yarnpkg/fslib", "npm:3.0.0-rc.42"],\ - ["tslib", "npm:2.5.0"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -5799,7 +5630,7 @@ const RAW_RUNTIME_STATE = ["@types/emscripten", "npm:1.39.6"],\ ["@types/yarnpkg__fslib", null],\ ["@yarnpkg/fslib", "npm:3.0.0-rc.42"],\ - ["tslib", "npm:2.5.0"]\ + ["tslib", "npm:2.6.2"]\ ],\ "packagePeers": [\ "@types/yarnpkg__fslib",\ @@ -5826,7 +5657,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@yarnpkg/parsers", "npm:3.0.0-rc.42"],\ ["js-yaml", "npm:3.14.1"],\ - ["tslib", "npm:2.5.0"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -5851,7 +5682,7 @@ const RAW_RUNTIME_STATE = ["@yarnpkg/fslib", "npm:3.0.0-rc.42"],\ ["@yarnpkg/nm", "npm:4.0.0-rc.42"],\ ["clipanion", "virtual:ba24742e5bfaec41d1d0434e6865c2744ffb69a716f18fa84bd7d44084043647838926c96a391f66b9946857565b9825479e97ad07079ef40683084ce389d203#npm:3.2.0"],\ - ["tslib", "npm:2.5.0"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -5868,7 +5699,7 @@ const RAW_RUNTIME_STATE = ["cross-spawn", "npm:7.0.3"],\ ["fast-glob", "npm:3.2.12"],\ ["micromatch", "npm:4.0.4"],\ - ["tslib", "npm:2.5.0"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -5942,13 +5773,6 @@ const RAW_RUNTIME_STATE = ["acorn", "npm:8.11.2"]\ ],\ "linkType": "HARD"\ - }],\ - ["npm:8.8.2", {\ - "packageLocation": "./.yarn/cache/acorn-npm-8.8.2-9d518fd7d3-b4e77d56d2.zip/node_modules/acorn/",\ - "packageDependencies": [\ - ["acorn", "npm:8.8.2"]\ - ],\ - "linkType": "HARD"\ }]\ ]],\ ["acorn-import-assertions", [\ @@ -5964,7 +5788,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["acorn-import-assertions", "virtual:a1758743d243877493a02719691b2bf5513261873450aca581311be1ead841af63c0be982c400355949a0dcad332960c6e3ed3885051f0427d191c70a7fc9856#npm:1.8.0"],\ ["@types/acorn", null],\ - ["acorn", "npm:8.8.2"]\ + ["acorn", "npm:8.11.2"]\ ],\ "packagePeers": [\ "@types/acorn",\ @@ -5993,19 +5817,6 @@ const RAW_RUNTIME_STATE = "acorn"\ ],\ "linkType": "HARD"\ - }],\ - ["virtual:fd2253859039a15030fecf2d1545fcad47d7bd43468b9166c71fdd4e35b538414e653775f5401c948ed8db3eb1925f84c66c161d39a27b19ee73fef5e721329e#npm:5.3.2", {\ - "packageLocation": "./.yarn/__virtual__/acorn-jsx-virtual-0c3ff7dbc9/0/cache/acorn-jsx-npm-5.3.2-d7594599ea-d4371eaef7.zip/node_modules/acorn-jsx/",\ - "packageDependencies": [\ - ["acorn-jsx", "virtual:fd2253859039a15030fecf2d1545fcad47d7bd43468b9166c71fdd4e35b538414e653775f5401c948ed8db3eb1925f84c66c161d39a27b19ee73fef5e721329e#npm:5.3.2"],\ - ["@types/acorn", null],\ - ["acorn", "npm:8.8.2"]\ - ],\ - "packagePeers": [\ - "@types/acorn",\ - "acorn"\ - ],\ - "linkType": "HARD"\ }]\ ]],\ ["acorn-walk", [\ @@ -6045,16 +5856,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["agentkeepalive", [\ - ["npm:4.2.0", {\ - "packageLocation": "./.yarn/cache/agentkeepalive-npm-4.2.0-e5e72b8ce4-cc6e1b4f1c.zip/node_modules/agentkeepalive/",\ - "packageDependencies": [\ - ["agentkeepalive", "npm:4.2.0"],\ - ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ - ["depd", "npm:1.1.2"],\ - ["humanize-ms", "npm:1.2.1"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:4.3.0", {\ "packageLocation": "./.yarn/cache/agentkeepalive-npm-4.3.0-ac3d8e6807-f791317eb4.zip/node_modules/agentkeepalive/",\ "packageDependencies": [\ @@ -6108,17 +5909,6 @@ const RAW_RUNTIME_STATE = ["uri-js", "npm:4.4.1"]\ ],\ "linkType": "HARD"\ - }],\ - ["npm:8.8.1", {\ - "packageLocation": "./.yarn/cache/ajv-npm-8.8.1-3d331224e3-fc52cd18c9.zip/node_modules/ajv/",\ - "packageDependencies": [\ - ["ajv", "npm:8.8.1"],\ - ["fast-deep-equal", "npm:3.1.3"],\ - ["json-schema-traverse", "npm:1.0.0"],\ - ["require-from-string", "npm:2.0.2"],\ - ["uri-js", "npm:4.4.1"]\ - ],\ - "linkType": "HARD"\ }]\ ]],\ ["ajv-formats", [\ @@ -6129,19 +5919,6 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "SOFT"\ }],\ - ["virtual:880cda903c2a2be387819a3f857d21494004437a03c92969b9853f7bdeebdfed08d417e68364ee9e158338603a6d78d690c457a55ab11e56398bc10f0ad232fc#npm:2.1.1", {\ - "packageLocation": "./.yarn/__virtual__/ajv-formats-virtual-26e397430a/0/cache/ajv-formats-npm-2.1.1-3cec02eae9-70c263ded2.zip/node_modules/ajv-formats/",\ - "packageDependencies": [\ - ["ajv-formats", "virtual:880cda903c2a2be387819a3f857d21494004437a03c92969b9853f7bdeebdfed08d417e68364ee9e158338603a6d78d690c457a55ab11e56398bc10f0ad232fc#npm:2.1.1"],\ - ["@types/ajv", null],\ - ["ajv", "npm:8.8.1"]\ - ],\ - "packagePeers": [\ - "@types/ajv",\ - "ajv"\ - ],\ - "linkType": "HARD"\ - }],\ ["virtual:e822c5b02ef2b3c5fb9c8d88d5e0ca208365bff76f80510f4ccf9b1de44e2078264bcb00d3cdd5e193c256e9ab81e27c34fcfb1ad3a0e8c1dc8fa0066c78c468#npm:2.1.1", {\ "packageLocation": "./.yarn/__virtual__/ajv-formats-virtual-39fabfe016/0/cache/ajv-formats-npm-2.1.1-3cec02eae9-70c263ded2.zip/node_modules/ajv-formats/",\ "packageDependencies": [\ @@ -6339,7 +6116,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["are-we-there-yet", "npm:2.0.0"],\ ["delegates", "npm:1.0.0"],\ - ["readable-stream", "npm:3.6.0"]\ + ["readable-stream", "npm:3.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -6375,7 +6152,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/array-buffer-byte-length-npm-1.0.0-331671f28a-044e101ce1.zip/node_modules/array-buffer-byte-length/",\ "packageDependencies": [\ ["array-buffer-byte-length", "npm:1.0.0"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["is-array-buffer", "npm:3.0.2"]\ ],\ "linkType": "HARD"\ @@ -6404,7 +6181,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/array-includes-npm-3.1.7-d32a5ee179-856a8be5d1.zip/node_modules/array-includes/",\ "packageDependencies": [\ ["array-includes", "npm:3.1.7"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"],\ ["get-intrinsic", "npm:1.2.2"],\ @@ -6427,7 +6204,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/array.prototype.findlastindex-npm-1.2.3-2a36f4417b-063cbab8ee.zip/node_modules/array.prototype.findlastindex/",\ "packageDependencies": [\ ["array.prototype.findlastindex", "npm:1.2.3"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"],\ ["es-shim-unscopables", "npm:1.0.2"],\ @@ -6441,7 +6218,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/array.prototype.flat-npm-1.3.2-350729f7f4-d9d2f6f275.zip/node_modules/array.prototype.flat/",\ "packageDependencies": [\ ["array.prototype.flat", "npm:1.3.2"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"],\ ["es-shim-unscopables", "npm:1.0.2"]\ @@ -6454,7 +6231,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/array.prototype.flatmap-npm-1.3.2-5c6a4af226-33f2000668.zip/node_modules/array.prototype.flatmap/",\ "packageDependencies": [\ ["array.prototype.flatmap", "npm:1.3.2"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"],\ ["es-shim-unscopables", "npm:1.0.2"]\ @@ -6468,7 +6245,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["arraybuffer.prototype.slice", "npm:1.0.2"],\ ["array-buffer-byte-length", "npm:1.0.0"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"],\ ["get-intrinsic", "npm:1.2.2"],\ @@ -6620,7 +6397,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["awilix", "npm:4.3.4"],\ ["camel-case", "npm:4.1.2"],\ - ["glob", "npm:7.2.0"]\ + ["glob", "npm:7.2.3"]\ ],\ "linkType": "HARD"\ }]\ @@ -6656,14 +6433,14 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/__virtual__/babel-eslint-virtual-ff1372ed3f/0/cache/babel-eslint-npm-10.1.0-6a6d2b1533-dc5dd948f8.zip/node_modules/babel-eslint/",\ "packageDependencies": [\ ["babel-eslint", "virtual:27dae49067a60fa65fec6e1c3adad1497d0dda3f71eda711624109131ff3b7d1061a20f55e89b5a0a219da1f7a0a1a0a76bc414d36870315bd60acf5bdcb7f55#npm:10.1.0"],\ - ["@babel/code-frame", "npm:7.16.7"],\ - ["@babel/parser", "npm:7.17.3"],\ - ["@babel/traverse", "npm:7.17.3"],\ - ["@babel/types", "npm:7.17.0"],\ + ["@babel/code-frame", "npm:7.22.13"],\ + ["@babel/parser", "npm:7.23.3"],\ + ["@babel/traverse", "npm:7.23.3"],\ + ["@babel/types", "npm:7.23.3"],\ ["@types/eslint", null],\ ["eslint", "npm:8.53.0"],\ ["eslint-visitor-keys", "npm:1.3.0"],\ - ["resolve", "patch:resolve@npm%3A1.22.0#optional!builtin::version=1.22.0&hash=c3c19d"]\ + ["resolve", "patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d"]\ ],\ "packagePeers": [\ "@types/eslint",\ @@ -6906,7 +6683,7 @@ const RAW_RUNTIME_STATE = ["bl", "npm:4.1.0"],\ ["buffer", "npm:5.7.1"],\ ["inherits", "npm:2.0.4"],\ - ["readable-stream", "npm:3.6.0"]\ + ["readable-stream", "npm:3.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -7093,18 +6870,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["browserslist", [\ - ["npm:4.18.1", {\ - "packageLocation": "./.yarn/cache/browserslist-npm-4.18.1-38eb8a64b9-83bb8dd04c.zip/node_modules/browserslist/",\ - "packageDependencies": [\ - ["browserslist", "npm:4.18.1"],\ - ["caniuse-lite", "npm:1.0.30001282"],\ - ["electron-to-chromium", "npm:1.3.903"],\ - ["escalade", "npm:3.1.1"],\ - ["node-releases", "npm:2.0.1"],\ - ["picocolors", "npm:1.0.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:4.22.1", {\ "packageLocation": "./.yarn/cache/browserslist-npm-4.22.1-cccae6d74e-4a515168e0.zip/node_modules/browserslist/",\ "packageDependencies": [\ @@ -7255,7 +7020,7 @@ const RAW_RUNTIME_STATE = ["cacache", "npm:18.0.0"],\ ["@npmcli/fs", "npm:3.1.0"],\ ["fs-minipass", "npm:3.0.3"],\ - ["glob", "npm:10.3.10"],\ + ["glob", "npm:10.4.1"],\ ["lru-cache", "npm:10.0.2"],\ ["minipass", "npm:7.0.4"],\ ["minipass-collect", "npm:1.0.2"],\ @@ -7263,7 +7028,7 @@ const RAW_RUNTIME_STATE = ["minipass-pipeline", "npm:1.2.4"],\ ["p-map", "npm:4.0.0"],\ ["ssri", "npm:10.0.5"],\ - ["tar", "npm:6.1.13"],\ + ["tar", "npm:6.2.1"],\ ["unique-filename", "npm:3.0.0"]\ ],\ "linkType": "HARD"\ @@ -7329,15 +7094,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["call-bind", [\ - ["npm:1.0.2", {\ - "packageLocation": "./.yarn/cache/call-bind-npm-1.0.2-c957124861-ca787179c1.zip/node_modules/call-bind/",\ - "packageDependencies": [\ - ["call-bind", "npm:1.0.2"],\ - ["function-bind", "npm:1.1.1"],\ - ["get-intrinsic", "npm:1.2.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.0.5", {\ "packageLocation": "./.yarn/cache/call-bind-npm-1.0.5-65600fae47-246d44db6e.zip/node_modules/call-bind/",\ "packageDependencies": [\ @@ -7373,7 +7129,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["camel-case", "npm:4.1.2"],\ ["pascal-case", "npm:3.1.2"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -7407,13 +7163,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["caniuse-lite", [\ - ["npm:1.0.30001282", {\ - "packageLocation": "./.yarn/cache/caniuse-lite-npm-1.0.30001282-49173a42dd-7802b8e099.zip/node_modules/caniuse-lite/",\ - "packageDependencies": [\ - ["caniuse-lite", "npm:1.0.30001282"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.0.30001561", {\ "packageLocation": "./.yarn/cache/caniuse-lite-npm-1.0.30001561-b213ca8bce-94cfc8454c.zip/node_modules/caniuse-lite/",\ "packageDependencies": [\ @@ -7428,7 +7177,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["capital-case", "npm:1.0.4"],\ ["no-case", "npm:3.0.4"],\ - ["tslib", "npm:2.4.1"],\ + ["tslib", "npm:2.6.2"],\ ["upper-case-first", "npm:2.0.2"]\ ],\ "linkType": "HARD"\ @@ -7485,7 +7234,7 @@ const RAW_RUNTIME_STATE = ["chai-as-promised", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:7.1.1"],\ ["@types/chai", "npm:4.2.22"],\ ["chai", "npm:4.3.10"],\ - ["check-error", "npm:1.0.2"]\ + ["check-error", "npm:1.0.3"]\ ],\ "packagePeers": [\ "@types/chai",\ @@ -7499,7 +7248,7 @@ const RAW_RUNTIME_STATE = ["chai-as-promised", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:7.1.1"],\ ["@types/chai", null],\ ["chai", "npm:4.3.10"],\ - ["check-error", "npm:1.0.2"]\ + ["check-error", "npm:1.0.3"]\ ],\ "packagePeers": [\ "@types/chai",\ @@ -7615,7 +7364,7 @@ const RAW_RUNTIME_STATE = ["path-case", "npm:3.0.4"],\ ["sentence-case", "npm:3.0.4"],\ ["snake-case", "npm:3.0.4"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -7630,13 +7379,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["check-error", [\ - ["npm:1.0.2", {\ - "packageLocation": "./.yarn/cache/check-error-npm-1.0.2-00c540c6e9-011e74b2ea.zip/node_modules/check-error/",\ - "packageDependencies": [\ - ["check-error", "npm:1.0.2"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.0.3", {\ "packageLocation": "./.yarn/cache/check-error-npm-1.0.3-137994eabc-e2131025cf.zip/node_modules/check-error/",\ "packageDependencies": [\ @@ -7931,6 +7673,15 @@ const RAW_RUNTIME_STATE = ["color-string", "npm:1.6.0"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:4.2.3", {\ + "packageLocation": "./.yarn/cache/color-npm-4.2.3-4a23227581-b23f5e500a.zip/node_modules/color/",\ + "packageDependencies": [\ + ["color", "npm:4.2.3"],\ + ["color-convert", "npm:2.0.1"],\ + ["color-string", "npm:1.9.1"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["color-convert", [\ @@ -7976,6 +7727,15 @@ const RAW_RUNTIME_STATE = ["simple-swizzle", "npm:0.2.2"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.9.1", {\ + "packageLocation": "./.yarn/cache/color-string-npm-1.9.1-dc020e56be-72aa0b81ee.zip/node_modules/color-string/",\ + "packageDependencies": [\ + ["color-string", "npm:1.9.1"],\ + ["color-name", "npm:1.1.4"],\ + ["simple-swizzle", "npm:0.2.2"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["color-support", [\ @@ -7988,13 +7748,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["colorette", [\ - ["npm:2.0.19", {\ - "packageLocation": "./.yarn/cache/colorette-npm-2.0.19-f73dfe6a4e-6e2606435c.zip/node_modules/colorette/",\ - "packageDependencies": [\ - ["colorette", "npm:2.0.19"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:2.0.20", {\ "packageLocation": "./.yarn/cache/colorette-npm-2.0.20-692d428726-0b8de48bfa.zip/node_modules/colorette/",\ "packageDependencies": [\ @@ -8186,7 +7939,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["constant-case", "npm:3.0.4"],\ ["no-case", "npm:3.0.4"],\ - ["tslib", "npm:2.4.1"],\ + ["tslib", "npm:2.6.2"],\ ["upper-case", "npm:2.0.2"]\ ],\ "linkType": "HARD"\ @@ -8625,13 +8378,14 @@ const RAW_RUNTIME_STATE = ["@dashevo/bls", "npm:1.2.9"],\ ["@dashevo/dapi-client", "workspace:packages/js-dapi-client"],\ ["@dashevo/dapi-grpc", "workspace:packages/dapi-grpc"],\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ + ["@dashevo/dashcore-lib", "npm:0.21.1"],\ ["@dashevo/dashpay-contract", "workspace:packages/dashpay-contract"],\ ["@dashevo/dpns-contract", "workspace:packages/dpns-contract"],\ ["@dashevo/grpc-common", "workspace:packages/js-grpc-common"],\ ["@dashevo/masternode-reward-shares-contract", "workspace:packages/masternode-reward-shares-contract"],\ ["@dashevo/wallet-lib", "workspace:packages/wallet-lib"],\ ["@dashevo/wasm-dpp", "workspace:packages/wasm-dpp"],\ + ["@dashevo/withdrawals-contract", "workspace:packages/withdrawals-contract"],\ ["@types/chai", "npm:4.2.22"],\ ["@types/dirty-chai", "npm:2.0.2"],\ ["@types/mocha", "npm:8.2.3"],\ @@ -8682,7 +8436,7 @@ const RAW_RUNTIME_STATE = ["ts-loader", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:9.5.0"],\ ["ts-mocha", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:10.0.0"],\ ["ts-mock-imports", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:1.3.8"],\ - ["ts-node", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:10.4.0"],\ + ["ts-node", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:10.9.1"],\ ["tsd", "npm:0.28.1"],\ ["typescript", "patch:typescript@npm%3A3.9.10#optional!builtin::version=3.9.10&hash=3bd3d3"],\ ["url", "npm:0.11.3"],\ @@ -8700,10 +8454,11 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["dashmate", "workspace:packages/dashmate"],\ ["@babel/core", "npm:7.23.3"],\ - ["@babel/eslint-parser", "virtual:880cda903c2a2be387819a3f857d21494004437a03c92969b9853f7bdeebdfed08d417e68364ee9e158338603a6d78d690c457a55ab11e56398bc10f0ad232fc#npm:7.23.3"],\ + ["@babel/eslint-parser", "virtual:6c6296bde00603e266f7d80babe1e01aa0c19f626934f58fe08f890a291bb1a38fcee25bf30c24857d5cfba290f01209decc48384318fd6815c5a514cb48be25#npm:7.23.3"],\ ["@dashevo/bls", "npm:1.2.9"],\ - ["@dashevo/dashcore-lib", "npm:0.21.0"],\ - ["@dashevo/dashd-rpc", "npm:18.2.0"],\ + ["@dashevo/dapi-client", "workspace:packages/js-dapi-client"],\ + ["@dashevo/dashcore-lib", "npm:0.21.1"],\ + ["@dashevo/dashd-rpc", "npm:18.3.0"],\ ["@dashevo/dashpay-contract", "workspace:packages/dashpay-contract"],\ ["@dashevo/docker-compose", "npm:0.24.4"],\ ["@dashevo/dpns-contract", "workspace:packages/dpns-contract"],\ @@ -8711,12 +8466,13 @@ const RAW_RUNTIME_STATE = ["@dashevo/masternode-reward-shares-contract", "workspace:packages/masternode-reward-shares-contract"],\ ["@dashevo/wallet-lib", "workspace:packages/wallet-lib"],\ ["@dashevo/withdrawals-contract", "workspace:packages/withdrawals-contract"],\ - ["@oclif/core", "npm:3.10.8"],\ + ["@oclif/core", "npm:3.26.5"],\ ["@oclif/plugin-help", "npm:6.0.5"],\ - ["ajv", "npm:8.8.1"],\ - ["ajv-formats", "virtual:880cda903c2a2be387819a3f857d21494004437a03c92969b9853f7bdeebdfed08d417e68364ee9e158338603a6d78d690c457a55ab11e56398bc10f0ad232fc#npm:2.1.1"],\ + ["ajv", "npm:8.12.0"],\ + ["ajv-formats", "virtual:e822c5b02ef2b3c5fb9c8d88d5e0ca208365bff76f80510f4ccf9b1de44e2078264bcb00d3cdd5e193c256e9ab81e27c34fcfb1ad3a0e8c1dc8fa0066c78c468#npm:2.1.1"],\ ["awilix", "npm:4.3.4"],\ ["begoo", "npm:2.0.2"],\ + ["bs58", "npm:4.0.1"],\ ["chai", "npm:4.3.10"],\ ["chai-as-promised", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:7.1.1"],\ ["chalk", "npm:4.1.2"],\ @@ -8729,7 +8485,7 @@ const RAW_RUNTIME_STATE = ["eslint", "npm:8.53.0"],\ ["eslint-config-airbnb-base", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:15.0.0"],\ ["eslint-plugin-import", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:2.29.0"],\ - ["glob", "npm:10.3.4"],\ + ["glob", "npm:10.4.1"],\ ["globby", "npm:11.1.0"],\ ["hasbin", "npm:1.2.3"],\ ["is-wsl", "npm:2.2.0"],\ @@ -9032,15 +8788,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["define-properties", [\ - ["npm:1.2.0", {\ - "packageLocation": "./.yarn/cache/define-properties-npm-1.2.0-3547cd0fd2-e60aee6a19.zip/node_modules/define-properties/",\ - "packageDependencies": [\ - ["define-properties", "npm:1.2.0"],\ - ["has-property-descriptors", "npm:1.0.0"],\ - ["object-keys", "npm:1.1.1"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.2.1", {\ "packageLocation": "./.yarn/cache/define-properties-npm-1.2.1-8a4d42413b-b4ccd00597.zip/node_modules/define-properties/",\ "packageDependencies": [\ @@ -9257,7 +9004,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["docker-modem", "npm:3.0.8"],\ ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ - ["readable-stream", "npm:3.6.0"],\ + ["readable-stream", "npm:3.6.2"],\ ["split-ca", "npm:1.0.1"],\ ["ssh2", "npm:1.11.0"]\ ],\ @@ -9322,7 +9069,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["dot-case", "npm:3.0.4"],\ ["no-case", "npm:3.0.4"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -9384,23 +9131,16 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["ejs", [\ - ["npm:3.1.8", {\ - "packageLocation": "./.yarn/cache/ejs-npm-3.1.8-30583753fc-879f84c8ee.zip/node_modules/ejs/",\ + ["npm:3.1.10", {\ + "packageLocation": "./.yarn/cache/ejs-npm-3.1.10-4e8cf4bdc1-a9cb7d7cd1.zip/node_modules/ejs/",\ "packageDependencies": [\ - ["ejs", "npm:3.1.8"],\ + ["ejs", "npm:3.1.10"],\ ["jake", "npm:10.8.5"]\ ],\ "linkType": "HARD"\ }]\ ]],\ ["electron-to-chromium", [\ - ["npm:1.3.903", {\ - "packageLocation": "./.yarn/cache/electron-to-chromium-npm-1.3.903-3e6dfabc20-12a0c5ba72.zip/node_modules/electron-to-chromium/",\ - "packageDependencies": [\ - ["electron-to-chromium", "npm:1.3.903"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.4.581", {\ "packageLocation": "./.yarn/cache/electron-to-chromium-npm-1.4.581-a32b5f3c64-a40ea2863c.zip/node_modules/electron-to-chromium/",\ "packageDependencies": [\ @@ -9486,14 +9226,14 @@ const RAW_RUNTIME_STATE = ["engine.io", "npm:6.4.2"],\ ["@types/cookie", "npm:0.4.1"],\ ["@types/cors", "npm:2.8.12"],\ - ["@types/node", "npm:17.0.21"],\ + ["@types/node", "npm:18.16.1"],\ ["accepts", "npm:1.3.7"],\ ["base64id", "npm:2.0.0"],\ ["cookie", "npm:0.4.1"],\ ["cors", "npm:2.8.5"],\ ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ ["engine.io-parser", "npm:5.0.4"],\ - ["ws", "virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.11.0"]\ + ["ws", "virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.17.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -9508,15 +9248,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["enhanced-resolve", [\ - ["npm:5.12.0", {\ - "packageLocation": "./.yarn/cache/enhanced-resolve-npm-5.12.0-c291ce4ee3-ea5b49a064.zip/node_modules/enhanced-resolve/",\ - "packageDependencies": [\ - ["enhanced-resolve", "npm:5.12.0"],\ - ["graceful-fs", "npm:4.2.10"],\ - ["tapable", "npm:2.2.1"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:5.15.0", {\ "packageLocation": "./.yarn/cache/enhanced-resolve-npm-5.15.0-16eb7ddef9-180c3f2706.zip/node_modules/enhanced-resolve/",\ "packageDependencies": [\ @@ -9603,47 +9334,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["es-abstract", [\ - ["npm:1.21.2", {\ - "packageLocation": "./.yarn/cache/es-abstract-npm-1.21.2-f4ebace1ab-2e1d6922c9.zip/node_modules/es-abstract/",\ - "packageDependencies": [\ - ["es-abstract", "npm:1.21.2"],\ - ["array-buffer-byte-length", "npm:1.0.0"],\ - ["available-typed-arrays", "npm:1.0.5"],\ - ["call-bind", "npm:1.0.2"],\ - ["es-set-tostringtag", "npm:2.0.1"],\ - ["es-to-primitive", "npm:1.2.1"],\ - ["function.prototype.name", "npm:1.1.5"],\ - ["get-intrinsic", "npm:1.2.0"],\ - ["get-symbol-description", "npm:1.0.0"],\ - ["globalthis", "npm:1.0.3"],\ - ["gopd", "npm:1.0.1"],\ - ["has", "npm:1.0.3"],\ - ["has-property-descriptors", "npm:1.0.0"],\ - ["has-proto", "npm:1.0.1"],\ - ["has-symbols", "npm:1.0.3"],\ - ["internal-slot", "npm:1.0.5"],\ - ["is-array-buffer", "npm:3.0.2"],\ - ["is-callable", "npm:1.2.7"],\ - ["is-negative-zero", "npm:2.0.2"],\ - ["is-regex", "npm:1.1.4"],\ - ["is-shared-array-buffer", "npm:1.0.2"],\ - ["is-string", "npm:1.0.7"],\ - ["is-typed-array", "npm:1.1.10"],\ - ["is-weakref", "npm:1.0.2"],\ - ["object-inspect", "npm:1.12.3"],\ - ["object-keys", "npm:1.1.1"],\ - ["object.assign", "npm:4.1.4"],\ - ["regexp.prototype.flags", "npm:1.4.3"],\ - ["safe-regex-test", "npm:1.0.0"],\ - ["string.prototype.trim", "npm:1.2.7"],\ - ["string.prototype.trimend", "npm:1.0.6"],\ - ["string.prototype.trimstart", "npm:1.0.6"],\ - ["typed-array-length", "npm:1.0.4"],\ - ["unbox-primitive", "npm:1.0.2"],\ - ["which-typed-array", "npm:1.1.9"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.22.3", {\ "packageLocation": "./.yarn/cache/es-abstract-npm-1.22.3-15a58832e5-e1ea9738ec.zip/node_modules/es-abstract/",\ "packageDependencies": [\ @@ -9705,7 +9395,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/es-set-tostringtag-npm-2.0.1-c87b5de872-ec416a1294.zip/node_modules/es-set-tostringtag/",\ "packageDependencies": [\ ["es-set-tostringtag", "npm:2.0.1"],\ - ["get-intrinsic", "npm:1.2.0"],\ + ["get-intrinsic", "npm:1.2.2"],\ ["has", "npm:1.0.3"],\ ["has-tostringtag", "npm:1.0.0"]\ ],\ @@ -9840,7 +9530,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/eslint-npm-8.53.0-2fc5c501d2-e305a71ce2.zip/node_modules/eslint/",\ "packageDependencies": [\ ["eslint", "npm:8.53.0"],\ - ["@eslint-community/eslint-utils", "virtual:2fc5c501d26c4c2fbc6a1d931e87d32adb7d9118fbcd7303a7b7faae809112bde136383859a265761a47c2852a001b7b803bf80e734ffa8ddc2ca30c129d1d76#npm:4.2.0"],\ + ["@eslint-community/eslint-utils", "virtual:2fc5c501d26c4c2fbc6a1d931e87d32adb7d9118fbcd7303a7b7faae809112bde136383859a265761a47c2852a001b7b803bf80e734ffa8ddc2ca30c129d1d76#npm:4.4.0"],\ ["@eslint-community/regexpp", "npm:4.10.0"],\ ["@eslint/eslintrc", "npm:2.1.3"],\ ["@eslint/js", "npm:8.53.0"],\ @@ -10259,13 +9949,6 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["npm:3.3.0", {\ - "packageLocation": "./.yarn/cache/eslint-visitor-keys-npm-3.3.0-d329af7c8c-37a1a5912a.zip/node_modules/eslint-visitor-keys/",\ - "packageDependencies": [\ - ["eslint-visitor-keys", "npm:3.3.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:3.4.3", {\ "packageLocation": "./.yarn/cache/eslint-visitor-keys-npm-3.4.3-a356ac7e46-3f357c554a.zip/node_modules/eslint-visitor-keys/",\ "packageDependencies": [\ @@ -10275,16 +9958,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["espree", [\ - ["npm:9.1.0", {\ - "packageLocation": "./.yarn/cache/espree-npm-9.1.0-fd22538590-8ade225f24.zip/node_modules/espree/",\ - "packageDependencies": [\ - ["espree", "npm:9.1.0"],\ - ["acorn", "npm:8.8.2"],\ - ["acorn-jsx", "virtual:fd2253859039a15030fecf2d1545fcad47d7bd43468b9166c71fdd4e35b538414e653775f5401c948ed8db3eb1925f84c66c161d39a27b19ee73fef5e721329e#npm:5.3.2"],\ - ["eslint-visitor-keys", "npm:3.3.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:9.6.1", {\ "packageLocation": "./.yarn/cache/espree-npm-9.6.1-a50722a5a9-255ab260f0.zip/node_modules/espree/",\ "packageDependencies": [\ @@ -10472,18 +10145,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["fast-glob", [\ - ["npm:3.2.11", {\ - "packageLocation": "./.yarn/cache/fast-glob-npm-3.2.11-bc01135fef-6b736d92a4.zip/node_modules/fast-glob/",\ - "packageDependencies": [\ - ["fast-glob", "npm:3.2.11"],\ - ["@nodelib/fs.stat", "npm:2.0.5"],\ - ["@nodelib/fs.walk", "npm:1.2.8"],\ - ["glob-parent", "npm:5.1.2"],\ - ["merge2", "npm:1.4.1"],\ - ["micromatch", "npm:4.0.4"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:3.2.12", {\ "packageLocation": "./.yarn/cache/fast-glob-npm-3.2.12-162763bbae-641e748664.zip/node_modules/fast-glob/",\ "packageDependencies": [\ @@ -10771,17 +10432,17 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["follow-redirects", [\ - ["npm:1.15.2", {\ - "packageLocation": "./.yarn/cache/follow-redirects-npm-1.15.2-1ec1dd82be-8be0d39919.zip/node_modules/follow-redirects/",\ + ["npm:1.15.6", {\ + "packageLocation": "./.yarn/cache/follow-redirects-npm-1.15.6-50635fe51d-70c7612c4c.zip/node_modules/follow-redirects/",\ "packageDependencies": [\ - ["follow-redirects", "npm:1.15.2"]\ + ["follow-redirects", "npm:1.15.6"]\ ],\ "linkType": "SOFT"\ }],\ - ["virtual:a313c479c5c7e54d9ec8fbeeea69ff640f56b8989ea2dff42351a3fa5c4061fb80a52d8ede0f0826a181a216820c2d2c3f15da881e7fdf31cef1c446e42f0c45#npm:1.15.2", {\ - "packageLocation": "./.yarn/__virtual__/follow-redirects-virtual-2696a91c1b/0/cache/follow-redirects-npm-1.15.2-1ec1dd82be-8be0d39919.zip/node_modules/follow-redirects/",\ + ["virtual:a313c479c5c7e54d9ec8fbeeea69ff640f56b8989ea2dff42351a3fa5c4061fb80a52d8ede0f0826a181a216820c2d2c3f15da881e7fdf31cef1c446e42f0c45#npm:1.15.6", {\ + "packageLocation": "./.yarn/__virtual__/follow-redirects-virtual-23ff1601e1/0/cache/follow-redirects-npm-1.15.6-50635fe51d-70c7612c4c.zip/node_modules/follow-redirects/",\ "packageDependencies": [\ - ["follow-redirects", "virtual:a313c479c5c7e54d9ec8fbeeea69ff640f56b8989ea2dff42351a3fa5c4061fb80a52d8ede0f0826a181a216820c2d2c3f15da881e7fdf31cef1c446e42f0c45#npm:1.15.2"],\ + ["follow-redirects", "virtual:a313c479c5c7e54d9ec8fbeeea69ff640f56b8989ea2dff42351a3fa5c4061fb80a52d8ede0f0826a181a216820c2d2c3f15da881e7fdf31cef1c446e42f0c45#npm:1.15.6"],\ ["@types/debug", null],\ ["debug", null]\ ],\ @@ -10926,13 +10587,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["function-bind", [\ - ["npm:1.1.1", {\ - "packageLocation": "./.yarn/cache/function-bind-npm-1.1.1-b56b322ae9-d83f296803.zip/node_modules/function-bind/",\ - "packageDependencies": [\ - ["function-bind", "npm:1.1.1"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.1.2", {\ "packageLocation": "./.yarn/cache/function-bind-npm-1.1.2-7a55be9b03-185e20d20f.zip/node_modules/function-bind/",\ "packageDependencies": [\ @@ -10942,22 +10596,11 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["function.prototype.name", [\ - ["npm:1.1.5", {\ - "packageLocation": "./.yarn/cache/function.prototype.name-npm-1.1.5-e776a642bb-5d426e5a38.zip/node_modules/function.prototype.name/",\ - "packageDependencies": [\ - ["function.prototype.name", "npm:1.1.5"],\ - ["call-bind", "npm:1.0.2"],\ - ["define-properties", "npm:1.2.0"],\ - ["es-abstract", "npm:1.21.2"],\ - ["functions-have-names", "npm:1.2.3"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.1.6", {\ "packageLocation": "./.yarn/cache/function.prototype.name-npm-1.1.6-fd3a6a5cdd-4d40be44d4.zip/node_modules/function.prototype.name/",\ "packageDependencies": [\ ["function.prototype.name", "npm:1.1.6"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"],\ ["functions-have-names", "npm:1.2.3"]\ @@ -11029,16 +10672,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["get-intrinsic", [\ - ["npm:1.2.0", {\ - "packageLocation": "./.yarn/cache/get-intrinsic-npm-1.2.0-eb08ea9b1d-f57c5fe67a.zip/node_modules/get-intrinsic/",\ - "packageDependencies": [\ - ["get-intrinsic", "npm:1.2.0"],\ - ["function-bind", "npm:1.1.1"],\ - ["has", "npm:1.0.3"],\ - ["has-symbols", "npm:1.0.3"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.2.2", {\ "packageLocation": "./.yarn/cache/get-intrinsic-npm-1.2.2-3f446d8847-aa96db4f80.zip/node_modules/get-intrinsic/",\ "packageDependencies": [\ @@ -11104,8 +10737,8 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/get-symbol-description-npm-1.0.0-9c95a4bc1f-7e5f298afe.zip/node_modules/get-symbol-description/",\ "packageDependencies": [\ ["get-symbol-description", "npm:1.0.0"],\ - ["call-bind", "npm:1.0.2"],\ - ["get-intrinsic", "npm:1.2.0"]\ + ["call-bind", "npm:1.0.5"],\ + ["get-intrinsic", "npm:1.2.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -11176,27 +10809,15 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["glob", [\ - ["npm:10.3.10", {\ - "packageLocation": "./.yarn/cache/glob-npm-10.3.10-da1ef8b112-38bdb2c9ce.zip/node_modules/glob/",\ + ["npm:10.4.1", {\ + "packageLocation": "./.yarn/cache/glob-npm-10.4.1-a0d030e0a9-d7bb49d2b4.zip/node_modules/glob/",\ "packageDependencies": [\ - ["glob", "npm:10.3.10"],\ + ["glob", "npm:10.4.1"],\ ["foreground-child", "npm:3.1.1"],\ - ["jackspeak", "npm:2.3.6"],\ - ["minimatch", "npm:9.0.3"],\ - ["minipass", "npm:7.0.3"],\ - ["path-scurry", "npm:1.10.1"]\ - ],\ - "linkType": "HARD"\ - }],\ - ["npm:10.3.4", {\ - "packageLocation": "./.yarn/cache/glob-npm-10.3.4-f58cd31f55-6375721bcd.zip/node_modules/glob/",\ - "packageDependencies": [\ - ["glob", "npm:10.3.4"],\ - ["foreground-child", "npm:3.1.1"],\ - ["jackspeak", "npm:2.3.3"],\ - ["minimatch", "npm:9.0.3"],\ - ["minipass", "npm:7.0.3"],\ - ["path-scurry", "npm:1.10.1"]\ + ["jackspeak", "npm:3.1.2"],\ + ["minimatch", "npm:9.0.4"],\ + ["minipass", "npm:7.1.2"],\ + ["path-scurry", "npm:1.11.1"]\ ],\ "linkType": "HARD"\ }],\ @@ -11226,6 +10847,19 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ + ["npm:7.2.3", {\ + "packageLocation": "./.yarn/cache/glob-npm-7.2.3-2d866d17a5-59452a9202.zip/node_modules/glob/",\ + "packageDependencies": [\ + ["glob", "npm:7.2.3"],\ + ["fs.realpath", "npm:1.0.0"],\ + ["inflight", "npm:1.0.6"],\ + ["inherits", "npm:2.0.4"],\ + ["minimatch", "npm:3.1.2"],\ + ["once", "npm:1.4.0"],\ + ["path-is-absolute", "npm:1.0.1"]\ + ],\ + "linkType": "HARD"\ + }],\ ["npm:8.1.0", {\ "packageLocation": "./.yarn/cache/glob-npm-8.1.0-65f64af8b1-9aab1c75eb.zip/node_modules/glob/",\ "packageDependencies": [\ @@ -11288,7 +10922,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/globalthis-npm-1.0.3-96cd56020d-45ae2f3b40.zip/node_modules/globalthis/",\ "packageDependencies": [\ ["globalthis", "npm:1.0.3"],\ - ["define-properties", "npm:1.2.0"]\ + ["define-properties", "npm:1.2.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -11300,7 +10934,7 @@ const RAW_RUNTIME_STATE = ["globby", "npm:11.1.0"],\ ["array-union", "npm:2.1.0"],\ ["dir-glob", "npm:3.0.1"],\ - ["fast-glob", "npm:3.2.11"],\ + ["fast-glob", "npm:3.2.12"],\ ["ignore", "npm:5.2.0"],\ ["merge2", "npm:1.4.1"],\ ["slash", "npm:3.0.0"]\ @@ -11331,7 +10965,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/gopd-npm-1.0.1-10c1d0b534-5fbc7ad57b.zip/node_modules/gopd/",\ "packageDependencies": [\ ["gopd", "npm:1.0.1"],\ - ["get-intrinsic", "npm:1.2.0"]\ + ["get-intrinsic", "npm:1.2.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -11447,7 +11081,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/has-npm-1.0.3-b7f00631c1-a449f3185b.zip/node_modules/has/",\ "packageDependencies": [\ ["has", "npm:1.0.3"],\ - ["function-bind", "npm:1.1.1"]\ + ["function-bind", "npm:1.1.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -11482,7 +11116,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/has-property-descriptors-npm-1.0.0-56289b918d-a6d3f0a266.zip/node_modules/has-property-descriptors/",\ "packageDependencies": [\ ["has-property-descriptors", "npm:1.0.0"],\ - ["get-intrinsic", "npm:1.2.0"]\ + ["get-intrinsic", "npm:1.2.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -11540,7 +11174,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["hash-base", "npm:3.1.0"],\ ["inherits", "npm:2.0.4"],\ - ["readable-stream", "npm:3.6.0"],\ + ["readable-stream", "npm:3.6.2"],\ ["safe-buffer", "npm:5.2.1"]\ ],\ "linkType": "HARD"\ @@ -11593,7 +11227,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["header-case", "npm:2.0.4"],\ ["capital-case", "npm:1.0.4"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -11604,7 +11238,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["help-me", "npm:4.2.0"],\ ["glob", "npm:8.1.0"],\ - ["readable-stream", "npm:3.6.0"]\ + ["readable-stream", "npm:3.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -11699,7 +11333,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["http-proxy", "npm:1.18.1"],\ ["eventemitter3", "npm:4.0.7"],\ - ["follow-redirects", "virtual:a313c479c5c7e54d9ec8fbeeea69ff640f56b8989ea2dff42351a3fa5c4061fb80a52d8ede0f0826a181a216820c2d2c3f15da881e7fdf31cef1c446e42f0c45#npm:1.15.2"],\ + ["follow-redirects", "virtual:a313c479c5c7e54d9ec8fbeeea69ff640f56b8989ea2dff42351a3fa5c4061fb80a52d8ede0f0826a181a216820c2d2c3f15da881e7fdf31cef1c446e42f0c45#npm:1.15.6"],\ ["requires-port", "npm:1.0.0"]\ ],\ "linkType": "HARD"\ @@ -12010,7 +11644,7 @@ const RAW_RUNTIME_STATE = ["mute-stream", "npm:0.0.8"],\ ["ora", "npm:5.4.1"],\ ["run-async", "npm:2.4.1"],\ - ["rxjs", "npm:7.8.0"],\ + ["rxjs", "npm:7.8.1"],\ ["string-width", "npm:4.2.3"],\ ["strip-ansi", "npm:6.0.1"],\ ["through", "npm:2.3.8"]\ @@ -12023,7 +11657,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/internal-slot-npm-1.0.5-a2241f3e66-e2eb5b348e.zip/node_modules/internal-slot/",\ "packageDependencies": [\ ["internal-slot", "npm:1.0.5"],\ - ["get-intrinsic", "npm:1.2.0"],\ + ["get-intrinsic", "npm:1.2.2"],\ ["has", "npm:1.0.3"],\ ["side-channel", "npm:1.0.4"]\ ],\ @@ -12046,18 +11680,13 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ - ["ip", [\ - ["npm:1.1.5", {\ - "packageLocation": "./.yarn/cache/ip-npm-1.1.5-af36318aa6-40a00572cf.zip/node_modules/ip/",\ - "packageDependencies": [\ - ["ip", "npm:1.1.5"]\ - ],\ - "linkType": "HARD"\ - }],\ - ["npm:2.0.0", {\ - "packageLocation": "./.yarn/cache/ip-npm-2.0.0-204facb3cc-1270b11e53.zip/node_modules/ip/",\ + ["ip-address", [\ + ["npm:9.0.5", {\ + "packageLocation": "./.yarn/cache/ip-address-npm-9.0.5-9fa024d42a-1ed81e0672.zip/node_modules/ip-address/",\ "packageDependencies": [\ - ["ip", "npm:2.0.0"]\ + ["ip-address", "npm:9.0.5"],\ + ["jsbn", "npm:1.1.0"],\ + ["sprintf-js", "npm:1.1.3"]\ ],\ "linkType": "HARD"\ }]\ @@ -12085,7 +11714,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/is-arguments-npm-1.1.1-eff4f6d4d7-a170c7e260.zip/node_modules/is-arguments/",\ "packageDependencies": [\ ["is-arguments", "npm:1.1.1"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["has-tostringtag", "npm:1.0.0"]\ ],\ "linkType": "HARD"\ @@ -12096,9 +11725,9 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/is-array-buffer-npm-3.0.2-0dec897785-dcac9dda66.zip/node_modules/is-array-buffer/",\ "packageDependencies": [\ ["is-array-buffer", "npm:3.0.2"],\ - ["call-bind", "npm:1.0.2"],\ - ["get-intrinsic", "npm:1.2.0"],\ - ["is-typed-array", "npm:1.1.10"]\ + ["call-bind", "npm:1.0.5"],\ + ["get-intrinsic", "npm:1.2.2"],\ + ["is-typed-array", "npm:1.1.12"]\ ],\ "linkType": "HARD"\ }]\ @@ -12144,7 +11773,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/is-boolean-object-npm-1.1.2-ecbd575e6a-ba794223b5.zip/node_modules/is-boolean-object/",\ "packageDependencies": [\ ["is-boolean-object", "npm:1.1.2"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["has-tostringtag", "npm:1.0.0"]\ ],\ "linkType": "HARD"\ @@ -12177,14 +11806,6 @@ const RAW_RUNTIME_STATE = ["hasown", "npm:2.0.0"]\ ],\ "linkType": "HARD"\ - }],\ - ["npm:2.8.1", {\ - "packageLocation": "./.yarn/cache/is-core-module-npm-2.8.1-ce21740d1b-80b33fbd45.zip/node_modules/is-core-module/",\ - "packageDependencies": [\ - ["is-core-module", "npm:2.8.1"],\ - ["has", "npm:1.0.3"]\ - ],\ - "linkType": "HARD"\ }]\ ]],\ ["is-date-object", [\ @@ -12277,8 +11898,8 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/is-nan-npm-1.3.2-a087d31a28-1f784d3472.zip/node_modules/is-nan/",\ "packageDependencies": [\ ["is-nan", "npm:1.3.2"],\ - ["call-bind", "npm:1.0.2"],\ - ["define-properties", "npm:1.2.0"]\ + ["call-bind", "npm:1.0.5"],\ + ["define-properties", "npm:1.2.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -12367,7 +11988,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/is-regex-npm-1.1.4-cca193ef11-36d9174d16.zip/node_modules/is-regex/",\ "packageDependencies": [\ ["is-regex", "npm:1.1.4"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["has-tostringtag", "npm:1.0.0"]\ ],\ "linkType": "HARD"\ @@ -12397,7 +12018,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/is-shared-array-buffer-npm-1.0.2-32e4181fcd-23d82259d6.zip/node_modules/is-shared-array-buffer/",\ "packageDependencies": [\ ["is-shared-array-buffer", "npm:1.0.2"],\ - ["call-bind", "npm:1.0.2"]\ + ["call-bind", "npm:1.0.5"]\ ],\ "linkType": "HARD"\ }]\ @@ -12442,18 +12063,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["is-typed-array", [\ - ["npm:1.1.10", {\ - "packageLocation": "./.yarn/cache/is-typed-array-npm-1.1.10-fe4ef83cdc-2392b2473b.zip/node_modules/is-typed-array/",\ - "packageDependencies": [\ - ["is-typed-array", "npm:1.1.10"],\ - ["available-typed-arrays", "npm:1.0.5"],\ - ["call-bind", "npm:1.0.2"],\ - ["for-each", "npm:0.3.3"],\ - ["gopd", "npm:1.0.1"],\ - ["has-tostringtag", "npm:1.0.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.1.12", {\ "packageLocation": "./.yarn/cache/is-typed-array-npm-1.1.12-6135c91b1a-d953adfd3c.zip/node_modules/is-typed-array/",\ "packageDependencies": [\ @@ -12495,7 +12104,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/is-weakref-npm-1.0.2-ff80e8c314-0023fd0e4b.zip/node_modules/is-weakref/",\ "packageDependencies": [\ ["is-weakref", "npm:1.0.2"],\ - ["call-bind", "npm:1.0.2"]\ + ["call-bind", "npm:1.0.5"]\ ],\ "linkType": "HARD"\ }]\ @@ -12596,7 +12205,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["isomorphic-ws", "virtual:7469c013e9c5baa67d67122340123f2260ba4f66d6748855fb7f2ab67ea3fe52b2c8821a105003266d54faf99a9564056fb1b532d9ae8b6985087ab5f8394bf0#npm:4.0.1"],\ ["@types/ws", "npm:7.4.7"],\ - ["ws", "virtual:7469c013e9c5baa67d67122340123f2260ba4f66d6748855fb7f2ab67ea3fe52b2c8821a105003266d54faf99a9564056fb1b532d9ae8b6985087ab5f8394bf0#npm:7.5.5"]\ + ["ws", "virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.17.1"]\ ],\ "packagePeers": [\ "@types/ws",\ @@ -12606,13 +12215,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["istanbul-lib-coverage", [\ - ["npm:3.2.0", {\ - "packageLocation": "./.yarn/cache/istanbul-lib-coverage-npm-3.2.0-93f84b2c8c-31621b84ad.zip/node_modules/istanbul-lib-coverage/",\ - "packageDependencies": [\ - ["istanbul-lib-coverage", "npm:3.2.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:3.2.2", {\ "packageLocation": "./.yarn/cache/istanbul-lib-coverage-npm-3.2.2-5c0526e059-40bbdd1e93.zip/node_modules/istanbul-lib-coverage/",\ "packageDependencies": [\ @@ -12638,7 +12240,7 @@ const RAW_RUNTIME_STATE = ["istanbul-lib-instrument", "npm:4.0.3"],\ ["@babel/core", "npm:7.23.3"],\ ["@istanbuljs/schema", "npm:0.1.3"],\ - ["istanbul-lib-coverage", "npm:3.2.0"],\ + ["istanbul-lib-coverage", "npm:3.2.2"],\ ["semver", "npm:7.5.3"]\ ],\ "linkType": "HARD"\ @@ -12664,7 +12266,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/istanbul-lib-report-npm-3.0.0-660f97340a-06b37952e9.zip/node_modules/istanbul-lib-report/",\ "packageDependencies": [\ ["istanbul-lib-report", "npm:3.0.0"],\ - ["istanbul-lib-coverage", "npm:3.2.0"],\ + ["istanbul-lib-coverage", "npm:3.2.2"],\ ["make-dir", "npm:3.1.0"],\ ["supports-color", "npm:7.2.0"]\ ],\ @@ -12677,7 +12279,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["istanbul-lib-source-maps", "npm:4.0.1"],\ ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ - ["istanbul-lib-coverage", "npm:3.2.0"],\ + ["istanbul-lib-coverage", "npm:3.2.2"],\ ["source-map", "npm:0.6.1"]\ ],\ "linkType": "HARD"\ @@ -12695,19 +12297,10 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["jackspeak", [\ - ["npm:2.3.3", {\ - "packageLocation": "./.yarn/cache/jackspeak-npm-2.3.3-755684cc60-a4c7c1a3ff.zip/node_modules/jackspeak/",\ - "packageDependencies": [\ - ["jackspeak", "npm:2.3.3"],\ - ["@isaacs/cliui", "npm:8.0.2"],\ - ["@pkgjs/parseargs", "npm:0.11.0"]\ - ],\ - "linkType": "HARD"\ - }],\ - ["npm:2.3.6", {\ - "packageLocation": "./.yarn/cache/jackspeak-npm-2.3.6-42e1233172-6e6490d676.zip/node_modules/jackspeak/",\ + ["npm:3.1.2", {\ + "packageLocation": "./.yarn/cache/jackspeak-npm-3.1.2-dbb3ed8474-7e6b94103e.zip/node_modules/jackspeak/",\ "packageDependencies": [\ - ["jackspeak", "npm:2.3.6"],\ + ["jackspeak", "npm:3.1.2"],\ ["@isaacs/cliui", "npm:8.0.2"],\ ["@pkgjs/parseargs", "npm:0.11.0"]\ ],\ @@ -12767,7 +12360,7 @@ const RAW_RUNTIME_STATE = ["isomorphic-ws", "virtual:7469c013e9c5baa67d67122340123f2260ba4f66d6748855fb7f2ab67ea3fe52b2c8821a105003266d54faf99a9564056fb1b532d9ae8b6985087ab5f8394bf0#npm:4.0.1"],\ ["json-stringify-safe", "npm:5.0.1"],\ ["uuid", "npm:8.3.2"],\ - ["ws", "virtual:7469c013e9c5baa67d67122340123f2260ba4f66d6748855fb7f2ab67ea3fe52b2c8821a105003266d54faf99a9564056fb1b532d9ae8b6985087ab5f8394bf0#npm:7.5.5"]\ + ["ws", "virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.17.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -12799,7 +12392,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/jest-worker-npm-27.5.1-1c110b5894-06c6e2a845.zip/node_modules/jest-worker/",\ "packageDependencies": [\ ["jest-worker", "npm:27.5.1"],\ - ["@types/node", "npm:17.0.21"],\ + ["@types/node", "npm:18.16.1"],\ ["merge-stream", "npm:2.0.0"],\ ["supports-color", "npm:8.1.1"]\ ],\ @@ -12870,6 +12463,15 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ + ["jsbn", [\ + ["npm:1.1.0", {\ + "packageLocation": "./.yarn/cache/jsbn-npm-1.1.0-1da0181838-bebe7ae829.zip/node_modules/jsbn/",\ + "packageDependencies": [\ + ["jsbn", "npm:1.1.0"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["jsdoc-type-pratt-parser", [\ ["npm:4.0.0", {\ "packageLocation": "./.yarn/cache/jsdoc-type-pratt-parser-npm-4.0.0-7b035921c4-a225ab874e.zip/node_modules/jsdoc-type-pratt-parser/",\ @@ -13006,14 +12608,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["json5", [\ - ["npm:2.2.0", {\ - "packageLocation": "./.yarn/cache/json5-npm-2.2.0-da49dc7cb5-d72ea87423.zip/node_modules/json5/",\ - "packageDependencies": [\ - ["json5", "npm:2.2.0"],\ - ["minimist", "npm:1.2.6"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:2.2.3", {\ "packageLocation": "./.yarn/cache/json5-npm-2.2.3-9962c55073-1db67b853f.zip/node_modules/json5/",\ "packageDependencies": [\ @@ -13080,7 +12674,7 @@ const RAW_RUNTIME_STATE = ["connect", "npm:3.7.0"],\ ["di", "npm:0.0.1"],\ ["dom-serialize", "npm:2.2.1"],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["graceful-fs", "npm:4.2.10"],\ ["http-proxy", "npm:1.18.1"],\ ["isbinaryfile", "npm:4.0.10"],\ @@ -13224,7 +12818,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["karma-webpack", "virtual:01938c2be4835443e5a304e2b117c575220e96e8b7cedeb0f48d79264590b4c4babc6d1fea6367f522b1ca0149d795b42f2ab89c34a6ffe3c20f0a8cbb8b4453#npm:5.0.0"],\ ["@types/webpack", null],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["minimatch", "npm:3.1.2"],\ ["webpack", "virtual:01938c2be4835443e5a304e2b117c575220e96e8b7cedeb0f48d79264590b4c4babc6d1fea6367f522b1ca0149d795b42f2ab89c34a6ffe3c20f0a8cbb8b4453#npm:5.76.1"],\ ["webpack-merge", "npm:4.2.2"]\ @@ -13240,7 +12834,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["karma-webpack", "virtual:45f214395bc38640da4dc5e940482d5df0572c5384e0262802601d1973e71077ec8bbd76b77eafa4c0550b706b664abd84d63fd67a5897139f0b2675530fc84f#npm:5.0.0"],\ ["@types/webpack", null],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["minimatch", "npm:3.1.2"],\ ["webpack", "virtual:45f214395bc38640da4dc5e940482d5df0572c5384e0262802601d1973e71077ec8bbd76b77eafa4c0550b706b664abd84d63fd67a5897139f0b2675530fc84f#npm:5.76.1"],\ ["webpack-merge", "npm:4.2.2"]\ @@ -13256,7 +12850,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["karma-webpack", "virtual:8f25fc90e0fb5fd89843707863857591fa8c52f9f33eadced4bf404b1871d91959f7bb86948ae0e1b53ee94d491ef8fde9c0b58b39c9490c0d0fa6c931945f97#npm:5.0.0"],\ ["@types/webpack", null],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["minimatch", "npm:3.1.2"],\ ["webpack", "virtual:8f25fc90e0fb5fd89843707863857591fa8c52f9f33eadced4bf404b1871d91959f7bb86948ae0e1b53ee94d491ef8fde9c0b58b39c9490c0d0fa6c931945f97#npm:5.76.1"],\ ["webpack-merge", "npm:4.2.2"]\ @@ -13272,7 +12866,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["karma-webpack", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.0.0"],\ ["@types/webpack", null],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["minimatch", "npm:3.1.2"],\ ["webpack", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.76.1"],\ ["webpack-merge", "npm:4.2.2"]\ @@ -13288,7 +12882,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["karma-webpack", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:5.0.0"],\ ["@types/webpack", null],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["minimatch", "npm:3.1.2"],\ ["webpack", "virtual:e2d057e7cc143d3cb9bec864f4a2d862441b5a09f81f8e6c46e7a098cbc89e4d07017cc6e2e2142d5704bb55da853cbec2d025ebc0b30e8696c31380c00f2c7d#npm:5.76.1"],\ ["webpack-merge", "npm:4.2.2"]\ @@ -13353,7 +12947,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["level-iterator-stream", "npm:4.0.2"],\ ["inherits", "npm:2.0.4"],\ - ["readable-stream", "npm:3.6.0"],\ + ["readable-stream", "npm:3.6.2"],\ ["xtend", "npm:4.0.2"]\ ],\ "linkType": "HARD"\ @@ -13436,7 +13030,7 @@ const RAW_RUNTIME_STATE = ["listr2", "virtual:880cda903c2a2be387819a3f857d21494004437a03c92969b9853f7bdeebdfed08d417e68364ee9e158338603a6d78d690c457a55ab11e56398bc10f0ad232fc#npm:5.0.7"],\ ["@types/enquirer", null],\ ["cli-truncate", "npm:2.1.0"],\ - ["colorette", "npm:2.0.19"],\ + ["colorette", "npm:2.0.20"],\ ["enquirer", "https://github.com/dashpay/enquirer.git#commit=86aaef0b1c82dfaa3436775e6b37de310eeb94f5"],\ ["log-update", "npm:4.0.0"],\ ["p-map", "npm:4.0.0"],\ @@ -13743,7 +13337,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/lower-case-npm-2.0.2-151055f1c2-83a0a5f159.zip/node_modules/lower-case/",\ "packageDependencies": [\ ["lower-case", "npm:2.0.2"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -13765,13 +13359,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["lru-cache", [\ - ["npm:10.0.1", {\ - "packageLocation": "./.yarn/cache/lru-cache-npm-10.0.1-0e1abf4c13-5bb91a97a3.zip/node_modules/lru-cache/",\ - "packageDependencies": [\ - ["lru-cache", "npm:10.0.1"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:10.0.2", {\ "packageLocation": "./.yarn/cache/lru-cache-npm-10.0.2-fcff47e16f-a675b71a19.zip/node_modules/lru-cache/",\ "packageDependencies": [\ @@ -13780,6 +13367,13 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ + ["npm:10.2.2", {\ + "packageLocation": "./.yarn/cache/lru-cache-npm-10.2.2-c54b721fc3-ff1a496d30.zip/node_modules/lru-cache/",\ + "packageDependencies": [\ + ["lru-cache", "npm:10.2.2"]\ + ],\ + "linkType": "HARD"\ + }],\ ["npm:5.1.1", {\ "packageLocation": "./.yarn/cache/lru-cache-npm-5.1.1-f475882a51-951d2673dc.zip/node_modules/lru-cache/",\ "packageDependencies": [\ @@ -13802,13 +13396,6 @@ const RAW_RUNTIME_STATE = ["lru-cache", "npm:7.18.3"]\ ],\ "linkType": "HARD"\ - }],\ - ["npm:7.3.1", {\ - "packageLocation": "./.yarn/cache/lru-cache-npm-7.3.1-b157dca680-83adf549d8.zip/node_modules/lru-cache/",\ - "packageDependencies": [\ - ["lru-cache", "npm:7.3.1"]\ - ],\ - "linkType": "HARD"\ }]\ ]],\ ["ltgt", [\ @@ -13862,13 +13449,13 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/make-fetch-happen-npm-10.0.3-e552879254-a9afbe3902.zip/node_modules/make-fetch-happen/",\ "packageDependencies": [\ ["make-fetch-happen", "npm:10.0.3"],\ - ["agentkeepalive", "npm:4.2.0"],\ + ["agentkeepalive", "npm:4.3.0"],\ ["cacache", "npm:18.0.0"],\ ["http-cache-semantics", "npm:4.1.1"],\ ["http-proxy-agent", "npm:5.0.0"],\ ["https-proxy-agent", "npm:5.0.0"],\ ["is-lambda", "npm:1.0.1"],\ - ["lru-cache", "npm:7.3.1"],\ + ["lru-cache", "npm:7.18.3"],\ ["minipass", "npm:3.1.6"],\ ["minipass-collect", "npm:1.0.2"],\ ["minipass-fetch", "npm:1.4.1"],\ @@ -13991,13 +13578,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["mem-fs-editor", [\ - ["npm:9.4.0", {\ - "packageLocation": "./.yarn/cache/mem-fs-editor-npm-9.4.0-97c608fb01-b196c50010.zip/node_modules/mem-fs-editor/",\ - "packageDependencies": [\ - ["mem-fs-editor", "npm:9.4.0"]\ - ],\ - "linkType": "SOFT"\ - }],\ ["npm:9.7.0", {\ "packageLocation": "./.yarn/cache/mem-fs-editor-npm-9.7.0-d55ddaa593-656275560f.zip/node_modules/mem-fs-editor/",\ "packageDependencies": [\ @@ -14005,19 +13585,19 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "SOFT"\ }],\ - ["virtual:2acb7f847f03bc2bd90f7df00604776d7c66477738a3b8df4954a29601a0fdca4ccd942111de77aa272590d0b875d8add6606fc244946461a413979c573cc813#npm:9.4.0", {\ - "packageLocation": "./.yarn/__virtual__/mem-fs-editor-virtual-b8ccd1d842/0/cache/mem-fs-editor-npm-9.4.0-97c608fb01-b196c50010.zip/node_modules/mem-fs-editor/",\ + ["virtual:2acb7f847f03bc2bd90f7df00604776d7c66477738a3b8df4954a29601a0fdca4ccd942111de77aa272590d0b875d8add6606fc244946461a413979c573cc813#npm:9.7.0", {\ + "packageLocation": "./.yarn/__virtual__/mem-fs-editor-virtual-c18f617f6d/0/cache/mem-fs-editor-npm-9.7.0-d55ddaa593-656275560f.zip/node_modules/mem-fs-editor/",\ "packageDependencies": [\ - ["mem-fs-editor", "virtual:2acb7f847f03bc2bd90f7df00604776d7c66477738a3b8df4954a29601a0fdca4ccd942111de77aa272590d0b875d8add6606fc244946461a413979c573cc813#npm:9.4.0"],\ + ["mem-fs-editor", "virtual:2acb7f847f03bc2bd90f7df00604776d7c66477738a3b8df4954a29601a0fdca4ccd942111de77aa272590d0b875d8add6606fc244946461a413979c573cc813#npm:9.7.0"],\ ["@types/mem-fs", null],\ ["binaryextensions", "npm:4.18.0"],\ ["commondir", "npm:1.0.1"],\ ["deep-extend", "npm:0.6.0"],\ - ["ejs", "npm:3.1.8"],\ + ["ejs", "npm:3.1.10"],\ ["globby", "npm:11.1.0"],\ - ["isbinaryfile", "npm:4.0.10"],\ + ["isbinaryfile", "npm:5.0.0"],\ ["mem-fs", "npm:2.2.1"],\ - ["minimatch", "npm:3.1.2"],\ + ["minimatch", "npm:7.4.6"],\ ["multimatch", "npm:5.0.0"],\ ["normalize-path", "npm:3.0.0"],\ ["textextensions", "npm:5.14.0"]\ @@ -14036,7 +13616,7 @@ const RAW_RUNTIME_STATE = ["binaryextensions", "npm:4.18.0"],\ ["commondir", "npm:1.0.1"],\ ["deep-extend", "npm:0.6.0"],\ - ["ejs", "npm:3.1.8"],\ + ["ejs", "npm:3.1.10"],\ ["globby", "npm:11.1.0"],\ ["isbinaryfile", "npm:5.0.0"],\ ["mem-fs", null],\ @@ -14278,14 +13858,6 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["npm:5.0.0", {\ - "packageLocation": "./.yarn/cache/minimatch-npm-5.0.0-969101c1d1-ee05bf8c18.zip/node_modules/minimatch/",\ - "packageDependencies": [\ - ["minimatch", "npm:5.0.0"],\ - ["brace-expansion", "npm:2.0.1"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:5.0.1", {\ "packageLocation": "./.yarn/cache/minimatch-npm-5.0.1-612724f6f0-2656580f18.zip/node_modules/minimatch/",\ "packageDependencies": [\ @@ -14317,6 +13889,14 @@ const RAW_RUNTIME_STATE = ["brace-expansion", "npm:2.0.1"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:9.0.4", {\ + "packageLocation": "./.yarn/cache/minimatch-npm-9.0.4-7be5a33efc-4cdc18d112.zip/node_modules/minimatch/",\ + "packageDependencies": [\ + ["minimatch", "npm:9.0.4"],\ + ["brace-expansion", "npm:2.0.1"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["minimist", [\ @@ -14349,13 +13929,6 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["npm:4.2.8", {\ - "packageLocation": "./.yarn/cache/minipass-npm-4.2.8-f05abfe254-e148eb6dcb.zip/node_modules/minipass/",\ - "packageDependencies": [\ - ["minipass", "npm:4.2.8"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:5.0.0", {\ "packageLocation": "./.yarn/cache/minipass-npm-5.0.0-c64fb63c92-61682162d2.zip/node_modules/minipass/",\ "packageDependencies": [\ @@ -14363,17 +13936,17 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["npm:7.0.3", {\ - "packageLocation": "./.yarn/cache/minipass-npm-7.0.3-3b57909ee9-04d72c8a43.zip/node_modules/minipass/",\ + ["npm:7.0.4", {\ + "packageLocation": "./.yarn/cache/minipass-npm-7.0.4-eacb4e042e-e864bd02ce.zip/node_modules/minipass/",\ "packageDependencies": [\ - ["minipass", "npm:7.0.3"]\ + ["minipass", "npm:7.0.4"]\ ],\ "linkType": "HARD"\ }],\ - ["npm:7.0.4", {\ - "packageLocation": "./.yarn/cache/minipass-npm-7.0.4-eacb4e042e-e864bd02ce.zip/node_modules/minipass/",\ + ["npm:7.1.2", {\ + "packageLocation": "./.yarn/cache/minipass-npm-7.1.2-3a5327d36d-c25f0ee819.zip/node_modules/minipass/",\ "packageDependencies": [\ - ["minipass", "npm:7.0.4"]\ + ["minipass", "npm:7.1.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -14808,7 +14381,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["no-case", "npm:3.0.4"],\ ["lower-case", "npm:2.0.2"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -14871,13 +14444,13 @@ const RAW_RUNTIME_STATE = ["node-gyp", "npm:10.0.1"],\ ["env-paths", "npm:2.2.1"],\ ["exponential-backoff", "npm:3.1.1"],\ - ["glob", "npm:10.3.10"],\ + ["glob", "npm:10.4.1"],\ ["graceful-fs", "npm:4.2.10"],\ ["make-fetch-happen", "npm:13.0.0"],\ ["nopt", "npm:7.2.0"],\ ["proc-log", "npm:3.0.0"],\ ["semver", "npm:7.5.3"],\ - ["tar", "npm:6.1.11"],\ + ["tar", "npm:6.2.1"],\ ["which", "npm:4.0.0"]\ ],\ "linkType": "HARD"\ @@ -14912,13 +14485,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["node-releases", [\ - ["npm:2.0.1", {\ - "packageLocation": "./.yarn/cache/node-releases-npm-2.0.1-77b8e327f7-b20dd8d4bc.zip/node_modules/node-releases/",\ - "packageDependencies": [\ - ["node-releases", "npm:2.0.1"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:2.0.13", {\ "packageLocation": "./.yarn/cache/node-releases-npm-2.0.13-1f2e177887-c9bb813aab.zip/node_modules/node-releases/",\ "packageDependencies": [\ @@ -14993,7 +14559,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["normalize-package-data", "npm:2.5.0"],\ ["hosted-git-info", "npm:2.8.9"],\ - ["resolve", "patch:resolve@npm%3A1.22.0#optional!builtin::version=1.22.0&hash=c3c19d"],\ + ["resolve", "patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d"],\ ["semver", "npm:7.5.3"],\ ["validate-npm-package-license", "npm:3.0.4"]\ ],\ @@ -15004,7 +14570,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["normalize-package-data", "npm:3.0.3"],\ ["hosted-git-info", "npm:4.0.2"],\ - ["is-core-module", "npm:2.8.1"],\ + ["is-core-module", "npm:2.13.1"],\ ["semver", "npm:7.5.3"],\ ["validate-npm-package-license", "npm:3.0.4"]\ ],\ @@ -15015,7 +14581,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["normalize-package-data", "npm:5.0.0"],\ ["hosted-git-info", "npm:6.1.1"],\ - ["is-core-module", "npm:2.8.1"],\ + ["is-core-module", "npm:2.13.1"],\ ["semver", "npm:7.5.3"],\ ["validate-npm-package-license", "npm:3.0.4"]\ ],\ @@ -15127,7 +14693,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/npm-packlist-npm-3.0.0-9671ff7386-6fda68f084.zip/node_modules/npm-packlist/",\ "packageDependencies": [\ ["npm-packlist", "npm:3.0.0"],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["ignore-walk", "npm:4.0.1"],\ ["npm-bundled", "npm:1.1.2"],\ ["npm-normalize-package-bin", "npm:1.0.1"]\ @@ -15233,8 +14799,8 @@ const RAW_RUNTIME_STATE = ["find-up", "npm:4.1.0"],\ ["foreground-child", "npm:2.0.0"],\ ["get-package-type", "npm:0.1.0"],\ - ["glob", "npm:7.2.0"],\ - ["istanbul-lib-coverage", "npm:3.2.0"],\ + ["glob", "npm:7.2.3"],\ + ["istanbul-lib-coverage", "npm:3.2.2"],\ ["istanbul-lib-hook", "npm:3.0.0"],\ ["istanbul-lib-instrument", "npm:4.0.3"],\ ["istanbul-lib-processinfo", "npm:2.0.3"],\ @@ -15265,13 +14831,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["object-inspect", [\ - ["npm:1.12.3", {\ - "packageLocation": "./.yarn/cache/object-inspect-npm-1.12.3-1e7d20f5ff-532b0036f0.zip/node_modules/object-inspect/",\ - "packageDependencies": [\ - ["object-inspect", "npm:1.12.3"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.13.1", {\ "packageLocation": "./.yarn/cache/object-inspect-npm-1.13.1-fd038a2f0a-92f4989ed8.zip/node_modules/object-inspect/",\ "packageDependencies": [\ @@ -15285,8 +14844,8 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/object-is-npm-1.1.5-48a862602b-75365aff5d.zip/node_modules/object-is/",\ "packageDependencies": [\ ["object-is", "npm:1.1.5"],\ - ["call-bind", "npm:1.0.2"],\ - ["define-properties", "npm:1.2.0"]\ + ["call-bind", "npm:1.0.5"],\ + ["define-properties", "npm:1.2.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -15314,8 +14873,8 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/object.assign-npm-4.1.4-fb3deb1c3a-fd82d45289.zip/node_modules/object.assign/",\ "packageDependencies": [\ ["object.assign", "npm:4.1.4"],\ - ["call-bind", "npm:1.0.2"],\ - ["define-properties", "npm:1.2.0"],\ + ["call-bind", "npm:1.0.5"],\ + ["define-properties", "npm:1.2.1"],\ ["has-symbols", "npm:1.0.3"],\ ["object-keys", "npm:1.1.1"]\ ],\ @@ -15327,9 +14886,9 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/object.entries-npm-1.1.6-5f9ba14b46-08a09ff839.zip/node_modules/object.entries/",\ "packageDependencies": [\ ["object.entries", "npm:1.1.6"],\ - ["call-bind", "npm:1.0.2"],\ - ["define-properties", "npm:1.2.0"],\ - ["es-abstract", "npm:1.21.2"]\ + ["call-bind", "npm:1.0.5"],\ + ["define-properties", "npm:1.2.1"],\ + ["es-abstract", "npm:1.22.3"]\ ],\ "linkType": "HARD"\ }]\ @@ -15339,7 +14898,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/object.fromentries-npm-2.0.7-2e38392540-1bfbe42a51.zip/node_modules/object.fromentries/",\ "packageDependencies": [\ ["object.fromentries", "npm:2.0.7"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"]\ ],\ @@ -15351,7 +14910,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/object.groupby-npm-1.0.1-fc268391fe-b7123d9140.zip/node_modules/object.groupby/",\ "packageDependencies": [\ ["object.groupby", "npm:1.0.1"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"],\ ["get-intrinsic", "npm:1.2.2"]\ @@ -15364,7 +14923,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/object.values-npm-1.1.7-deae619f88-20ab42c0bb.zip/node_modules/object.values/",\ "packageDependencies": [\ ["object.values", "npm:1.1.7"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"]\ ],\ @@ -15743,7 +15302,7 @@ const RAW_RUNTIME_STATE = ["read-package-json-fast", "npm:2.0.3"],\ ["rimraf", "npm:3.0.2"],\ ["ssri", "npm:8.0.1"],\ - ["tar", "npm:6.1.11"]\ + ["tar", "npm:6.2.1"]\ ],\ "linkType": "HARD"\ }],\ @@ -15768,7 +15327,7 @@ const RAW_RUNTIME_STATE = ["read-package-json-fast", "npm:3.0.2"],\ ["sigstore", "npm:1.9.0"],\ ["ssri", "npm:10.0.5"],\ - ["tar", "npm:6.1.13"]\ + ["tar", "npm:6.2.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -15797,7 +15356,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["param-case", "npm:3.0.4"],\ ["dot-case", "npm:3.0.4"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -15852,7 +15411,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/parse-json-npm-5.2.0-00a63b1199-62085b17d6.zip/node_modules/parse-json/",\ "packageDependencies": [\ ["parse-json", "npm:5.2.0"],\ - ["@babel/code-frame", "npm:7.16.7"],\ + ["@babel/code-frame", "npm:7.22.13"],\ ["error-ex", "npm:1.3.2"],\ ["json-parse-even-better-errors", "npm:2.3.1"],\ ["lines-and-columns", "npm:1.1.6"]\ @@ -15884,7 +15443,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["pascal-case", "npm:3.1.2"],\ ["no-case", "npm:3.0.4"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -15898,6 +15457,15 @@ const RAW_RUNTIME_STATE = ["cross-spawn", "npm:6.0.5"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.1.3", {\ + "packageLocation": "./.yarn/cache/password-prompt-npm-1.1.3-0190666768-1cf7001e66.zip/node_modules/password-prompt/",\ + "packageDependencies": [\ + ["password-prompt", "npm:1.1.3"],\ + ["ansi-escapes", "npm:4.3.2"],\ + ["cross-spawn", "npm:7.0.3"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["path-browserify", [\ @@ -15915,7 +15483,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["path-case", "npm:3.0.4"],\ ["dot-case", "npm:3.0.4"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -15978,12 +15546,12 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["path-scurry", [\ - ["npm:1.10.1", {\ - "packageLocation": "./.yarn/cache/path-scurry-npm-1.10.1-52bd946f2e-eebfb8304f.zip/node_modules/path-scurry/",\ + ["npm:1.11.1", {\ + "packageLocation": "./.yarn/cache/path-scurry-npm-1.11.1-aaf8c339af-5e8845c159.zip/node_modules/path-scurry/",\ "packageDependencies": [\ - ["path-scurry", "npm:1.10.1"],\ - ["lru-cache", "npm:10.0.1"],\ - ["minipass", "npm:7.0.3"]\ + ["path-scurry", "npm:1.11.1"],\ + ["lru-cache", "npm:10.2.2"],\ + ["minipass", "npm:7.1.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -16371,7 +15939,7 @@ const RAW_RUNTIME_STATE = ["@protobufjs/pool", "npm:1.1.0"],\ ["@protobufjs/utf8", "npm:1.1.0"],\ ["@types/long", "npm:4.0.1"],\ - ["@types/node", "npm:17.0.21"],\ + ["@types/node", "npm:18.16.1"],\ ["long", "npm:4.0.0"]\ ],\ "linkType": "HARD"\ @@ -16603,7 +16171,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/read-package-json-npm-6.0.4-bf5c705b94-2c72fc8674.zip/node_modules/read-package-json/",\ "packageDependencies": [\ ["read-package-json", "npm:6.0.4"],\ - ["glob", "npm:10.3.10"],\ + ["glob", "npm:10.4.1"],\ ["json-parse-even-better-errors", "npm:3.0.0"],\ ["normalize-package-data", "npm:5.0.0"],\ ["npm-normalize-package-bin", "npm:3.0.1"]\ @@ -16701,16 +16269,6 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["npm:3.6.0", {\ - "packageLocation": "./.yarn/cache/readable-stream-npm-3.6.0-23a4a5eb56-b80b3e6a7f.zip/node_modules/readable-stream/",\ - "packageDependencies": [\ - ["readable-stream", "npm:3.6.0"],\ - ["inherits", "npm:2.0.4"],\ - ["string_decoder", "npm:1.3.0"],\ - ["util-deprecate", "npm:1.0.2"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:3.6.2", {\ "packageLocation": "./.yarn/cache/readable-stream-npm-3.6.2-d2a6069158-d9e3e53193.zip/node_modules/readable-stream/",\ "packageDependencies": [\ @@ -16771,7 +16329,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/rechoir-npm-0.6.2-0df5f171ec-fe76bf9c21.zip/node_modules/rechoir/",\ "packageDependencies": [\ ["rechoir", "npm:0.6.2"],\ - ["resolve", "patch:resolve@npm%3A1.22.0#optional!builtin::version=1.22.0&hash=c3c19d"]\ + ["resolve", "patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d"]\ ],\ "linkType": "HARD"\ }],\ @@ -16779,7 +16337,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/rechoir-npm-0.7.1-0c7e5c1201-2a04aab4e2.zip/node_modules/rechoir/",\ "packageDependencies": [\ ["rechoir", "npm:0.7.1"],\ - ["resolve", "patch:resolve@npm%3A1.22.0#optional!builtin::version=1.22.0&hash=c3c19d"]\ + ["resolve", "patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d"]\ ],\ "linkType": "HARD"\ }]\ @@ -16844,21 +16402,11 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["regexp.prototype.flags", [\ - ["npm:1.4.3", {\ - "packageLocation": "./.yarn/cache/regexp.prototype.flags-npm-1.4.3-df1c08b65d-3cde7cd22f.zip/node_modules/regexp.prototype.flags/",\ - "packageDependencies": [\ - ["regexp.prototype.flags", "npm:1.4.3"],\ - ["call-bind", "npm:1.0.2"],\ - ["define-properties", "npm:1.2.0"],\ - ["functions-have-names", "npm:1.2.3"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.5.1", {\ "packageLocation": "./.yarn/cache/regexp.prototype.flags-npm-1.5.1-b8faeee306-3fa5610b8e.zip/node_modules/regexp.prototype.flags/",\ "packageDependencies": [\ ["regexp.prototype.flags", "npm:1.5.1"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["set-function-name", "npm:2.0.1"]\ ],\ @@ -16973,16 +16521,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["resolve", [\ - ["patch:resolve@npm%3A1.22.0#optional!builtin::version=1.22.0&hash=c3c19d", {\ - "packageLocation": "./.yarn/cache/resolve-patch-2781af2c06-cb53ccafb0.zip/node_modules/resolve/",\ - "packageDependencies": [\ - ["resolve", "patch:resolve@npm%3A1.22.0#optional!builtin::version=1.22.0&hash=c3c19d"],\ - ["is-core-module", "npm:2.8.1"],\ - ["path-parse", "npm:1.0.7"],\ - ["supports-preserve-symlinks-flag", "npm:1.0.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d", {\ "packageLocation": "./.yarn/cache/resolve-patch-4254c24959-f345cd37f5.zip/node_modules/resolve/",\ "packageDependencies": [\ @@ -17097,7 +16635,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/rimraf-npm-2.7.1-9a71f3cc37-4586c296c7.zip/node_modules/rimraf/",\ "packageDependencies": [\ ["rimraf", "npm:2.7.1"],\ - ["glob", "npm:7.2.0"]\ + ["glob", "npm:7.2.3"]\ ],\ "linkType": "HARD"\ }],\ @@ -17105,7 +16643,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/rimraf-npm-3.0.2-2cb7dac69a-063ffaccaa.zip/node_modules/rimraf/",\ "packageDependencies": [\ ["rimraf", "npm:3.0.2"],\ - ["glob", "npm:7.2.0"]\ + ["glob", "npm:7.2.3"]\ ],\ "linkType": "HARD"\ }]\ @@ -17149,19 +16687,11 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["npm:7.8.0", {\ - "packageLocation": "./.yarn/cache/rxjs-npm-7.8.0-722f1c7172-ff9359cc78.zip/node_modules/rxjs/",\ - "packageDependencies": [\ - ["rxjs", "npm:7.8.0"],\ - ["tslib", "npm:2.4.1"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:7.8.1", {\ "packageLocation": "./.yarn/cache/rxjs-npm-7.8.1-41c443a75b-b10cac1a52.zip/node_modules/rxjs/",\ "packageDependencies": [\ ["rxjs", "npm:7.8.1"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -17171,7 +16701,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/safe-array-concat-npm-1.0.1-8a42907bbf-44f073d85c.zip/node_modules/safe-array-concat/",\ "packageDependencies": [\ ["safe-array-concat", "npm:1.0.1"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["get-intrinsic", "npm:1.2.2"],\ ["has-symbols", "npm:1.0.3"],\ ["isarray", "npm:2.0.5"]\ @@ -17200,8 +16730,8 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/safe-regex-test-npm-1.0.0-e94a09b84e-c7248dfa07.zip/node_modules/safe-regex-test/",\ "packageDependencies": [\ ["safe-regex-test", "npm:1.0.0"],\ - ["call-bind", "npm:1.0.2"],\ - ["get-intrinsic", "npm:1.2.0"],\ + ["call-bind", "npm:1.0.5"],\ + ["get-intrinsic", "npm:1.2.2"],\ ["is-regex", "npm:1.1.4"]\ ],\ "linkType": "HARD"\ @@ -17263,7 +16793,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/schema-utils-npm-3.1.1-8704647575-cfcf991f10.zip/node_modules/schema-utils/",\ "packageDependencies": [\ ["schema-utils", "npm:3.1.1"],\ - ["@types/json-schema", "npm:7.0.11"],\ + ["@types/json-schema", "npm:7.0.15"],\ ["ajv", "npm:6.12.6"],\ ["ajv-keywords", "virtual:8704647575acf2f5b19fccfcb0acebacd9c94259ebe9afcfaf4c053812fd896f10775930ee5a5949e20833a61503d2cd22aa259cbe69729f6a192de4bf43dc00#npm:3.5.2"]\ ],\ @@ -17273,7 +16803,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/schema-utils-npm-4.2.0-e822c5b02e-808784735e.zip/node_modules/schema-utils/",\ "packageDependencies": [\ ["schema-utils", "npm:4.2.0"],\ - ["@types/json-schema", "npm:7.0.11"],\ + ["@types/json-schema", "npm:7.0.15"],\ ["ajv", "npm:8.12.0"],\ ["ajv-formats", "virtual:e822c5b02ef2b3c5fb9c8d88d5e0ca208365bff76f80510f4ccf9b1de44e2078264bcb00d3cdd5e193c256e9ab81e27c34fcfb1ad3a0e8c1dc8fa0066c78c468#npm:2.1.1"],\ ["ajv-keywords", "virtual:e822c5b02ef2b3c5fb9c8d88d5e0ca208365bff76f80510f4ccf9b1de44e2078264bcb00d3cdd5e193c256e9ab81e27c34fcfb1ad3a0e8c1dc8fa0066c78c468#npm:5.1.0"]\ @@ -17324,7 +16854,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["sentence-case", "npm:3.0.4"],\ ["no-case", "npm:3.0.4"],\ - ["tslib", "npm:2.4.1"],\ + ["tslib", "npm:2.6.2"],\ ["upper-case-first", "npm:2.0.2"]\ ],\ "linkType": "HARD"\ @@ -17452,7 +16982,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/shelljs-npm-0.8.5-44be43f84a-f2178274b9.zip/node_modules/shelljs/",\ "packageDependencies": [\ ["shelljs", "npm:0.8.5"],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["interpret", "npm:1.4.0"],\ ["rechoir", "npm:0.6.2"]\ ],\ @@ -17548,9 +17078,9 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/side-channel-npm-1.0.4-e1f38b9e06-c4998d9fc5.zip/node_modules/side-channel/",\ "packageDependencies": [\ ["side-channel", "npm:1.0.4"],\ - ["call-bind", "npm:1.0.2"],\ - ["get-intrinsic", "npm:1.2.0"],\ - ["object-inspect", "npm:1.12.3"]\ + ["call-bind", "npm:1.0.5"],\ + ["get-intrinsic", "npm:1.2.2"],\ + ["object-inspect", "npm:1.13.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -17737,7 +17267,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["snake-case", "npm:3.0.4"],\ ["dot-case", "npm:3.0.4"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -17778,20 +17308,11 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["socks", [\ - ["npm:2.6.1", {\ - "packageLocation": "./.yarn/cache/socks-npm-2.6.1-09133d0d22-6ae166bd1a.zip/node_modules/socks/",\ + ["npm:2.8.3", {\ + "packageLocation": "./.yarn/cache/socks-npm-2.8.3-3532b59899-ffcb622c22.zip/node_modules/socks/",\ "packageDependencies": [\ - ["socks", "npm:2.6.1"],\ - ["ip", "npm:1.1.5"],\ - ["smart-buffer", "npm:4.2.0"]\ - ],\ - "linkType": "HARD"\ - }],\ - ["npm:2.7.1", {\ - "packageLocation": "./.yarn/cache/socks-npm-2.7.1-17f2b53052-5074f7d6a1.zip/node_modules/socks/",\ - "packageDependencies": [\ - ["socks", "npm:2.7.1"],\ - ["ip", "npm:2.0.0"],\ + ["socks", "npm:2.8.3"],\ + ["ip-address", "npm:9.0.5"],\ ["smart-buffer", "npm:4.2.0"]\ ],\ "linkType": "HARD"\ @@ -17804,7 +17325,7 @@ const RAW_RUNTIME_STATE = ["socks-proxy-agent", "npm:6.1.1"],\ ["agent-base", "npm:6.0.2"],\ ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ - ["socks", "npm:2.6.1"]\ + ["socks", "npm:2.8.3"]\ ],\ "linkType": "HARD"\ }],\ @@ -17814,7 +17335,7 @@ const RAW_RUNTIME_STATE = ["socks-proxy-agent", "npm:7.0.0"],\ ["agent-base", "npm:6.0.2"],\ ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ - ["socks", "npm:2.7.1"]\ + ["socks", "npm:2.8.3"]\ ],\ "linkType": "HARD"\ }],\ @@ -17824,7 +17345,7 @@ const RAW_RUNTIME_STATE = ["socks-proxy-agent", "npm:8.0.2"],\ ["agent-base", "npm:7.1.0"],\ ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ - ["socks", "npm:2.7.1"]\ + ["socks", "npm:2.8.3"]\ ],\ "linkType": "HARD"\ }]\ @@ -17850,13 +17371,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["source-map", [\ - ["npm:0.5.7", {\ - "packageLocation": "./.yarn/cache/source-map-npm-0.5.7-7c3f035429-9b4ac749ec.zip/node_modules/source-map/",\ - "packageDependencies": [\ - ["source-map", "npm:0.5.7"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:0.6.1", {\ "packageLocation": "./.yarn/cache/source-map-npm-0.6.1-1a3621db16-59ef7462f1.zip/node_modules/source-map/",\ "packageDependencies": [\ @@ -17972,7 +17486,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/split2-npm-3.2.2-4ccd21b4f7-a426e1e671.zip/node_modules/split2/",\ "packageDependencies": [\ ["split2", "npm:3.2.2"],\ - ["readable-stream", "npm:3.6.0"]\ + ["readable-stream", "npm:3.6.2"]\ ],\ "linkType": "HARD"\ }],\ @@ -17991,6 +17505,13 @@ const RAW_RUNTIME_STATE = ["sprintf-js", "npm:1.0.3"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.1.3", {\ + "packageLocation": "./.yarn/cache/sprintf-js-npm-1.1.3-b99efd75b2-e7587128c4.zip/node_modules/sprintf-js/",\ + "packageDependencies": [\ + ["sprintf-js", "npm:1.1.3"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["ssh2", [\ @@ -18048,7 +17569,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["stream-browserify", "npm:3.0.0"],\ ["inherits", "npm:2.0.4"],\ - ["readable-stream", "npm:3.6.0"]\ + ["readable-stream", "npm:3.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -18060,7 +17581,7 @@ const RAW_RUNTIME_STATE = ["stream-http", "npm:3.2.0"],\ ["builtin-status-codes", "npm:3.0.0"],\ ["inherits", "npm:2.0.4"],\ - ["readable-stream", "npm:3.6.0"],\ + ["readable-stream", "npm:3.6.2"],\ ["xtend", "npm:4.0.2"]\ ],\ "linkType": "HARD"\ @@ -18101,21 +17622,11 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["string.prototype.trim", [\ - ["npm:1.2.7", {\ - "packageLocation": "./.yarn/cache/string.prototype.trim-npm-1.2.7-3fbaf3b9d2-a1b795bdb4.zip/node_modules/string.prototype.trim/",\ - "packageDependencies": [\ - ["string.prototype.trim", "npm:1.2.7"],\ - ["call-bind", "npm:1.0.2"],\ - ["define-properties", "npm:1.2.0"],\ - ["es-abstract", "npm:1.21.2"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.2.8", {\ "packageLocation": "./.yarn/cache/string.prototype.trim-npm-1.2.8-7ed4517ce8-9301f6cb2b.zip/node_modules/string.prototype.trim/",\ "packageDependencies": [\ ["string.prototype.trim", "npm:1.2.8"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"]\ ],\ @@ -18123,21 +17634,11 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["string.prototype.trimend", [\ - ["npm:1.0.6", {\ - "packageLocation": "./.yarn/cache/string.prototype.trimend-npm-1.0.6-304246ecc1-3893db9267.zip/node_modules/string.prototype.trimend/",\ - "packageDependencies": [\ - ["string.prototype.trimend", "npm:1.0.6"],\ - ["call-bind", "npm:1.0.2"],\ - ["define-properties", "npm:1.2.0"],\ - ["es-abstract", "npm:1.21.2"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.0.7", {\ "packageLocation": "./.yarn/cache/string.prototype.trimend-npm-1.0.7-159b9dcfbc-3f0d3397ab.zip/node_modules/string.prototype.trimend/",\ "packageDependencies": [\ ["string.prototype.trimend", "npm:1.0.7"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"]\ ],\ @@ -18145,21 +17646,11 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["string.prototype.trimstart", [\ - ["npm:1.0.6", {\ - "packageLocation": "./.yarn/cache/string.prototype.trimstart-npm-1.0.6-0926caea6c-05e2cd06fa.zip/node_modules/string.prototype.trimstart/",\ - "packageDependencies": [\ - ["string.prototype.trimstart", "npm:1.0.6"],\ - ["call-bind", "npm:1.0.2"],\ - ["define-properties", "npm:1.2.0"],\ - ["es-abstract", "npm:1.21.2"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:1.0.7", {\ "packageLocation": "./.yarn/cache/string.prototype.trimstart-npm-1.0.7-ae2f803b78-6e594d3a61.zip/node_modules/string.prototype.trimstart/",\ "packageDependencies": [\ ["string.prototype.trimstart", "npm:1.0.7"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["define-properties", "npm:1.2.1"],\ ["es-abstract", "npm:1.22.3"]\ ],\ @@ -18317,15 +17808,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["supports-hyperlinks", [\ - ["npm:2.2.0", {\ - "packageLocation": "./.yarn/cache/supports-hyperlinks-npm-2.2.0-9b22a6271b-a63f2acba5.zip/node_modules/supports-hyperlinks/",\ - "packageDependencies": [\ - ["supports-hyperlinks", "npm:2.2.0"],\ - ["has-flag", "npm:4.0.0"],\ - ["supports-color", "npm:7.2.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:2.3.0", {\ "packageLocation": "./.yarn/cache/supports-hyperlinks-npm-2.3.0-d19176eba2-3e7df6e9ea.zip/node_modules/supports-hyperlinks/",\ "packageDependencies": [\ @@ -18389,7 +17871,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/table-npm-6.8.1-83abb79e20-512c4f2bfb.zip/node_modules/table/",\ "packageDependencies": [\ ["table", "npm:6.8.1"],\ - ["ajv", "npm:8.8.1"],\ + ["ajv", "npm:8.12.0"],\ ["lodash.truncate", "npm:4.4.2"],\ ["slice-ansi", "npm:4.0.0"],\ ["string-width", "npm:4.2.3"],\ @@ -18419,26 +17901,13 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["tar", [\ - ["npm:6.1.11", {\ - "packageLocation": "./.yarn/cache/tar-npm-6.1.11-e6ac3cba9c-0e6789e664.zip/node_modules/tar/",\ - "packageDependencies": [\ - ["tar", "npm:6.1.11"],\ - ["chownr", "npm:2.0.0"],\ - ["fs-minipass", "npm:2.1.0"],\ - ["minipass", "npm:3.1.6"],\ - ["minizlib", "npm:2.1.2"],\ - ["mkdirp", "npm:1.0.4"],\ - ["yallist", "npm:4.0.0"]\ - ],\ - "linkType": "HARD"\ - }],\ - ["npm:6.1.13", {\ - "packageLocation": "./.yarn/cache/tar-npm-6.1.13-3234e72781-add2c3c6d0.zip/node_modules/tar/",\ + ["npm:6.2.1", {\ + "packageLocation": "./.yarn/cache/tar-npm-6.2.1-237800bb20-bfbfbb2861.zip/node_modules/tar/",\ "packageDependencies": [\ - ["tar", "npm:6.1.13"],\ + ["tar", "npm:6.2.1"],\ ["chownr", "npm:2.0.0"],\ ["fs-minipass", "npm:2.1.0"],\ - ["minipass", "npm:4.2.8"],\ + ["minipass", "npm:5.0.0"],\ ["minizlib", "npm:2.1.2"],\ ["mkdirp", "npm:1.0.4"],\ ["yallist", "npm:4.0.0"]\ @@ -18468,7 +17937,7 @@ const RAW_RUNTIME_STATE = ["end-of-stream", "npm:1.4.4"],\ ["fs-constants", "npm:1.0.0"],\ ["inherits", "npm:2.0.4"],\ - ["readable-stream", "npm:3.6.0"]\ + ["readable-stream", "npm:3.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -18499,7 +17968,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["terser", "npm:5.14.2"],\ ["@jridgewell/source-map", "npm:0.3.2"],\ - ["acorn", "npm:8.8.2"],\ + ["acorn", "npm:8.11.2"],\ ["commander", "npm:2.20.3"],\ ["source-map-support", "npm:0.5.21"]\ ],\ @@ -18518,7 +17987,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/__virtual__/terser-webpack-plugin-virtual-7b10d7bddb/0/cache/terser-webpack-plugin-npm-5.3.3-659a8e4514-db2bc0e570.zip/node_modules/terser-webpack-plugin/",\ "packageDependencies": [\ ["terser-webpack-plugin", "virtual:2a3d558ccb76dd3ab11b6ed4ba45a56a4c8ede48a0f5bce78e9f369869629c0ab3fdd420246c54134f91e3f10302373527dda29ebc24d5a11b3ceb41128ccfad#npm:5.3.3"],\ - ["@jridgewell/trace-mapping", "npm:0.3.15"],\ + ["@jridgewell/trace-mapping", "npm:0.3.18"],\ ["@swc/core", null],\ ["@types/esbuild", null],\ ["@types/swc__core", null],\ @@ -18548,7 +18017,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/__virtual__/terser-webpack-plugin-virtual-520d9753e1/0/cache/terser-webpack-plugin-npm-5.3.3-659a8e4514-db2bc0e570.zip/node_modules/terser-webpack-plugin/",\ "packageDependencies": [\ ["terser-webpack-plugin", "virtual:42f4a899ff66a92a935fae1e8403ae89d87f8a151c8c0f294f5e2ee8bca90964f194c289f6f47a8333ea1d64884bb4ea4c5aea65e0aa5a8603494f665e284ad3#npm:5.3.3"],\ - ["@jridgewell/trace-mapping", "npm:0.3.15"],\ + ["@jridgewell/trace-mapping", "npm:0.3.18"],\ ["@swc/core", null],\ ["@types/esbuild", null],\ ["@types/swc__core", null],\ @@ -18578,7 +18047,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/__virtual__/terser-webpack-plugin-virtual-00677cea6c/0/cache/terser-webpack-plugin-npm-5.3.3-659a8e4514-db2bc0e570.zip/node_modules/terser-webpack-plugin/",\ "packageDependencies": [\ ["terser-webpack-plugin", "virtual:a1758743d243877493a02719691b2bf5513261873450aca581311be1ead841af63c0be982c400355949a0dcad332960c6e3ed3885051f0427d191c70a7fc9856#npm:5.3.3"],\ - ["@jridgewell/trace-mapping", "npm:0.3.15"],\ + ["@jridgewell/trace-mapping", "npm:0.3.18"],\ ["@swc/core", null],\ ["@types/esbuild", null],\ ["@types/swc__core", null],\ @@ -18608,7 +18077,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/__virtual__/terser-webpack-plugin-virtual-65e4fce360/0/cache/terser-webpack-plugin-npm-5.3.3-659a8e4514-db2bc0e570.zip/node_modules/terser-webpack-plugin/",\ "packageDependencies": [\ ["terser-webpack-plugin", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.3.3"],\ - ["@jridgewell/trace-mapping", "npm:0.3.15"],\ + ["@jridgewell/trace-mapping", "npm:0.3.18"],\ ["@swc/core", null],\ ["@types/esbuild", null],\ ["@types/swc__core", null],\ @@ -18638,7 +18107,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/__virtual__/terser-webpack-plugin-virtual-9f9f9cad8b/0/cache/terser-webpack-plugin-npm-5.3.3-659a8e4514-db2bc0e570.zip/node_modules/terser-webpack-plugin/",\ "packageDependencies": [\ ["terser-webpack-plugin", "virtual:d33ae3339557a5a7f9578102570f67e936a4c1af78c1322b63541bc89dc24f419318f0ddd4e3241021a7e0be1ce717f7ffe8cc168317f38d8d886f6915b6482d#npm:5.3.3"],\ - ["@jridgewell/trace-mapping", "npm:0.3.15"],\ + ["@jridgewell/trace-mapping", "npm:0.3.18"],\ ["@swc/core", null],\ ["@types/esbuild", null],\ ["@types/swc__core", null],\ @@ -18671,7 +18140,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["test-exclude", "npm:6.0.0"],\ ["@istanbuljs/schema", "npm:0.1.3"],\ - ["glob", "npm:7.2.0"],\ + ["glob", "npm:7.2.3"],\ ["minimatch", "npm:3.1.2"]\ ],\ "linkType": "HARD"\ @@ -18746,7 +18215,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/through2-npm-4.0.2-da7b2da443-72c246233d.zip/node_modules/through2/",\ "packageDependencies": [\ ["through2", "npm:4.0.2"],\ - ["readable-stream", "npm:3.6.0"]\ + ["readable-stream", "npm:3.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -19005,13 +18474,6 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["ts-node", [\ - ["npm:10.4.0", {\ - "packageLocation": "./.yarn/cache/ts-node-npm-10.4.0-04cb6e2279-5874ac27f6.zip/node_modules/ts-node/",\ - "packageDependencies": [\ - ["ts-node", "npm:10.4.0"]\ - ],\ - "linkType": "SOFT"\ - }],\ ["npm:10.9.1", {\ "packageLocation": "./.yarn/cache/ts-node-npm-10.9.1-6c268be7f4-bee56d4dc9.zip/node_modules/ts-node/",\ "packageDependencies": [\ @@ -19035,11 +18497,11 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:10.4.0", {\ - "packageLocation": "./.yarn/__virtual__/ts-node-virtual-065e96423f/0/cache/ts-node-npm-10.4.0-04cb6e2279-5874ac27f6.zip/node_modules/ts-node/",\ + ["virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:10.9.1", {\ + "packageLocation": "./.yarn/__virtual__/ts-node-virtual-b591c0cf5f/0/cache/ts-node-npm-10.9.1-6c268be7f4-bee56d4dc9.zip/node_modules/ts-node/",\ "packageDependencies": [\ - ["ts-node", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:10.4.0"],\ - ["@cspotcode/source-map-support", "npm:0.7.0"],\ + ["ts-node", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:10.9.1"],\ + ["@cspotcode/source-map-support", "npm:0.8.1"],\ ["@swc/core", null],\ ["@swc/wasm", null],\ ["@tsconfig/node10", "npm:1.0.8"],\ @@ -19050,13 +18512,14 @@ const RAW_RUNTIME_STATE = ["@types/swc__core", null],\ ["@types/swc__wasm", null],\ ["@types/typescript", null],\ - ["acorn", "npm:8.8.2"],\ + ["acorn", "npm:8.11.2"],\ ["acorn-walk", "npm:8.2.0"],\ ["arg", "npm:4.1.3"],\ ["create-require", "npm:1.1.1"],\ ["diff", "npm:4.0.2"],\ ["make-error", "npm:1.3.6"],\ ["typescript", "patch:typescript@npm%3A3.9.10#optional!builtin::version=3.9.10&hash=3bd3d3"],\ + ["v8-compile-cache-lib", "npm:3.0.1"],\ ["yn", "npm:3.1.1"]\ ],\ "packagePeers": [\ @@ -19085,7 +18548,7 @@ const RAW_RUNTIME_STATE = ["@types/swc__core", null],\ ["@types/swc__wasm", null],\ ["@types/typescript", null],\ - ["acorn", "npm:8.8.2"],\ + ["acorn", "npm:8.11.2"],\ ["acorn-walk", "npm:8.2.0"],\ ["arg", "npm:4.1.3"],\ ["create-require", "npm:1.1.1"],\ @@ -19171,20 +18634,6 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["npm:2.4.1", {\ - "packageLocation": "./.yarn/cache/tslib-npm-2.4.1-36f0ed04db-e14311d539.zip/node_modules/tslib/",\ - "packageDependencies": [\ - ["tslib", "npm:2.4.1"]\ - ],\ - "linkType": "HARD"\ - }],\ - ["npm:2.5.0", {\ - "packageLocation": "./.yarn/cache/tslib-npm-2.5.0-bb364efebd-ea556fbdf3.zip/node_modules/tslib/",\ - "packageDependencies": [\ - ["tslib", "npm:2.5.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:2.6.2", {\ "packageLocation": "./.yarn/cache/tslib-npm-2.6.2-4fc8c068d9-bd26c22d36.zip/node_modules/tslib/",\ "packageDependencies": [\ @@ -19359,9 +18808,9 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/typed-array-buffer-npm-1.0.0-95cb610310-3e0281c79b.zip/node_modules/typed-array-buffer/",\ "packageDependencies": [\ ["typed-array-buffer", "npm:1.0.0"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["get-intrinsic", "npm:1.2.2"],\ - ["is-typed-array", "npm:1.1.10"]\ + ["is-typed-array", "npm:1.1.12"]\ ],\ "linkType": "HARD"\ }]\ @@ -19371,10 +18820,10 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/typed-array-byte-length-npm-1.0.0-94d79975ca-6f376bf5d9.zip/node_modules/typed-array-byte-length/",\ "packageDependencies": [\ ["typed-array-byte-length", "npm:1.0.0"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["for-each", "npm:0.3.3"],\ ["has-proto", "npm:1.0.1"],\ - ["is-typed-array", "npm:1.1.10"]\ + ["is-typed-array", "npm:1.1.12"]\ ],\ "linkType": "HARD"\ }]\ @@ -19385,10 +18834,10 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["typed-array-byte-offset", "npm:1.0.0"],\ ["available-typed-arrays", "npm:1.0.5"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["for-each", "npm:0.3.3"],\ ["has-proto", "npm:1.0.1"],\ - ["is-typed-array", "npm:1.1.10"]\ + ["is-typed-array", "npm:1.1.12"]\ ],\ "linkType": "HARD"\ }]\ @@ -19398,9 +18847,9 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/typed-array-length-npm-1.0.4-92771b81fc-0444658acc.zip/node_modules/typed-array-length/",\ "packageDependencies": [\ ["typed-array-length", "npm:1.0.4"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["for-each", "npm:0.3.3"],\ - ["is-typed-array", "npm:1.1.10"]\ + ["is-typed-array", "npm:1.1.12"]\ ],\ "linkType": "HARD"\ }]\ @@ -19459,10 +18908,10 @@ const RAW_RUNTIME_STATE = ["ansi-split", "npm:1.0.1"],\ ["chalk", "npm:4.1.2"],\ ["cross-spawn", "npm:7.0.3"],\ - ["fast-glob", "npm:3.2.11"],\ + ["fast-glob", "npm:3.2.12"],\ ["globrex", "npm:0.1.2"],\ ["ignore", "npm:5.2.0"],\ - ["json5", "npm:2.2.0"],\ + ["json5", "npm:2.2.3"],\ ["micro-memoize", "npm:4.0.9"],\ ["npm-run-path", "npm:4.0.1"],\ ["pid-cwd", "npm:1.2.0"],\ @@ -19483,7 +18932,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/unbox-primitive-npm-1.0.2-cb56a05066-06e1ee41c1.zip/node_modules/unbox-primitive/",\ "packageDependencies": [\ ["unbox-primitive", "npm:1.0.2"],\ - ["call-bind", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.5"],\ ["has-bigints", "npm:1.0.2"],\ ["has-symbols", "npm:1.0.3"],\ ["which-boxed-primitive", "npm:1.0.2"]\ @@ -19632,7 +19081,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/upper-case-npm-2.0.2-6cf3bda96c-508723a2b0.zip/node_modules/upper-case/",\ "packageDependencies": [\ ["upper-case", "npm:2.0.2"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -19642,7 +19091,7 @@ const RAW_RUNTIME_STATE = "packageLocation": "./.yarn/cache/upper-case-first-npm-2.0.2-8e0c5a851a-4487db4701.zip/node_modules/upper-case-first/",\ "packageDependencies": [\ ["upper-case-first", "npm:2.0.2"],\ - ["tslib", "npm:2.4.1"]\ + ["tslib", "npm:2.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -19696,9 +19145,9 @@ const RAW_RUNTIME_STATE = ["inherits", "npm:2.0.4"],\ ["is-arguments", "npm:1.1.1"],\ ["is-generator-function", "npm:1.0.10"],\ - ["is-typed-array", "npm:1.1.10"],\ + ["is-typed-array", "npm:1.1.12"],\ ["safe-buffer", "npm:5.2.1"],\ - ["which-typed-array", "npm:1.1.9"]\ + ["which-typed-array", "npm:1.1.13"]\ ],\ "linkType": "HARD"\ }]\ @@ -19913,11 +19362,11 @@ const RAW_RUNTIME_STATE = ["@webassemblyjs/ast", "npm:1.11.1"],\ ["@webassemblyjs/wasm-edit", "npm:1.11.1"],\ ["@webassemblyjs/wasm-parser", "npm:1.11.1"],\ - ["acorn", "npm:8.8.2"],\ + ["acorn", "npm:8.11.2"],\ ["acorn-import-assertions", "virtual:a1758743d243877493a02719691b2bf5513261873450aca581311be1ead841af63c0be982c400355949a0dcad332960c6e3ed3885051f0427d191c70a7fc9856#npm:1.8.0"],\ - ["browserslist", "npm:4.18.1"],\ + ["browserslist", "npm:4.22.1"],\ ["chrome-trace-event", "npm:1.0.3"],\ - ["enhanced-resolve", "npm:5.12.0"],\ + ["enhanced-resolve", "npm:5.15.0"],\ ["es-module-lexer", "npm:0.9.3"],\ ["eslint-scope", "npm:5.1.1"],\ ["events", "npm:3.3.0"],\ @@ -19950,11 +19399,11 @@ const RAW_RUNTIME_STATE = ["@webassemblyjs/ast", "npm:1.11.1"],\ ["@webassemblyjs/wasm-edit", "npm:1.11.1"],\ ["@webassemblyjs/wasm-parser", "npm:1.11.1"],\ - ["acorn", "npm:8.8.2"],\ + ["acorn", "npm:8.11.2"],\ ["acorn-import-assertions", "virtual:a1758743d243877493a02719691b2bf5513261873450aca581311be1ead841af63c0be982c400355949a0dcad332960c6e3ed3885051f0427d191c70a7fc9856#npm:1.8.0"],\ - ["browserslist", "npm:4.18.1"],\ + ["browserslist", "npm:4.22.1"],\ ["chrome-trace-event", "npm:1.0.3"],\ - ["enhanced-resolve", "npm:5.12.0"],\ + ["enhanced-resolve", "npm:5.15.0"],\ ["es-module-lexer", "npm:0.9.3"],\ ["eslint-scope", "npm:5.1.1"],\ ["events", "npm:3.3.0"],\ @@ -19987,11 +19436,11 @@ const RAW_RUNTIME_STATE = ["@webassemblyjs/ast", "npm:1.11.1"],\ ["@webassemblyjs/wasm-edit", "npm:1.11.1"],\ ["@webassemblyjs/wasm-parser", "npm:1.11.1"],\ - ["acorn", "npm:8.8.2"],\ + ["acorn", "npm:8.11.2"],\ ["acorn-import-assertions", "virtual:a1758743d243877493a02719691b2bf5513261873450aca581311be1ead841af63c0be982c400355949a0dcad332960c6e3ed3885051f0427d191c70a7fc9856#npm:1.8.0"],\ - ["browserslist", "npm:4.18.1"],\ + ["browserslist", "npm:4.22.1"],\ ["chrome-trace-event", "npm:1.0.3"],\ - ["enhanced-resolve", "npm:5.12.0"],\ + ["enhanced-resolve", "npm:5.15.0"],\ ["es-module-lexer", "npm:0.9.3"],\ ["eslint-scope", "npm:5.1.1"],\ ["events", "npm:3.3.0"],\ @@ -20024,11 +19473,11 @@ const RAW_RUNTIME_STATE = ["@webassemblyjs/ast", "npm:1.11.1"],\ ["@webassemblyjs/wasm-edit", "npm:1.11.1"],\ ["@webassemblyjs/wasm-parser", "npm:1.11.1"],\ - ["acorn", "npm:8.8.2"],\ + ["acorn", "npm:8.11.2"],\ ["acorn-import-assertions", "virtual:a1758743d243877493a02719691b2bf5513261873450aca581311be1ead841af63c0be982c400355949a0dcad332960c6e3ed3885051f0427d191c70a7fc9856#npm:1.8.0"],\ - ["browserslist", "npm:4.18.1"],\ + ["browserslist", "npm:4.22.1"],\ ["chrome-trace-event", "npm:1.0.3"],\ - ["enhanced-resolve", "npm:5.12.0"],\ + ["enhanced-resolve", "npm:5.15.0"],\ ["es-module-lexer", "npm:0.9.3"],\ ["eslint-scope", "npm:5.1.1"],\ ["events", "npm:3.3.0"],\ @@ -20061,11 +19510,11 @@ const RAW_RUNTIME_STATE = ["@webassemblyjs/ast", "npm:1.11.1"],\ ["@webassemblyjs/wasm-edit", "npm:1.11.1"],\ ["@webassemblyjs/wasm-parser", "npm:1.11.1"],\ - ["acorn", "npm:8.8.2"],\ + ["acorn", "npm:8.11.2"],\ ["acorn-import-assertions", "virtual:a1758743d243877493a02719691b2bf5513261873450aca581311be1ead841af63c0be982c400355949a0dcad332960c6e3ed3885051f0427d191c70a7fc9856#npm:1.8.0"],\ - ["browserslist", "npm:4.18.1"],\ + ["browserslist", "npm:4.22.1"],\ ["chrome-trace-event", "npm:1.0.3"],\ - ["enhanced-resolve", "npm:5.12.0"],\ + ["enhanced-resolve", "npm:5.15.0"],\ ["es-module-lexer", "npm:0.9.3"],\ ["eslint-scope", "npm:5.1.1"],\ ["events", "npm:3.3.0"],\ @@ -20112,7 +19561,7 @@ const RAW_RUNTIME_STATE = ["@webpack-cli/info", "virtual:0249f7ceb5542d6b732af2b44f9fcd16c60be8b8440f0f3abc6a5de67aabcff731bc3bc83f3067ab2f9037661176f001f89208fcea9e8962835fd43d0aabe88a#npm:1.4.0"],\ ["@webpack-cli/migrate", null],\ ["@webpack-cli/serve", "virtual:0249f7ceb5542d6b732af2b44f9fcd16c60be8b8440f0f3abc6a5de67aabcff731bc3bc83f3067ab2f9037661176f001f89208fcea9e8962835fd43d0aabe88a#npm:1.6.0"],\ - ["colorette", "npm:2.0.19"],\ + ["colorette", "npm:2.0.20"],\ ["commander", "npm:7.2.0"],\ ["execa", "npm:5.1.1"],\ ["fastest-levenshtein", "npm:1.0.12"],\ @@ -20153,7 +19602,7 @@ const RAW_RUNTIME_STATE = ["@webpack-cli/info", "virtual:b37ef7cf98ceabe8c7b789a7db3f0a5f3444d083afa5f0e3ab570292e74eff241f890fadbf245a134b2ebfcba326b1782124a4dd4f16ca7cdb6091dd9a987c04#npm:1.4.0"],\ ["@webpack-cli/migrate", null],\ ["@webpack-cli/serve", "virtual:b37ef7cf98ceabe8c7b789a7db3f0a5f3444d083afa5f0e3ab570292e74eff241f890fadbf245a134b2ebfcba326b1782124a4dd4f16ca7cdb6091dd9a987c04#npm:1.6.0"],\ - ["colorette", "npm:2.0.19"],\ + ["colorette", "npm:2.0.20"],\ ["commander", "npm:7.2.0"],\ ["execa", "npm:5.1.1"],\ ["fastest-levenshtein", "npm:1.0.12"],\ @@ -20194,7 +19643,7 @@ const RAW_RUNTIME_STATE = ["@webpack-cli/info", "virtual:7fc88da9d00679384dc013444a3b1ed8ef8395fcad9d046790a1851d5db985e5ee052061731f87c5475e4bf20a92d69ea1a1a287c0d76d7b1a6bf97010c63532#npm:1.4.0"],\ ["@webpack-cli/migrate", null],\ ["@webpack-cli/serve", "virtual:7fc88da9d00679384dc013444a3b1ed8ef8395fcad9d046790a1851d5db985e5ee052061731f87c5475e4bf20a92d69ea1a1a287c0d76d7b1a6bf97010c63532#npm:1.6.0"],\ - ["colorette", "npm:2.0.19"],\ + ["colorette", "npm:2.0.20"],\ ["commander", "npm:7.2.0"],\ ["execa", "npm:5.1.1"],\ ["fastest-levenshtein", "npm:1.0.12"],\ @@ -20235,7 +19684,7 @@ const RAW_RUNTIME_STATE = ["@webpack-cli/info", "virtual:16885aa8448c33477ea2cd730ac3a5bbbcb89a3f570f5364364e7dc5830b16f19367cec64b723cc62ddb3078b4ee0f0ce5d244584279bc98369c8ee9e5959a27#npm:1.4.0"],\ ["@webpack-cli/migrate", null],\ ["@webpack-cli/serve", "virtual:16885aa8448c33477ea2cd730ac3a5bbbcb89a3f570f5364364e7dc5830b16f19367cec64b723cc62ddb3078b4ee0f0ce5d244584279bc98369c8ee9e5959a27#npm:1.6.0"],\ - ["colorette", "npm:2.0.19"],\ + ["colorette", "npm:2.0.20"],\ ["commander", "npm:7.2.0"],\ ["execa", "npm:5.1.1"],\ ["fastest-levenshtein", "npm:1.0.12"],\ @@ -20381,19 +19830,6 @@ const RAW_RUNTIME_STATE = ["has-tostringtag", "npm:1.0.0"]\ ],\ "linkType": "HARD"\ - }],\ - ["npm:1.1.9", {\ - "packageLocation": "./.yarn/cache/which-typed-array-npm-1.1.9-9559c95dfc-90ef760a09.zip/node_modules/which-typed-array/",\ - "packageDependencies": [\ - ["which-typed-array", "npm:1.1.9"],\ - ["available-typed-arrays", "npm:1.0.5"],\ - ["call-bind", "npm:1.0.2"],\ - ["for-each", "npm:0.3.3"],\ - ["gopd", "npm:1.0.1"],\ - ["has-tostringtag", "npm:1.0.0"],\ - ["is-typed-array", "npm:1.1.10"]\ - ],\ - "linkType": "HARD"\ }]\ ]],\ ["wide-align", [\ @@ -20435,7 +19871,7 @@ const RAW_RUNTIME_STATE = ["is-stream", "npm:2.0.1"],\ ["logform", "npm:2.3.0"],\ ["one-time", "npm:1.0.0"],\ - ["readable-stream", "npm:3.6.0"],\ + ["readable-stream", "npm:3.6.2"],\ ["stack-trace", "npm:0.0.10"],\ ["triple-beam", "npm:1.3.0"],\ ["winston-transport", "npm:4.4.0"]\ @@ -20553,24 +19989,17 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["ws", [\ - ["npm:7.5.5", {\ - "packageLocation": "./.yarn/cache/ws-npm-7.5.5-8f4a2a84a8-2e91fd634b.zip/node_modules/ws/",\ + ["npm:8.17.1", {\ + "packageLocation": "./.yarn/cache/ws-npm-8.17.1-f57fb24a2c-4264ae92c0.zip/node_modules/ws/",\ "packageDependencies": [\ - ["ws", "npm:7.5.5"]\ + ["ws", "npm:8.17.1"]\ ],\ "linkType": "SOFT"\ }],\ - ["npm:8.11.0", {\ - "packageLocation": "./.yarn/cache/ws-npm-8.11.0-ab72116a01-f759ea19e4.zip/node_modules/ws/",\ + ["virtual:01938c2be4835443e5a304e2b117c575220e96e8b7cedeb0f48d79264590b4c4babc6d1fea6367f522b1ca0149d795b42f2ab89c34a6ffe3c20f0a8cbb8b4453#npm:8.17.1", {\ + "packageLocation": "./.yarn/__virtual__/ws-virtual-9c0ceafc6c/0/cache/ws-npm-8.17.1-f57fb24a2c-4264ae92c0.zip/node_modules/ws/",\ "packageDependencies": [\ - ["ws", "npm:8.11.0"]\ - ],\ - "linkType": "SOFT"\ - }],\ - ["virtual:01938c2be4835443e5a304e2b117c575220e96e8b7cedeb0f48d79264590b4c4babc6d1fea6367f522b1ca0149d795b42f2ab89c34a6ffe3c20f0a8cbb8b4453#npm:7.5.5", {\ - "packageLocation": "./.yarn/__virtual__/ws-virtual-49f0813c39/0/cache/ws-npm-7.5.5-8f4a2a84a8-2e91fd634b.zip/node_modules/ws/",\ - "packageDependencies": [\ - ["ws", "virtual:01938c2be4835443e5a304e2b117c575220e96e8b7cedeb0f48d79264590b4c4babc6d1fea6367f522b1ca0149d795b42f2ab89c34a6ffe3c20f0a8cbb8b4453#npm:7.5.5"],\ + ["ws", "virtual:01938c2be4835443e5a304e2b117c575220e96e8b7cedeb0f48d79264590b4c4babc6d1fea6367f522b1ca0149d795b42f2ab89c34a6ffe3c20f0a8cbb8b4453#npm:8.17.1"],\ ["@types/bufferutil", null],\ ["@types/utf-8-validate", null],\ ["bufferutil", "npm:4.0.6"],\ @@ -20584,27 +20013,10 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["virtual:7469c013e9c5baa67d67122340123f2260ba4f66d6748855fb7f2ab67ea3fe52b2c8821a105003266d54faf99a9564056fb1b532d9ae8b6985087ab5f8394bf0#npm:7.5.5", {\ - "packageLocation": "./.yarn/__virtual__/ws-virtual-90d8bcd261/0/cache/ws-npm-7.5.5-8f4a2a84a8-2e91fd634b.zip/node_modules/ws/",\ + ["virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.17.1", {\ + "packageLocation": "./.yarn/__virtual__/ws-virtual-59f3d5fa16/0/cache/ws-npm-8.17.1-f57fb24a2c-4264ae92c0.zip/node_modules/ws/",\ "packageDependencies": [\ - ["ws", "virtual:7469c013e9c5baa67d67122340123f2260ba4f66d6748855fb7f2ab67ea3fe52b2c8821a105003266d54faf99a9564056fb1b532d9ae8b6985087ab5f8394bf0#npm:7.5.5"],\ - ["@types/bufferutil", null],\ - ["@types/utf-8-validate", null],\ - ["bufferutil", null],\ - ["utf-8-validate", null]\ - ],\ - "packagePeers": [\ - "@types/bufferutil",\ - "@types/utf-8-validate",\ - "bufferutil",\ - "utf-8-validate"\ - ],\ - "linkType": "HARD"\ - }],\ - ["virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.11.0", {\ - "packageLocation": "./.yarn/__virtual__/ws-virtual-110db35f33/0/cache/ws-npm-8.11.0-ab72116a01-f759ea19e4.zip/node_modules/ws/",\ - "packageDependencies": [\ - ["ws", "virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.11.0"],\ + ["ws", "virtual:b375dcefccef90d9158d5f197a75395cffedb61772e66f2efcf31c6c8e30c82a6423e0d52b091b15b4fa72cda43a09256ed00b6ce89b9cfb14074f087b9c8496#npm:8.17.1"],\ ["@types/bufferutil", null],\ ["@types/utf-8-validate", null],\ ["bufferutil", null],\ @@ -20695,7 +20107,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["yamljs", "npm:0.3.0"],\ ["argparse", "npm:1.0.10"],\ - ["glob", "npm:7.2.0"]\ + ["glob", "npm:7.2.3"]\ ],\ "linkType": "HARD"\ }]\ @@ -20786,7 +20198,7 @@ const RAW_RUNTIME_STATE = ["commander", "npm:7.1.0"],\ ["dateformat", "npm:4.6.3"],\ ["debug", "virtual:4b12ba5111caf7e8338099bdbc7cb046a9f8e079a44e74d0c03dca469876e3071ebbe671c5e90ae6b78ae33e22c205fa5ed32169a4aabd1404b13c56d09986e1#npm:4.3.4"],\ - ["diff", "npm:5.0.0"],\ + ["diff", "npm:5.1.0"],\ ["error", "npm:10.4.0"],\ ["escape-string-regexp", "npm:4.0.0"],\ ["execa", "npm:5.1.1"],\ @@ -20799,7 +20211,7 @@ const RAW_RUNTIME_STATE = ["lodash", "npm:4.17.21"],\ ["log-symbols", "npm:4.1.0"],\ ["mem-fs", "npm:2.2.1"],\ - ["mem-fs-editor", "virtual:2acb7f847f03bc2bd90f7df00604776d7c66477738a3b8df4954a29601a0fdca4ccd942111de77aa272590d0b875d8add6606fc244946461a413979c573cc813#npm:9.4.0"],\ + ["mem-fs-editor", "virtual:2acb7f847f03bc2bd90f7df00604776d7c66477738a3b8df4954a29601a0fdca4ccd942111de77aa272590d0b875d8add6606fc244946461a413979c573cc813#npm:9.7.0"],\ ["minimatch", "npm:3.1.2"],\ ["npmlog", "npm:5.0.1"],\ ["p-queue", "npm:6.6.2"],\ diff --git a/.yarn/cache/@babel-code-frame-npm-7.16.7-093eb9e124-db2f7faa31.zip b/.yarn/cache/@babel-code-frame-npm-7.16.7-093eb9e124-db2f7faa31.zip deleted file mode 100644 index 1c98cc9480c..00000000000 Binary files a/.yarn/cache/@babel-code-frame-npm-7.16.7-093eb9e124-db2f7faa31.zip and /dev/null differ diff --git a/.yarn/cache/@babel-generator-npm-7.17.3-b206625c17-9a102a87b4.zip b/.yarn/cache/@babel-generator-npm-7.17.3-b206625c17-9a102a87b4.zip deleted file mode 100644 index 1f810427fa2..00000000000 Binary files a/.yarn/cache/@babel-generator-npm-7.17.3-b206625c17-9a102a87b4.zip and /dev/null differ diff --git a/.yarn/cache/@babel-helper-environment-visitor-npm-7.16.7-3ee2ba2019-c03a10105d.zip b/.yarn/cache/@babel-helper-environment-visitor-npm-7.16.7-3ee2ba2019-c03a10105d.zip deleted file mode 100644 index 525f2b2fcf8..00000000000 Binary files a/.yarn/cache/@babel-helper-environment-visitor-npm-7.16.7-3ee2ba2019-c03a10105d.zip and /dev/null differ diff --git a/.yarn/cache/@babel-helper-function-name-npm-7.16.7-aa24c7b296-12e2678236.zip b/.yarn/cache/@babel-helper-function-name-npm-7.16.7-aa24c7b296-12e2678236.zip deleted file mode 100644 index bd14dd9b60b..00000000000 Binary files a/.yarn/cache/@babel-helper-function-name-npm-7.16.7-aa24c7b296-12e2678236.zip and /dev/null differ diff --git a/.yarn/cache/@babel-helper-get-function-arity-npm-7.16.7-987b1b1bed-25d969fb20.zip b/.yarn/cache/@babel-helper-get-function-arity-npm-7.16.7-987b1b1bed-25d969fb20.zip deleted file mode 100644 index cf5b13d58cf..00000000000 Binary files a/.yarn/cache/@babel-helper-get-function-arity-npm-7.16.7-987b1b1bed-25d969fb20.zip and /dev/null differ diff --git a/.yarn/cache/@babel-helper-hoist-variables-npm-7.16.7-25cc3abba4-6ae1641f4a.zip b/.yarn/cache/@babel-helper-hoist-variables-npm-7.16.7-25cc3abba4-6ae1641f4a.zip deleted file mode 100644 index 81cfcbbfad0..00000000000 Binary files a/.yarn/cache/@babel-helper-hoist-variables-npm-7.16.7-25cc3abba4-6ae1641f4a.zip and /dev/null differ diff --git a/.yarn/cache/@babel-helper-plugin-utils-npm-7.14.5-e35eef11cb-fe20e90a24.zip b/.yarn/cache/@babel-helper-plugin-utils-npm-7.14.5-e35eef11cb-fe20e90a24.zip deleted file mode 100644 index 47da224221a..00000000000 Binary files a/.yarn/cache/@babel-helper-plugin-utils-npm-7.14.5-e35eef11cb-fe20e90a24.zip and /dev/null differ diff --git a/.yarn/cache/@babel-helper-split-export-declaration-npm-7.16.7-5b9ae90171-e10aaf1354.zip b/.yarn/cache/@babel-helper-split-export-declaration-npm-7.16.7-5b9ae90171-e10aaf1354.zip deleted file mode 100644 index 5249cf09fe3..00000000000 Binary files a/.yarn/cache/@babel-helper-split-export-declaration-npm-7.16.7-5b9ae90171-e10aaf1354.zip and /dev/null differ diff --git a/.yarn/cache/@babel-helper-validator-identifier-npm-7.16.7-8599fb00fc-42b9b56c35.zip b/.yarn/cache/@babel-helper-validator-identifier-npm-7.16.7-8599fb00fc-42b9b56c35.zip deleted file mode 100644 index e3f61150a17..00000000000 Binary files a/.yarn/cache/@babel-helper-validator-identifier-npm-7.16.7-8599fb00fc-42b9b56c35.zip and /dev/null differ diff --git a/.yarn/cache/@babel-highlight-npm-7.16.10-626c03326c-1f1bdd752a.zip b/.yarn/cache/@babel-highlight-npm-7.16.10-626c03326c-1f1bdd752a.zip deleted file mode 100644 index 18595b7127d..00000000000 Binary files a/.yarn/cache/@babel-highlight-npm-7.16.10-626c03326c-1f1bdd752a.zip and /dev/null differ diff --git a/.yarn/cache/@babel-parser-npm-7.17.3-1c3b6747e0-2d45750cdf.zip b/.yarn/cache/@babel-parser-npm-7.17.3-1c3b6747e0-2d45750cdf.zip deleted file mode 100644 index 3ea658b71a8..00000000000 Binary files a/.yarn/cache/@babel-parser-npm-7.17.3-1c3b6747e0-2d45750cdf.zip and /dev/null differ diff --git a/.yarn/cache/@babel-template-npm-7.16.7-a18e444be8-f35836a8cd.zip b/.yarn/cache/@babel-template-npm-7.16.7-a18e444be8-f35836a8cd.zip deleted file mode 100644 index 5a706bc905a..00000000000 Binary files a/.yarn/cache/@babel-template-npm-7.16.7-a18e444be8-f35836a8cd.zip and /dev/null differ diff --git a/.yarn/cache/@babel-traverse-npm-7.17.3-c2bff3e671-03aed531e0.zip b/.yarn/cache/@babel-traverse-npm-7.17.3-c2bff3e671-03aed531e0.zip deleted file mode 100644 index f435a79f837..00000000000 Binary files a/.yarn/cache/@babel-traverse-npm-7.17.3-c2bff3e671-03aed531e0.zip and /dev/null differ diff --git a/.yarn/cache/@babel-types-npm-7.17.0-3c936b54e4-535ccef360.zip b/.yarn/cache/@babel-types-npm-7.17.0-3c936b54e4-535ccef360.zip deleted file mode 100644 index d6067f111a6..00000000000 Binary files a/.yarn/cache/@babel-types-npm-7.17.0-3c936b54e4-535ccef360.zip and /dev/null differ diff --git a/.yarn/cache/@cspotcode-source-map-consumer-npm-0.8.0-1f37e9e72b-dfe1399712.zip b/.yarn/cache/@cspotcode-source-map-consumer-npm-0.8.0-1f37e9e72b-dfe1399712.zip deleted file mode 100644 index b80c61c493f..00000000000 Binary files a/.yarn/cache/@cspotcode-source-map-consumer-npm-0.8.0-1f37e9e72b-dfe1399712.zip and /dev/null differ diff --git a/.yarn/cache/@cspotcode-source-map-support-npm-0.7.0-456c3ea2ce-d58b31640c.zip b/.yarn/cache/@cspotcode-source-map-support-npm-0.7.0-456c3ea2ce-d58b31640c.zip deleted file mode 100644 index ae1e68e422f..00000000000 Binary files a/.yarn/cache/@cspotcode-source-map-support-npm-0.7.0-456c3ea2ce-d58b31640c.zip and /dev/null differ diff --git a/.yarn/cache/@dashevo-dashcore-lib-npm-0.21.0-1997e852e6-fb4419623f.zip b/.yarn/cache/@dashevo-dashcore-lib-npm-0.21.0-1997e852e6-fb4419623f.zip deleted file mode 100644 index 81560d8bc59..00000000000 Binary files a/.yarn/cache/@dashevo-dashcore-lib-npm-0.21.0-1997e852e6-fb4419623f.zip and /dev/null differ diff --git a/.yarn/cache/@dashevo-dashcore-lib-npm-0.21.1-2fe9b7647d-68502e4078.zip b/.yarn/cache/@dashevo-dashcore-lib-npm-0.21.1-2fe9b7647d-68502e4078.zip new file mode 100644 index 00000000000..56bf009b704 Binary files /dev/null and b/.yarn/cache/@dashevo-dashcore-lib-npm-0.21.1-2fe9b7647d-68502e4078.zip differ diff --git a/.yarn/cache/@dashevo-dashd-rpc-npm-18.2.0-194a5d4c4b-38341b8d5a.zip b/.yarn/cache/@dashevo-dashd-rpc-npm-18.2.0-194a5d4c4b-38341b8d5a.zip deleted file mode 100644 index 29aee764371..00000000000 Binary files a/.yarn/cache/@dashevo-dashd-rpc-npm-18.2.0-194a5d4c4b-38341b8d5a.zip and /dev/null differ diff --git a/.yarn/cache/@dashevo-dashd-rpc-npm-18.3.0-4f165136e8-b83fbdb149.zip b/.yarn/cache/@dashevo-dashd-rpc-npm-18.3.0-4f165136e8-b83fbdb149.zip new file mode 100644 index 00000000000..4f4b7a146a3 Binary files /dev/null and b/.yarn/cache/@dashevo-dashd-rpc-npm-18.3.0-4f165136e8-b83fbdb149.zip differ diff --git a/.yarn/cache/@eslint-community-eslint-utils-npm-4.2.0-434cf92d50-ef8b20b0c7.zip b/.yarn/cache/@eslint-community-eslint-utils-npm-4.2.0-434cf92d50-ef8b20b0c7.zip deleted file mode 100644 index cd12dbed623..00000000000 Binary files a/.yarn/cache/@eslint-community-eslint-utils-npm-4.2.0-434cf92d50-ef8b20b0c7.zip and /dev/null differ diff --git a/.yarn/cache/@eslint-community-regexpp-npm-4.4.0-6bee7b2314-3d9b740479.zip b/.yarn/cache/@eslint-community-regexpp-npm-4.4.0-6bee7b2314-3d9b740479.zip deleted file mode 100644 index c8e3d8abb9b..00000000000 Binary files a/.yarn/cache/@eslint-community-regexpp-npm-4.4.0-6bee7b2314-3d9b740479.zip and /dev/null differ diff --git a/.yarn/cache/@jridgewell-gen-mapping-npm-0.3.2-c64eeb4a4e-7ba0070be1.zip b/.yarn/cache/@jridgewell-gen-mapping-npm-0.3.2-c64eeb4a4e-7ba0070be1.zip deleted file mode 100644 index e4905c2164c..00000000000 Binary files a/.yarn/cache/@jridgewell-gen-mapping-npm-0.3.2-c64eeb4a4e-7ba0070be1.zip and /dev/null differ diff --git a/.yarn/cache/@jridgewell-resolve-uri-npm-3.0.8-94779c6a1d-ba6bb26bae.zip b/.yarn/cache/@jridgewell-resolve-uri-npm-3.0.8-94779c6a1d-ba6bb26bae.zip deleted file mode 100644 index 02ccaf6eac4..00000000000 Binary files a/.yarn/cache/@jridgewell-resolve-uri-npm-3.0.8-94779c6a1d-ba6bb26bae.zip and /dev/null differ diff --git a/.yarn/cache/@jridgewell-trace-mapping-npm-0.3.15-7357dbf648-c889039e05.zip b/.yarn/cache/@jridgewell-trace-mapping-npm-0.3.15-7357dbf648-c889039e05.zip deleted file mode 100644 index 6cf18d7286f..00000000000 Binary files a/.yarn/cache/@jridgewell-trace-mapping-npm-0.3.15-7357dbf648-c889039e05.zip and /dev/null differ diff --git a/.yarn/cache/@oclif-core-npm-3.26.5-02719845fd-4e2aa1a945.zip b/.yarn/cache/@oclif-core-npm-3.26.5-02719845fd-4e2aa1a945.zip new file mode 100644 index 00000000000..abfc68a753a Binary files /dev/null and b/.yarn/cache/@oclif-core-npm-3.26.5-02719845fd-4e2aa1a945.zip differ diff --git a/.yarn/cache/@types-json-schema-npm-7.0.11-79462ae5ca-e50864a93f.zip b/.yarn/cache/@types-json-schema-npm-7.0.11-79462ae5ca-e50864a93f.zip deleted file mode 100644 index f28a98d38cc..00000000000 Binary files a/.yarn/cache/@types-json-schema-npm-7.0.11-79462ae5ca-e50864a93f.zip and /dev/null differ diff --git a/.yarn/cache/@types-node-npm-17.0.21-7d68eb6a13-2beae12b02.zip b/.yarn/cache/@types-node-npm-17.0.21-7d68eb6a13-2beae12b02.zip deleted file mode 100644 index 672e0a48150..00000000000 Binary files a/.yarn/cache/@types-node-npm-17.0.21-7d68eb6a13-2beae12b02.zip and /dev/null differ diff --git a/.yarn/cache/@types-semver-npm-7.3.13-56212b60da-0064efd7a0.zip b/.yarn/cache/@types-semver-npm-7.3.13-56212b60da-0064efd7a0.zip deleted file mode 100644 index 6d63bba22be..00000000000 Binary files a/.yarn/cache/@types-semver-npm-7.3.13-56212b60da-0064efd7a0.zip and /dev/null differ diff --git a/.yarn/cache/acorn-npm-8.8.2-9d518fd7d3-b4e77d56d2.zip b/.yarn/cache/acorn-npm-8.8.2-9d518fd7d3-b4e77d56d2.zip deleted file mode 100644 index c79441c782e..00000000000 Binary files a/.yarn/cache/acorn-npm-8.8.2-9d518fd7d3-b4e77d56d2.zip and /dev/null differ diff --git a/.yarn/cache/agentkeepalive-npm-4.2.0-e5e72b8ce4-cc6e1b4f1c.zip b/.yarn/cache/agentkeepalive-npm-4.2.0-e5e72b8ce4-cc6e1b4f1c.zip deleted file mode 100644 index 90ae9925e30..00000000000 Binary files a/.yarn/cache/agentkeepalive-npm-4.2.0-e5e72b8ce4-cc6e1b4f1c.zip and /dev/null differ diff --git a/.yarn/cache/ajv-npm-8.8.1-3d331224e3-fc52cd18c9.zip b/.yarn/cache/ajv-npm-8.8.1-3d331224e3-fc52cd18c9.zip deleted file mode 100644 index 9fb342a58b2..00000000000 Binary files a/.yarn/cache/ajv-npm-8.8.1-3d331224e3-fc52cd18c9.zip and /dev/null differ diff --git a/.yarn/cache/browserslist-npm-4.18.1-38eb8a64b9-83bb8dd04c.zip b/.yarn/cache/browserslist-npm-4.18.1-38eb8a64b9-83bb8dd04c.zip deleted file mode 100644 index e00bb3f3422..00000000000 Binary files a/.yarn/cache/browserslist-npm-4.18.1-38eb8a64b9-83bb8dd04c.zip and /dev/null differ diff --git a/.yarn/cache/call-bind-npm-1.0.2-c957124861-ca787179c1.zip b/.yarn/cache/call-bind-npm-1.0.2-c957124861-ca787179c1.zip deleted file mode 100644 index 81779aadc49..00000000000 Binary files a/.yarn/cache/call-bind-npm-1.0.2-c957124861-ca787179c1.zip and /dev/null differ diff --git a/.yarn/cache/caniuse-lite-npm-1.0.30001282-49173a42dd-7802b8e099.zip b/.yarn/cache/caniuse-lite-npm-1.0.30001282-49173a42dd-7802b8e099.zip deleted file mode 100644 index 8b2227c6b3c..00000000000 Binary files a/.yarn/cache/caniuse-lite-npm-1.0.30001282-49173a42dd-7802b8e099.zip and /dev/null differ diff --git a/.yarn/cache/check-error-npm-1.0.2-00c540c6e9-011e74b2ea.zip b/.yarn/cache/check-error-npm-1.0.2-00c540c6e9-011e74b2ea.zip deleted file mode 100644 index 358cbb7a5fc..00000000000 Binary files a/.yarn/cache/check-error-npm-1.0.2-00c540c6e9-011e74b2ea.zip and /dev/null differ diff --git a/.yarn/cache/color-npm-4.2.3-4a23227581-b23f5e500a.zip b/.yarn/cache/color-npm-4.2.3-4a23227581-b23f5e500a.zip new file mode 100644 index 00000000000..3f65ebe0c16 Binary files /dev/null and b/.yarn/cache/color-npm-4.2.3-4a23227581-b23f5e500a.zip differ diff --git a/.yarn/cache/color-string-npm-1.9.1-dc020e56be-72aa0b81ee.zip b/.yarn/cache/color-string-npm-1.9.1-dc020e56be-72aa0b81ee.zip new file mode 100644 index 00000000000..7cb3fbdc1b7 Binary files /dev/null and b/.yarn/cache/color-string-npm-1.9.1-dc020e56be-72aa0b81ee.zip differ diff --git a/.yarn/cache/colorette-npm-2.0.19-f73dfe6a4e-6e2606435c.zip b/.yarn/cache/colorette-npm-2.0.19-f73dfe6a4e-6e2606435c.zip deleted file mode 100644 index be43f7c11a2..00000000000 Binary files a/.yarn/cache/colorette-npm-2.0.19-f73dfe6a4e-6e2606435c.zip and /dev/null differ diff --git a/.yarn/cache/define-properties-npm-1.2.0-3547cd0fd2-e60aee6a19.zip b/.yarn/cache/define-properties-npm-1.2.0-3547cd0fd2-e60aee6a19.zip deleted file mode 100644 index bcbfcf6e68f..00000000000 Binary files a/.yarn/cache/define-properties-npm-1.2.0-3547cd0fd2-e60aee6a19.zip and /dev/null differ diff --git a/.yarn/cache/ejs-npm-3.1.10-4e8cf4bdc1-a9cb7d7cd1.zip b/.yarn/cache/ejs-npm-3.1.10-4e8cf4bdc1-a9cb7d7cd1.zip new file mode 100644 index 00000000000..da09b74bcf7 Binary files /dev/null and b/.yarn/cache/ejs-npm-3.1.10-4e8cf4bdc1-a9cb7d7cd1.zip differ diff --git a/.yarn/cache/ejs-npm-3.1.8-30583753fc-879f84c8ee.zip b/.yarn/cache/ejs-npm-3.1.8-30583753fc-879f84c8ee.zip deleted file mode 100644 index 368ffb9272a..00000000000 Binary files a/.yarn/cache/ejs-npm-3.1.8-30583753fc-879f84c8ee.zip and /dev/null differ diff --git a/.yarn/cache/electron-to-chromium-npm-1.3.903-3e6dfabc20-12a0c5ba72.zip b/.yarn/cache/electron-to-chromium-npm-1.3.903-3e6dfabc20-12a0c5ba72.zip deleted file mode 100644 index 215be7ad47c..00000000000 Binary files a/.yarn/cache/electron-to-chromium-npm-1.3.903-3e6dfabc20-12a0c5ba72.zip and /dev/null differ diff --git a/.yarn/cache/enhanced-resolve-npm-5.12.0-c291ce4ee3-ea5b49a064.zip b/.yarn/cache/enhanced-resolve-npm-5.12.0-c291ce4ee3-ea5b49a064.zip deleted file mode 100644 index 661b9e4ef1b..00000000000 Binary files a/.yarn/cache/enhanced-resolve-npm-5.12.0-c291ce4ee3-ea5b49a064.zip and /dev/null differ diff --git a/.yarn/cache/es-abstract-npm-1.21.2-f4ebace1ab-2e1d6922c9.zip b/.yarn/cache/es-abstract-npm-1.21.2-f4ebace1ab-2e1d6922c9.zip deleted file mode 100644 index 1735b16d38c..00000000000 Binary files a/.yarn/cache/es-abstract-npm-1.21.2-f4ebace1ab-2e1d6922c9.zip and /dev/null differ diff --git a/.yarn/cache/eslint-import-resolver-node-npm-0.3.6-d9426786c6-c35c6edb7e.zip b/.yarn/cache/eslint-import-resolver-node-npm-0.3.6-d9426786c6-c35c6edb7e.zip deleted file mode 100644 index 90681030d34..00000000000 Binary files a/.yarn/cache/eslint-import-resolver-node-npm-0.3.6-d9426786c6-c35c6edb7e.zip and /dev/null differ diff --git a/.yarn/cache/eslint-visitor-keys-npm-3.3.0-d329af7c8c-37a1a5912a.zip b/.yarn/cache/eslint-visitor-keys-npm-3.3.0-d329af7c8c-37a1a5912a.zip deleted file mode 100644 index 2a0d03ccb0a..00000000000 Binary files a/.yarn/cache/eslint-visitor-keys-npm-3.3.0-d329af7c8c-37a1a5912a.zip and /dev/null differ diff --git a/.yarn/cache/espree-npm-9.1.0-fd22538590-8ade225f24.zip b/.yarn/cache/espree-npm-9.1.0-fd22538590-8ade225f24.zip deleted file mode 100644 index cd75e37be85..00000000000 Binary files a/.yarn/cache/espree-npm-9.1.0-fd22538590-8ade225f24.zip and /dev/null differ diff --git a/.yarn/cache/fast-glob-npm-3.2.11-bc01135fef-6b736d92a4.zip b/.yarn/cache/fast-glob-npm-3.2.11-bc01135fef-6b736d92a4.zip deleted file mode 100644 index 105b1dfab13..00000000000 Binary files a/.yarn/cache/fast-glob-npm-3.2.11-bc01135fef-6b736d92a4.zip and /dev/null differ diff --git a/.yarn/cache/follow-redirects-npm-1.15.2-1ec1dd82be-8be0d39919.zip b/.yarn/cache/follow-redirects-npm-1.15.2-1ec1dd82be-8be0d39919.zip deleted file mode 100644 index 9aa62ac845d..00000000000 Binary files a/.yarn/cache/follow-redirects-npm-1.15.2-1ec1dd82be-8be0d39919.zip and /dev/null differ diff --git a/.yarn/cache/follow-redirects-npm-1.15.6-50635fe51d-70c7612c4c.zip b/.yarn/cache/follow-redirects-npm-1.15.6-50635fe51d-70c7612c4c.zip new file mode 100644 index 00000000000..d64f38e50a7 Binary files /dev/null and b/.yarn/cache/follow-redirects-npm-1.15.6-50635fe51d-70c7612c4c.zip differ diff --git a/.yarn/cache/function-bind-npm-1.1.1-b56b322ae9-d83f296803.zip b/.yarn/cache/function-bind-npm-1.1.1-b56b322ae9-d83f296803.zip deleted file mode 100644 index b10b9658cff..00000000000 Binary files a/.yarn/cache/function-bind-npm-1.1.1-b56b322ae9-d83f296803.zip and /dev/null differ diff --git a/.yarn/cache/function.prototype.name-npm-1.1.5-e776a642bb-5d426e5a38.zip b/.yarn/cache/function.prototype.name-npm-1.1.5-e776a642bb-5d426e5a38.zip deleted file mode 100644 index 46ce2d234f8..00000000000 Binary files a/.yarn/cache/function.prototype.name-npm-1.1.5-e776a642bb-5d426e5a38.zip and /dev/null differ diff --git a/.yarn/cache/get-intrinsic-npm-1.2.0-eb08ea9b1d-f57c5fe67a.zip b/.yarn/cache/get-intrinsic-npm-1.2.0-eb08ea9b1d-f57c5fe67a.zip deleted file mode 100644 index f716bea6182..00000000000 Binary files a/.yarn/cache/get-intrinsic-npm-1.2.0-eb08ea9b1d-f57c5fe67a.zip and /dev/null differ diff --git a/.yarn/cache/glob-npm-10.3.10-da1ef8b112-38bdb2c9ce.zip b/.yarn/cache/glob-npm-10.3.10-da1ef8b112-38bdb2c9ce.zip deleted file mode 100644 index 5c0f342c115..00000000000 Binary files a/.yarn/cache/glob-npm-10.3.10-da1ef8b112-38bdb2c9ce.zip and /dev/null differ diff --git a/.yarn/cache/glob-npm-10.3.4-f58cd31f55-6375721bcd.zip b/.yarn/cache/glob-npm-10.3.4-f58cd31f55-6375721bcd.zip deleted file mode 100644 index 26849fc8f32..00000000000 Binary files a/.yarn/cache/glob-npm-10.3.4-f58cd31f55-6375721bcd.zip and /dev/null differ diff --git a/.yarn/cache/glob-npm-10.4.1-a0d030e0a9-d7bb49d2b4.zip b/.yarn/cache/glob-npm-10.4.1-a0d030e0a9-d7bb49d2b4.zip new file mode 100644 index 00000000000..8d44135f2f9 Binary files /dev/null and b/.yarn/cache/glob-npm-10.4.1-a0d030e0a9-d7bb49d2b4.zip differ diff --git a/.yarn/cache/glob-npm-7.2.3-2d866d17a5-59452a9202.zip b/.yarn/cache/glob-npm-7.2.3-2d866d17a5-59452a9202.zip new file mode 100644 index 00000000000..711edd7c1e0 Binary files /dev/null and b/.yarn/cache/glob-npm-7.2.3-2d866d17a5-59452a9202.zip differ diff --git a/.yarn/cache/ip-address-npm-9.0.5-9fa024d42a-1ed81e0672.zip b/.yarn/cache/ip-address-npm-9.0.5-9fa024d42a-1ed81e0672.zip new file mode 100644 index 00000000000..f29f3f6f189 Binary files /dev/null and b/.yarn/cache/ip-address-npm-9.0.5-9fa024d42a-1ed81e0672.zip differ diff --git a/.yarn/cache/ip-npm-1.1.5-af36318aa6-40a00572cf.zip b/.yarn/cache/ip-npm-1.1.5-af36318aa6-40a00572cf.zip deleted file mode 100644 index fa0bbc93c13..00000000000 Binary files a/.yarn/cache/ip-npm-1.1.5-af36318aa6-40a00572cf.zip and /dev/null differ diff --git a/.yarn/cache/ip-npm-2.0.0-204facb3cc-1270b11e53.zip b/.yarn/cache/ip-npm-2.0.0-204facb3cc-1270b11e53.zip deleted file mode 100644 index c751a851ab9..00000000000 Binary files a/.yarn/cache/ip-npm-2.0.0-204facb3cc-1270b11e53.zip and /dev/null differ diff --git a/.yarn/cache/is-core-module-npm-2.8.1-ce21740d1b-80b33fbd45.zip b/.yarn/cache/is-core-module-npm-2.8.1-ce21740d1b-80b33fbd45.zip deleted file mode 100644 index 77d6a993276..00000000000 Binary files a/.yarn/cache/is-core-module-npm-2.8.1-ce21740d1b-80b33fbd45.zip and /dev/null differ diff --git a/.yarn/cache/is-typed-array-npm-1.1.10-fe4ef83cdc-2392b2473b.zip b/.yarn/cache/is-typed-array-npm-1.1.10-fe4ef83cdc-2392b2473b.zip deleted file mode 100644 index 305419609d8..00000000000 Binary files a/.yarn/cache/is-typed-array-npm-1.1.10-fe4ef83cdc-2392b2473b.zip and /dev/null differ diff --git a/.yarn/cache/istanbul-lib-coverage-npm-3.2.0-93f84b2c8c-31621b84ad.zip b/.yarn/cache/istanbul-lib-coverage-npm-3.2.0-93f84b2c8c-31621b84ad.zip deleted file mode 100644 index 1c849581e6a..00000000000 Binary files a/.yarn/cache/istanbul-lib-coverage-npm-3.2.0-93f84b2c8c-31621b84ad.zip and /dev/null differ diff --git a/.yarn/cache/jackspeak-npm-2.3.3-755684cc60-a4c7c1a3ff.zip b/.yarn/cache/jackspeak-npm-2.3.3-755684cc60-a4c7c1a3ff.zip deleted file mode 100644 index eacd30ac5d4..00000000000 Binary files a/.yarn/cache/jackspeak-npm-2.3.3-755684cc60-a4c7c1a3ff.zip and /dev/null differ diff --git a/.yarn/cache/jackspeak-npm-2.3.6-42e1233172-6e6490d676.zip b/.yarn/cache/jackspeak-npm-2.3.6-42e1233172-6e6490d676.zip deleted file mode 100644 index 91909eb58a6..00000000000 Binary files a/.yarn/cache/jackspeak-npm-2.3.6-42e1233172-6e6490d676.zip and /dev/null differ diff --git a/.yarn/cache/jackspeak-npm-3.1.2-dbb3ed8474-7e6b94103e.zip b/.yarn/cache/jackspeak-npm-3.1.2-dbb3ed8474-7e6b94103e.zip new file mode 100644 index 00000000000..8b9ff400e38 Binary files /dev/null and b/.yarn/cache/jackspeak-npm-3.1.2-dbb3ed8474-7e6b94103e.zip differ diff --git a/.yarn/cache/jsbn-npm-1.1.0-1da0181838-bebe7ae829.zip b/.yarn/cache/jsbn-npm-1.1.0-1da0181838-bebe7ae829.zip new file mode 100644 index 00000000000..4e18b228c5f Binary files /dev/null and b/.yarn/cache/jsbn-npm-1.1.0-1da0181838-bebe7ae829.zip differ diff --git a/.yarn/cache/json5-npm-2.2.0-da49dc7cb5-d72ea87423.zip b/.yarn/cache/json5-npm-2.2.0-da49dc7cb5-d72ea87423.zip deleted file mode 100644 index 9642fe2201b..00000000000 Binary files a/.yarn/cache/json5-npm-2.2.0-da49dc7cb5-d72ea87423.zip and /dev/null differ diff --git a/.yarn/cache/lru-cache-npm-10.0.1-0e1abf4c13-5bb91a97a3.zip b/.yarn/cache/lru-cache-npm-10.0.1-0e1abf4c13-5bb91a97a3.zip deleted file mode 100644 index 5759347ee25..00000000000 Binary files a/.yarn/cache/lru-cache-npm-10.0.1-0e1abf4c13-5bb91a97a3.zip and /dev/null differ diff --git a/.yarn/cache/lru-cache-npm-10.2.2-c54b721fc3-ff1a496d30.zip b/.yarn/cache/lru-cache-npm-10.2.2-c54b721fc3-ff1a496d30.zip new file mode 100644 index 00000000000..7e71190c37e Binary files /dev/null and b/.yarn/cache/lru-cache-npm-10.2.2-c54b721fc3-ff1a496d30.zip differ diff --git a/.yarn/cache/lru-cache-npm-7.3.1-b157dca680-83adf549d8.zip b/.yarn/cache/lru-cache-npm-7.3.1-b157dca680-83adf549d8.zip deleted file mode 100644 index cd127a2e1b9..00000000000 Binary files a/.yarn/cache/lru-cache-npm-7.3.1-b157dca680-83adf549d8.zip and /dev/null differ diff --git a/.yarn/cache/mem-fs-editor-npm-9.4.0-97c608fb01-b196c50010.zip b/.yarn/cache/mem-fs-editor-npm-9.4.0-97c608fb01-b196c50010.zip deleted file mode 100644 index da9d0e2dbc6..00000000000 Binary files a/.yarn/cache/mem-fs-editor-npm-9.4.0-97c608fb01-b196c50010.zip and /dev/null differ diff --git a/.yarn/cache/minimatch-npm-5.0.0-969101c1d1-ee05bf8c18.zip b/.yarn/cache/minimatch-npm-5.0.0-969101c1d1-ee05bf8c18.zip deleted file mode 100644 index db3898f3278..00000000000 Binary files a/.yarn/cache/minimatch-npm-5.0.0-969101c1d1-ee05bf8c18.zip and /dev/null differ diff --git a/.yarn/cache/minimatch-npm-9.0.4-7be5a33efc-4cdc18d112.zip b/.yarn/cache/minimatch-npm-9.0.4-7be5a33efc-4cdc18d112.zip new file mode 100644 index 00000000000..61a88c7c69d Binary files /dev/null and b/.yarn/cache/minimatch-npm-9.0.4-7be5a33efc-4cdc18d112.zip differ diff --git a/.yarn/cache/minipass-npm-4.2.8-f05abfe254-e148eb6dcb.zip b/.yarn/cache/minipass-npm-4.2.8-f05abfe254-e148eb6dcb.zip deleted file mode 100644 index 7ce99cd2f47..00000000000 Binary files a/.yarn/cache/minipass-npm-4.2.8-f05abfe254-e148eb6dcb.zip and /dev/null differ diff --git a/.yarn/cache/minipass-npm-7.0.3-3b57909ee9-04d72c8a43.zip b/.yarn/cache/minipass-npm-7.0.3-3b57909ee9-04d72c8a43.zip deleted file mode 100644 index 3a742326aa5..00000000000 Binary files a/.yarn/cache/minipass-npm-7.0.3-3b57909ee9-04d72c8a43.zip and /dev/null differ diff --git a/.yarn/cache/minipass-npm-7.1.2-3a5327d36d-c25f0ee819.zip b/.yarn/cache/minipass-npm-7.1.2-3a5327d36d-c25f0ee819.zip new file mode 100644 index 00000000000..4c88fb60ce3 Binary files /dev/null and b/.yarn/cache/minipass-npm-7.1.2-3a5327d36d-c25f0ee819.zip differ diff --git a/.yarn/cache/node-releases-npm-2.0.1-77b8e327f7-b20dd8d4bc.zip b/.yarn/cache/node-releases-npm-2.0.1-77b8e327f7-b20dd8d4bc.zip deleted file mode 100644 index f80933576c9..00000000000 Binary files a/.yarn/cache/node-releases-npm-2.0.1-77b8e327f7-b20dd8d4bc.zip and /dev/null differ diff --git a/.yarn/cache/object-inspect-npm-1.12.3-1e7d20f5ff-532b0036f0.zip b/.yarn/cache/object-inspect-npm-1.12.3-1e7d20f5ff-532b0036f0.zip deleted file mode 100644 index fae851e6bd2..00000000000 Binary files a/.yarn/cache/object-inspect-npm-1.12.3-1e7d20f5ff-532b0036f0.zip and /dev/null differ diff --git a/.yarn/cache/password-prompt-npm-1.1.3-0190666768-1cf7001e66.zip b/.yarn/cache/password-prompt-npm-1.1.3-0190666768-1cf7001e66.zip new file mode 100644 index 00000000000..11d8442b2b5 Binary files /dev/null and b/.yarn/cache/password-prompt-npm-1.1.3-0190666768-1cf7001e66.zip differ diff --git a/.yarn/cache/path-scurry-npm-1.10.1-52bd946f2e-eebfb8304f.zip b/.yarn/cache/path-scurry-npm-1.10.1-52bd946f2e-eebfb8304f.zip deleted file mode 100644 index 10a74fec69a..00000000000 Binary files a/.yarn/cache/path-scurry-npm-1.10.1-52bd946f2e-eebfb8304f.zip and /dev/null differ diff --git a/.yarn/cache/path-scurry-npm-1.11.1-aaf8c339af-5e8845c159.zip b/.yarn/cache/path-scurry-npm-1.11.1-aaf8c339af-5e8845c159.zip new file mode 100644 index 00000000000..40cc3d66f37 Binary files /dev/null and b/.yarn/cache/path-scurry-npm-1.11.1-aaf8c339af-5e8845c159.zip differ diff --git a/.yarn/cache/readable-stream-npm-3.6.0-23a4a5eb56-b80b3e6a7f.zip b/.yarn/cache/readable-stream-npm-3.6.0-23a4a5eb56-b80b3e6a7f.zip deleted file mode 100644 index 57b8b2b964e..00000000000 Binary files a/.yarn/cache/readable-stream-npm-3.6.0-23a4a5eb56-b80b3e6a7f.zip and /dev/null differ diff --git a/.yarn/cache/regexp.prototype.flags-npm-1.4.3-df1c08b65d-3cde7cd22f.zip b/.yarn/cache/regexp.prototype.flags-npm-1.4.3-df1c08b65d-3cde7cd22f.zip deleted file mode 100644 index f841d7b38ca..00000000000 Binary files a/.yarn/cache/regexp.prototype.flags-npm-1.4.3-df1c08b65d-3cde7cd22f.zip and /dev/null differ diff --git a/.yarn/cache/resolve-npm-1.22.0-f641ddcc95-b2f7405d30.zip b/.yarn/cache/resolve-npm-1.22.0-f641ddcc95-b2f7405d30.zip deleted file mode 100644 index 0e9cb9ba4b9..00000000000 Binary files a/.yarn/cache/resolve-npm-1.22.0-f641ddcc95-b2f7405d30.zip and /dev/null differ diff --git a/.yarn/cache/resolve-patch-2781af2c06-cb53ccafb0.zip b/.yarn/cache/resolve-patch-2781af2c06-cb53ccafb0.zip deleted file mode 100644 index 3883e5aa27d..00000000000 Binary files a/.yarn/cache/resolve-patch-2781af2c06-cb53ccafb0.zip and /dev/null differ diff --git a/.yarn/cache/rxjs-npm-7.8.0-722f1c7172-ff9359cc78.zip b/.yarn/cache/rxjs-npm-7.8.0-722f1c7172-ff9359cc78.zip deleted file mode 100644 index e62f91d938a..00000000000 Binary files a/.yarn/cache/rxjs-npm-7.8.0-722f1c7172-ff9359cc78.zip and /dev/null differ diff --git a/.yarn/cache/socks-npm-2.6.1-09133d0d22-6ae166bd1a.zip b/.yarn/cache/socks-npm-2.6.1-09133d0d22-6ae166bd1a.zip deleted file mode 100644 index 8327fc3d21a..00000000000 Binary files a/.yarn/cache/socks-npm-2.6.1-09133d0d22-6ae166bd1a.zip and /dev/null differ diff --git a/.yarn/cache/socks-npm-2.7.1-17f2b53052-5074f7d6a1.zip b/.yarn/cache/socks-npm-2.7.1-17f2b53052-5074f7d6a1.zip deleted file mode 100644 index 51cba2db5b1..00000000000 Binary files a/.yarn/cache/socks-npm-2.7.1-17f2b53052-5074f7d6a1.zip and /dev/null differ diff --git a/.yarn/cache/socks-npm-2.8.3-3532b59899-ffcb622c22.zip b/.yarn/cache/socks-npm-2.8.3-3532b59899-ffcb622c22.zip new file mode 100644 index 00000000000..95c8964f1f7 Binary files /dev/null and b/.yarn/cache/socks-npm-2.8.3-3532b59899-ffcb622c22.zip differ diff --git a/.yarn/cache/source-map-npm-0.5.7-7c3f035429-9b4ac749ec.zip b/.yarn/cache/source-map-npm-0.5.7-7c3f035429-9b4ac749ec.zip deleted file mode 100644 index e3bc38bd01e..00000000000 Binary files a/.yarn/cache/source-map-npm-0.5.7-7c3f035429-9b4ac749ec.zip and /dev/null differ diff --git a/.yarn/cache/sprintf-js-npm-1.1.3-b99efd75b2-e7587128c4.zip b/.yarn/cache/sprintf-js-npm-1.1.3-b99efd75b2-e7587128c4.zip new file mode 100644 index 00000000000..3e6b96b97df Binary files /dev/null and b/.yarn/cache/sprintf-js-npm-1.1.3-b99efd75b2-e7587128c4.zip differ diff --git a/.yarn/cache/string.prototype.trim-npm-1.2.7-3fbaf3b9d2-a1b795bdb4.zip b/.yarn/cache/string.prototype.trim-npm-1.2.7-3fbaf3b9d2-a1b795bdb4.zip deleted file mode 100644 index 843c03ebe9d..00000000000 Binary files a/.yarn/cache/string.prototype.trim-npm-1.2.7-3fbaf3b9d2-a1b795bdb4.zip and /dev/null differ diff --git a/.yarn/cache/string.prototype.trimend-npm-1.0.6-304246ecc1-3893db9267.zip b/.yarn/cache/string.prototype.trimend-npm-1.0.6-304246ecc1-3893db9267.zip deleted file mode 100644 index c8b07fbc771..00000000000 Binary files a/.yarn/cache/string.prototype.trimend-npm-1.0.6-304246ecc1-3893db9267.zip and /dev/null differ diff --git a/.yarn/cache/string.prototype.trimstart-npm-1.0.6-0926caea6c-05e2cd06fa.zip b/.yarn/cache/string.prototype.trimstart-npm-1.0.6-0926caea6c-05e2cd06fa.zip deleted file mode 100644 index 0fb7c079b82..00000000000 Binary files a/.yarn/cache/string.prototype.trimstart-npm-1.0.6-0926caea6c-05e2cd06fa.zip and /dev/null differ diff --git a/.yarn/cache/supports-hyperlinks-npm-2.2.0-9b22a6271b-a63f2acba5.zip b/.yarn/cache/supports-hyperlinks-npm-2.2.0-9b22a6271b-a63f2acba5.zip deleted file mode 100644 index ae491693d14..00000000000 Binary files a/.yarn/cache/supports-hyperlinks-npm-2.2.0-9b22a6271b-a63f2acba5.zip and /dev/null differ diff --git a/.yarn/cache/tar-npm-6.1.11-e6ac3cba9c-0e6789e664.zip b/.yarn/cache/tar-npm-6.1.11-e6ac3cba9c-0e6789e664.zip deleted file mode 100644 index d7f57a7b2f8..00000000000 Binary files a/.yarn/cache/tar-npm-6.1.11-e6ac3cba9c-0e6789e664.zip and /dev/null differ diff --git a/.yarn/cache/tar-npm-6.1.13-3234e72781-add2c3c6d0.zip b/.yarn/cache/tar-npm-6.1.13-3234e72781-add2c3c6d0.zip deleted file mode 100644 index 2ff4ab17413..00000000000 Binary files a/.yarn/cache/tar-npm-6.1.13-3234e72781-add2c3c6d0.zip and /dev/null differ diff --git a/.yarn/cache/tar-npm-6.2.1-237800bb20-bfbfbb2861.zip b/.yarn/cache/tar-npm-6.2.1-237800bb20-bfbfbb2861.zip new file mode 100644 index 00000000000..066f404767f Binary files /dev/null and b/.yarn/cache/tar-npm-6.2.1-237800bb20-bfbfbb2861.zip differ diff --git a/.yarn/cache/ts-node-npm-10.4.0-04cb6e2279-5874ac27f6.zip b/.yarn/cache/ts-node-npm-10.4.0-04cb6e2279-5874ac27f6.zip deleted file mode 100644 index 097601aaa45..00000000000 Binary files a/.yarn/cache/ts-node-npm-10.4.0-04cb6e2279-5874ac27f6.zip and /dev/null differ diff --git a/.yarn/cache/tslib-npm-2.4.1-36f0ed04db-e14311d539.zip b/.yarn/cache/tslib-npm-2.4.1-36f0ed04db-e14311d539.zip deleted file mode 100644 index d6f40b2d786..00000000000 Binary files a/.yarn/cache/tslib-npm-2.4.1-36f0ed04db-e14311d539.zip and /dev/null differ diff --git a/.yarn/cache/tslib-npm-2.5.0-bb364efebd-ea556fbdf3.zip b/.yarn/cache/tslib-npm-2.5.0-bb364efebd-ea556fbdf3.zip deleted file mode 100644 index 11112dd8937..00000000000 Binary files a/.yarn/cache/tslib-npm-2.5.0-bb364efebd-ea556fbdf3.zip and /dev/null differ diff --git a/.yarn/cache/which-typed-array-npm-1.1.9-9559c95dfc-90ef760a09.zip b/.yarn/cache/which-typed-array-npm-1.1.9-9559c95dfc-90ef760a09.zip deleted file mode 100644 index ef1370d4989..00000000000 Binary files a/.yarn/cache/which-typed-array-npm-1.1.9-9559c95dfc-90ef760a09.zip and /dev/null differ diff --git a/.yarn/cache/ws-npm-7.5.5-8f4a2a84a8-2e91fd634b.zip b/.yarn/cache/ws-npm-7.5.5-8f4a2a84a8-2e91fd634b.zip deleted file mode 100644 index ce54109cc3a..00000000000 Binary files a/.yarn/cache/ws-npm-7.5.5-8f4a2a84a8-2e91fd634b.zip and /dev/null differ diff --git a/.yarn/cache/ws-npm-8.11.0-ab72116a01-f759ea19e4.zip b/.yarn/cache/ws-npm-8.11.0-ab72116a01-f759ea19e4.zip deleted file mode 100644 index 337545a406a..00000000000 Binary files a/.yarn/cache/ws-npm-8.11.0-ab72116a01-f759ea19e4.zip and /dev/null differ diff --git a/.yarn/cache/ws-npm-8.17.1-f57fb24a2c-4264ae92c0.zip b/.yarn/cache/ws-npm-8.17.1-f57fb24a2c-4264ae92c0.zip new file mode 100644 index 00000000000..cd6b6f229ef Binary files /dev/null and b/.yarn/cache/ws-npm-8.17.1-f57fb24a2c-4264ae92c0.zip differ diff --git a/.yarnrc.yml b/.yarnrc.yml index 4f2712be643..a900111793f 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -6,6 +6,15 @@ enableGlobalCache: false npmPublishRegistry: "https://registry.npmjs.org" +npmAuditExcludePackages: + - rimraf # TODO: Update karma + - glob # TODO: Update karma + - inflight # TODO: Update karma + - braces # TODO: Update karma + - "@grpc/grpc-js" # TODO: Remove when gRPC stack is updated + - "@humanwhocodes/config-array" # TODO: Update eslint + - "@humanwhocodes/object-schema" # TODO: Update eslint + packageExtensions: "@dashevo/protobufjs@*": dependencies: diff --git a/CHANGELOG.md b/CHANGELOG.md index 70524e911c0..38e353a70ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,429 @@ +## [1.0.0-dev.15](https://github.com/dashpay/platform/compare/v1.0.0-dev.14...v1.0.0-dev.15) (2024-05-22) + + +### Miscellaneous Chores + +* **drive:** state transition observability ([#1846](https://github.com/dashpay/platform/issues/1846)) + +## [1.0.0-dev.14](https://github.com/dashpay/platform/compare/v1.0.0-dev.13...v1.0.0-dev.14) (2024-05-17) + + +### ⚠ BREAKING CHANGES + +* Data Contract Create and Update transitions validation logic is changed so previously created block chain data might not be valid anymore (#1835) + +### Features + +* **dashmate:** check for DKG before stopping node ([#1683](https://github.com/dashpay/platform/issues/1683)) + + +### Bug Fixes + +* data contract transition validation issues ([#1835](https://github.com/dashpay/platform/issues/1835)) + + +### Code Refactoring + +* rename `DataContractConfig.validate_config_update` ([#1843](https://github.com/dashpay/platform/issues/1843)) +* rename `validate` to `full_validation` ([#1845](https://github.com/dashpay/platform/issues/1845)) + +## [1.0.0-dev.13](https://github.com/dashpay/platform/compare/v1.0.0-dev.12...v1.0.0-dev.13) (2024-05-09) + + +### ⚠ BREAKING CHANGES + +* **sdk:** don't return Arc in SdkBuilder (#1838) +* **platform:** document creation/update/deletion does not refetch contract (#1840) + +### Features + +* **dashmate:** handle docker pull error on images update ([#1685](https://github.com/dashpay/platform/issues/1685)) +* make document tranfers public +* make start identities number u16 +* make purchase document public +* make sdk document purchases public ([#1832](https://github.com/dashpay/platform/issues/1832)) +* make sdk files public +* put index serialization behind feature +* serialize for indexes and change error messages to strings +* use all current identities for strategy test state transitions ([#1820](https://github.com/dashpay/platform/issues/1820)) + + +### Bug Fixes + +* **platform:** npm audit security fix ([#1836](https://github.com/dashpay/platform/issues/1836)) + + +### Code Refactoring + +* **platform:** document creation/update/deletion does not refetch contract ([#1840](https://github.com/dashpay/platform/issues/1840)) +* **sdk:** don't return Arc in SdkBuilder ([#1838](https://github.com/dashpay/platform/issues/1838)) + + +### Miscellaneous Chores + +* observability and security for HTTP gateway ([#1825](https://github.com/dashpay/platform/issues/1825)) + +## [1.0.0-dev.12](https://github.com/dashpay/platform/compare/v1.0.0-dev.11...v1.0.0-dev.12) (2024-04-29) + + +### ⚠ BREAKING CHANGES + +* Removed `getIdentities` and `getIdentitiesByPublicKeyHashes` endpoints in favor of `getIdentitiesContractKeys` (#1766) +* **platform:** basic nft support (#1829) +* **dapi:** `getStatus` is removed in favor of `getMasternodeStatus` and `getBlockchainStatus` (#1812) +* **platform:** documents serialization format is changed that makes previously created block chain data invalid (#1826) + +### Features + +* **dapi:** split getStatus into two endpoints ([#1812](https://github.com/dashpay/platform/issues/1812)) +* **drive-abci:** configure dir to store rejected txs ([#1823](https://github.com/dashpay/platform/issues/1823)) +* getIdentitiesContractKeys endpoint ([#1766](https://github.com/dashpay/platform/issues/1766)) +* **platform:** ability to transfer documents ([#1826](https://github.com/dashpay/platform/issues/1826)) +* **platform:** basic nft support ([#1829](https://github.com/dashpay/platform/issues/1829)) +* **sdk:** add query for data contract history ([#1787](https://github.com/dashpay/platform/issues/1787)) +* **wallet-lib:** optional sync of the account ([#1830](https://github.com/dashpay/platform/issues/1830)) + + +### Bug Fixes + +* add tls-webpki-roots to support tls on mobile (Android, iOS) ([#1828](https://github.com/dashpay/platform/issues/1828)) + + +### Miscellaneous Chores + +* **dapi:** update autogenerated clients ([#1827](https://github.com/dashpay/platform/issues/1827)) +* **dashmate:** limit concurrent state transition checks ([#1824](https://github.com/dashpay/platform/issues/1824)) + +## [1.0.0-dev.10](https://github.com/dashpay/platform/compare/v1.0.0-dev.9...v1.0.0-dev.10) (2024-04-04) + + +### ⚠ BREAKING CHANGES + +There are multiple breaking changes that make previously created state invalid: +* **drive:** addition key-value in epoch trees (#1778) +* **platform:** processing costs were updated for some state transitions (#1805, #1800) +* **drive:** now we count and persist a version proposal vote on the epoch change (#1769) +* **drive:** protocol version for the first block of an epoch might be different (#1769) +* **platform:** ST validation was changed, as well as some constants (#1796, #1795) +* **dpp:** document type name must be 1 to 64 alphanumeric chars and "_", or "-" (#1798) +* **platform:** max state transition is 20 kB (#1792) + +### Features + +* **dpp:** validate document type name ([#1798](https://github.com/dashpay/platform/issues/1798)) +* **drive-abci:** better processing costs of state transitions (no schema processing improvements) ([#1800](https://github.com/dashpay/platform/issues/1800)) +* **drive:** provide protocol version in epoch info query ([#1778](https://github.com/dashpay/platform/issues/1778)) +* pass asset lock vector rather than callback in strategies +* **platform:** improved state processing fees ([#1805](https://github.com/dashpay/platform/issues/1805)) +* **platform:** mitigate issues of asset lock based transitions ([#1796](https://github.com/dashpay/platform/issues/1796)) +* **platform:** various document validation improvements ([#1795](https://github.com/dashpay/platform/issues/1795)) +* **strategy-tests:** add extra_keys field for StartIdentities and use random identities for transfers ([#1794](https://github.com/dashpay/platform/issues/1794)) + + +### Bug Fixes + +* **drive:** no longer build full grovedb when using verify feature ([#1804](https://github.com/dashpay/platform/issues/1804)) +* **drive:** versioning issues on epoch change ([#1769](https://github.com/dashpay/platform/issues/1769)) +* **platform:** max state transition size ([#1792](https://github.com/dashpay/platform/issues/1792)) +* **sdk:** not bumping nonce on contract creation ([#1801](https://github.com/dashpay/platform/issues/1801)) +* state transition already in chain error on low credit transfer amount ([#1797](https://github.com/dashpay/platform/issues/1797)) +* **strategy-tests:** default identity nonce and document op contract id ([#1777](https://github.com/dashpay/platform/issues/1777)) + + +### Performance Improvements + +* **platform:** use inline on versioned functions ([#1793](https://github.com/dashpay/platform/issues/1793)) + + +### Tests + +* added a test registering many random contracts in strategy tests ([#1791](https://github.com/dashpay/platform/issues/1791)) + + +### Miscellaneous Chores + +* **sdk:** export various libraries in rs-sdk ([#1802](https://github.com/dashpay/platform/issues/1802)) + +## [1.0.0-dev.9](https://github.com/dashpay/platform/compare/v1.0.0-dev.8...v1.0.0-dev.9) (2024-03-19) + + +### ⚠ BREAKING CHANGES + +* **sdk:** don't allow duplicate mock expectations (#1788) +* created_at and updated_at from block time (#1780) +* created_at_block_height and variants (#1784) + + +### Features + +* created_at and updated_at from block time ([#1780](https://github.com/dashpay/platform/issues/1780)) +* created_at_block_height and variants ([#1784](https://github.com/dashpay/platform/issues/1784)) + + +### Bug Fixes + +* **drive:** internal error on querying proofs ([#1747](https://github.com/dashpay/platform/issues/1747)) +* identity add keys in strategy tests ([#1727](https://github.com/dashpay/platform/issues/1727)) +* **sdk:** don't allow duplicate mock expectations ([#1788](https://github.com/dashpay/platform/issues/1788)) +* query retry on race condition ([#1776](https://github.com/dashpay/platform/issues/1776)) +* identity state transition validation fixes ([#1786](https://github.com/dashpay/platform/issues/1786)) + + +### Code Refactoring + +* make strategy start identities a new struct ([#1764](https://github.com/dashpay/platform/issues/1764)) +* updated descriptions and function names in strategy tests plus readme file ([#1785](https://github.com/dashpay/platform/issues/1785)) + + +### Miscellaneous Chores + +* **dashmate:** readme fixes ([#1624](https://github.com/dashpay/platform/issues/1624)) +* fix npm audit for follow-redirects package ([#1781](https://github.com/dashpay/platform/issues/1781)) +* **dapi:** use broadcast_tx instead of deprecated broadcast_tx_sync ([#1775](https://github.com/dashpay/platform/issues/1775)) + + +### Build System + +* rs-tenderdash-abci 0.14.0-dev.9 ([#1782](https://github.com/dashpay/platform/issues/1782)) + + +### Continuous Integration + +* enforce warnings as errors ([#1783](https://github.com/dashpay/platform/issues/1783)) +* update doc build branch in action config ([#1748](https://github.com/dashpay/platform/issues/1748)) + +## [1.0.0-dev.8](https://github.com/dashpay/platform/compare/v1.0.0-dev.7...v1.0.0-dev.8) (2024-03-14) + + +### ⚠ BREAKING CHANGES + +* **platform:** identity update can not disable a key it is also adding (#1772) +* **platform:** key disabled at based on state transition block time (#1771) +* **platform:** data contract validation improvements (#1768) +* update tenderdash to 0.14-dev.4 (#1770) +* **platform:** advanced data contract structure validation position (#1763) + +### Features + +* **platform:** identity update can not disable a key it is also adding ([#1772](https://github.com/dashpay/platform/issues/1772)) +* **platform:** key disabled at based on state transition block time ([#1771](https://github.com/dashpay/platform/issues/1771)) + + +### Bug Fixes + +* **platform:** advanced data contract structure validation position ([#1763](https://github.com/dashpay/platform/issues/1763)) +* **platform:** data contract validation improvements ([#1768](https://github.com/dashpay/platform/issues/1768)) +* **platform:** wrong state used to get current validator set ([#1773](https://github.com/dashpay/platform/issues/1773)) +* remove unnecessary clone +* update strategy test document transitions with initial contract ids + + +### Code Refactoring + +* **drive:** relax versioning of calls with fees ([#1762](https://github.com/dashpay/platform/issues/1762)) +* drop unused includes; use calculate_sign_hash ([#1767](https://github.com/dashpay/platform/issues/1767)) +* resolve various warnings during build or by clippy ([#1761](https://github.com/dashpay/platform/issues/1761)) +* strategy test start identities ([#1749](https://github.com/dashpay/platform/issues/1749)) + + +### Miscellaneous Chores + +* **dashmate:** upgrade to Core 20.1 ([#1760](https://github.com/dashpay/platform/issues/1760)) +* update tenderdash to 0.14-dev.4 ([#1770](https://github.com/dashpay/platform/issues/1770)) + +## [1.0.0-dev.7](https://github.com/dashpay/platform/compare/v1.0.0-dev.6...v1.0.0-dev.7) (2024-03-08) + + +### ⚠ BREAKING CHANGES + +* **platform:** addded fee increase field to state transitions (#1750) + +### Features + +* enable random contract creation in strategies ([#1729](https://github.com/dashpay/platform/issues/1729)) +* **platform:** state transition fee increase and priorities ([#1750](https://github.com/dashpay/platform/issues/1750)) + + +### Bug Fixes + +* **drive:** inconsistent platform state and version during ABCI calls ([#1733](https://github.com/dashpay/platform/issues/1733)) +* **drive:** internal error on querying specific identity keys ([#1728](https://github.com/dashpay/platform/issues/1728)) +* resolve strategy-tests test failures ([#1743](https://github.com/dashpay/platform/issues/1743)) + + +### Documentation + +* update and expand mkdocs redirects ([#1740](https://github.com/dashpay/platform/issues/1740)) + + +### Code Refactoring + +* **drive:** expose more groveDB internals ([#1739](https://github.com/dashpay/platform/issues/1739)) +* reduce cargo clippy warnings ([#1738](https://github.com/dashpay/platform/issues/1738)) +* reduce cargo clippy warnings ([#1741](https://github.com/dashpay/platform/issues/1741)) +* reduce cargo clippy warnings in rs-dpp ([#1742](https://github.com/dashpay/platform/issues/1742)) +* resolve a few clippy warnings in dapi-grpc, rs-drive-proof-verifier, rs-platform-serialization, rs-platform-serialization-derive, rs-platform-value, rs-sdk, strategy-tests ([#1756](https://github.com/dashpay/platform/issues/1756)) +* resolve a few clippy warnings in rs-platform-serializaation and rs-platform-value ([#1744](https://github.com/dashpay/platform/issues/1744)) +* resolve clippy warnings in rs-dpp ([#1754](https://github.com/dashpay/platform/issues/1754)) +* resolve clippy warnings in rs-drive ([#1752](https://github.com/dashpay/platform/issues/1752)) +* resolve clippy warnings in rs-drive-abci ([#1755](https://github.com/dashpay/platform/issues/1755)) +* resolve clippy warnings in wasm-dpp ([#1753](https://github.com/dashpay/platform/issues/1753)) + + +### Miscellaneous Chores + +* fmt ([#1751](https://github.com/dashpay/platform/issues/1751)) +* update testnet genesis and core nightly ([#1758](https://github.com/dashpay/platform/issues/1758)) + +## [1.0.0-dev.6](https://github.com/dashpay/platform/compare/v1.0.0-dev.5...v1.0.0-dev.6) (2024-03-05) + + +### ⚠ BREAKING CHANGES + +* **platform:** identity nonce for Data Contract Create (#1724) + +### Features + +* add ContractUpdate to used_contract_ids function +* **platform:** identity nonce for Data Contract Create ([#1724](https://github.com/dashpay/platform/issues/1724)) +* **sdk:** add fetch_current_with_metadata to ExtendedEpochInfo ([#1708](https://github.com/dashpay/platform/issues/1708)) +* **sdk:** fetch with metadata ([#1707](https://github.com/dashpay/platform/issues/1707)) +* **sdk:** re-fetch nonce on interval ([#1706](https://github.com/dashpay/platform/issues/1706)) + + +### Bug Fixes + +* **drive-abci:** reject reward shares operations ([#1722](https://github.com/dashpay/platform/issues/1722)) +* make strategy tests compatible with all networks and platform tui ([#1705](https://github.com/dashpay/platform/issues/1705)) +* **sdk:** nonce manager caching bug ([#1711](https://github.com/dashpay/platform/issues/1711)) +* **test-suite:** masternode identities ([#1709](https://github.com/dashpay/platform/issues/1709)) + + +### Performance Improvements + +* query and check tx parallel processing ([#1694](https://github.com/dashpay/platform/issues/1694)) + + +### Miscellaneous Chores + +* fix npm audit warning ([#1723](https://github.com/dashpay/platform/issues/1723)) + + +### Tests + +* **test-suite:** restore dpns tests ([#1725](https://github.com/dashpay/platform/issues/1725)) +* **test-suite:** withdrawals identityRecent index ([#1716](https://github.com/dashpay/platform/issues/1716)) + +## [1.0.0-dev.5](https://github.com/dashpay/platform/compare/v1.0.0-dev.4...v1.0.0-dev.5) (2024-02-20) + +### ⚠ BREAKING CHANGES + +* Identity nonce and identity contract nonces to prevent replay attacks (#1681) +* Improved check tx verification (#1681) +* Do not allow creating data contracts without documents (#1675) + +### Features + +* State transitions support in rust sdk (#1596) +* Mempool uniqueness by state transition identifiers (#1681) +* Remove ability to verify proofs from drive-abci in order to have a smaller package size and to reduce potential issues (#1699) +* Tenderdash mempool cache size config option (#1702) + +### Bug Fixes + +* Remove min core fee per byte check (#1690) +* Fix proof balance and revision proofs for IdentityTopUp (#1678) +* NPM IP package vulnerable to SSRF attacks (#1703) +* Fix for contract proofs (#1699) + +### Miscellaneous Chores +* Autogenerated clippy refactoring and fixes for rust version 1.76 (#1691) +* Bump protoc to 25.2 (#1692) + +## [1.0.0-dev.4](https://github.com/dashpay/platform/compare/v1.0.0-dev.3...v1.0.0-dev.4) (2024-02-07) + + +### ⚠ BREAKING CHANGES + +* The state now contains information about chain lock quorums (#1621) +* Minimal asset lock amount is introduced that makes previous data invalid (#1667) +* The initial state is changed (#1601) + + +### Features + +* chainlock optimized verification ([#1621](https://github.com/dashpay/platform/issues/1621)) +* **drive:** validate asset lock proof minimal value ([#1667](https://github.com/dashpay/platform/issues/1667)) +* **drive:** withdrawals finalization ([#1601](https://github.com/dashpay/platform/issues/1601)) + + +### Bug Fixes + +* **dashmate:** service status when tenderdash is syncing ([#1682](https://github.com/dashpay/platform/issues/1682)) +* **drive:** invalid protocol version is using to deserialize state ([#1679](https://github.com/dashpay/platform/issues/1679)) + + +### Miscellaneous Chores + +* **dashmate:** update to core v20.1.0-devpr5806.a1814ce2 ([#1665](https://github.com/dashpay/platform/issues/1665)) +* system data contracts versioning ([#1676](https://github.com/dashpay/platform/issues/1676)) +* update rs-tenderdash-abci to v0.14.0-dev.6 and tenderdash to v0.14.0-dev.2 ([#1686](https://github.com/dashpay/platform/issues/1686)) + +## [1.0.0-dev.3](https://github.com/dashpay/platform/compare/v1.0.0-dev.2...v1.0.0-dev.3) (2024-01-16) + + +### Bug Fixes + +* **dapi:** internal errors if broadcasting failed ([#1673](https://github.com/dashpay/platform/issues/1673)) + +## [1.0.0-dev.2](https://github.com/dashpay/platform/compare/v1.0.0-dev.1...v1.0.0-dev.2) (2024-01-12) + + +### ⚠ BREAKING CHANGES + +* **dashmate:** adjust consensus params and enable re-check (#1669) +* **drive-abci:** internal error if vote extension block is already committed (#1663) + +### Bug Fixes + +* broadcasting already invalidated transitions ([#1668](https://github.com/dashpay/platform/issues/1668)) +* **dashmate:** dapi kills host machine on container stop ([#1670](https://github.com/dashpay/platform/issues/1670)) +* **drive-abci:** internal error if vote extension block is already committed ([#1663](https://github.com/dashpay/platform/issues/1663)) + + +### Miscellaneous Chores + +* **dashmate:** adjust consensus params and enable re-check ([#1669](https://github.com/dashpay/platform/issues/1669)) +* **drive-abci:** fix state transition logging ([#1664](https://github.com/dashpay/platform/issues/1664)) +* various logging improvements ([#1666](https://github.com/dashpay/platform/issues/1666)) + +## [1.0.0-dev.1](https://github.com/dashpay/platform/compare/v0.25.21...v1.0.0-dev.1) (2024-01-11) + + +### ⚠ BREAKING CHANGES + +* invalid state transitions now included into blocks that makes previous chain data invalid. (#1657) +* credit transfer state transition requires revision. (#1634) +* calculated fee amounts are changed (#1656) + +### Features + +* **drive-abci:** include invalid state transitions into block ([#1657](https://github.com/dashpay/platform/issues/1657)) +* **drive-abci:** processing fees for signature verification ([#1656](https://github.com/dashpay/platform/issues/1656)) +* **drive-abci:** remove unnecessary validation from check tx and re-check ([#1647](https://github.com/dashpay/platform/issues/1647)) +* **sdk:** rs-sdk fetch current epoch ([#1604](https://github.com/dashpay/platform/issues/1604)) + + +### Bug Fixes + +* **platform:** credit transfer replay attack ([#1634](https://github.com/dashpay/platform/issues/1634)) +* **dapi**: internal error when mempool is full ([#1661](https://github.com/dashpay/platform/issues/1661)) + + +### Miscellaneous Chores + +* automatic clippy fixes ([#1528](https://github.com/dashpay/platform/issues/1528), [#1602](https://github.com/dashpay/platform/issues/1602)) + ### [0.25.21](https://github.com/dashpay/platform/compare/v0.25.20...v0.25.21) (2023-12-28) diff --git a/CODEOWNERS b/CODEOWNERS index 6bf6cba8c96..0af1265884e 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1 +1 @@ -* @shumkov @antouhou @QuantumExplorer \ No newline at end of file +* @shumkov @QuantumExplorer \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index f142933a6f7..19c63f23809 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,37 +19,50 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ "getrandom", "once_cell", - "serde", "version_check", ] [[package]] name = "ahash" -version = "0.8.6" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", + "getrandom", "once_cell", + "serde", "version_check", "zerocopy", ] [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + +[[package]] +name = "ambient-authority" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9d4ee0d472d1cd2e28c97dfa124b3d8d992e10eb0a035f33f5d12e3a177ba3b" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -67,9 +80,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.5" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" dependencies = [ "anstyle", "anstyle-parse", @@ -81,9 +94,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" @@ -115,9 +128,21 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" + +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" + +[[package]] +name = "arc-swap" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" [[package]] name = "arrayref" @@ -131,6 +156,12 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "assert_matches" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" + [[package]] name = "async-io" version = "1.13.0" @@ -179,18 +210,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] @@ -206,9 +237,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "axum" @@ -221,9 +252,9 @@ dependencies = [ "bitflags 1.3.2", "bytes", "futures-util", - "http", - "http-body", - "hyper", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", "itoa", "matchit", "memchr", @@ -247,8 +278,8 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.6", "mime", "rustversion", "tower-layer", @@ -257,11 +288,11 @@ dependencies = [ [[package]] name = "backon" -version = "0.4.1" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c1a6197b2120bb2185a267f6515038558b019e92b832bb0320e96d66268dcf9" +checksum = "d67782c3f868daa71d3533538e98a8e13713231969def7536e8039606fc46bf0" dependencies = [ - "fastrand 1.9.0", + "fastrand 2.0.2", "futures-core", "pin-project", "tokio", @@ -269,9 +300,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -296,9 +327,15 @@ checksum = "0ea22880d78093b0cbe17c89f64a7d457941e65759157ec6cb31a31d652b05e5" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" [[package]] name = "base64ct" @@ -353,16 +390,46 @@ dependencies = [ "lazycell", "log", "peeking_take_while", - "prettyplease 0.2.15", + "prettyplease 0.2.19", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", - "syn 2.0.41", + "syn 2.0.60", "which", ] +[[package]] +name = "bindgen" +version = "0.69.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +dependencies = [ + "bitflags 2.5.0", + "cexpr", + "clang-sys", + "itertools 0.12.1", + "lazy_static", + "lazycell", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.60", +] + +[[package]] +name = "bip37-bloom-filter" +version = "0.1.0" +source = "git+https://github.com/dashpay/rs-bip37-bloom-filter?branch=develop#352fa2312fd6e0f47bf4cba3a67bfd78c3ba763b" +dependencies = [ + "bitvec", + "murmur3", + "thiserror", +] + [[package]] name = "bit-set" version = "0.5.3" @@ -401,9 +468,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "bitvec" @@ -419,9 +486,9 @@ dependencies = [ [[package]] name = "blake3" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87" +checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" dependencies = [ "arrayref", "arrayvec", @@ -442,9 +509,9 @@ dependencies = [ [[package]] name = "bls-dash-sys" version = "1.2.5" -source = "git+https://github.com/dashpay/bls-signatures?branch=develop#3540b8bbed47e04ed6f02eea2141bd62dae0c411" +source = "git+https://github.com/dashpay/bls-signatures?tag=v1.3.1#1c2fc79c19dc8041610c005e68d58bfb4bc32721" dependencies = [ - "bindgen", + "bindgen 0.65.1", "cc", "glob", ] @@ -452,7 +519,7 @@ dependencies = [ [[package]] name = "bls-signatures" version = "1.2.5" -source = "git+https://github.com/dashpay/bls-signatures?branch=develop#3540b8bbed47e04ed6f02eea2141bd62dae0c411" +source = "git+https://github.com/dashpay/bls-signatures?tag=v1.3.1#1c2fc79c19dc8041610c005e68d58bfb4bc32721" dependencies = [ "bls-dash-sys", "hex", @@ -462,9 +529,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.2.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9897ef0f1bd2362169de6d7e436ea2237dc1085d7d1e4db75f4be34d86f309d1" +checksum = "0901fc8eb0aca4c83be0106d6f2db17d86a08dfc2c25f0e84464bf381158add6" dependencies = [ "borsh-derive", "cfg_aliases", @@ -472,15 +539,15 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.2.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478b41ff04256c5c8330f3dfdaaae2a5cc976a8e75088bafa4625b0d0208de8c" +checksum = "51670c3aa053938b0ee3bd67c3817e471e626151131b934038e83c5bf8de48f5" dependencies = [ "once_cell", - "proc-macro-crate 2.0.1", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", "syn_derive", ] @@ -492,24 +559,24 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bs58" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" dependencies = [ "tinyvec", ] [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytecheck" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" +checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" dependencies = [ "bytecheck_derive", "ptr_meta", @@ -518,9 +585,9 @@ dependencies = [ [[package]] name = "bytecheck_derive" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" +checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" dependencies = [ "proc-macro2", "quote", @@ -529,9 +596,9 @@ dependencies = [ [[package]] name = "bytecount" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205" +checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce" [[package]] name = "byteorder" @@ -541,9 +608,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" dependencies = [ "serde", ] @@ -568,11 +635,76 @@ dependencies = [ "serde", ] +[[package]] +name = "cap-fs-ext" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88e341d15ac1029aadce600be764a1a1edafe40e03cde23285bc1d261b3a4866" +dependencies = [ + "cap-primitives", + "cap-std", + "io-lifetimes 2.0.3", + "windows-sys 0.52.0", +] + +[[package]] +name = "cap-primitives" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe16767ed8eee6d3f1f00d6a7576b81c226ab917eb54b96e5f77a5216ef67abb" +dependencies = [ + "ambient-authority", + "fs-set-times", + "io-extras", + "io-lifetimes 2.0.3", + "ipnet", + "maybe-owned", + "rustix 0.38.34", + "windows-sys 0.52.0", + "winx", +] + +[[package]] +name = "cap-rand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e5695565f0cd7106bc3c7170323597540e772bb73e0be2cd2c662a0f8fa4ca" +dependencies = [ + "ambient-authority", + "rand", +] + +[[package]] +name = "cap-std" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "593db20e4c51f62d3284bae7ee718849c3214f93a3b94ea1899ad85ba119d330" +dependencies = [ + "cap-primitives", + "io-extras", + "io-lifetimes 2.0.3", + "rustix 0.38.34", +] + +[[package]] +name = "cap-time-ext" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03261630f291f425430a36f38c847828265bc928f517cdd2004c56f4b02f002b" +dependencies = [ + "ambient-authority", + "cap-primitives", + "iana-time-zone", + "once_cell", + "rustix 0.38.34", + "winx", +] + [[package]] name = "cargo-platform" -version = "0.1.5" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" dependencies = [ "serde", ] @@ -598,12 +730,13 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b" dependencies = [ "jobserver", "libc", + "once_cell", ] [[package]] @@ -627,11 +760,18 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" +[[package]] +name = "check-features" +version = "0.1.1-3" +dependencies = [ + "toml", +] + [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", @@ -639,7 +779,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.5", ] [[package]] @@ -668,9 +808,9 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" +checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" dependencies = [ "glob", "libc", @@ -690,9 +830,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.11" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ "clap_builder", "clap_derive", @@ -700,33 +840,33 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.11" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim", + "strsim 0.11.1", ] [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "colorchoice" @@ -736,13 +876,12 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "colored" -version = "1.9.4" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f741c91823341bebf717d4c71bda820630ce065443b58bd1b7451af008355" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" dependencies = [ - "is-terminal", "lazy_static", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -754,6 +893,43 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "console-api" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd326812b3fd01da5bb1af7d340d0d555fd3d4b641e7f1dfcf5962a902952787" +dependencies = [ + "futures-core", + "prost 0.12.4", + "prost-types 0.12.4", + "tonic 0.10.2", + "tracing-core", +] + +[[package]] +name = "console-subscriber" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7481d4c57092cd1c19dd541b92bdce883de840df30aa5d03fd48a3935c01842e" +dependencies = [ + "console-api", + "crossbeam-channel", + "crossbeam-utils", + "futures-task", + "hdrhistogram", + "humantime", + "prost-types 0.12.4", + "serde", + "serde_json", + "thread_local", + "tokio", + "tokio-stream", + "tonic 0.10.2", + "tracing", + "tracing-core", + "tracing-subscriber", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -790,18 +966,127 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "cranelift-bforest" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c22542c0b95bd3302f7ed6839869c561f2324bac2fd5e7e99f5cfa65fdc8b92" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-codegen" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b3db903ef2e9c8a4de2ea6db5db052c7857282952f9df604aa55d169e6000d8" +dependencies = [ + "bumpalo", + "cranelift-bforest", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-control", + "cranelift-entity", + "cranelift-isle", + "gimli", + "hashbrown 0.14.3", + "log", + "regalloc2", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6590feb5a1d6438f974bf6a5ac4dddf69fca14e1f07f3265d880f69e61a94463" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7239038c56fafe77fddc8788fc8533dd6c474dc5bdc5637216404f41ba807330" + +[[package]] +name = "cranelift-control" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7dc9c595341404d381d27a3d950160856b35b402275f0c3990cd1ad683c8053" +dependencies = [ + "arbitrary", +] + +[[package]] +name = "cranelift-entity" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44e3ee532fc4776c69bcedf7e62f9632cbb3f35776fa9a525cdade3195baa3f7" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "cranelift-frontend" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a612c94d09e653662ec37681dc2d6fd2b9856e6df7147be0afc9aabb0abf19df" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85db9830abeb1170b7d29b536ffd55af1d4d26ac8a77570b5d1aca003bf225cc" + +[[package]] +name = "cranelift-native" +version = "0.103.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "301ef0edafeaeda5771a5d2db64ac53e1818ae3111220a185677025fe91db4a1" dependencies = [ + "cranelift-codegen", "libc", + "target-lexicon", +] + +[[package]] +name = "cranelift-wasm" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380f0abe8264e4570ac615fc31cef32a3b90a77f7eb97b08331f9dd357b1f500" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "itertools 0.10.5", + "log", + "smallvec", + "wasmparser", + "wasmtime-types", ] [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] @@ -817,7 +1102,7 @@ dependencies = [ "clap 2.34.0", "criterion-plot", "csv", - "itertools", + "itertools 0.10.5", "lazy_static", "num-traits", "oorandom", @@ -839,51 +1124,65 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876" dependencies = [ "cast", - "itertools", + "itertools 0.10.5", +] + +[[package]] +name = "crossbeam" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils", ] [[package]] name = "crossbeam-channel" -version = "0.5.9" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c3242926edf34aec4ac3a77108ad4854bffaa2e4ddc1824124ce59231302d5" +checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.16" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "memoffset", ] [[package]] -name = "crossbeam-utils" -version = "0.8.17" +name = "crossbeam-queue" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" dependencies = [ - "cfg-if", + "crossbeam-utils", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" + [[package]] name = "crypto-common" version = "0.1.6" @@ -917,9 +1216,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.1" +version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" dependencies = [ "cfg-if", "cpufeatures", @@ -940,38 +1239,40 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] name = "dapi-grpc" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ "dapi-grpc-macros", + "futures-core", "platform-version", - "prost 0.11.9", + "prost 0.12.4", "serde", "serde_bytes", - "tenderdash-proto 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci)", - "tonic", - "tonic-build", + "serde_json", + "tenderdash-proto", + "tonic 0.11.0", + "tonic-build 0.9.2", ] [[package]] name = "dapi-grpc-macros" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ "dapi-grpc", - "heck", + "heck 0.5.0", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] name = "darling" -version = "0.20.3" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" dependencies = [ "darling_core", "darling_macro", @@ -979,41 +1280,77 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.3" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim", - "syn 2.0.41", + "strsim 0.10.0", + "syn 2.0.60", ] [[package]] name = "darling_macro" -version = "0.20.3" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] -name = "dashcore" -version = "0.30.0" -source = "git+https://github.com/dashpay/rust-dashcore?branch=master#35a166e76256edc5ca491163d9050ead0e0f50d5" +name = "dash-sdk" +version = "1.0.0-dev.15" dependencies = [ - "anyhow", - "bech32", - "dashcore-private", - "dashcore_hashes", + "async-trait", + "base64 0.22.0", + "bincode 2.0.0-rc.3", + "bip37-bloom-filter", + "ciborium", + "clap 4.5.4", + "dapi-grpc", + "dapi-grpc-macros", + "dashcore-rpc", + "data-contracts", + "derive_more", + "dotenvy", + "dpp", + "drive", + "drive-proof-verifier", + "envy", + "futures", "hex", - "hex_lit", - "rustversion", + "http 0.2.12", + "lru", + "rs-dapi-client", + "sanitize-filename", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-test", + "tokio-util", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "dashcore" +version = "0.30.0" +source = "git+https://github.com/dashpay/rust-dashcore?branch=master#a29315dbe56729be1be963fb6f7b60a22288663f" +dependencies = [ + "anyhow", + "bech32", + "dashcore-private", + "dashcore_hashes", + "hex", + "hex_lit", + "rustversion", "secp256k1", "serde", ] @@ -1021,16 +1358,16 @@ dependencies = [ [[package]] name = "dashcore-private" version = "0.1.0" -source = "git+https://github.com/dashpay/rust-dashcore?branch=master#35a166e76256edc5ca491163d9050ead0e0f50d5" +source = "git+https://github.com/dashpay/rust-dashcore?branch=master#a29315dbe56729be1be963fb6f7b60a22288663f" [[package]] name = "dashcore-rpc" version = "0.15.1" -source = "git+https://github.com/dashpay/rust-dashcore-rpc?branch=master#016e3af953fe92e0e58a8fe2b3958334e318b6c0" +source = "git+https://github.com/dashpay/rust-dashcore-rpc?tag=v0.15.2#9e596142f589d32a7347872b8f5c2b3b2ed54257" dependencies = [ "dashcore-private", "dashcore-rpc-json", - "env_logger 0.10.1", + "env_logger 0.10.2", "hex", "jsonrpc", "log", @@ -1041,7 +1378,7 @@ dependencies = [ [[package]] name = "dashcore-rpc-json" version = "0.15.1" -source = "git+https://github.com/dashpay/rust-dashcore-rpc?branch=master#016e3af953fe92e0e58a8fe2b3958334e318b6c0" +source = "git+https://github.com/dashpay/rust-dashcore-rpc?tag=v0.15.2#9e596142f589d32a7347872b8f5c2b3b2ed54257" dependencies = [ "bincode 2.0.0-rc.3", "dashcore", @@ -1055,7 +1392,7 @@ dependencies = [ [[package]] name = "dashcore_hashes" version = "0.12.0" -source = "git+https://github.com/dashpay/rust-dashcore?branch=master#35a166e76256edc5ca491163d9050ead0e0f50d5" +source = "git+https://github.com/dashpay/rust-dashcore?branch=master#a29315dbe56729be1be963fb6f7b60a22288663f" dependencies = [ "dashcore-private", "rs-x11-hash", @@ -1065,22 +1402,26 @@ dependencies = [ [[package]] name = "dashpay-contract" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ "platform-value", + "platform-version", "serde_json", + "thiserror", ] [[package]] name = "data-contracts" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ "dashpay-contract", "dpns-contract", "feature-flags-contract", "masternode-reward-shares-contract", "platform-value", + "platform-version", "serde_json", + "thiserror", "withdrawals-contract", ] @@ -1097,9 +1438,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", "zeroize", @@ -1107,9 +1448,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", "serde", @@ -1150,6 +1491,37 @@ dependencies = [ "crypto-common", ] +[[package]] +name = "dircpy" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29259db751c34980bfc44100875890c507f585323453b91936960ab1104272ca" +dependencies = [ + "jwalk", + "log", + "walkdir", +] + +[[package]] +name = "dirs" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + [[package]] name = "dotenvy" version = "0.15.7" @@ -1164,19 +1536,22 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "dpns-contract" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ "platform-value", + "platform-version", "serde_json", + "thiserror", ] [[package]] name = "dpp" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ "anyhow", + "assert_matches", "async-trait", - "base64 0.20.0", + "base64 0.22.0", "bincode 2.0.0-rc.3", "bls-signatures", "bs58 0.4.0", @@ -1188,15 +1563,14 @@ dependencies = [ "derive_more", "dpp", "ed25519-dalek", - "enum-map", "env_logger 0.9.3", "getrandom", "hex", - "indexmap 2.1.0", - "integer-encoding 4.0.0", - "itertools", - "json-patch", - "jsonptr", + "indexmap 2.2.6", + "integer-encoding", + "itertools 0.12.1", + "json-schema-compatibility-validator", + "json-schema-faker", "jsonschema", "lazy_static", "log", @@ -1216,6 +1590,7 @@ dependencies = [ "serde_json", "serde_repr", "sha2", + "strum 0.25.0", "test-case", "thiserror", "tokio", @@ -1223,11 +1598,11 @@ dependencies = [ [[package]] name = "drive" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ - "anyhow", - "base64 0.21.5", - "bs58 0.5.0", + "arc-swap", + "base64 0.21.7", + "bs58 0.5.1", "byteorder", "chrono", "ciborium", @@ -1240,12 +1615,13 @@ dependencies = [ "grovedb-path", "grovedb-storage", "hex", - "indexmap 1.9.3", - "integer-encoding 4.0.0", + "indexmap 2.2.6", + "integer-encoding", "intmap", - "itertools", + "itertools 0.11.0", "moka", "nohash-hasher", + "parking_lot", "platform-version", "rand", "serde", @@ -1258,16 +1634,18 @@ dependencies = [ [[package]] name = "drive-abci" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ + "arc-swap", + "assert_matches", + "async-trait", "atty", "base64 0.20.0", "bincode 2.0.0-rc.3", - "bs58 0.4.0", - "bytes", "chrono", "ciborium", - "clap 4.4.11", + "clap 4.5.4", + "console-subscriber", "dapi-grpc", "dashcore-rpc", "delegate", @@ -1278,15 +1656,15 @@ dependencies = [ "envy", "file-rotate", "hex", - "indexmap 1.9.3", - "integer-encoding 4.0.0", - "itertools", + "indexmap 2.2.6", + "integer-encoding", + "itertools 0.10.5", "lazy_static", "metrics", "metrics-exporter-prometheus", "mockall", "platform-version", - "prost 0.11.9", + "prost 0.12.4", "rand", "regex", "reopen", @@ -1295,12 +1673,12 @@ dependencies = [ "rust_decimal_macros", "serde", "serde_json", - "serde_with 3.4.0", + "serde_with 3.8.0", "sha2", "simple-signer", "strategy-tests", "tempfile", - "tenderdash-abci 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.2)", + "tenderdash-abci", "thiserror", "tokio", "tokio-util", @@ -1312,16 +1690,15 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ "dapi-grpc", "dpp", "drive", "hex", - "lazy_static", "serde", "serde_json", - "tenderdash-abci 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci)", + "tenderdash-abci", "thiserror", "tracing", ] @@ -1359,9 +1736,9 @@ dependencies = [ [[package]] name = "ed25519-dalek" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ "curve25519-dalek", "ed25519", @@ -1374,9 +1751,9 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" [[package]] name = "enum-map" @@ -1395,7 +1772,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] @@ -1413,9 +1790,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" dependencies = [ "humantime", "is-terminal", @@ -1486,14 +1863,21 @@ dependencies = [ "synstructure", ] +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + [[package]] name = "fancy-regex" -version = "0.7.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6b8560a05112eb52f04b00e5d3790c0dd75d9d980eb8a122fb23b92a623ccf" +checksum = "531e46835a22af56d1e3b66f04844bed63158bc094a628bec1d321d9b4c44bf2" dependencies = [ "bit-set", - "regex", + "regex-automata 0.4.6", + "regex-syntax 0.8.3", ] [[package]] @@ -1507,23 +1891,36 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" + +[[package]] +name = "fd-lock" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e5768da2206272c81ef0b5e951a41862938a6070da63bcea197899942d3b947" +dependencies = [ + "cfg-if", + "rustix 0.38.34", + "windows-sys 0.52.0", +] [[package]] name = "feature-flags-contract" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ "platform-value", + "platform-version", "serde_json", + "thiserror", ] [[package]] name = "fiat-crypto" -version = "0.2.5" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" +checksum = "38793c55593b33412e3ae40c2c9781ffaa6f438f6f8c10f24e71846fbd7ae01e" [[package]] name = "file-rotate" @@ -1575,6 +1972,21 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1586,9 +1998,9 @@ dependencies = [ [[package]] name = "fraction" -version = "0.9.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aba3510011eee8825018be07f08d9643421de007eaf62a3bde58d89b058abfa7" +checksum = "b486ab61634f05b11b591c38c71fb25139cb55e22be4fb6ecf649cc3736c074a" dependencies = [ "lazy_static", "num", @@ -1600,6 +2012,17 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" +[[package]] +name = "fs-set-times" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "033b337d725b97690d86893f9de22b67b80dcc4e9ad815f348254c38119db8fb" +dependencies = [ + "io-lifetimes 2.0.3", + "rustix 0.38.34", + "windows-sys 0.52.0", +] + [[package]] name = "fs_extra" version = "1.3.0" @@ -1614,9 +2037,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -1629,9 +2052,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -1639,15 +2062,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -1656,9 +2079,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-lite" @@ -1677,32 +2100,32 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -1728,9 +2151,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" dependencies = [ "cfg-if", "js-sys", @@ -1744,6 +2167,11 @@ name = "gimli" version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +dependencies = [ + "fallible-iterator", + "indexmap 2.2.6", + "stable_deref_trait", +] [[package]] name = "glob" @@ -1754,21 +2182,20 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "grovedb" version = "1.0.0-rc.2" -source = "git+https://github.com/dashpay/grovedb?rev=b40dd1a35f852c81caeda2d3c2910c40fae3a67f#b40dd1a35f852c81caeda2d3c2910c40fae3a67f" +source = "git+https://github.com/dashpay/grovedb?rev=d9292aa20bd8f3bda7c5d25d62db06ac341b0677#d9292aa20bd8f3bda7c5d25d62db06ac341b0677" dependencies = [ - "bincode 1.3.3", + "bincode 2.0.0-rc.3", "grovedb-costs", "grovedb-merk", "grovedb-path", "grovedb-storage", "grovedb-visualize", "hex", - "indexmap 1.9.3", - "integer-encoding 3.0.4", + "indexmap 2.2.6", + "integer-encoding", "intmap", - "itertools", + "itertools 0.12.1", "nohash-hasher", - "serde", "tempfile", "thiserror", ] @@ -1776,9 +2203,9 @@ dependencies = [ [[package]] name = "grovedb-costs" version = "1.0.0-rc.2" -source = "git+https://github.com/dashpay/grovedb?rev=b40dd1a35f852c81caeda2d3c2910c40fae3a67f#b40dd1a35f852c81caeda2d3c2910c40fae3a67f" +source = "git+https://github.com/dashpay/grovedb?rev=d9292aa20bd8f3bda7c5d25d62db06ac341b0677#d9292aa20bd8f3bda7c5d25d62db06ac341b0677" dependencies = [ - "integer-encoding 3.0.4", + "integer-encoding", "intmap", "thiserror", ] @@ -1786,7 +2213,7 @@ dependencies = [ [[package]] name = "grovedb-merk" version = "1.0.0-rc.2" -source = "git+https://github.com/dashpay/grovedb?rev=b40dd1a35f852c81caeda2d3c2910c40fae3a67f#b40dd1a35f852c81caeda2d3c2910c40fae3a67f" +source = "git+https://github.com/dashpay/grovedb?rev=d9292aa20bd8f3bda7c5d25d62db06ac341b0677#d9292aa20bd8f3bda7c5d25d62db06ac341b0677" dependencies = [ "blake3", "byteorder", @@ -1798,9 +2225,8 @@ dependencies = [ "grovedb-storage", "grovedb-visualize", "hex", - "indexmap 1.9.3", - "integer-encoding 3.0.4", - "jemallocator", + "indexmap 2.2.6", + "integer-encoding", "num_cpus", "rand", "thiserror", @@ -1810,23 +2236,23 @@ dependencies = [ [[package]] name = "grovedb-path" version = "1.0.0-rc.2" -source = "git+https://github.com/dashpay/grovedb?rev=b40dd1a35f852c81caeda2d3c2910c40fae3a67f#b40dd1a35f852c81caeda2d3c2910c40fae3a67f" +source = "git+https://github.com/dashpay/grovedb?rev=d9292aa20bd8f3bda7c5d25d62db06ac341b0677#d9292aa20bd8f3bda7c5d25d62db06ac341b0677" [[package]] name = "grovedb-storage" version = "1.0.0-rc.2" -source = "git+https://github.com/dashpay/grovedb?rev=b40dd1a35f852c81caeda2d3c2910c40fae3a67f#b40dd1a35f852c81caeda2d3c2910c40fae3a67f" +source = "git+https://github.com/dashpay/grovedb?rev=d9292aa20bd8f3bda7c5d25d62db06ac341b0677#d9292aa20bd8f3bda7c5d25d62db06ac341b0677" dependencies = [ "blake3", "grovedb-costs", "grovedb-path", "grovedb-visualize", "hex", - "integer-encoding 3.0.4", + "integer-encoding", "lazy_static", "num_cpus", "rocksdb", - "strum", + "strum 0.26.2", "tempfile", "thiserror", ] @@ -1834,25 +2260,44 @@ dependencies = [ [[package]] name = "grovedb-visualize" version = "1.0.0-rc.2" -source = "git+https://github.com/dashpay/grovedb?rev=b40dd1a35f852c81caeda2d3c2910c40fae3a67f#b40dd1a35f852c81caeda2d3c2910c40fae3a67f" +source = "git+https://github.com/dashpay/grovedb?rev=d9292aa20bd8f3bda7c5d25d62db06ac341b0677#d9292aa20bd8f3bda7c5d25d62db06ac341b0677" dependencies = [ "hex", - "itertools", + "itertools 0.12.1", +] + +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", ] [[package]] name = "h2" -version = "0.3.22" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http", - "indexmap 2.1.0", + "http 1.1.0", + "indexmap 2.2.6", "slab", "tokio", "tokio-util", @@ -1861,9 +2306,9 @@ dependencies = [ [[package]] name = "half" -version = "1.8.2" +version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" +checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" [[package]] name = "hashbrown" @@ -1871,16 +2316,16 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.7", + "ahash 0.7.8", ] [[package]] name = "hashbrown" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ff8ae62cd3a9102e5637afc8452c55acf3844001bd5374e0b0bd7b6616c038" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", ] [[package]] @@ -1888,6 +2333,23 @@ name = "hashbrown" version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash 0.8.11", + "allocator-api2", +] + +[[package]] +name = "hdrhistogram" +version = "7.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "765c9198f173dd59ce26ff9f95ef0aafd0a0fe01fb9d72841bc5066a4c06511d" +dependencies = [ + "base64 0.21.7", + "byteorder", + "flate2", + "nom", + "num-traits", +] [[package]] name = "heck" @@ -1895,6 +2357,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1906,9 +2374,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hex" @@ -1936,9 +2404,20 @@ dependencies = [ [[package]] name = "http" -version = "0.2.11" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -1952,7 +2431,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +dependencies = [ + "bytes", + "futures-core", + "http 1.1.0", + "http-body 1.0.0", "pin-project-lite", ] @@ -1976,45 +2478,102 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", "httparse", "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.10", + "socket2 0.5.6", "tokio", "tower-service", "tracing", "want", ] +[[package]] +name = "hyper" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.4", + "http 1.1.0", + "http-body 1.0.0", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + [[package]] name = "hyper-timeout" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper", + "hyper 0.14.28", "pin-project-lite", "tokio", "tokio-io-timeout", ] +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper 1.3.1", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "hyper 1.3.1", + "pin-project-lite", + "socket2 0.5.6", + "tokio", + "tower", + "tower-service", + "tracing", +] + [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -2062,9 +2621,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -2080,12 +2639,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "integer-encoding" -version = "3.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bb03732005da905c88227371639bf1ad885cc712789c011c31c5fb3ab3ccf02" - [[package]] name = "integer-encoding" version = "4.0.0" @@ -2101,17 +2654,33 @@ dependencies = [ "serde", ] +[[package]] +name = "io-extras" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9f046b9af244f13b3bd939f55d16830ac3a201e8a9ba9661bfcb03e2be72b9b" +dependencies = [ + "io-lifetimes 2.0.3", + "windows-sys 0.52.0", +] + [[package]] name = "io-lifetimes" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.3", + "hermit-abi 0.3.9", "libc", "windows-sys 0.48.0", ] +[[package]] +name = "io-lifetimes" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a611371471e98973dbcab4e0ec66c31a10bc356eeb4d54a0e05eac8158fe38c" + [[package]] name = "ipnet" version = "2.9.0" @@ -2120,20 +2689,20 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ - "hermit-abi 0.3.3", - "rustix 0.38.28", - "windows-sys 0.48.0", + "hermit-abi 0.3.9", + "libc", + "windows-sys 0.52.0", ] [[package]] name = "iso8601" -version = "0.4.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5b94fbeb759754d87e1daea745bc8efd3037cd16980331fe1d1524c9a79ce96" +checksum = "924e5d73ea28f59011fec52a0d12185d496a9b075d360657aed2a5707f701153" dependencies = [ "nom", ] @@ -2148,36 +2717,34 @@ dependencies = [ ] [[package]] -name = "itoa" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" - -[[package]] -name = "jemalloc-sys" -version = "0.5.4+5.3.0-patched" +name = "itertools" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac6c1946e1cea1788cbfde01c993b52a10e2da07f4bac608228d1bed20bfebf2" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" dependencies = [ - "cc", - "libc", + "either", ] [[package]] -name = "jemallocator" -version = "0.5.4" +name = "itertools" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0de374a9f8e63150e6f5e8a60cc14c668226d7a347d8aee1a45766e3c4dd3bc" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ - "jemalloc-sys", - "libc", + "either", ] +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + [[package]] name = "jobserver" -version = "0.1.27" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" dependencies = [ "libc", ] @@ -2193,25 +2760,38 @@ dependencies = [ [[package]] name = "json-patch" -version = "0.2.7" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3fa5a61630976fc4c353c70297f2e93f1930e3ccee574d59d618ccbd5154ce" +checksum = "55ff1e1486799e3f64129f8ccad108b38290df9cd7015cd31bed17239f0789d6" dependencies = [ "serde", "serde_json", - "treediff 3.0.2", + "thiserror", + "treediff 4.0.3", ] [[package]] -name = "jsonptr" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e7a1ae7fc3e87c05f7a3de7e51083f62cdafcd9fed52cffebca22819a8f799" +name = "json-schema-compatibility-validator" +version = "0.25.16-rc.7" dependencies = [ - "serde", + "json-patch", + "json-schema-compatibility-validator", + "once_cell", "serde_json", - "uniresid", - "url", + "thiserror", +] + +[[package]] +name = "json-schema-faker" +version = "0.1.0" +source = "git+https://github.com/fominok/json-schema-faker-rs?rev=2dd1cf7#2dd1cf7ea17b9246aa2aabd7026a3a320e3fa903" +dependencies = [ + "dircpy", + "serde_json", + "thiserror", + "wasi-common", + "wasmtime", + "wasmtime-wasi", ] [[package]] @@ -2228,11 +2808,11 @@ dependencies = [ [[package]] name = "jsonschema" version = "0.15.0" -source = "git+https://github.com/fominok/jsonschema-rs?branch=feat-unevaluated-properties#18f61ab46b4a06fb313fadadffd669058bddeafd" +source = "git+https://github.com/fominok/jsonschema-rs?branch=feat-unevaluated-properties#bb4800c8bb00803e088ac6ca724116d4fda12efe" dependencies = [ - "ahash 0.7.7", + "ahash 0.8.11", "anyhow", - "base64 0.13.1", + "base64 0.22.0", "bytecount", "fancy-regex", "fraction", @@ -2248,7 +2828,17 @@ dependencies = [ "serde_json", "time", "url", - "uuid 0.8.2", + "uuid", +] + +[[package]] +name = "jwalk" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2735847566356cd2179a2a38264839308f7079fa96e6bd5a42d740460e003c56" +dependencies = [ + "crossbeam", + "rayon", ] [[package]] @@ -2263,35 +2853,51 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + [[package]] name = "lhash" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6df04c84bd3f83849dd23c51be4cbb22a02d80ebdea22741558fe30127d837ae" +checksum = "744a4c881f502e98c2241d2e5f50040ac73b30194d64452bb6260393b53f0dc9" [[package]] name = "libc" -version = "0.2.151" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libloading" -version = "0.7.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ "cfg-if", - "winapi", + "windows-targets 0.52.5", +] + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.5.0", + "libc", ] [[package]] name = "librocksdb-sys" -version = "0.11.0+8.1.1" +version = "0.16.0+8.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3386f101bcb4bd252d8e9d2fb41ec3b0862a15a62b478c355b2982efa469e3e" +checksum = "ce3d60bc059831dc1c83903fb45c103f75db65c5a7bf22272764d9cc683e348c" dependencies = [ - "bindgen", + "bindgen 0.69.4", "bzip2-sys", "cc", "glob", @@ -2303,9 +2909,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.12" +version = "1.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" +checksum = "5e143b5e666b2695d28f6bca6497720813f699c9602dd7f5cac91008b8ada7f9" dependencies = [ "cc", "pkg-config", @@ -2320,15 +2926,15 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -2336,9 +2942,18 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "lru" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" +dependencies = [ + "hashbrown 0.14.3", +] [[package]] name = "lz4-sys" @@ -2350,21 +2965,32 @@ dependencies = [ "libc", ] +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + [[package]] name = "mach2" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d0d1830bcd151a6fc4aea1369af235b36c1528fe976b8ff678683c9995eade8" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" dependencies = [ "libc", ] [[package]] name = "masternode-reward-shares-contract" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ "platform-value", + "platform-version", "serde_json", + "thiserror", ] [[package]] @@ -2382,73 +3008,79 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +[[package]] +name = "maybe-owned" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" + [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" + +[[package]] +name = "memfd" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" +dependencies = [ + "rustix 0.38.34", +] [[package]] name = "memoffset" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] [[package]] name = "metrics" -version = "0.21.1" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fde3af1a009ed76a778cb84fdef9e7dbbdf5775ae3e4cc1f434a6a307f6f76c5" +checksum = "2be3cbd384d4e955b231c895ce10685e3d8260c5ccffae898c96c723b0772835" dependencies = [ - "ahash 0.8.6", - "metrics-macros", + "ahash 0.8.11", "portable-atomic", ] [[package]] name = "metrics-exporter-prometheus" -version = "0.12.2" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d4fa7ce7c4862db464a37b0b31d89bca874562f034bd7993895572783d02950" +checksum = "5d58e362dc7206e9456ddbcdbd53c71ba441020e62104703075a69151e38d85f" dependencies = [ - "base64 0.21.5", - "hyper", - "indexmap 1.9.3", + "base64 0.22.0", + "http-body-util", + "hyper 1.3.1", + "hyper-tls", + "hyper-util", + "indexmap 2.2.6", "ipnet", "metrics", "metrics-util", - "quanta", + "quanta 0.12.3", "thiserror", "tokio", "tracing", ] -[[package]] -name = "metrics-macros" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddece26afd34c31585c74a4db0630c376df271c285d682d1e55012197830b6df" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.41", -] - [[package]] name = "metrics-util" -version = "0.15.1" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4de2ed6e491ed114b40b732e4d1659a9d53992ebd87490c44a6ffe23739d973e" +checksum = "8b07a5eb561b8cbc16be2d216faf7757f9baf3bfb94dbb0fae3df8387a5bb47f" dependencies = [ "crossbeam-epoch", "crossbeam-utils", - "hashbrown 0.13.1", + "hashbrown 0.14.3", "metrics", "num_cpus", - "quanta", + "quanta 0.12.3", "sketches-ddsketch", ] @@ -2466,18 +3098,18 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "wasi", @@ -2525,7 +3157,7 @@ dependencies = [ "futures-util", "once_cell", "parking_lot", - "quanta", + "quanta 0.11.1", "rustc_version", "scheduled-thread-pool", "skeptic", @@ -2533,7 +3165,7 @@ dependencies = [ "tagptr", "thiserror", "triomphe", - "uuid 1.6.1", + "uuid", ] [[package]] @@ -2542,6 +3174,36 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" +[[package]] +name = "multimap" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" + +[[package]] +name = "murmur3" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9252111cf132ba0929b6f8e030cac2a24b507f3a4d6db6fb2896f27b354c714b" + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "nohash-hasher" version = "0.2.0" @@ -2576,9 +3238,9 @@ dependencies = [ [[package]] name = "num" -version = "0.2.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36" +checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" dependencies = [ "num-bigint", "num-complex", @@ -2590,9 +3252,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.2.6" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ "autocfg", "num-integer", @@ -2607,40 +3269,44 @@ checksum = "63335b2e2c34fae2fb0aa2cecfd9f0832a1e24b3b32ecec612c3426d46dc8aaa" [[package]] name = "num-complex" -version = "0.2.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" +checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" dependencies = [ - "autocfg", "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-derive" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-iter" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" dependencies = [ "autocfg", "num-integer", @@ -2649,9 +3315,9 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.2.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", "num-bigint", @@ -2661,9 +3327,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] @@ -2674,7 +3340,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.3", + "hermit-abi 0.3.9", "libc", ] @@ -2701,10 +3367,13 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ + "crc32fast", + "hashbrown 0.14.3", + "indexmap 2.2.6", "memchr", ] @@ -2720,12 +3389,50 @@ version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +[[package]] +name = "openssl" +version = "0.10.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +dependencies = [ + "bitflags 2.5.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.60", +] + [[package]] name = "openssl-probe" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "openssl-sys" +version = "0.9.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "overload" version = "0.1.1" @@ -2740,9 +3447,9 @@ checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" dependencies = [ "lock_api", "parking_lot_core", @@ -2750,15 +3457,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.52.5", ] [[package]] @@ -2786,34 +3493,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.1.0", + "indexmap 2.2.6", ] [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -2833,13 +3540,13 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "platform-serialization" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ "bincode 2.0.0-rc.3", "platform-version", @@ -2847,24 +3554,24 @@ dependencies = [ [[package]] name = "platform-serialization-derive" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", "virtue 0.0.14", ] [[package]] name = "platform-value" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ - "base64 0.13.1", + "base64 0.22.0", "bincode 2.0.0-rc.3", - "bs58 0.4.0", + "bs58 0.5.1", "ciborium", "hex", - "indexmap 2.1.0", + "indexmap 2.2.6", "lazy_static", "platform-serialization", "platform-version", @@ -2873,38 +3580,38 @@ dependencies = [ "serde", "serde_json", "thiserror", - "treediff 4.0.2", + "treediff 5.0.0", ] [[package]] name = "platform-value-convertible" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] name = "platform-version" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ "thiserror", ] [[package]] name = "platform-versioning" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] name = "platforms" -version = "3.2.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e6ab3f592e6fb464fc9712d8d6e6912de6473954635fd76a589d832cffcbb0" +checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7" [[package]] name = "plotters" @@ -2976,7 +3683,7 @@ checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" dependencies = [ "difflib", "float-cmp", - "itertools", + "itertools 0.10.5", "normalize-line-endings", "predicates-core", "regex", @@ -3020,12 +3727,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.15" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +checksum = "5ac2cf0f2e4f42b49f5ffd07dae8d746508ef7526c13940e5f524012ae6c6550" dependencies = [ "proc-macro2", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] @@ -3040,12 +3747,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "2.0.1" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97dc5fea232fc28d2f597b37c4876b348a40e33f3b02cc975c8d006d78d94b1a" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ - "toml_datetime", - "toml_edit 0.20.2", + "toml_edit 0.21.1", ] [[package]] @@ -3074,9 +3780,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] @@ -3093,12 +3799,12 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" +checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" dependencies = [ "bytes", - "prost-derive 0.12.3", + "prost-derive 0.12.4", ] [[package]] @@ -3108,11 +3814,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" dependencies = [ "bytes", - "heck", - "itertools", + "heck 0.4.1", + "itertools 0.10.5", "lazy_static", "log", - "multimap", + "multimap 0.8.3", "petgraph", "prettyplease 0.1.25", "prost 0.11.9", @@ -3125,24 +3831,23 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2" +checksum = "80b776a1b2dc779f5ee0641f8ade0125bc1298dd41a9a0c16d8bd57b42d222b1" dependencies = [ "bytes", - "heck", - "itertools", + "heck 0.5.0", + "itertools 0.12.1", "log", - "multimap", + "multimap 0.10.0", "once_cell", "petgraph", - "prettyplease 0.2.15", - "prost 0.12.3", - "prost-types 0.12.3", + "prettyplease 0.2.19", + "prost 0.12.4", + "prost-types 0.12.4", "regex", - "syn 2.0.41", + "syn 2.0.60", "tempfile", - "which", ] [[package]] @@ -3152,7 +3857,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", - "itertools", + "itertools 0.10.5", "proc-macro2", "quote", "syn 1.0.109", @@ -3160,15 +3865,15 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" +checksum = "19de2de2a00075bf566bee3bd4db014b11587e84184d3f7a791bc17f1a8e9e48" dependencies = [ "anyhow", - "itertools", + "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] @@ -3182,11 +3887,20 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.12.3" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3235c33eb02c1f1e212abdbe34c78b264b038fb58ca612664343271e36e55ffe" +dependencies = [ + "prost 0.12.4", +] + +[[package]] +name = "psm" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" dependencies = [ - "prost 0.12.3", + "cc", ] [[package]] @@ -3211,11 +3925,11 @@ dependencies = [ [[package]] name = "pulldown-cmark" -version = "0.9.3" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998" +checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.5.0", "memchr", "unicase", ] @@ -3230,7 +3944,22 @@ dependencies = [ "libc", "mach2", "once_cell", - "raw-cpuid", + "raw-cpuid 10.7.0", + "wasi", + "web-sys", + "winapi", +] + +[[package]] +name = "quanta" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5" +dependencies = [ + "crossbeam-utils", + "libc", + "once_cell", + "raw-cpuid 11.0.1", "wasi", "web-sys", "winapi", @@ -3238,9 +3967,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -3290,11 +4019,20 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "raw-cpuid" +version = "11.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d86a7c4638d42c44551f4791a20e687dbb4c3de1f33c43dd71e355cd429def1" +dependencies = [ + "bitflags 2.5.0", +] + [[package]] name = "rayon" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -3302,9 +4040,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -3312,23 +4050,47 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.5.0", +] + +[[package]] +name = "redox_users" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + +[[package]] +name = "regalloc2" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" +dependencies = [ + "hashbrown 0.13.2", + "log", + "rustc-hash", + "slice-group-by", + "smallvec", ] [[package]] name = "regex" -version = "1.10.2" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.3", - "regex-syntax 0.8.2", + "regex-automata 0.4.6", + "regex-syntax 0.8.3", ] [[package]] @@ -3342,13 +4104,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax 0.8.3", ] [[package]] @@ -3359,15 +4121,15 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "rend" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" +checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" dependencies = [ "bytecheck", ] @@ -3383,23 +4145,24 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", + "cfg-if", "getrandom", "libc", "spin", "untrusted", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "rkyv" -version = "0.7.43" +version = "0.7.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527a97cdfef66f65998b5f3b637c26f5a5ec09cc52a3f9932313ac645f4190f5" +checksum = "5cba464629b3394fc4dbc6f940ff8f5b4ff5c7aef40f29166fd4ad12acbc99c0" dependencies = [ "bitvec", "bytecheck", @@ -3410,14 +4173,14 @@ dependencies = [ "rkyv_derive", "seahash", "tinyvec", - "uuid 1.6.1", + "uuid", ] [[package]] name = "rkyv_derive" -version = "0.7.43" +version = "0.7.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5c462a1328c8e67e4d6dbad1eb0355dd43e8ab432c6e227a43657f16ade5033" +checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" dependencies = [ "proc-macro2", "quote", @@ -3426,9 +4189,9 @@ dependencies = [ [[package]] name = "rocksdb" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6f170a4041d50a0ce04b0d2e14916d6ca863ea2e422689a5b694395d299ffe" +checksum = "6bd13e55d6d7b8cd0ea569161127567cd587676c99f4472f779a0279aa60a7a7" dependencies = [ "libc", "librocksdb-sys", @@ -3436,71 +4199,38 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ "backon", "chrono", "dapi-grpc", "futures", "hex", - "http", + "http 0.2.12", + "lru", "rand", - "serde", - "serde_json", "sha2", "thiserror", "tokio", - "tonic", "tracing", ] [[package]] -name = "rs-sdk" -version = "0.25.21" +name = "rs-x11-hash" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94ea852806513d6f5fd7750423300375bc8481a18ed033756c1a836257893a30" dependencies = [ - "async-trait", - "base64 0.21.5", - "bincode 2.0.0-rc.3", - "ciborium", - "dapi-grpc", - "dashcore-rpc", - "data-contracts", - "derive_more", - "dotenvy", - "dpp", - "drive", - "drive-abci", - "drive-proof-verifier", - "envy", - "futures", - "hex", - "http", - "rs-dapi-client", - "serde", - "serde_json", - "thiserror", - "tokio", - "tokio-test", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "rs-x11-hash" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94ea852806513d6f5fd7750423300375bc8481a18ed033756c1a836257893a30" -dependencies = [ - "bindgen", + "bindgen 0.65.1", "cc", "libc", ] [[package]] name = "rust_decimal" -version = "1.33.1" +version = "1.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06676aec5ccb8fc1da723cc8c0f9a46549f21ebb8753d3915c6c41db1e7f1dc4" +checksum = "1790d1c4c0ca81211399e0e0af16333276f375209e71a37b67698a373db5b47a" dependencies = [ "arrayvec", "borsh", @@ -3514,9 +4244,9 @@ dependencies = [ [[package]] name = "rust_decimal_macros" -version = "1.33.1" +version = "1.34.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e43721f4ef7060ebc2c3ede757733209564ca8207f47674181bcd425dd76945" +checksum = "e418701588729bef95e7a655f2b483ad64bb97c46e8e79fde83efd92aaab6d82" dependencies = [ "quote", "rust_decimal", @@ -3551,7 +4281,7 @@ checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" dependencies = [ "bitflags 1.3.2", "errno", - "io-lifetimes", + "io-lifetimes 1.0.11", "libc", "linux-raw-sys 0.3.8", "windows-sys 0.48.0", @@ -3559,71 +4289,84 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.5.0", "errno", + "itoa", "libc", - "linux-raw-sys 0.4.12", + "linux-raw-sys 0.4.13", + "once_cell", "windows-sys 0.52.0", ] [[package]] name = "rustls" -version = "0.21.10" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" dependencies = [ "log", "ring", + "rustls-pki-types", "rustls-webpki", - "sct", + "subtle", + "zeroize", ] [[package]] name = "rustls-native-certs" -version = "0.6.3" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" +checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" dependencies = [ "openssl-probe", "rustls-pemfile", + "rustls-pki-types", "schannel", "security-framework", ] [[package]] name = "rustls-pemfile" -version = "1.0.4" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" dependencies = [ - "base64 0.21.5", + "base64 0.22.0", + "rustls-pki-types", ] +[[package]] +name = "rustls-pki-types" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "beb461507cee2c2ff151784c52762cf4d9ff6a61f3e80968600ed24fa837fa54" + [[package]] name = "rustls-webpki" -version = "0.101.7" +version = "0.102.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" dependencies = [ "ring", + "rustls-pki-types", "untrusted", ] [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "same-file" @@ -3634,13 +4377,23 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "sanitize-filename" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ed72fbaf78e6f2d41744923916966c4fbe3d7c74e3037a8ee482f1115572603" +dependencies = [ + "lazy_static", + "regex", +] + [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3658,16 +4411,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "seahash" version = "4.1.0" @@ -3697,9 +4440,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.2" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -3710,9 +4453,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" dependencies = [ "core-foundation-sys", "libc", @@ -3720,18 +4463,18 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.193" +version = "1.0.198" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" dependencies = [ "serde_derive", ] @@ -3748,9 +4491,9 @@ dependencies = [ [[package]] name = "serde_bytes" -version = "0.11.12" +version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff" +checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734" dependencies = [ "serde", ] @@ -3767,22 +4510,22 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.198" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.6", "itoa", "ryu", "serde", @@ -3790,13 +4533,22 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.17" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", +] + +[[package]] +name = "serde_spanned" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +dependencies = [ + "serde", ] [[package]] @@ -3817,16 +4569,17 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.4.0" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" +checksum = "2c85f8e96d1d6857f13768fcbd895fcb06225510022a2774ed8b5150581847b0" dependencies = [ - "base64 0.21.5", + "base64 0.22.0", "chrono", "hex", "serde", + "serde_derive", "serde_json", - "serde_with_macros 3.4.0", + "serde_with_macros 3.8.0", "time", ] @@ -3839,19 +4592,19 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] name = "serde_with_macros" -version = "3.4.0" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" +checksum = "c8b3a576c4eb2924262d5951a3b737ccaf16c931e39a2810c36f9a7e25575557" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] @@ -3874,17 +4627,26 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shellexpand" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ccc8076840c4da029af4f87e4e8daeb0fca6b87bbb02e10cb60b791450e11e4" +dependencies = [ + "dirs", +] + [[package]] name = "shlex" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] @@ -3906,9 +4668,8 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "simple-signer" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ - "anyhow", "bincode 2.0.0-rc.3", "dashcore-rpc", "dpp", @@ -3931,9 +4692,9 @@ dependencies = [ [[package]] name = "sketches-ddsketch" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a406c1882ed7f29cd5e248c9848a80e7cb6ae0fea82346d2746f2f941c07e1" +checksum = "85636c14b73d81f541e525f585c0a2109e6744e1565b5c1668e31c70c10ed65c" [[package]] name = "slab" @@ -3944,11 +4705,17 @@ dependencies = [ "autocfg", ] +[[package]] +name = "slice-group-by" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" + [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" @@ -3962,12 +4729,12 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3986,28 +4753,42 @@ dependencies = [ "der", ] +[[package]] +name = "sptr" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" + [[package]] name = "sqlparser" -version = "0.13.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9907f54bd0f7b6ce72c2be1e570a614819ee08e3deb66d90480df341d8a12a8" +checksum = "0272b7bb0a225320170c99901b4b5fb3a4384e255a7f2cc228f61e2ba3893e75" dependencies = [ "log", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "strategy-tests" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ "bincode 2.0.0-rc.3", "dpp", "drive", + "futures", "hex", - "platform-serialization-derive", "platform-version", "rand", "rocksdb", + "serde_json", "simple-signer", + "tracing", ] [[package]] @@ -4016,26 +4797,54 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "strum" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" dependencies = [ - "strum_macros", + "strum_macros 0.25.3", +] + +[[package]] +name = "strum" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" +dependencies = [ + "strum_macros 0.26.2", ] [[package]] name = "strum_macros" -version = "0.24.3" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", - "syn 1.0.109", + "syn 2.0.60", +] + +[[package]] +name = "strum_macros" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.60", ] [[package]] @@ -4066,9 +4875,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.41" +version = "2.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" +checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" dependencies = [ "proc-macro2", "quote", @@ -4084,7 +4893,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] @@ -4105,6 +4914,22 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "system-interface" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0682e006dd35771e392a6623ac180999a9a854b1d4a6c12fb2e804941c2b1f58" +dependencies = [ + "bitflags 2.5.0", + "cap-fs-ext", + "cap-std", + "fd-lock", + "io-lifetimes 2.0.3", + "rustix 0.38.34", + "windows-sys 0.52.0", + "winx", +] + [[package]] name = "tagptr" version = "0.2.0" @@ -4118,64 +4943,49 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] -name = "tempfile" -version = "3.8.1" +name = "target-lexicon" +version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" -dependencies = [ - "cfg-if", - "fastrand 2.0.1", - "redox_syscall", - "rustix 0.38.28", - "windows-sys 0.48.0", -] +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] -name = "tenderdash-abci" -version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.2#6ebfaa31052f7ad538d6589323e5daf7e5e55999" +name = "tempfile" +version = "3.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ - "bytes", - "futures", - "hex", - "lhash", - "prost 0.12.3", - "semver", - "tenderdash-proto 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.2)", - "thiserror", - "tokio", - "tokio-util", - "tracing", - "tracing-subscriber", - "url", - "uuid 1.6.1", + "cfg-if", + "fastrand 2.0.2", + "rustix 0.38.34", + "windows-sys 0.52.0", ] [[package]] name = "tenderdash-abci" -version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci#b4df6543efb0457a477db30153131495da1b8bbb" +version = "0.14.0-dev.12" +source = "git+https://github.com/dashpay/rs-tenderdash-abci#a848ad6d67b1c1d8f053c9ca97b89e5e4c929d96" dependencies = [ "bytes", "futures", "hex", "lhash", - "prost 0.12.3", + "prost 0.12.4", "semver", - "tenderdash-proto 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci)", + "serde_json", + "tenderdash-proto", "thiserror", "tokio", "tokio-util", "tracing", "tracing-subscriber", "url", - "uuid 1.6.1", + "uuid", ] [[package]] name = "tenderdash-proto" -version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.2#6ebfaa31052f7ad538d6589323e5daf7e5e55999" +version = "0.14.0-dev.12" +source = "git+https://github.com/dashpay/rs-tenderdash-abci#a848ad6d67b1c1d8f053c9ca97b89e5e4c929d96" dependencies = [ "bytes", "chrono", @@ -4183,54 +4993,25 @@ dependencies = [ "flex-error", "num-derive", "num-traits", - "prost 0.12.3", + "prost 0.12.4", + "prost-types 0.12.4", "serde", "subtle-encoding", - "tenderdash-proto-compiler 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.2)", - "time", -] - -[[package]] -name = "tenderdash-proto" -version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci#b4df6543efb0457a477db30153131495da1b8bbb" -dependencies = [ - "bytes", - "chrono", - "derive_more", - "flex-error", - "num-derive", - "num-traits", - "prost 0.12.3", - "serde", - "subtle-encoding", - "tenderdash-proto-compiler 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci)", + "tenderdash-proto-compiler", "time", + "tonic 0.11.0", ] [[package]] name = "tenderdash-proto-compiler" -version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.2#6ebfaa31052f7ad538d6589323e5daf7e5e55999" +version = "0.14.0-dev.12" +source = "git+https://github.com/dashpay/rs-tenderdash-abci#a848ad6d67b1c1d8f053c9ca97b89e5e4c929d96" dependencies = [ "fs_extra", - "prost-build 0.12.3", - "regex", - "tempfile", - "ureq", - "walkdir", - "zip", -] - -[[package]] -name = "tenderdash-proto-compiler" -version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci#b4df6543efb0457a477db30153131495da1b8bbb" -dependencies = [ - "fs_extra", - "prost-build 0.12.3", + "prost-build 0.12.4", "regex", "tempfile", + "tonic-build 0.11.0", "ureq", "walkdir", "zip", @@ -4238,9 +5019,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] @@ -4284,29 +5065,29 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.51" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7" +checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.51" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df" +checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] name = "thread_local" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ "cfg-if", "once_cell", @@ -4314,12 +5095,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -4334,10 +5116,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ + "num-conv", "time-core", ] @@ -4368,9 +5151,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.0" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", @@ -4380,8 +5163,9 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.5", + "socket2 0.5.6", "tokio-macros", + "tracing", "windows-sys 0.48.0", ] @@ -4403,24 +5187,35 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", ] [[package]] name = "tokio-rustls" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" dependencies = [ "rustls", + "rustls-pki-types", "tokio", ] [[package]] name = "tokio-stream" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" dependencies = [ "futures-core", "pin-project-lite", @@ -4429,9 +5224,9 @@ dependencies = [ [[package]] name = "tokio-test" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89b3cbabd3ae862100094ae433e1def582cf86451b4e9bf83aa7ac1d8a7d719" +checksum = "2468baabc3311435b55dd935f702f42cd1b8abb7e754fb7dfb16bd36aa88f9f7" dependencies = [ "async-stream", "bytes", @@ -4454,11 +5249,26 @@ dependencies = [ "tracing", ] +[[package]] +name = "toml" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.22.12", +] + [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" @@ -4466,45 +5276,84 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.6", "toml_datetime", - "winnow", + "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.20.2" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.6", "toml_datetime", - "winnow", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.22.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef" +dependencies = [ + "indexmap 2.2.6", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.6.6", ] [[package]] name = "tonic" -version = "0.9.2" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" +checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e" dependencies = [ "async-stream", "async-trait", "axum", - "base64 0.21.5", + "base64 0.21.7", "bytes", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", "hyper-timeout", "percent-encoding", "pin-project", - "prost 0.11.9", + "prost 0.12.4", + "tokio", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tonic" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" +dependencies = [ + "async-stream", + "async-trait", + "axum", + "base64 0.21.7", + "bytes", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost 0.12.4", "rustls-native-certs", "rustls-pemfile", + "rustls-pki-types", "tokio", "tokio-rustls", "tokio-stream", @@ -4512,6 +5361,7 @@ dependencies = [ "tower-layer", "tower-service", "tracing", + "webpki-roots", ] [[package]] @@ -4527,15 +5377,27 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "tonic-build" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4ef6dd70a610078cb4e338a0f79d06bc759ff1b22d2120c2ff02ae264ba9c2" +dependencies = [ + "prettyplease 0.2.19", + "proc-macro2", + "prost-build 0.12.4", + "quote", + "syn 2.0.60", +] + [[package]] name = "tower" version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +source = "git+https://github.com/QuantumExplorer/tower?branch=fix/indexMap2OnV0413#5286f8c605d10f48d51254f2434c5ab3fc5d7779" dependencies = [ "futures-core", "futures-util", - "indexmap 1.9.3", + "indexmap 2.2.6", "pin-project", "pin-project-lite", "rand", @@ -4550,14 +5412,12 @@ dependencies = [ [[package]] name = "tower-layer" version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" +source = "git+https://github.com/QuantumExplorer/tower?branch=fix/indexMap2OnV0413#5286f8c605d10f48d51254f2434c5ab3fc5d7779" [[package]] name = "tower-service" version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +source = "git+https://github.com/QuantumExplorer/tower?branch=fix/indexMap2OnV0413#5286f8c605d10f48d51254f2434c5ab3fc5d7779" [[package]] name = "tracing" @@ -4565,6 +5425,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4578,7 +5439,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] @@ -4635,18 +5496,18 @@ dependencies = [ [[package]] name = "treediff" -version = "3.0.2" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "761e8d5ad7ce14bb82b7e61ccc0ca961005a275a060b9644a2431aa11553c2ff" +checksum = "4d127780145176e2b5d16611cc25a900150e86e9fd79d3bde6ff3a37359c9cb5" dependencies = [ "serde_json", ] [[package]] name = "treediff" -version = "4.0.2" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52984d277bdf2a751072b5df30ec0377febdb02f7696d64c2d7d54630bac4303" +checksum = "e2ce481b2b7c2534fe7b5242cccebf37f9084392665c6a3783c414a1bada5432" [[package]] name = "triomphe" @@ -4677,9 +5538,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -4689,9 +5550,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] @@ -4708,18 +5569,6 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" -[[package]] -name = "uniresid" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "995a4007fbec4f43386ea1b1d81d42d986a0c9616378e9aa4a96f45ea661e1b0" -dependencies = [ - "once_cell", - "serde", - "thiserror", - "url", -] - [[package]] name = "untrusted" version = "0.9.0" @@ -4728,15 +5577,16 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.9.1" +version = "2.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8cdd25c339e200129fe4de81451814e5228c9b771d57378817d6117cc2b3f97" +checksum = "d11a831e3c0b56e438a28308e7c810799e3c118417f342d30ecec080105395cd" dependencies = [ - "base64 0.21.5", + "base64 0.22.0", "flate2", "log", "once_cell", "rustls", + "rustls-pki-types", "rustls-webpki", "url", "webpki-roots", @@ -4761,15 +5611,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" - -[[package]] -name = "uuid" -version = "1.6.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ "getrandom", "rand", @@ -4813,9 +5657,9 @@ checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -4836,6 +5680,49 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasi-cap-std-sync" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "154528979a211aa28d969846e883df75705809ed9bcc70aba61460683ea7355b" +dependencies = [ + "anyhow", + "async-trait", + "cap-fs-ext", + "cap-rand", + "cap-std", + "cap-time-ext", + "fs-set-times", + "io-extras", + "io-lifetimes 2.0.3", + "once_cell", + "rustix 0.38.34", + "system-interface", + "tracing", + "wasi-common", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasi-common" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d888b611fee7d273dd057dc009d2dd3132736f36710ffd65657ac83628d1e3b" +dependencies = [ + "anyhow", + "bitflags 2.5.0", + "cap-rand", + "cap-std", + "io-extras", + "log", + "rustix 0.38.34", + "thiserror", + "tracing", + "wasmtime", + "wiggle", + "windows-sys 0.48.0", +] + [[package]] name = "wasm-bindgen" version = "0.2.86" @@ -4857,7 +5744,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", "wasm-bindgen-shared", ] @@ -4891,7 +5778,7 @@ checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4904,16 +5791,17 @@ checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] name = "wasm-dpp" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ "anyhow", "async-trait", "dpp", "hex", - "itertools", + "itertools 0.10.5", "js-sys", "log", "num_enum", + "paste", "serde", "serde-wasm-bindgen", "serde_json", @@ -4924,6 +5812,15 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wasm-encoder" +version = "0.38.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ad2b51884de9c7f4fe2fd1043fccb8dcad4b1e29558146ee57a144d15779f3f" +dependencies = [ + "leb128", +] + [[package]] name = "wasm-logger" version = "0.2.0" @@ -4935,6 +5832,233 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wasmparser" +version = "0.118.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77f1154f1ab868e2a01d9834a805faca7bf8b50d041b4ca714d005d0dab1c50c" +dependencies = [ + "indexmap 2.2.6", + "semver", +] + +[[package]] +name = "wasmtime" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8e539fded2495422ea3c4dfa7beeddba45904eece182cf315294009e1a323bf" +dependencies = [ + "anyhow", + "bincode 1.3.3", + "bumpalo", + "cfg-if", + "indexmap 2.2.6", + "libc", + "log", + "object", + "once_cell", + "paste", + "serde", + "serde_derive", + "serde_json", + "target-lexicon", + "wasmparser", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-jit", + "wasmtime-runtime", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "660ba9143e15a2acd921820df221b73aee256bd3ca2d208d73d8adc9587ccbb9" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-cranelift" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d648c8b4064a7911093b02237cd5569f71ca171d3a0a486bf80600b19e1cba2" +dependencies = [ + "anyhow", + "cfg-if", + "cranelift-codegen", + "cranelift-control", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "cranelift-wasm", + "gimli", + "log", + "object", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-cranelift-shared", + "wasmtime-environ", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-cranelift-shared" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290a89027688782da8ff60b12bb95695494b1874e0d0ba2ba387d23dace6d70c" +dependencies = [ + "anyhow", + "cranelift-codegen", + "cranelift-control", + "cranelift-native", + "gimli", + "object", + "target-lexicon", + "wasmtime-environ", +] + +[[package]] +name = "wasmtime-environ" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61eb64fb3e0da883e2df4a13a81d6282e072336e6cb6295021d0f7ab2e352754" +dependencies = [ + "anyhow", + "cranelift-entity", + "gimli", + "indexmap 2.2.6", + "log", + "object", + "serde", + "serde_derive", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-jit" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f485336add49267d8859e8f8084d2d4b9a4b1564496b6f30ba5b168d50c10ceb" +dependencies = [ + "anyhow", + "bincode 1.3.3", + "cfg-if", + "gimli", + "log", + "object", + "rustix 0.38.34", + "serde", + "serde_derive", + "target-lexicon", + "wasmtime-environ", + "wasmtime-jit-icache-coherence", + "wasmtime-runtime", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b6d197fcc34ad32ed440e1f9552fd57d1f377d9699d31dee1b5b457322c1f8a" +dependencies = [ + "cfg-if", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-runtime" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "794b2bb19b99ef8322ff0dd9fe1ba7e19c41036dfb260b3f99ecce128c42ff92" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "indexmap 2.2.6", + "libc", + "log", + "mach", + "memfd", + "memoffset", + "paste", + "psm", + "rustix 0.38.34", + "sptr", + "wasm-encoder", + "wasmtime-asm-macros", + "wasmtime-environ", + "wasmtime-versioned-export-macros", + "wasmtime-wmemcheck", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-types" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d995db8bb56f2cd8d2dc0ed5ffab94ffb435283b0fe6747f80f7aab40b2d06a1" +dependencies = [ + "cranelift-entity", + "serde", + "serde_derive", + "thiserror", + "wasmparser", +] + +[[package]] +name = "wasmtime-versioned-export-macros" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55c5565959287c21dd0f4277ae3518dd2ae62679f655ee2dbc4396e19d210db" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.60", +] + +[[package]] +name = "wasmtime-wasi" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccd8370078149d49a3a47e93741553fd79b700421464b6a27ca32718192ab130" +dependencies = [ + "anyhow", + "bytes", + "io-extras", + "libc", + "log", + "once_cell", + "url", + "wasi-cap-std-sync", + "wasi-common", + "wasmtime", + "wiggle", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-wmemcheck" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67761d8f8c0b3c13a5d34356274b10a40baba67fe9cfabbfc379a8b414e45de2" + +[[package]] +name = "wast" +version = "35.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ef140f1b49946586078353a453a1d28ba90adfc54dde75710bc1931de204d68" +dependencies = [ + "leb128", +] + [[package]] name = "web-sys" version = "0.3.63" @@ -4947,9 +6071,12 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.3" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" +checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +dependencies = [ + "rustls-pki-types", +] [[package]] name = "which" @@ -4960,7 +6087,49 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.28", + "rustix 0.38.34", +] + +[[package]] +name = "wiggle" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0afb26cd3269289bb314a361ff0a6685e5ce793b62181a9fe3f81ace15051697" +dependencies = [ + "anyhow", + "async-trait", + "bitflags 2.5.0", + "thiserror", + "tracing", + "wasmtime", + "wiggle-macro", +] + +[[package]] +name = "wiggle-generate" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cef2868fed7584d2b552fa317104858ded80021d23b073b2d682d3c932a027bd" +dependencies = [ + "anyhow", + "heck 0.4.1", + "proc-macro2", + "quote", + "shellexpand", + "syn 2.0.60", + "witx", +] + +[[package]] +name = "wiggle-macro" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31ae1ec11a17ea481539ee9a5719a278c9790d974060fbf71db4b2c05378780b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.60", + "wiggle-generate", ] [[package]] @@ -4981,11 +6150,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "winapi", + "windows-sys 0.52.0", ] [[package]] @@ -4996,11 +6165,11 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-core" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.52.5", ] [[package]] @@ -5018,7 +6187,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.5", ] [[package]] @@ -5038,17 +6207,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] @@ -5059,9 +6229,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" @@ -5071,9 +6241,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" @@ -5083,9 +6253,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" @@ -5095,9 +6271,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" @@ -5107,9 +6283,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" @@ -5119,9 +6295,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" @@ -5131,28 +6307,61 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winnow" -version = "0.5.28" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c830786f7720c2fd27a1a0e27a709dbd3c4d009b56d098fc742d4f4eab91fe2" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c976aaaa0e1f90dbb21e9587cdaf1d9679a1cde8875c0d6bd83ab96a208352" +dependencies = [ + "memchr", +] + +[[package]] +name = "winx" +version = "0.36.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9643b83820c0cd246ecabe5fa454dd04ba4fa67996369466d0747472d337346" +dependencies = [ + "bitflags 2.5.0", + "windows-sys 0.52.0", +] + [[package]] name = "withdrawals-contract" -version = "0.25.21" +version = "1.0.0-dev.15" dependencies = [ "num_enum", "platform-value", + "platform-version", "serde", "serde_json", "serde_repr", + "thiserror", +] + +[[package]] +name = "witx" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e366f27a5cabcddb2706a78296a40b8fcc451e1a6aba2fc1d94b4a01bdaaef4b" +dependencies = [ + "anyhow", + "log", + "thiserror", + "wast", ] [[package]] @@ -5172,22 +6381,22 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "zerocopy" -version = "0.7.31" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c4061bedbb353041c12f413700357bec76df2c7e2ca8e4df8bac24c6bf68e3d" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.31" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3c129550b3e6de3fd0ba67ba5c81818f9805e58b8d7fee80a3a59d2c9fc601a" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] @@ -5210,9 +6419,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.9+zstd.1.5.5" +version = "2.0.10+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" +checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" dependencies = [ "cc", "pkg-config", diff --git a/Cargo.toml b/Cargo.toml index 8fe09c67d2b..bdf98a874fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,7 @@ [workspace] +resolver = "2" + members = [ "packages/dapi-grpc", "packages/rs-dapi-grpc-macros", @@ -24,4 +26,11 @@ members = [ "packages/rs-sdk", "packages/strategy-tests", "packages/simple-signer", + "packages/rs-json-schema-compatibility-validator", + "packages/check-features", ] + +[patch.crates-io] +tower-service = { git = "https://github.com/QuantumExplorer/tower", branch = "fix/indexMap2OnV0413" } +tower-layer = { git = "https://github.com/QuantumExplorer/tower", branch = "fix/indexMap2OnV0413" } +tower = { git = "https://github.com/QuantumExplorer/tower", branch = "fix/indexMap2OnV0413" } diff --git a/Dockerfile b/Dockerfile index 25ab93f4373..a7c30303022 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,7 +30,7 @@ # SCCACHE_SERVER_PORT port to avoid conflicts in case of parallel compilation ARG ALPINE_VERSION=3.18 - +ARG PROTOC_VERSION=25.2 ARG RUSTC_WRAPPER # @@ -73,13 +73,14 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ --profile minimal \ -y \ # Rust version the same as in /README.md - --default-toolchain stable \ + --default-toolchain 1.76 \ --target wasm32-unknown-unknown # Install protoc - protobuf compiler # The one shipped with Alpine does not work +ARG PROTOC_VERSION RUN if [[ "$TARGETARCH" == "arm64" ]] ; then export PROTOC_ARCH=aarch_64; else export PROTOC_ARCH=x86_64; fi; \ - curl -Ls https://github.com/protocolbuffers/protobuf/releases/download/v22.4/protoc-22.4-linux-${PROTOC_ARCH}.zip \ + curl -Ls https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-${PROTOC_ARCH}.zip \ -o /tmp/protoc.zip && \ unzip -qd /opt/protoc /tmp/protoc.zip && \ rm /tmp/protoc.zip && \ @@ -193,7 +194,8 @@ RUN --mount=type=cache,sharing=shared,id=cargo_registry_index,target=${CARGO_HOM if [[ -z "${SCCACHE_MEMCACHED}" ]] ; then unset SCCACHE_MEMCACHED ; fi ; \ cargo build \ --profile "$CARGO_BUILD_PROFILE" \ - --package drive-abci && \ + --package drive-abci \ + --locked && \ cp /platform/target/*/drive-abci /artifacts/ && \ if [[ "${RUSTC_WRAPPER}" == "sccache" ]] ; then sccache --show-stats; fi @@ -231,12 +233,14 @@ LABEL description="Drive ABCI Rust" RUN apk add --no-cache libgcc libstdc++ ENV DB_PATH=/var/lib/dash/rs-drive-abci/db +ENV REJECTIONS_PATH=/var/log/dash/rejected RUN mkdir -p /var/log/dash \ - /var/lib/dash/rs-drive-abci/db + /var/lib/dash/rs-drive-abci/db \ + ${REJECTIONS_PATH} COPY --from=build-drive-abci /artifacts/drive-abci /usr/bin/drive-abci -COPY --from=build-drive-abci /platform/packages/rs-drive-abci/.env.example /var/lib/dash/rs-drive-abci/.env +COPY --from=build-drive-abci /platform/packages/rs-drive-abci/.env.mainnet /var/lib/dash/rs-drive-abci/.env # Create a volume VOLUME /var/lib/dash/rs-drive-abci/db @@ -264,6 +268,7 @@ CMD ["start"] # ABCI interface EXPOSE 26658 +EXPOSE 26659 # Prometheus port EXPOSE 29090 @@ -295,7 +300,6 @@ COPY --from=build-dashmate-helper /platform/package.json /platform/yarn.lock /pl COPY --from=build-dashmate-helper /platform/packages/dashmate packages/dashmate COPY --from=build-dashmate-helper /platform/packages/dashpay-contract packages/dashpay-contract COPY --from=build-dashmate-helper /platform/packages/wallet-lib packages/wallet-lib -COPY --from=build-dashmate-helper /platform/packages/js-dash-sdk packages/js-dash-sdk COPY --from=build-dashmate-helper /platform/packages/js-dapi-client packages/js-dapi-client COPY --from=build-dashmate-helper /platform/packages/js-grpc-common packages/js-grpc-common COPY --from=build-dashmate-helper /platform/packages/dapi-grpc packages/dapi-grpc @@ -392,9 +396,6 @@ LABEL description="DAPI Node.JS" # Install ZMQ shared library RUN apk add --no-cache zeromq-dev -# Install pm2 -RUN npm install -g pm2 - WORKDIR /platform/packages/dapi COPY --from=build-dapi /platform/.yarn /platform/.yarn @@ -411,5 +412,3 @@ RUN cp /platform/packages/dapi/.env.example /platform/packages/dapi/.env EXPOSE 2500 2501 2510 USER node - -ENTRYPOINT ["yarn", "node", "/usr/local/bin/pm2-runtime", "pm2.yml"] diff --git a/README.md b/README.md index dfcebf86e09..628306d98b7 100644 --- a/README.md +++ b/README.md @@ -53,19 +53,16 @@ this repository may be used on the following networks: - Install prerequisites: - [node.js](https://nodejs.org/) v20 - [docker](https://docs.docker.com/get-docker/) v20.10+ - - [rust](https://www.rust-lang.org/tools/install) v1.73+, with wasm32 target (`rustup target add wasm32-unknown-unknown`) + - [rust](https://www.rust-lang.org/tools/install) v1.76+, with wasm32 target (`rustup target add wasm32-unknown-unknown`) + - [protoc - protobuf compiler](https://github.com/protocolbuffers/protobuf/releases) v25.2+ + - if needed, set PROTOC environment variable to location of `protoc` binary - [wasm-bingen toolchain](https://rustwasm.github.io/wasm-bindgen/): - **IMPORTANT (OSX only)**: built-in `llvm` on OSX does not work, needs to be installed from brew: - `brew install llvm` - LLVM installed from brew is keg only, and path to it must be provided in the profile file, in terminal run `echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc` or `echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.bash_profile` depending on your default shell. You can find your default shell with `echo $SHELL` - - Reload your shell with `source ~/.zshrc` or `source ~/.bash_profile` - - install `protoc` - protobuf compiler: - - on debian/ubuntu: `apt install -y protobuf-compiler` - - on Mac: `brew install protobuf` - - on other systems, install most recent version from [Protocol Buffers releases page](https://github.com/protocolbuffers/protobuf/releases) (tested with protobuf 22.4) - - if needed, set PROTOC environment variable to location of `protoc` binary + - Reload your shell with `source ~/.zshrc` or `source ~/.bash_profile` - `cargo install wasm-bindgen-cli@0.2.85` - *double-check that wasm-bindgen-cli version above matches wasm-bindgen version in Cargo.lock file* - *Depending on system, additional packages may need to be installed as a prerequisite for wasm-bindgen-cli. If anything is missing, installation will error and prompt what packages are missing (i.e. clang, llvm, libssl-dev)* diff --git a/mkdocs.yml b/mkdocs.yml index 64637fd664d..b1142098254 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -2,41 +2,60 @@ site_name: Dash Platform plugins: - redirects: redirect_maps: - 'SDK/README.md': 'https://dashplatform.readme.io/docs/dash-sdk-overview' - 'SDK/Overview.md': 'https://dashplatform.readme.io/docs/dash-sdk-overview' - 'SDK/examples/fetch-an-identity-from-its-name.md': 'https://dashplatform.readme.io/docs/dash-sdk-examples-fetch-an-identity-from-its-name' - 'SDK/examples/generate-a-new-mnemonic.md': 'https://dashplatform.readme.io/docs/dash-sdk-examples-generate-a-new-mnemonic' - 'SDK/examples/pay-to-another-address.md': 'https://dashplatform.readme.io/docs/dash-sdk-examples-paying-to-another-address' - 'SDK/examples/receive-money-and-check-balance.md': 'https://dashplatform.readme.io/docs/dash-sdk-examples-receive-money-and-check-balance' - 'SDK/examples/sign-and-verify-messages.md': 'https://dashplatform.readme.io/docs/dash-sdk-examples-sign-and-verify-messages' - 'SDK/examples/use-different-account.md': 'https://dashplatform.readme.io/docs/dash-sdk-examples-use-different-account' - 'SDK/getting-started/about-schemas.md': 'https://dashplatform.readme.io/docs/dash-sdk-getting-started-about-schemas' - 'SDK/getting-started/core-concepts.md': 'https://dashplatform.readme.io/docs/dash-sdk-getting-started-core-concepts' - 'SDK/getting-started/dash-platform-applications.md': 'https://dashplatform.readme.io/docs/dash-sdk-getting-started-dash-platform-applications' - 'SDK/getting-started/multiple-apps.md': 'https://dashplatform.readme.io/docs/dash-sdk-getting-started-working-with-multiple-apps' - 'SDK/getting-started/quickstart.md': 'https://dashplatform.readme.io/docs/dash-sdk-getting-started-quick-start' - 'SDK/getting-started/with-typescript.md': 'https://dashplatform.readme.io/docs/dash-sdk-getting-started-with-typescript' - 'SDK/platform/about-platform.md': 'https://dashplatform.readme.io/docs/dash-sdk-platform' - 'SDK/platform/contracts/about-contracts.md': 'https://dashplatform.readme.io/docs/dash-sdk-contracts' - 'SDK/platform/contracts/create.md': 'https://dashplatform.readme.io/docs/dash-sdk-contracts-create' - 'SDK/platform/contracts/get.md': 'https://dashplatform.readme.io/docs/dash-sdk-contracts-get' - 'SDK/platform/contracts/publish.md': 'https://dashplatform.readme.io/docs/dash-sdk-contracts-publish' - 'SDK/platform/contracts/update.md': 'https://dashplatform.readme.io/docs/dash-sdk-contracts-update' - 'SDK/platform/documents/about-documents.md': 'https://dashplatform.readme.io/docs/dash-sdk-documents' - 'SDK/platform/documents/broadcast.md': 'https://dashplatform.readme.io/docs/dash-sdk-documents-broadcast' - 'SDK/platform/documents/create.md': 'https://dashplatform.readme.io/docs/dash-sdk-documents-create' - 'SDK/platform/documents/get.md': 'https://dashplatform.readme.io/docs/dash-sdk-documents-get' - 'SDK/platform/identities/about-identity.md': 'https://dashplatform.readme.io/docs/dash-sdk-identities' - 'SDK/platform/identities/get.md': 'https://dashplatform.readme.io/docs/dash-sdk-identities-get' - 'SDK/platform/identities/register.md': 'https://dashplatform.readme.io/docs/dash-sdk-identities-register' - 'SDK/platform/identities/topUp.md': 'https://dashplatform.readme.io/docs/dash-sdk-identities-topup' - 'SDK/platform/names/about-dpns.md': 'https://dashplatform.readme.io/docs/dash-sdk-names' - 'SDK/platform/names/register.md': 'https://dashplatform.readme.io/docs/dash-sdk-names-register' - 'SDK/platform/names/resolve.md': 'https://dashplatform.readme.io/docs/dash-sdk-names-resolve' - 'SDK/platform/names/resolveByRecord.md': 'https://dashplatform.readme.io/docs/dash-sdk-names-resolvebyrecord' - 'SDK/platform/names/search.md': 'https://dashplatform.readme.io/docs/dash-sdk-names-search' - 'SDK/usage/dapi.md': 'https://dashplatform.readme.io/docs/dash-sdk-usage-dapi' - 'SDK/usage/dashcorelib-primitives.md': 'https://dashplatform.readme.io/docs/dash-sdk-usage-dashcore-lib-primitives' - 'SDK/wallet/about-wallet-lib.md': 'https://dashplatform.readme.io/docs/dash-sdk-wallet' - 'SDK/wallet/accounts.md': 'https://dashplatform.readme.io/docs/dash-sdk-wallet-accounts' - 'SDK/wallet/signing-encrypt.md': 'https://dashplatform.readme.io/docs/dash-sdk-wallet-signing-encrypt' + 'SDK/README.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/overview.html' + 'SDK/Overview.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/overview.html' + 'SDK/examples/fetch-an-identity-from-its-name.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/examples/fetch-an-identity-from-its-name.html' + 'SDK/examples/generate-a-new-mnemonic.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/examples/generate-a-new-mnemonic.html' + 'SDK/examples/pay-to-another-address.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/examples/paying-to-another-address.html' + 'SDK/examples/receive-money-and-check-balance.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/examples/receive-money-and-check-balance.html' + 'SDK/examples/sign-and-verify-messages.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/examples/sign-and-verify-messages.html' + 'SDK/examples/use-different-account.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/examples/use-different-account.html' + 'SDK/getting-started/about-schemas.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/getting-started/about-schemas.html' + 'SDK/getting-started/core-concepts.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/getting-started/core-concepts.html' + 'SDK/getting-started/dash-platform-applications.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/getting-started/dash-platform-applications.html' + 'SDK/getting-started/multiple-apps.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/getting-started/working-with-multiple-apps.html' + 'SDK/getting-started/quickstart.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/getting-started/quick-start.html' + 'SDK/getting-started/with-typescript.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/getting-started/with-typescript.html' + 'SDK/platform/about-platform.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/platform.html' + 'SDK/platform/contracts/about-contracts.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/contracts/contracts.html' + 'SDK/platform/contracts/create.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/contracts/create.html' + 'SDK/platform/contracts/get.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/contracts/get.html' + 'SDK/platform/contracts/publish.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/contracts/publish.html' + 'SDK/platform/contracts/update.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/contracts/update.html' + 'SDK/platform/documents/about-documents.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/documents/documents.html' + 'SDK/platform/documents/broadcast.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/documents/broadcast.html' + 'SDK/platform/documents/create.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/documents/create.html' + 'SDK/platform/documents/get.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/documents/get.html' + 'SDK/platform/identities/about-identity.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/identities/identities.html' + 'SDK/platform/identities/get.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/identities/get.html' + 'SDK/platform/identities/register.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/identities/register.html' + 'SDK/platform/identities/topUp.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/identities/register.html' + 'SDK/platform/names/about-dpns.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/names/names.html' + 'SDK/platform/names/register.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/names/register.html' + 'SDK/platform/names/resolve.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/names/resolve.html' + 'SDK/platform/names/resolveByRecord.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/names/resolvebyrecord.html' + 'SDK/platform/names/search.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/platform/names/search.html' + 'SDK/usage/dapi.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/usage/dapi.html#' + 'SDK/usage/dashcorelib-primitives.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/usage/dashcore-lib-primitives.html' + 'SDK/wallet/about-wallet-lib.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/wallet/wallet.html' + 'SDK/wallet/accounts.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/wallet/accounts.html' + 'SDK/wallet/signing-encrypt.md': 'https://docs.dash.org/projects/platform/en/stable/docs/sdk-js/wallet/signing-encrypt.html' + 'DAPI-Client/README.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/overview.html' + 'DAPI-Client/getting-started/quickstart.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/quick-start.html' + 'DAPI-Client/usage/application/DAPIClient.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/dapiclient.html' + 'DAPI-Client/usage/application/core/broadcastTransaction.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/broadcasttransaction.html' + 'DAPI-Client/usage/application/core/getBestBlockHash.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/getbestblockhash.html' + 'DAPI-Client/usage/application/core/getBlockByHash.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/getblockbyhash.html' + 'DAPI-Client/usage/application/core/getBlockByHeight.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/getblockbyheight.html' + 'DAPI-Client/usage/application/core/getBlockHash.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/getblockhash.html' + 'DAPI-Client/usage/application/core/getStatus.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/getstatus.html' + 'DAPI-Client/usage/application/core/getTransaction.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/gettransaction.html' + 'DAPI-Client/usage/application/core/subscribeToTransactionsWithProofs.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/subscribetotransactionswithproofs.html' + 'DAPI-Client/usage/application/core/subscribeToMasternodeList.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/subscribetomasternodelist.html' + 'DAPI-Client/usage/application/core/subscribeToBlockHeadersWithChainLocks.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/core/subscribetoblockheaderswithchainlocks.html' + 'DAPI-Client/usage/application/platform/broadcastStateTransition.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/platform/broadcaststatetransition.html' + 'DAPI-Client/usage/application/getDataContract.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/platform/getdatacontract.html' + 'DAPI-Client/usage/application/getDocuments.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/platform/getdocuments.html' + 'DAPI-Client/usage/application/getIdentity.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/platform/getidentity.html' + 'DAPI-Client/usage/application/getIdentityByFirstPublicKey.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/platform/getidentitybyfirstpublickey.html' + 'DAPI-Client/usage/application/getIdentityIdByFirstPublicKey.md': 'https://docs.dash.org/projects/platform/en/stable/docs/dapi-client-js/usage/platform/getidentityidbyfirstpublickey.html' diff --git a/package.json b/package.json index cc263f63a6b..041d54ec125 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/platform", - "version": "0.25.21", + "version": "1.0.0-dev.15", "private": true, "scripts": { "setup": "yarn install && yarn run build && yarn run configure", @@ -69,8 +69,8 @@ "resolutions": { "elliptic": "^6.5.4", "bn.js": "4.12.0", - "ejs": "^3.1.7", "fast-json-patch": "^3.1.1", + "node-tar": "^6.2.1", "oclif@3.4.2": "patch:oclif@npm:3.4.2#.yarn/patches/oclif-npm-3.4.2-a655d32eed.patch", "qs": "^6.7.3", "engine.io": "^6.4.2", @@ -84,10 +84,14 @@ "browserify-sign": "4.2.2", "istanbul-lib-processinfo": "2.0.3", "@babel/core": "7.23.3", + "tar": "^6.2.1", "tsconfig-paths": "4.2.0", "ansi-regex": "5.0.1", "cacache": "18.0.0", - "node-gyp": "10.0.1" + "node-gyp": "10.0.1", + "follow-redirects": "^1.15.5", + "socks": "^2.8.1", + "ws": "^8.17.1" }, "dependencies": { "node-gyp": "^10.0.1" diff --git a/packages/bench-suite/benchmarks/basicValidation.js b/packages/bench-suite/benchmarks/basicValidation.js index cc1eb900d57..40c0944241c 100644 --- a/packages/bench-suite/benchmarks/basicValidation.js +++ b/packages/bench-suite/benchmarks/basicValidation.js @@ -1,6 +1,6 @@ const { PrivateKey } = require('@dashevo/dashcore-lib'); -const dpnsDocumentTypes = require('@dashevo/dpns-contract/schema/dpns-contract-documents'); +const dpnsDocumentTypes = require('@dashevo/dpns-contract/schema/v1/dpns-contract-documents.json'); // const { DashPlatformProtocol, Identity, Identifier, default: loadWasmDpp } = require('@dashevo/wasm-dpp'); const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); diff --git a/packages/bench-suite/benchmarks/documents/dpns.js b/packages/bench-suite/benchmarks/documents/dpns.js index 605862943ca..a1062007b1b 100644 --- a/packages/bench-suite/benchmarks/documents/dpns.js +++ b/packages/bench-suite/benchmarks/documents/dpns.js @@ -1,6 +1,6 @@ const crypto = require('crypto'); -const dpnsDocumentTypes = require('@dashevo/dpns-contract/schema/dpns-contract-documents'); +const dpnsDocumentTypes = require('@dashevo/dpns-contract/schema/v1/dpns-contract-documents.json'); const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); diff --git a/packages/bench-suite/package.json b/packages/bench-suite/package.json index 1fb2397a82e..53c0e10d0cb 100644 --- a/packages/bench-suite/package.json +++ b/packages/bench-suite/package.json @@ -1,14 +1,14 @@ { "name": "@dashevo/bench-suite", "private": true, - "version": "0.25.21", + "version": "1.0.0-dev.15", "description": "Dash Platform benchmark tool", "scripts": { "bench": "node ./bin/bench.js", "lint": "" }, "dependencies": { - "@dashevo/dashcore-lib": "~0.21.0", + "@dashevo/dashcore-lib": "~0.21.1", "@dashevo/dpns-contract": "workspace:*", "@dashevo/wallet-lib": "workspace:*", "@dashevo/wasm-dpp": "workspace:*", diff --git a/packages/check-features/Cargo.toml b/packages/check-features/Cargo.toml new file mode 100644 index 00000000000..72aa4dd27d0 --- /dev/null +++ b/packages/check-features/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "check-features" +version = "0.1.1-3" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +toml = "0.8.12" \ No newline at end of file diff --git a/packages/check-features/src/main.rs b/packages/check-features/src/main.rs new file mode 100644 index 00000000000..c74fa560c84 --- /dev/null +++ b/packages/check-features/src/main.rs @@ -0,0 +1,136 @@ +use std::fs; +use std::process::Command; +use toml::Value; + +fn main() { + let crates = [ + "rs-sdk", + "rs-drive-abci", + "rs-dpp", + "rs-drive", + "rs-drive-proof-verifier", + ]; + + for specific_crate in crates { + check_crate(specific_crate) + } +} + +fn check_crate(crate_name: &str) { + // Construct the path to the Cargo.toml file for each crate + let cargo_toml_path = format!("packages/{}/Cargo.toml", crate_name); + + // Read and parse the Cargo.toml file + let cargo_toml_content = fs::read_to_string(cargo_toml_path) + .unwrap_or_else(|_| panic!("Failed to read Cargo.toml for {}", crate_name)); + + let cargo_toml: Value = cargo_toml_content + .parse() + .expect("Failed to parse Cargo.toml"); + + let features = cargo_toml + .get("features") + .expect("No features in Cargo.toml"); + + let name = cargo_toml + .get("package") + .expect("No package in Cargo.toml") + .get("name") + .expect("expected name in Cargo.toml"); + + println!("Checking crate {} with default features", crate_name); + + // Change directory to the crate's directory and run cargo check for the specific feature + let status = Command::new("cargo") + .current_dir(format!("packages/{}", crate_name)) // Set the current directory to the crate's directory + .arg("check") + .status() + .expect("Failed to execute cargo check"); + + if !status.success() { + println!( + "Feature check failed in crate {} with default features", + crate_name + ); + println!("cargo check -p {}", name); + std::process::exit(1); + } + + println!("Checking crate {} with no default features", crate_name); + + // Change directory to the crate's directory and run cargo check for the specific feature + let status = Command::new("cargo") + .current_dir(format!("packages/{}", crate_name)) // Set the current directory to the crate's directory + .arg("check") + .arg("--no-default-features") + .status() + .expect("Failed to execute cargo check"); + + if !status.success() { + println!( + "Check failed in crate {} with no default features", + crate_name + ); + println!("cargo check -p {} --no-default-features", name); + std::process::exit(1); + } + + for (feature, _) in features.as_table().unwrap().iter() { + // Skip special feature groups + if feature == "default" || feature.ends_with("features") { + continue; + } + + println!( + "Checking feature: {} in crate {} with default features", + feature, crate_name + ); + + // Change directory to the crate's directory and run cargo check for the specific feature + let status = Command::new("cargo") + .current_dir(format!("packages/{}", crate_name)) // Set the current directory to the crate's directory + .arg("check") + .arg("--features") + .arg(feature) + .status() + .expect("Failed to execute cargo check"); + + if !status.success() { + println!( + "Feature check failed for feature: {} in crate {} with default features", + feature, crate_name + ); + println!("cargo check -p {} --features {}", name, feature); + std::process::exit(1); + } + + println!( + "Checking feature: {} in crate {} with no default features", + feature, crate_name + ); + + // Change directory to the crate's directory and run cargo check for the specific feature + let status = Command::new("cargo") + .current_dir(format!("packages/{}", crate_name)) // Set the current directory to the crate's directory + .arg("check") + .arg("--features") + .arg(feature) + .arg("--no-default-features") + .status() + .expect("Failed to execute cargo check"); + + if !status.success() { + println!( + "Feature check failed for feature: {} in crate {} with no default features", + feature, crate_name + ); + println!( + "cargo check -p {} --features {} --no-default-features", + name, feature + ); + std::process::exit(1); + } + } + + println!("All features checked successfully on {}", crate_name); +} diff --git a/packages/dapi-grpc/.gitignore b/packages/dapi-grpc/.gitignore new file mode 100644 index 00000000000..e8aa2e11061 --- /dev/null +++ b/packages/dapi-grpc/.gitignore @@ -0,0 +1,2 @@ +src/core/*/ +src/platform/*/ diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index 7160550b714..21e63ea3e3e 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -1,36 +1,48 @@ [package] name = "dapi-grpc" description = "GRPC client for Dash Platform" -version = "0.25.21" +version = "1.0.0-dev.15" authors = [ - "Samuel Westrich ", - "Igor Markin ", - "Łukasz Klimek ", - "Anton Suprunchuk ", - "Ivan Shumkov ", + "Samuel Westrich ", + "Igor Markin ", + "Łukasz Klimek ", + "Anton Suprunchuk ", + "Ivan Shumkov ", ] edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" [features] -default = ["core", "platform", "client", "serde"] +default = ["core", "platform", "client"] core = [] platform = [] # Re-export Dash Platform protobuf types as `dapi_grpc::platform::proto` +# Note: client needs tls and tls-roots to connect to testnet which uses TLS. tenderdash-proto = [] -client = ["tonic/channel", "tonic/tls", "tonic/tls-roots", "platform"] +client = [ + "tonic/channel", + "tonic/transport", + "tonic/tls", + "tonic/tls-roots", + "tonic/tls-webpki-roots", + "platform", +] +server = ["tonic/channel", "tonic/transport", "platform"] serde = ["dep:serde", "dep:serde_bytes"] +mocks = ["serde", "dep:serde_json"] [dependencies] -prost = { version = "0.11.9" } -tonic = { version = "0.9.2", features = [ - "codegen", - "prost", +prost = { version = "0.12.3" } +futures-core = "0.3.30" +tonic = { version = "0.11", features = [ + "codegen", + "prost", ], default-features = false } -serde = { version = "1.0.171", optional = true, features = ["derive"] } +serde = { version = "1.0.197", optional = true, features = ["derive"] } serde_bytes = { version = "0.11.12", optional = true } -tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci" } +serde_json = { version = "1.0", optional = true } +tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci", version = "0.14.0-dev.12", default-features = false } dapi-grpc-macros = { path = "../rs-dapi-grpc-macros" } platform-version = { path = "../rs-platform-version" } @@ -49,4 +61,9 @@ name = "platform_example" path = "clients/platform/v0/rust/platform_example.rs" [package.metadata.cargo-machete] -ignored = ["platform-version", "serde_bytes"] +ignored = [ + "platform-version", + "serde_bytes", + "futures-core", + "dapi-grpc-macros", +] diff --git a/packages/dapi-grpc/build.rs b/packages/dapi-grpc/build.rs index 713494f292e..7237fa7fc70 100644 --- a/packages/dapi-grpc/build.rs +++ b/packages/dapi-grpc/build.rs @@ -1,12 +1,35 @@ use std::{ fs::{create_dir_all, remove_dir_all}, path::PathBuf, + process::exit, }; use tonic_build::Builder; +const SERDE_WITH_BYTES: &str = r#"#[cfg_attr(feature = "serde", serde(with = "serde_bytes"))]"#; +const SERDE_WITH_BASE64: &str = + r#"#[cfg_attr(feature = "serde", serde(with = "crate::deserialization::vec_base64string"))]"#; +const SERDE_WITH_STRING: &str = + r#"#[cfg_attr(feature = "serde", serde(with = "crate::deserialization::from_to_string"))]"#; + fn main() { - generate().expect("failed to compile protobuf definitions"); + let core = MappingConfig::new( + PathBuf::from("protos/core/v0/core.proto"), + PathBuf::from("src/core"), + ); + + configure_core(core) + .generate() + .expect("generate core proto"); + + let platform = MappingConfig::new( + PathBuf::from("protos/platform/v0/platform.proto"), + PathBuf::from("src/platform"), + ); + + configure_platform(platform) + .generate() + .expect("generate platform proto"); println!("cargo:rerun-if-changed=./protos"); println!("cargo:rerun-if-env-changed=CARGO_FEATURE_SERDE"); @@ -18,29 +41,20 @@ struct MappingConfig { builder: Builder, proto_includes: Vec, } -/// Generate Rust definitions from Protobuf definitions -pub fn generate() -> Result<(), std::io::Error> { - let core = MappingConfig::new( - PathBuf::from("protos/core/v0/core.proto"), - PathBuf::from("src/core/proto"), - ); - core.generate().unwrap(); - - let mut platform = MappingConfig::new( - PathBuf::from("protos/platform/v0/platform.proto"), - PathBuf::from("src/platform/proto"), - ); +fn configure_platform(mut platform: MappingConfig) -> MappingConfig { // Derive features for versioned messages // // "GetConsensusParamsRequest" is excluded as this message does not support proofs - const VERSIONED_REQUESTS: [&str; 15] = [ + const VERSIONED_REQUESTS: [&str; 19] = [ "GetDataContractHistoryRequest", "GetDataContractRequest", "GetDataContractsRequest", "GetDocumentsRequest", "GetIdentitiesByPublicKeyHashesRequest", "GetIdentitiesRequest", + "GetIdentityNonceRequest", + "GetIdentityContractNonceRequest", "GetIdentityBalanceAndRevisionRequest", "GetIdentityBalanceRequest", "GetIdentityByPublicKeyHashRequest", @@ -50,10 +64,12 @@ pub fn generate() -> Result<(), std::io::Error> { "WaitForStateTransitionResultRequest", "GetProtocolVersionUpgradeStateRequest", "GetProtocolVersionUpgradeVoteStatusRequest", + "GetPathElementsRequest", + "GetIdentitiesContractKeysRequest", ]; // "GetConsensusParamsResponse" is excluded as this message does not support proofs - const VERSIONED_RESPONSES: [&str; 16] = [ + const VERSIONED_RESPONSES: [&str; 20] = [ "GetDataContractHistoryResponse", "GetDataContractResponse", "GetDataContractsResponse", @@ -62,6 +78,8 @@ pub fn generate() -> Result<(), std::io::Error> { "GetIdentitiesResponse", "GetIdentityBalanceAndRevisionResponse", "GetIdentityBalanceResponse", + "GetIdentityNonceResponse", + "GetIdentityContractNonceResponse", "GetIdentityByPublicKeyHashResponse", "GetIdentityKeysResponse", "GetIdentityResponse", @@ -70,6 +88,8 @@ pub fn generate() -> Result<(), std::io::Error> { "GetEpochsInfoResponse", "GetProtocolVersionUpgradeStateResponse", "GetProtocolVersionUpgradeVoteStatusResponse", + "GetPathElementsResponse", + "GetIdentitiesContractKeysResponse", ]; // Derive VersionedGrpcMessage on requests @@ -92,66 +112,91 @@ pub fn generate() -> Result<(), std::io::Error> { .message_attribute(msg, r#"#[grpc_versions(0)]"#); } - #[cfg(feature = "serde")] + // All messages can be mocked. + let platform = platform.message_attribute(".", r#"#[derive( ::dapi_grpc_macros::Mockable)]"#); + let platform = platform .type_attribute( ".", - r#"#[derive(::serde::Serialize, ::serde::Deserialize)]"#, - ) - .type_attribute(".", r#"#[serde(rename_all = "snake_case")]"#) - .field_attribute("id", r#"#[serde(with = "serde_bytes")]"#) - .field_attribute("identity_id", r#"#[serde(with = "serde_bytes")]"#) - .field_attribute( - "ids", - r#"#[serde(with = "crate::deserialization::vec_base64string")]"#, - ) - .field_attribute( - "ResponseMetadata.height", - r#"#[serde(with = "crate::deserialization::from_to_string")]"#, - ) - .field_attribute( - "ResponseMetadata.time_ms", - r#"#[serde(with = "crate::deserialization::from_to_string")]"#, + r#"#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]"#, ) - .field_attribute( - "start_at_ms", - r#"#[serde(with = "crate::deserialization::from_to_string")]"#, - ) - .field_attribute("public_key_hash", r#"#[serde(with = "serde_bytes")]"#) - .field_attribute( - "public_key_hashes", - r#"#[serde(with = "crate::deserialization::vec_base64string")]"#, + .type_attribute( + ".", + r#"#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]"#, ) + .field_attribute("id", SERDE_WITH_BYTES) + .field_attribute("identity_id", SERDE_WITH_BYTES) + .field_attribute("ids", SERDE_WITH_BASE64) + .field_attribute("ResponseMetadata.height", SERDE_WITH_STRING) + .field_attribute("ResponseMetadata.time_ms", SERDE_WITH_STRING) + .field_attribute("start_at_ms", SERDE_WITH_STRING) + .field_attribute("public_key_hash", SERDE_WITH_BYTES) + .field_attribute("public_key_hashes", SERDE_WITH_BASE64) // Get documents fields - .field_attribute("data_contract_id", r#"#[serde(with = "serde_bytes")]"#) - .field_attribute("where", r#"#[serde(with = "serde_bytes")]"#) - .field_attribute("order_by", r#"#[serde(with = "serde_bytes")]"#) + .field_attribute("data_contract_id", SERDE_WITH_BYTES) + .field_attribute("where", SERDE_WITH_BYTES) + .field_attribute("order_by", SERDE_WITH_BYTES) // Proof fields - .field_attribute("Proof.grovedb_proof", r#"#[serde(with = "serde_bytes")]"#) - .field_attribute("Proof.quorum_hash", r#"#[serde(with = "serde_bytes")]"#) - .field_attribute("Proof.signature", r#"#[serde(with = "serde_bytes")]"#) - .field_attribute("Proof.block_id_hash", r#"#[serde(with = "serde_bytes")]"#); + .field_attribute("Proof.grovedb_proof", SERDE_WITH_BYTES) + .field_attribute("Proof.quorum_hash", SERDE_WITH_BYTES) + .field_attribute("Proof.signature", SERDE_WITH_BYTES) + .field_attribute("Proof.block_id_hash", SERDE_WITH_BYTES); - platform.generate().unwrap(); + #[allow(clippy::let_and_return)] + platform +} - Ok(()) +fn configure_core(core: MappingConfig) -> MappingConfig { + // All messages can be mocked. + let core = core.message_attribute(".", r#"#[derive(::dapi_grpc_macros::Mockable)]"#); + + // Serde support + let core = core.type_attribute( + ".", + r#"#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]"#, + ); + + #[allow(clippy::let_and_return)] + core } impl MappingConfig { + /// Create a new MappingConfig instance. + /// + /// ## Arguments + /// + /// * `protobuf_file` - Path to the protobuf file to use as input. + /// * `out_dir` - Output directory where subdirectories for generated files will be created. + /// Depending on the features, either `client`, `server` or `client_server` subdirectory + /// will be created inside `out_dir`. fn new(protobuf_file: PathBuf, out_dir: PathBuf) -> Self { let protobuf_file = abs_path(&protobuf_file); - let out_dir = abs_path(&out_dir); + + let build_server = cfg!(feature = "server"); + let build_client = cfg!(feature = "client"); + + // Depending on the features, we need to build the server, client or both. + // We save these artifacts in separate directories to avoid overwriting the generated files + // when another crate requires different features. + let out_dir_suffix = match (build_server, build_client) { + (true, true) => "client_server", + (true, false) => "server", + (false, true) => "client", + (false, false) => { + println!("WARNING: At least one of the features 'server' or 'client' must be enabled; dapi-grpc will not generate any files."); + exit(0) + } + }; + + let out_dir = abs_path(&out_dir.join(out_dir_suffix)); let builder = tonic_build::configure() - .build_server(false) + .build_server(build_server) + .build_client(build_client) + .build_transport(build_server || build_client) .out_dir(out_dir.clone()) .protoc_arg("--experimental_allow_proto3_optional"); - #[cfg(feature = "client")] - let builder = builder.build_client(true).build_transport(true); - #[cfg(not(feature = "client"))] - let builder = builder.build_client(false).build_transport(false); - Self { protobuf_file, out_dir, diff --git a/packages/dapi-grpc/clients/core/v0/java/org/dash/platform/dapi/v0/CoreGrpc.java b/packages/dapi-grpc/clients/core/v0/java/org/dash/platform/dapi/v0/CoreGrpc.java index 13210195573..029ad20c799 100644 --- a/packages/dapi-grpc/clients/core/v0/java/org/dash/platform/dapi/v0/CoreGrpc.java +++ b/packages/dapi-grpc/clients/core/v0/java/org/dash/platform/dapi/v0/CoreGrpc.java @@ -15,35 +15,66 @@ private CoreGrpc() {} public static final String SERVICE_NAME = "org.dash.platform.dapi.v0.Core"; // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor getGetStatusMethod; + private static volatile io.grpc.MethodDescriptor getGetBlockchainStatusMethod; @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "getStatus", - requestType = org.dash.platform.dapi.v0.CoreOuterClass.GetStatusRequest.class, - responseType = org.dash.platform.dapi.v0.CoreOuterClass.GetStatusResponse.class, + fullMethodName = SERVICE_NAME + '/' + "getBlockchainStatus", + requestType = org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusRequest.class, + responseType = org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusResponse.class, methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor getGetStatusMethod() { - io.grpc.MethodDescriptor getGetStatusMethod; - if ((getGetStatusMethod = CoreGrpc.getGetStatusMethod) == null) { + public static io.grpc.MethodDescriptor getGetBlockchainStatusMethod() { + io.grpc.MethodDescriptor getGetBlockchainStatusMethod; + if ((getGetBlockchainStatusMethod = CoreGrpc.getGetBlockchainStatusMethod) == null) { synchronized (CoreGrpc.class) { - if ((getGetStatusMethod = CoreGrpc.getGetStatusMethod) == null) { - CoreGrpc.getGetStatusMethod = getGetStatusMethod = - io.grpc.MethodDescriptor.newBuilder() + if ((getGetBlockchainStatusMethod = CoreGrpc.getGetBlockchainStatusMethod) == null) { + CoreGrpc.getGetBlockchainStatusMethod = getGetBlockchainStatusMethod = + io.grpc.MethodDescriptor.newBuilder() .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getStatus")) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getBlockchainStatus")) .setSampledToLocalTracing(true) .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.dash.platform.dapi.v0.CoreOuterClass.GetStatusRequest.getDefaultInstance())) + org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusRequest.getDefaultInstance())) .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.dash.platform.dapi.v0.CoreOuterClass.GetStatusResponse.getDefaultInstance())) - .setSchemaDescriptor(new CoreMethodDescriptorSupplier("getStatus")) + org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusResponse.getDefaultInstance())) + .setSchemaDescriptor(new CoreMethodDescriptorSupplier("getBlockchainStatus")) .build(); } } } - return getGetStatusMethod; + return getGetBlockchainStatusMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetMasternodeStatusMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getMasternodeStatus", + requestType = org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusRequest.class, + responseType = org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetMasternodeStatusMethod() { + io.grpc.MethodDescriptor getGetMasternodeStatusMethod; + if ((getGetMasternodeStatusMethod = CoreGrpc.getGetMasternodeStatusMethod) == null) { + synchronized (CoreGrpc.class) { + if ((getGetMasternodeStatusMethod = CoreGrpc.getGetMasternodeStatusMethod) == null) { + CoreGrpc.getGetMasternodeStatusMethod = getGetMasternodeStatusMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getMasternodeStatus")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusResponse.getDefaultInstance())) + .setSchemaDescriptor(new CoreMethodDescriptorSupplier("getMasternodeStatus")) + .build(); + } + } + } + return getGetMasternodeStatusMethod; } private static volatile io.grpc.MethodDescriptor getGetBlockMethod() { return getGetBlockMethod; } + private static volatile io.grpc.MethodDescriptor getGetBestBlockHeightMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getBestBlockHeight", + requestType = org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightRequest.class, + responseType = org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetBestBlockHeightMethod() { + io.grpc.MethodDescriptor getGetBestBlockHeightMethod; + if ((getGetBestBlockHeightMethod = CoreGrpc.getGetBestBlockHeightMethod) == null) { + synchronized (CoreGrpc.class) { + if ((getGetBestBlockHeightMethod = CoreGrpc.getGetBestBlockHeightMethod) == null) { + CoreGrpc.getGetBestBlockHeightMethod = getGetBestBlockHeightMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getBestBlockHeight")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightResponse.getDefaultInstance())) + .setSchemaDescriptor(new CoreMethodDescriptorSupplier("getBestBlockHeight")) + .build(); + } + } + } + return getGetBestBlockHeightMethod; + } + private static volatile io.grpc.MethodDescriptor getBroadcastTransactionMethod; @@ -232,6 +294,37 @@ org.dash.platform.dapi.v0.CoreOuterClass.TransactionsWithProofsResponse> getSubs return getSubscribeToTransactionsWithProofsMethod; } + private static volatile io.grpc.MethodDescriptor getSubscribeToMasternodeListMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "subscribeToMasternodeList", + requestType = org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListRequest.class, + responseType = org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + public static io.grpc.MethodDescriptor getSubscribeToMasternodeListMethod() { + io.grpc.MethodDescriptor getSubscribeToMasternodeListMethod; + if ((getSubscribeToMasternodeListMethod = CoreGrpc.getSubscribeToMasternodeListMethod) == null) { + synchronized (CoreGrpc.class) { + if ((getSubscribeToMasternodeListMethod = CoreGrpc.getSubscribeToMasternodeListMethod) == null) { + CoreGrpc.getSubscribeToMasternodeListMethod = getSubscribeToMasternodeListMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "subscribeToMasternodeList")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListResponse.getDefaultInstance())) + .setSchemaDescriptor(new CoreMethodDescriptorSupplier("subscribeToMasternodeList")) + .build(); + } + } + } + return getSubscribeToMasternodeListMethod; + } + /** * Creates a new async stub that supports all call types for the service */ @@ -282,9 +375,16 @@ public static abstract class CoreImplBase implements io.grpc.BindableService { /** */ - public void getStatus(org.dash.platform.dapi.v0.CoreOuterClass.GetStatusRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetStatusMethod(), responseObserver); + public void getBlockchainStatus(org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetBlockchainStatusMethod(), responseObserver); + } + + /** + */ + public void getMasternodeStatus(org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetMasternodeStatusMethod(), responseObserver); } /** @@ -294,6 +394,13 @@ public void getBlock(org.dash.platform.dapi.v0.CoreOuterClass.GetBlockRequest re io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetBlockMethod(), responseObserver); } + /** + */ + public void getBestBlockHeight(org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetBestBlockHeightMethod(), responseObserver); + } + /** */ public void broadcastTransaction(org.dash.platform.dapi.v0.CoreOuterClass.BroadcastTransactionRequest request, @@ -329,15 +436,29 @@ public void subscribeToTransactionsWithProofs(org.dash.platform.dapi.v0.CoreOute io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSubscribeToTransactionsWithProofsMethod(), responseObserver); } + /** + */ + public void subscribeToMasternodeList(org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSubscribeToMasternodeListMethod(), responseObserver); + } + @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) .addMethod( - getGetStatusMethod(), + getGetBlockchainStatusMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusRequest, + org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusResponse>( + this, METHODID_GET_BLOCKCHAIN_STATUS))) + .addMethod( + getGetMasternodeStatusMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( new MethodHandlers< - org.dash.platform.dapi.v0.CoreOuterClass.GetStatusRequest, - org.dash.platform.dapi.v0.CoreOuterClass.GetStatusResponse>( - this, METHODID_GET_STATUS))) + org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusRequest, + org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusResponse>( + this, METHODID_GET_MASTERNODE_STATUS))) .addMethod( getGetBlockMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( @@ -345,6 +466,13 @@ public void subscribeToTransactionsWithProofs(org.dash.platform.dapi.v0.CoreOute org.dash.platform.dapi.v0.CoreOuterClass.GetBlockRequest, org.dash.platform.dapi.v0.CoreOuterClass.GetBlockResponse>( this, METHODID_GET_BLOCK))) + .addMethod( + getGetBestBlockHeightMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightRequest, + org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightResponse>( + this, METHODID_GET_BEST_BLOCK_HEIGHT))) .addMethod( getBroadcastTransactionMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( @@ -380,6 +508,13 @@ public void subscribeToTransactionsWithProofs(org.dash.platform.dapi.v0.CoreOute org.dash.platform.dapi.v0.CoreOuterClass.TransactionsWithProofsRequest, org.dash.platform.dapi.v0.CoreOuterClass.TransactionsWithProofsResponse>( this, METHODID_SUBSCRIBE_TO_TRANSACTIONS_WITH_PROOFS))) + .addMethod( + getSubscribeToMasternodeListMethod(), + io.grpc.stub.ServerCalls.asyncServerStreamingCall( + new MethodHandlers< + org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListRequest, + org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListResponse>( + this, METHODID_SUBSCRIBE_TO_MASTERNODE_LIST))) .build(); } } @@ -400,10 +535,18 @@ protected CoreStub build( /** */ - public void getStatus(org.dash.platform.dapi.v0.CoreOuterClass.GetStatusRequest request, - io.grpc.stub.StreamObserver responseObserver) { + public void getBlockchainStatus(org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusRequest request, + io.grpc.stub.StreamObserver responseObserver) { io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getGetStatusMethod(), getCallOptions()), request, responseObserver); + getChannel().newCall(getGetBlockchainStatusMethod(), getCallOptions()), request, responseObserver); + } + + /** + */ + public void getMasternodeStatus(org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetMasternodeStatusMethod(), getCallOptions()), request, responseObserver); } /** @@ -414,6 +557,14 @@ public void getBlock(org.dash.platform.dapi.v0.CoreOuterClass.GetBlockRequest re getChannel().newCall(getGetBlockMethod(), getCallOptions()), request, responseObserver); } + /** + */ + public void getBestBlockHeight(org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetBestBlockHeightMethod(), getCallOptions()), request, responseObserver); + } + /** */ public void broadcastTransaction(org.dash.platform.dapi.v0.CoreOuterClass.BroadcastTransactionRequest request, @@ -453,6 +604,14 @@ public void subscribeToTransactionsWithProofs(org.dash.platform.dapi.v0.CoreOute io.grpc.stub.ClientCalls.asyncServerStreamingCall( getChannel().newCall(getSubscribeToTransactionsWithProofsMethod(), getCallOptions()), request, responseObserver); } + + /** + */ + public void subscribeToMasternodeList(org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncServerStreamingCall( + getChannel().newCall(getSubscribeToMasternodeListMethod(), getCallOptions()), request, responseObserver); + } } /** @@ -471,9 +630,16 @@ protected CoreBlockingStub build( /** */ - public org.dash.platform.dapi.v0.CoreOuterClass.GetStatusResponse getStatus(org.dash.platform.dapi.v0.CoreOuterClass.GetStatusRequest request) { + public org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusResponse getBlockchainStatus(org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusRequest request) { return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getGetStatusMethod(), getCallOptions(), request); + getChannel(), getGetBlockchainStatusMethod(), getCallOptions(), request); + } + + /** + */ + public org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusResponse getMasternodeStatus(org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetMasternodeStatusMethod(), getCallOptions(), request); } /** @@ -483,6 +649,13 @@ public org.dash.platform.dapi.v0.CoreOuterClass.GetBlockResponse getBlock(org.da getChannel(), getGetBlockMethod(), getCallOptions(), request); } + /** + */ + public org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightResponse getBestBlockHeight(org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetBestBlockHeightMethod(), getCallOptions(), request); + } + /** */ public org.dash.platform.dapi.v0.CoreOuterClass.BroadcastTransactionResponse broadcastTransaction(org.dash.platform.dapi.v0.CoreOuterClass.BroadcastTransactionRequest request) { @@ -519,6 +692,14 @@ public java.util.Iterator subscribeToMasternodeList( + org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListRequest request) { + return io.grpc.stub.ClientCalls.blockingServerStreamingCall( + getChannel(), getSubscribeToMasternodeListMethod(), getCallOptions(), request); + } } /** @@ -537,10 +718,18 @@ protected CoreFutureStub build( /** */ - public com.google.common.util.concurrent.ListenableFuture getStatus( - org.dash.platform.dapi.v0.CoreOuterClass.GetStatusRequest request) { + public com.google.common.util.concurrent.ListenableFuture getBlockchainStatus( + org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusRequest request) { return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getGetStatusMethod(), getCallOptions()), request); + getChannel().newCall(getGetBlockchainStatusMethod(), getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture getMasternodeStatus( + org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetMasternodeStatusMethod(), getCallOptions()), request); } /** @@ -551,6 +740,14 @@ public com.google.common.util.concurrent.ListenableFuture getBestBlockHeight( + org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetBestBlockHeightMethod(), getCallOptions()), request); + } + /** */ public com.google.common.util.concurrent.ListenableFuture broadcastTransaction( @@ -576,13 +773,16 @@ public com.google.common.util.concurrent.ListenableFuture implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -601,14 +801,22 @@ private static final class MethodHandlers implements @java.lang.SuppressWarnings("unchecked") public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { switch (methodId) { - case METHODID_GET_STATUS: - serviceImpl.getStatus((org.dash.platform.dapi.v0.CoreOuterClass.GetStatusRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); + case METHODID_GET_BLOCKCHAIN_STATUS: + serviceImpl.getBlockchainStatus((org.dash.platform.dapi.v0.CoreOuterClass.GetBlockchainStatusRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_MASTERNODE_STATUS: + serviceImpl.getMasternodeStatus((org.dash.platform.dapi.v0.CoreOuterClass.GetMasternodeStatusRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); break; case METHODID_GET_BLOCK: serviceImpl.getBlock((org.dash.platform.dapi.v0.CoreOuterClass.GetBlockRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_GET_BEST_BLOCK_HEIGHT: + serviceImpl.getBestBlockHeight((org.dash.platform.dapi.v0.CoreOuterClass.GetBestBlockHeightRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; case METHODID_BROADCAST_TRANSACTION: serviceImpl.broadcastTransaction((org.dash.platform.dapi.v0.CoreOuterClass.BroadcastTransactionRequest) request, (io.grpc.stub.StreamObserver) responseObserver); @@ -629,6 +837,10 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv serviceImpl.subscribeToTransactionsWithProofs((org.dash.platform.dapi.v0.CoreOuterClass.TransactionsWithProofsRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_SUBSCRIBE_TO_MASTERNODE_LIST: + serviceImpl.subscribeToMasternodeList((org.dash.platform.dapi.v0.CoreOuterClass.MasternodeListRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; default: throw new AssertionError(); } @@ -690,13 +902,16 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { if (result == null) { serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) .setSchemaDescriptor(new CoreFileDescriptorSupplier()) - .addMethod(getGetStatusMethod()) + .addMethod(getGetBlockchainStatusMethod()) + .addMethod(getGetMasternodeStatusMethod()) .addMethod(getGetBlockMethod()) + .addMethod(getGetBestBlockHeightMethod()) .addMethod(getBroadcastTransactionMethod()) .addMethod(getGetTransactionMethod()) .addMethod(getGetEstimatedTransactionFeeMethod()) .addMethod(getSubscribeToBlockHeadersWithChainLocksMethod()) .addMethod(getSubscribeToTransactionsWithProofsMethod()) + .addMethod(getSubscribeToMasternodeListMethod()) .build(); } } diff --git a/packages/dapi-grpc/clients/core/v0/nodejs/CorePromiseClient.js b/packages/dapi-grpc/clients/core/v0/nodejs/CorePromiseClient.js index 8cdd7f3086a..1fa77f20f2e 100644 --- a/packages/dapi-grpc/clients/core/v0/nodejs/CorePromiseClient.js +++ b/packages/dapi-grpc/clients/core/v0/nodejs/CorePromiseClient.js @@ -24,10 +24,14 @@ const { platform: { dapi: { v0: { - GetStatusRequest: PBJSGetStatusRequest, - GetStatusResponse: PBJSGetStatusResponse, + GetBlockchainStatusRequest: PBJSGetBlockchainStatusRequest, + GetBlockchainStatusResponse: PBJSGetBlockchainStatusResponse, + GetMasternodeStatusRequest: PBJSGetMasternodeStatusRequest, + GetMasternodeStatusResponse: PBJSGetMasternodeStatusResponse, GetBlockRequest: PBJSGetBlockRequest, GetBlockResponse: PBJSGetBlockResponse, + GetBestBlockHeightRequest: PBJSGetBestBlockHeightRequest, + GetBestBlockHeightResponse: PBJSGetBestBlockHeightResponse, BroadcastTransactionRequest: PBJSBroadcastTransactionRequest, BroadcastTransactionResponse: PBJSBroadcastTransactionResponse, GetTransactionRequest: PBJSGetTransactionRequest, @@ -38,6 +42,8 @@ const { GetEstimatedTransactionFeeResponse: PBJSGetEstimatedTransactionFeeResponse, TransactionsWithProofsRequest: PBJSTransactionsWithProofsRequest, TransactionsWithProofsResponse: PBJSTransactionsWithProofsResponse, + MasternodeListRequest: PBJSMasternodeListRequest, + MasternodeListResponse: PBJSMasternodeListResponse, }, }, }, @@ -46,13 +52,16 @@ const { } = require('./core_pbjs'); const { - GetStatusResponse: ProtocGetStatusResponse, + GetBlockchainStatusResponse: ProtocGetBlockchainStatusResponse, + GetMasternodeStatusResponse: ProtocGetMasternodeStatusResponse, GetBlockResponse: ProtocGetBlockResponse, + GetBestBlockHeightResponse: ProtocGetBestBlockHeightResponse, BroadcastTransactionResponse: ProtocBroadcastTransactionResponse, GetTransactionResponse: ProtocGetTransactionResponse, BlockHeadersWithChainLocksResponse: ProtocBlockHeadersWithChainLocksResponse, GetEstimatedTransactionFeeResponse: ProtocGetEstimatedTransactionFeeResponse, TransactionsWithProofsResponse: ProtocTransactionsWithProofsResponse, + MasternodeListResponse: ProtocMasternodeListResponse, } = require('./core_protoc'); const getCoreDefinition = require('../../../../lib/getCoreDefinition'); @@ -79,14 +88,22 @@ class CorePromiseClient { this.client = new CoreNodeJSClient(strippedHostname, credentials, options); - this.client.getStatus = promisify( - this.client.getStatus.bind(this.client), + this.client.getBlockchainStatus = promisify( + this.client.getBlockchainStatus.bind(this.client), + ); + + this.client.getMasternodeStatus = promisify( + this.client.getMasternodeStatus.bind(this.client), ); this.client.getBlock = promisify( this.client.getBlock.bind(this.client), ); + this.client.getBestBlockHeight = promisify( + this.client.getBestBlockHeight.bind(this.client), + ); + this.client.broadcastTransaction = promisify( this.client.broadcastTransaction.bind(this.client), ); @@ -101,28 +118,28 @@ class CorePromiseClient { } /** - * @param {!GetStatusRequest} getStatusRequest + * @param {!GetBlockchainStatusRequest} getBlockchainStatusRequest * @param {?Object} metadata * @param {CallOptions} [options={}] - * @return {Promise} + * @return {Promise} */ - getStatus(getStatusRequest, metadata = {}, options = {}) { + getBlockchainStatus(getBlockchainStatusRequest, metadata = {}, options = {}) { if (!isObject(metadata)) { throw new Error('metadata must be an object'); } - return this.client.getStatus( - getStatusRequest, + return this.client.getBlockchainStatus( + getBlockchainStatusRequest, convertObjectToMetadata(metadata), { interceptors: [ jsonToProtobufInterceptorFactory( jsonToProtobufFactory( - ProtocGetStatusResponse, - PBJSGetStatusResponse, + ProtocGetBlockchainStatusResponse, + PBJSGetBlockchainStatusResponse, ), protobufToJsonFactory( - PBJSGetStatusRequest, + PBJSGetBlockchainStatusRequest, ), ), ], @@ -162,6 +179,68 @@ class CorePromiseClient { ); } + /** + * @param {!GetBestBlockHeightRequest} getBestBlockHeightRequest + * @param {?Object} metadata + * @param {CallOptions} [options={}] + * @return {Promise} + */ + getBestBlockHeight(getBestBlockHeightRequest, metadata = {}, options = {}) { + if (!isObject(metadata)) { + throw new Error('metadata must be an object'); + } + + return this.client.getBestBlockHeight( + getBestBlockHeightRequest, + convertObjectToMetadata(metadata), + { + interceptors: [ + jsonToProtobufInterceptorFactory( + jsonToProtobufFactory( + ProtocGetBestBlockHeightResponse, + PBJSGetBestBlockHeightResponse, + ), + protobufToJsonFactory( + PBJSGetBestBlockHeightRequest, + ), + ), + ], + ...options, + }, + ); + } + + /** + * @param {!GetMasternodeStatusRequest} getMasternodeStatusRequest + * @param {?Object} metadata + * @param {CallOptions} [options={}] + * @return {Promise} + */ + getMasternodeStatus(getMasternodeStatusRequest, metadata = {}, options = {}) { + if (!isObject(metadata)) { + throw new Error('metadata must be an object'); + } + + return this.client.getMasternodeStatus( + getMasternodeStatusRequest, + convertObjectToMetadata(metadata), + { + interceptors: [ + jsonToProtobufInterceptorFactory( + jsonToProtobufFactory( + ProtocGetMasternodeStatusResponse, + PBJSGetMasternodeStatusResponse, + ), + protobufToJsonFactory( + PBJSGetMasternodeStatusRequest, + ), + ), + ], + ...options, + }, + ); + } + /** * @param {!BroadcastTransactionRequest} broadcastTransactionRequest * @param {?Object} metadata @@ -322,6 +401,38 @@ class CorePromiseClient { }, ); } + + /** + * @param {MasternodeListRequest} masternodeListRequest The request proto + * @param {?Object} metadata User defined call metadata + * @param {CallOptions} [options={}] + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ + subscribeToMasternodeList(masternodeListRequest, metadata = {}, options = {}) { + if (!isObject(metadata)) { + throw new Error('metadata must be an object'); + } + + return this.client.subscribeToMasternodeList( + masternodeListRequest, + convertObjectToMetadata(metadata), + { + interceptors: [ + jsonToProtobufInterceptorFactory( + jsonToProtobufFactory( + ProtocMasternodeListResponse, + PBJSMasternodeListResponse, + ), + protobufToJsonFactory( + PBJSMasternodeListRequest, + ), + ), + ], + ...options, + }, + ); + } } module.exports = CorePromiseClient; diff --git a/packages/dapi-grpc/clients/core/v0/nodejs/core_pbjs.js b/packages/dapi-grpc/clients/core/v0/nodejs/core_pbjs.js index cd62cc98c1b..20266d4be7c 100644 --- a/packages/dapi-grpc/clients/core/v0/nodejs/core_pbjs.js +++ b/packages/dapi-grpc/clients/core/v0/nodejs/core_pbjs.js @@ -87,35 +87,68 @@ $root.org = (function() { }; /** - * Callback as used by {@link org.dash.platform.dapi.v0.Core#getStatus}. + * Callback as used by {@link org.dash.platform.dapi.v0.Core#getBlockchainStatus}. * @memberof org.dash.platform.dapi.v0.Core - * @typedef getStatusCallback + * @typedef getBlockchainStatusCallback * @type {function} * @param {Error|null} error Error, if any - * @param {org.dash.platform.dapi.v0.GetStatusResponse} [response] GetStatusResponse + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse} [response] GetBlockchainStatusResponse */ /** - * Calls getStatus. - * @function getStatus + * Calls getBlockchainStatus. + * @function getBlockchainStatus * @memberof org.dash.platform.dapi.v0.Core * @instance - * @param {org.dash.platform.dapi.v0.IGetStatusRequest} request GetStatusRequest message or plain object - * @param {org.dash.platform.dapi.v0.Core.getStatusCallback} callback Node-style callback called with the error, if any, and GetStatusResponse + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusRequest} request GetBlockchainStatusRequest message or plain object + * @param {org.dash.platform.dapi.v0.Core.getBlockchainStatusCallback} callback Node-style callback called with the error, if any, and GetBlockchainStatusResponse * @returns {undefined} * @variation 1 */ - Object.defineProperty(Core.prototype.getStatus = function getStatus(request, callback) { - return this.rpcCall(getStatus, $root.org.dash.platform.dapi.v0.GetStatusRequest, $root.org.dash.platform.dapi.v0.GetStatusResponse, request, callback); - }, "name", { value: "getStatus" }); + Object.defineProperty(Core.prototype.getBlockchainStatus = function getBlockchainStatus(request, callback) { + return this.rpcCall(getBlockchainStatus, $root.org.dash.platform.dapi.v0.GetBlockchainStatusRequest, $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse, request, callback); + }, "name", { value: "getBlockchainStatus" }); /** - * Calls getStatus. - * @function getStatus + * Calls getBlockchainStatus. + * @function getBlockchainStatus * @memberof org.dash.platform.dapi.v0.Core * @instance - * @param {org.dash.platform.dapi.v0.IGetStatusRequest} request GetStatusRequest message or plain object - * @returns {Promise} Promise + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusRequest} request GetBlockchainStatusRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Core#getMasternodeStatus}. + * @memberof org.dash.platform.dapi.v0.Core + * @typedef getMasternodeStatusCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.GetMasternodeStatusResponse} [response] GetMasternodeStatusResponse + */ + + /** + * Calls getMasternodeStatus. + * @function getMasternodeStatus + * @memberof org.dash.platform.dapi.v0.Core + * @instance + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusRequest} request GetMasternodeStatusRequest message or plain object + * @param {org.dash.platform.dapi.v0.Core.getMasternodeStatusCallback} callback Node-style callback called with the error, if any, and GetMasternodeStatusResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Core.prototype.getMasternodeStatus = function getMasternodeStatus(request, callback) { + return this.rpcCall(getMasternodeStatus, $root.org.dash.platform.dapi.v0.GetMasternodeStatusRequest, $root.org.dash.platform.dapi.v0.GetMasternodeStatusResponse, request, callback); + }, "name", { value: "getMasternodeStatus" }); + + /** + * Calls getMasternodeStatus. + * @function getMasternodeStatus + * @memberof org.dash.platform.dapi.v0.Core + * @instance + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusRequest} request GetMasternodeStatusRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ @@ -152,6 +185,39 @@ $root.org = (function() { * @variation 2 */ + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Core#getBestBlockHeight}. + * @memberof org.dash.platform.dapi.v0.Core + * @typedef getBestBlockHeightCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.GetBestBlockHeightResponse} [response] GetBestBlockHeightResponse + */ + + /** + * Calls getBestBlockHeight. + * @function getBestBlockHeight + * @memberof org.dash.platform.dapi.v0.Core + * @instance + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightRequest} request GetBestBlockHeightRequest message or plain object + * @param {org.dash.platform.dapi.v0.Core.getBestBlockHeightCallback} callback Node-style callback called with the error, if any, and GetBestBlockHeightResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Core.prototype.getBestBlockHeight = function getBestBlockHeight(request, callback) { + return this.rpcCall(getBestBlockHeight, $root.org.dash.platform.dapi.v0.GetBestBlockHeightRequest, $root.org.dash.platform.dapi.v0.GetBestBlockHeightResponse, request, callback); + }, "name", { value: "getBestBlockHeight" }); + + /** + * Calls getBestBlockHeight. + * @function getBestBlockHeight + * @memberof org.dash.platform.dapi.v0.Core + * @instance + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightRequest} request GetBestBlockHeightRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link org.dash.platform.dapi.v0.Core#broadcastTransaction}. * @memberof org.dash.platform.dapi.v0.Core @@ -317,26 +383,59 @@ $root.org = (function() { * @variation 2 */ + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Core#subscribeToMasternodeList}. + * @memberof org.dash.platform.dapi.v0.Core + * @typedef subscribeToMasternodeListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.MasternodeListResponse} [response] MasternodeListResponse + */ + + /** + * Calls subscribeToMasternodeList. + * @function subscribeToMasternodeList + * @memberof org.dash.platform.dapi.v0.Core + * @instance + * @param {org.dash.platform.dapi.v0.IMasternodeListRequest} request MasternodeListRequest message or plain object + * @param {org.dash.platform.dapi.v0.Core.subscribeToMasternodeListCallback} callback Node-style callback called with the error, if any, and MasternodeListResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Core.prototype.subscribeToMasternodeList = function subscribeToMasternodeList(request, callback) { + return this.rpcCall(subscribeToMasternodeList, $root.org.dash.platform.dapi.v0.MasternodeListRequest, $root.org.dash.platform.dapi.v0.MasternodeListResponse, request, callback); + }, "name", { value: "subscribeToMasternodeList" }); + + /** + * Calls subscribeToMasternodeList. + * @function subscribeToMasternodeList + * @memberof org.dash.platform.dapi.v0.Core + * @instance + * @param {org.dash.platform.dapi.v0.IMasternodeListRequest} request MasternodeListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return Core; })(); - v0.GetStatusRequest = (function() { + v0.GetBlockchainStatusRequest = (function() { /** - * Properties of a GetStatusRequest. + * Properties of a GetBlockchainStatusRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetStatusRequest + * @interface IGetBlockchainStatusRequest */ /** - * Constructs a new GetStatusRequest. + * Constructs a new GetBlockchainStatusRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetStatusRequest. - * @implements IGetStatusRequest + * @classdesc Represents a GetBlockchainStatusRequest. + * @implements IGetBlockchainStatusRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetStatusRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusRequest=} [properties] Properties to set */ - function GetStatusRequest(properties) { + function GetBlockchainStatusRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -344,60 +443,60 @@ $root.org = (function() { } /** - * Creates a new GetStatusRequest instance using the specified properties. + * Creates a new GetBlockchainStatusRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetStatusRequest + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusRequest * @static - * @param {org.dash.platform.dapi.v0.IGetStatusRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetStatusRequest} GetStatusRequest instance + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusRequest} GetBlockchainStatusRequest instance */ - GetStatusRequest.create = function create(properties) { - return new GetStatusRequest(properties); + GetBlockchainStatusRequest.create = function create(properties) { + return new GetBlockchainStatusRequest(properties); }; /** - * Encodes the specified GetStatusRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusRequest.verify|verify} messages. + * Encodes the specified GetBlockchainStatusRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetStatusRequest + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusRequest * @static - * @param {org.dash.platform.dapi.v0.IGetStatusRequest} message GetStatusRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusRequest} message GetBlockchainStatusRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetStatusRequest.encode = function encode(message, writer) { + GetBlockchainStatusRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); return writer; }; /** - * Encodes the specified GetStatusRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusRequest.verify|verify} messages. + * Encodes the specified GetBlockchainStatusRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusRequest + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusRequest * @static - * @param {org.dash.platform.dapi.v0.IGetStatusRequest} message GetStatusRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusRequest} message GetBlockchainStatusRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetStatusRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetBlockchainStatusRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetStatusRequest message from the specified reader or buffer. + * Decodes a GetBlockchainStatusRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetStatusRequest + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetStatusRequest} GetStatusRequest + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusRequest} GetBlockchainStatusRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetStatusRequest.decode = function decode(reader, length) { + GetBlockchainStatusRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetStatusRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -410,100 +509,99 @@ $root.org = (function() { }; /** - * Decodes a GetStatusRequest message from the specified reader or buffer, length delimited. + * Decodes a GetBlockchainStatusRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusRequest + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetStatusRequest} GetStatusRequest + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusRequest} GetBlockchainStatusRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetStatusRequest.decodeDelimited = function decodeDelimited(reader) { + GetBlockchainStatusRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetStatusRequest message. + * Verifies a GetBlockchainStatusRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetStatusRequest + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetStatusRequest.verify = function verify(message) { + GetBlockchainStatusRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; return null; }; /** - * Creates a GetStatusRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetBlockchainStatusRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetStatusRequest + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetStatusRequest} GetStatusRequest + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusRequest} GetBlockchainStatusRequest */ - GetStatusRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetStatusRequest) + GetBlockchainStatusRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockchainStatusRequest) return object; - return new $root.org.dash.platform.dapi.v0.GetStatusRequest(); + return new $root.org.dash.platform.dapi.v0.GetBlockchainStatusRequest(); }; /** - * Creates a plain object from a GetStatusRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetBlockchainStatusRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetStatusRequest + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusRequest * @static - * @param {org.dash.platform.dapi.v0.GetStatusRequest} message GetStatusRequest + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusRequest} message GetBlockchainStatusRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetStatusRequest.toObject = function toObject() { + GetBlockchainStatusRequest.toObject = function toObject() { return {}; }; /** - * Converts this GetStatusRequest to JSON. + * Converts this GetBlockchainStatusRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetStatusRequest + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusRequest * @instance * @returns {Object.} JSON object */ - GetStatusRequest.prototype.toJSON = function toJSON() { + GetBlockchainStatusRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetStatusRequest; + return GetBlockchainStatusRequest; })(); - v0.GetStatusResponse = (function() { + v0.GetBlockchainStatusResponse = (function() { /** - * Properties of a GetStatusResponse. + * Properties of a GetBlockchainStatusResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetStatusResponse - * @property {org.dash.platform.dapi.v0.GetStatusResponse.IVersion|null} [version] GetStatusResponse version - * @property {org.dash.platform.dapi.v0.GetStatusResponse.ITime|null} [time] GetStatusResponse time - * @property {org.dash.platform.dapi.v0.GetStatusResponse.Status|null} [status] GetStatusResponse status - * @property {number|null} [syncProgress] GetStatusResponse syncProgress - * @property {org.dash.platform.dapi.v0.GetStatusResponse.IChain|null} [chain] GetStatusResponse chain - * @property {org.dash.platform.dapi.v0.GetStatusResponse.IMasternode|null} [masternode] GetStatusResponse masternode - * @property {org.dash.platform.dapi.v0.GetStatusResponse.INetwork|null} [network] GetStatusResponse network + * @interface IGetBlockchainStatusResponse + * @property {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IVersion|null} [version] GetBlockchainStatusResponse version + * @property {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.ITime|null} [time] GetBlockchainStatusResponse time + * @property {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status|null} [status] GetBlockchainStatusResponse status + * @property {number|null} [syncProgress] GetBlockchainStatusResponse syncProgress + * @property {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IChain|null} [chain] GetBlockchainStatusResponse chain + * @property {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetwork|null} [network] GetBlockchainStatusResponse network */ /** - * Constructs a new GetStatusResponse. + * Constructs a new GetBlockchainStatusResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetStatusResponse. - * @implements IGetStatusResponse + * @classdesc Represents a GetBlockchainStatusResponse. + * @implements IGetBlockchainStatusResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetStatusResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusResponse=} [properties] Properties to set */ - function GetStatusResponse(properties) { + function GetBlockchainStatusResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -511,138 +609,128 @@ $root.org = (function() { } /** - * GetStatusResponse version. - * @member {org.dash.platform.dapi.v0.GetStatusResponse.IVersion|null|undefined} version - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * GetBlockchainStatusResponse version. + * @member {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IVersion|null|undefined} version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @instance */ - GetStatusResponse.prototype.version = null; + GetBlockchainStatusResponse.prototype.version = null; /** - * GetStatusResponse time. - * @member {org.dash.platform.dapi.v0.GetStatusResponse.ITime|null|undefined} time - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * GetBlockchainStatusResponse time. + * @member {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.ITime|null|undefined} time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @instance */ - GetStatusResponse.prototype.time = null; + GetBlockchainStatusResponse.prototype.time = null; /** - * GetStatusResponse status. - * @member {org.dash.platform.dapi.v0.GetStatusResponse.Status} status - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * GetBlockchainStatusResponse status. + * @member {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status} status + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @instance */ - GetStatusResponse.prototype.status = 0; + GetBlockchainStatusResponse.prototype.status = 0; /** - * GetStatusResponse syncProgress. + * GetBlockchainStatusResponse syncProgress. * @member {number} syncProgress - * @memberof org.dash.platform.dapi.v0.GetStatusResponse - * @instance - */ - GetStatusResponse.prototype.syncProgress = 0; - - /** - * GetStatusResponse chain. - * @member {org.dash.platform.dapi.v0.GetStatusResponse.IChain|null|undefined} chain - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @instance */ - GetStatusResponse.prototype.chain = null; + GetBlockchainStatusResponse.prototype.syncProgress = 0; /** - * GetStatusResponse masternode. - * @member {org.dash.platform.dapi.v0.GetStatusResponse.IMasternode|null|undefined} masternode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * GetBlockchainStatusResponse chain. + * @member {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IChain|null|undefined} chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @instance */ - GetStatusResponse.prototype.masternode = null; + GetBlockchainStatusResponse.prototype.chain = null; /** - * GetStatusResponse network. - * @member {org.dash.platform.dapi.v0.GetStatusResponse.INetwork|null|undefined} network - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * GetBlockchainStatusResponse network. + * @member {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetwork|null|undefined} network + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @instance */ - GetStatusResponse.prototype.network = null; + GetBlockchainStatusResponse.prototype.network = null; /** - * Creates a new GetStatusResponse instance using the specified properties. + * Creates a new GetBlockchainStatusResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @static - * @param {org.dash.platform.dapi.v0.IGetStatusResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetStatusResponse} GetStatusResponse instance + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse} GetBlockchainStatusResponse instance */ - GetStatusResponse.create = function create(properties) { - return new GetStatusResponse(properties); + GetBlockchainStatusResponse.create = function create(properties) { + return new GetBlockchainStatusResponse(properties); }; /** - * Encodes the specified GetStatusResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.verify|verify} messages. + * Encodes the specified GetBlockchainStatusResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @static - * @param {org.dash.platform.dapi.v0.IGetStatusResponse} message GetStatusResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusResponse} message GetBlockchainStatusResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetStatusResponse.encode = function encode(message, writer) { + GetBlockchainStatusResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.version != null && Object.hasOwnProperty.call(message, "version")) - $root.org.dash.platform.dapi.v0.GetStatusResponse.Version.encode(message.version, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.encode(message.version, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.time != null && Object.hasOwnProperty.call(message, "time")) - $root.org.dash.platform.dapi.v0.GetStatusResponse.Time.encode(message.time, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.encode(message.time, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.status != null && Object.hasOwnProperty.call(message, "status")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.status); if (message.syncProgress != null && Object.hasOwnProperty.call(message, "syncProgress")) writer.uint32(/* id 4, wireType 1 =*/33).double(message.syncProgress); if (message.chain != null && Object.hasOwnProperty.call(message, "chain")) - $root.org.dash.platform.dapi.v0.GetStatusResponse.Chain.encode(message.chain, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.masternode != null && Object.hasOwnProperty.call(message, "masternode")) - $root.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.encode(message.masternode, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.encode(message.chain, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); if (message.network != null && Object.hasOwnProperty.call(message, "network")) - $root.org.dash.platform.dapi.v0.GetStatusResponse.Network.encode(message.network, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.encode(message.network, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetStatusResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.verify|verify} messages. + * Encodes the specified GetBlockchainStatusResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @static - * @param {org.dash.platform.dapi.v0.IGetStatusResponse} message GetStatusResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetBlockchainStatusResponse} message GetBlockchainStatusResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetStatusResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetBlockchainStatusResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetStatusResponse message from the specified reader or buffer. + * Decodes a GetBlockchainStatusResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetStatusResponse} GetStatusResponse + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse} GetBlockchainStatusResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetStatusResponse.decode = function decode(reader, length) { + GetBlockchainStatusResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetStatusResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.version = $root.org.dash.platform.dapi.v0.GetStatusResponse.Version.decode(reader, reader.uint32()); + message.version = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.decode(reader, reader.uint32()); break; case 2: - message.time = $root.org.dash.platform.dapi.v0.GetStatusResponse.Time.decode(reader, reader.uint32()); + message.time = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.decode(reader, reader.uint32()); break; case 3: message.status = reader.int32(); @@ -651,13 +739,10 @@ $root.org = (function() { message.syncProgress = reader.double(); break; case 5: - message.chain = $root.org.dash.platform.dapi.v0.GetStatusResponse.Chain.decode(reader, reader.uint32()); - break; - case 6: - message.masternode = $root.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.decode(reader, reader.uint32()); + message.chain = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.decode(reader, reader.uint32()); break; case 7: - message.network = $root.org.dash.platform.dapi.v0.GetStatusResponse.Network.decode(reader, reader.uint32()); + message.network = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -668,39 +753,39 @@ $root.org = (function() { }; /** - * Decodes a GetStatusResponse message from the specified reader or buffer, length delimited. + * Decodes a GetBlockchainStatusResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetStatusResponse} GetStatusResponse + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse} GetBlockchainStatusResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetStatusResponse.decodeDelimited = function decodeDelimited(reader) { + GetBlockchainStatusResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetStatusResponse message. + * Verifies a GetBlockchainStatusResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetStatusResponse.verify = function verify(message) { + GetBlockchainStatusResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.version != null && message.hasOwnProperty("version")) { - var error = $root.org.dash.platform.dapi.v0.GetStatusResponse.Version.verify(message.version); + var error = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.verify(message.version); if (error) return "version." + error; } if (message.time != null && message.hasOwnProperty("time")) { - var error = $root.org.dash.platform.dapi.v0.GetStatusResponse.Time.verify(message.time); + var error = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.verify(message.time); if (error) return "time." + error; } @@ -718,17 +803,12 @@ $root.org = (function() { if (typeof message.syncProgress !== "number") return "syncProgress: number expected"; if (message.chain != null && message.hasOwnProperty("chain")) { - var error = $root.org.dash.platform.dapi.v0.GetStatusResponse.Chain.verify(message.chain); + var error = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.verify(message.chain); if (error) return "chain." + error; } - if (message.masternode != null && message.hasOwnProperty("masternode")) { - var error = $root.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.verify(message.masternode); - if (error) - return "masternode." + error; - } if (message.network != null && message.hasOwnProperty("network")) { - var error = $root.org.dash.platform.dapi.v0.GetStatusResponse.Network.verify(message.network); + var error = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.verify(message.network); if (error) return "network." + error; } @@ -736,26 +816,26 @@ $root.org = (function() { }; /** - * Creates a GetStatusResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetBlockchainStatusResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetStatusResponse} GetStatusResponse + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse} GetBlockchainStatusResponse */ - GetStatusResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetStatusResponse) + GetBlockchainStatusResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetStatusResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse(); if (object.version != null) { if (typeof object.version !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetStatusResponse.version: object expected"); - message.version = $root.org.dash.platform.dapi.v0.GetStatusResponse.Version.fromObject(object.version); + throw TypeError(".org.dash.platform.dapi.v0.GetBlockchainStatusResponse.version: object expected"); + message.version = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.fromObject(object.version); } if (object.time != null) { if (typeof object.time !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetStatusResponse.time: object expected"); - message.time = $root.org.dash.platform.dapi.v0.GetStatusResponse.Time.fromObject(object.time); + throw TypeError(".org.dash.platform.dapi.v0.GetBlockchainStatusResponse.time: object expected"); + message.time = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.fromObject(object.time); } switch (object.status) { case "NOT_STARTED": @@ -779,32 +859,27 @@ $root.org = (function() { message.syncProgress = Number(object.syncProgress); if (object.chain != null) { if (typeof object.chain !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetStatusResponse.chain: object expected"); - message.chain = $root.org.dash.platform.dapi.v0.GetStatusResponse.Chain.fromObject(object.chain); - } - if (object.masternode != null) { - if (typeof object.masternode !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetStatusResponse.masternode: object expected"); - message.masternode = $root.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.fromObject(object.masternode); + throw TypeError(".org.dash.platform.dapi.v0.GetBlockchainStatusResponse.chain: object expected"); + message.chain = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.fromObject(object.chain); } if (object.network != null) { if (typeof object.network !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetStatusResponse.network: object expected"); - message.network = $root.org.dash.platform.dapi.v0.GetStatusResponse.Network.fromObject(object.network); + throw TypeError(".org.dash.platform.dapi.v0.GetBlockchainStatusResponse.network: object expected"); + message.network = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.fromObject(object.network); } return message; }; /** - * Creates a plain object from a GetStatusResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetBlockchainStatusResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse} message GetStatusResponse + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse} message GetBlockchainStatusResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetStatusResponse.toObject = function toObject(message, options) { + GetBlockchainStatusResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -814,42 +889,39 @@ $root.org = (function() { object.status = options.enums === String ? "NOT_STARTED" : 0; object.syncProgress = 0; object.chain = null; - object.masternode = null; object.network = null; } if (message.version != null && message.hasOwnProperty("version")) - object.version = $root.org.dash.platform.dapi.v0.GetStatusResponse.Version.toObject(message.version, options); + object.version = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.toObject(message.version, options); if (message.time != null && message.hasOwnProperty("time")) - object.time = $root.org.dash.platform.dapi.v0.GetStatusResponse.Time.toObject(message.time, options); + object.time = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.toObject(message.time, options); if (message.status != null && message.hasOwnProperty("status")) - object.status = options.enums === String ? $root.org.dash.platform.dapi.v0.GetStatusResponse.Status[message.status] : message.status; + object.status = options.enums === String ? $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status[message.status] : message.status; if (message.syncProgress != null && message.hasOwnProperty("syncProgress")) object.syncProgress = options.json && !isFinite(message.syncProgress) ? String(message.syncProgress) : message.syncProgress; if (message.chain != null && message.hasOwnProperty("chain")) - object.chain = $root.org.dash.platform.dapi.v0.GetStatusResponse.Chain.toObject(message.chain, options); - if (message.masternode != null && message.hasOwnProperty("masternode")) - object.masternode = $root.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.toObject(message.masternode, options); + object.chain = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.toObject(message.chain, options); if (message.network != null && message.hasOwnProperty("network")) - object.network = $root.org.dash.platform.dapi.v0.GetStatusResponse.Network.toObject(message.network, options); + object.network = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.toObject(message.network, options); return object; }; /** - * Converts this GetStatusResponse to JSON. + * Converts this GetBlockchainStatusResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @instance * @returns {Object.} JSON object */ - GetStatusResponse.prototype.toJSON = function toJSON() { + GetBlockchainStatusResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetStatusResponse.Version = (function() { + GetBlockchainStatusResponse.Version = (function() { /** * Properties of a Version. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @interface IVersion * @property {number|null} [protocol] Version protocol * @property {number|null} [software] Version software @@ -858,11 +930,11 @@ $root.org = (function() { /** * Constructs a new Version. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @classdesc Represents a Version. * @implements IVersion * @constructor - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IVersion=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IVersion=} [properties] Properties to set */ function Version(properties) { if (properties) @@ -874,7 +946,7 @@ $root.org = (function() { /** * Version protocol. * @member {number} protocol - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @instance */ Version.prototype.protocol = 0; @@ -882,7 +954,7 @@ $root.org = (function() { /** * Version software. * @member {number} software - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @instance */ Version.prototype.software = 0; @@ -890,7 +962,7 @@ $root.org = (function() { /** * Version agent. * @member {string} agent - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @instance */ Version.prototype.agent = ""; @@ -898,21 +970,21 @@ $root.org = (function() { /** * Creates a new Version instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IVersion=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Version} Version instance + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IVersion=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} Version instance */ Version.create = function create(properties) { return new Version(properties); }; /** - * Encodes the specified Version message. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Version.verify|verify} messages. + * Encodes the specified Version message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IVersion} message Version message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IVersion} message Version message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -929,11 +1001,11 @@ $root.org = (function() { }; /** - * Encodes the specified Version message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Version.verify|verify} messages. + * Encodes the specified Version message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IVersion} message Version message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IVersion} message Version message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -944,18 +1016,18 @@ $root.org = (function() { /** * Decodes a Version message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Version} Version + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} Version * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Version.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Version(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -979,10 +1051,10 @@ $root.org = (function() { /** * Decodes a Version message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Version} Version + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} Version * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -995,7 +1067,7 @@ $root.org = (function() { /** * Verifies a Version message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -1018,15 +1090,15 @@ $root.org = (function() { /** * Creates a Version message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Version} Version + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} Version */ Version.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetStatusResponse.Version) + if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version) return object; - var message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Version(); + var message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version(); if (object.protocol != null) message.protocol = object.protocol >>> 0; if (object.software != null) @@ -1039,9 +1111,9 @@ $root.org = (function() { /** * Creates a plain object from a Version message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.Version} message Version + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} message Version * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -1066,7 +1138,7 @@ $root.org = (function() { /** * Converts this Version to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Version + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version * @instance * @returns {Object.} JSON object */ @@ -1077,11 +1149,11 @@ $root.org = (function() { return Version; })(); - GetStatusResponse.Time = (function() { + GetBlockchainStatusResponse.Time = (function() { /** * Properties of a Time. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @interface ITime * @property {number|null} [now] Time now * @property {number|null} [offset] Time offset @@ -1090,11 +1162,11 @@ $root.org = (function() { /** * Constructs a new Time. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @classdesc Represents a Time. * @implements ITime * @constructor - * @param {org.dash.platform.dapi.v0.GetStatusResponse.ITime=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.ITime=} [properties] Properties to set */ function Time(properties) { if (properties) @@ -1106,7 +1178,7 @@ $root.org = (function() { /** * Time now. * @member {number} now - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @instance */ Time.prototype.now = 0; @@ -1114,7 +1186,7 @@ $root.org = (function() { /** * Time offset. * @member {number} offset - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @instance */ Time.prototype.offset = 0; @@ -1122,7 +1194,7 @@ $root.org = (function() { /** * Time median. * @member {number} median - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @instance */ Time.prototype.median = 0; @@ -1130,21 +1202,21 @@ $root.org = (function() { /** * Creates a new Time instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.ITime=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Time} Time instance + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.ITime=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} Time instance */ Time.create = function create(properties) { return new Time(properties); }; /** - * Encodes the specified Time message. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Time.verify|verify} messages. + * Encodes the specified Time message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.ITime} message Time message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.ITime} message Time message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -1161,11 +1233,11 @@ $root.org = (function() { }; /** - * Encodes the specified Time message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Time.verify|verify} messages. + * Encodes the specified Time message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.ITime} message Time message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.ITime} message Time message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -1176,18 +1248,18 @@ $root.org = (function() { /** * Decodes a Time message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Time} Time + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} Time * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Time.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Time(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -1211,10 +1283,10 @@ $root.org = (function() { /** * Decodes a Time message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Time} Time + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} Time * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -1227,7 +1299,7 @@ $root.org = (function() { /** * Verifies a Time message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -1250,15 +1322,15 @@ $root.org = (function() { /** * Creates a Time message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Time} Time + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} Time */ Time.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetStatusResponse.Time) + if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time) return object; - var message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Time(); + var message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time(); if (object.now != null) message.now = object.now >>> 0; if (object.offset != null) @@ -1271,9 +1343,9 @@ $root.org = (function() { /** * Creates a plain object from a Time message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.Time} message Time + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} message Time * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -1298,7 +1370,7 @@ $root.org = (function() { /** * Converts this Time to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Time + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time * @instance * @returns {Object.} JSON object */ @@ -1311,14 +1383,14 @@ $root.org = (function() { /** * Status enum. - * @name org.dash.platform.dapi.v0.GetStatusResponse.Status + * @name org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status * @enum {number} * @property {number} NOT_STARTED=0 NOT_STARTED value * @property {number} SYNCING=1 SYNCING value * @property {number} READY=2 READY value * @property {number} ERROR=3 ERROR value */ - GetStatusResponse.Status = (function() { + GetBlockchainStatusResponse.Status = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "NOT_STARTED"] = 0; values[valuesById[1] = "SYNCING"] = 1; @@ -1327,11 +1399,11 @@ $root.org = (function() { return values; })(); - GetStatusResponse.Chain = (function() { + GetBlockchainStatusResponse.Chain = (function() { /** * Properties of a Chain. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @interface IChain * @property {string|null} [name] Chain name * @property {number|null} [headersCount] Chain headersCount @@ -1345,11 +1417,11 @@ $root.org = (function() { /** * Constructs a new Chain. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse * @classdesc Represents a Chain. * @implements IChain * @constructor - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IChain=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IChain=} [properties] Properties to set */ function Chain(properties) { if (properties) @@ -1361,7 +1433,7 @@ $root.org = (function() { /** * Chain name. * @member {string} name - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @instance */ Chain.prototype.name = ""; @@ -1369,7 +1441,7 @@ $root.org = (function() { /** * Chain headersCount. * @member {number} headersCount - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @instance */ Chain.prototype.headersCount = 0; @@ -1377,7 +1449,7 @@ $root.org = (function() { /** * Chain blocksCount. * @member {number} blocksCount - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @instance */ Chain.prototype.blocksCount = 0; @@ -1385,7 +1457,7 @@ $root.org = (function() { /** * Chain bestBlockHash. * @member {Uint8Array} bestBlockHash - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @instance */ Chain.prototype.bestBlockHash = $util.newBuffer([]); @@ -1393,7 +1465,7 @@ $root.org = (function() { /** * Chain difficulty. * @member {number} difficulty - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @instance */ Chain.prototype.difficulty = 0; @@ -1401,7 +1473,7 @@ $root.org = (function() { /** * Chain chainWork. * @member {Uint8Array} chainWork - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @instance */ Chain.prototype.chainWork = $util.newBuffer([]); @@ -1409,7 +1481,7 @@ $root.org = (function() { /** * Chain isSynced. * @member {boolean} isSynced - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @instance */ Chain.prototype.isSynced = false; @@ -1417,7 +1489,7 @@ $root.org = (function() { /** * Chain syncProgress. * @member {number} syncProgress - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @instance */ Chain.prototype.syncProgress = 0; @@ -1425,21 +1497,21 @@ $root.org = (function() { /** * Creates a new Chain instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IChain=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Chain} Chain instance + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IChain=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} Chain instance */ Chain.create = function create(properties) { return new Chain(properties); }; /** - * Encodes the specified Chain message. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Chain.verify|verify} messages. + * Encodes the specified Chain message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IChain} message Chain message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IChain} message Chain message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -1466,11 +1538,11 @@ $root.org = (function() { }; /** - * Encodes the specified Chain message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Chain.verify|verify} messages. + * Encodes the specified Chain message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IChain} message Chain message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.IChain} message Chain message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -1481,18 +1553,18 @@ $root.org = (function() { /** * Decodes a Chain message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Chain} Chain + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} Chain * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Chain.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Chain(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -1531,10 +1603,10 @@ $root.org = (function() { /** * Decodes a Chain message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Chain} Chain + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} Chain * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -1547,7 +1619,7 @@ $root.org = (function() { /** * Verifies a Chain message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -1585,15 +1657,15 @@ $root.org = (function() { /** * Creates a Chain message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Chain} Chain + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} Chain */ Chain.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetStatusResponse.Chain) + if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain) return object; - var message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Chain(); + var message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain(); if (object.name != null) message.name = String(object.name); if (object.headersCount != null) @@ -1622,9 +1694,9 @@ $root.org = (function() { /** * Creates a plain object from a Chain message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.Chain} message Chain + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} message Chain * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -1676,7 +1748,7 @@ $root.org = (function() { /** * Converts this Chain to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Chain + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain * @instance * @returns {Object.} JSON object */ @@ -1687,28 +1759,25 @@ $root.org = (function() { return Chain; })(); - GetStatusResponse.Masternode = (function() { + GetBlockchainStatusResponse.NetworkFee = (function() { /** - * Properties of a Masternode. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse - * @interface IMasternode - * @property {org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status|null} [status] Masternode status - * @property {Uint8Array|null} [proTxHash] Masternode proTxHash - * @property {number|null} [posePenalty] Masternode posePenalty - * @property {boolean|null} [isSynced] Masternode isSynced - * @property {number|null} [syncProgress] Masternode syncProgress + * Properties of a NetworkFee. + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse + * @interface INetworkFee + * @property {number|null} [relay] NetworkFee relay + * @property {number|null} [incremental] NetworkFee incremental */ /** - * Constructs a new Masternode. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse - * @classdesc Represents a Masternode. - * @implements IMasternode + * Constructs a new NetworkFee. + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse + * @classdesc Represents a NetworkFee. + * @implements INetworkFee * @constructor - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IMasternode=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetworkFee=} [properties] Properties to set */ - function Masternode(properties) { + function NetworkFee(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1716,127 +1785,88 @@ $root.org = (function() { } /** - * Masternode status. - * @member {org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status} status - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode - * @instance - */ - Masternode.prototype.status = 0; - - /** - * Masternode proTxHash. - * @member {Uint8Array} proTxHash - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode - * @instance - */ - Masternode.prototype.proTxHash = $util.newBuffer([]); - - /** - * Masternode posePenalty. - * @member {number} posePenalty - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode - * @instance - */ - Masternode.prototype.posePenalty = 0; - - /** - * Masternode isSynced. - * @member {boolean} isSynced - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * NetworkFee relay. + * @member {number} relay + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @instance */ - Masternode.prototype.isSynced = false; + NetworkFee.prototype.relay = 0; /** - * Masternode syncProgress. - * @member {number} syncProgress - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * NetworkFee incremental. + * @member {number} incremental + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @instance */ - Masternode.prototype.syncProgress = 0; + NetworkFee.prototype.incremental = 0; /** - * Creates a new Masternode instance using the specified properties. + * Creates a new NetworkFee instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IMasternode=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Masternode} Masternode instance + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetworkFee=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} NetworkFee instance */ - Masternode.create = function create(properties) { - return new Masternode(properties); + NetworkFee.create = function create(properties) { + return new NetworkFee(properties); }; /** - * Encodes the specified Masternode message. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Masternode.verify|verify} messages. + * Encodes the specified NetworkFee message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IMasternode} message Masternode message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetworkFee} message NetworkFee message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Masternode.encode = function encode(message, writer) { + NetworkFee.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.status != null && Object.hasOwnProperty.call(message, "status")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.status); - if (message.proTxHash != null && Object.hasOwnProperty.call(message, "proTxHash")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proTxHash); - if (message.posePenalty != null && Object.hasOwnProperty.call(message, "posePenalty")) - writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.posePenalty); - if (message.isSynced != null && Object.hasOwnProperty.call(message, "isSynced")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.isSynced); - if (message.syncProgress != null && Object.hasOwnProperty.call(message, "syncProgress")) - writer.uint32(/* id 5, wireType 1 =*/41).double(message.syncProgress); + if (message.relay != null && Object.hasOwnProperty.call(message, "relay")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.relay); + if (message.incremental != null && Object.hasOwnProperty.call(message, "incremental")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.incremental); return writer; }; /** - * Encodes the specified Masternode message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Masternode.verify|verify} messages. + * Encodes the specified NetworkFee message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.IMasternode} message Masternode message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetworkFee} message NetworkFee message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Masternode.encodeDelimited = function encodeDelimited(message, writer) { + NetworkFee.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Masternode message from the specified reader or buffer. + * Decodes a NetworkFee message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Masternode} Masternode + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} NetworkFee * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Masternode.decode = function decode(reader, length) { + NetworkFee.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Masternode(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.status = reader.int32(); + message.relay = reader.double(); break; case 2: - message.proTxHash = reader.bytes(); - break; - case 3: - message.posePenalty = reader.uint32(); - break; - case 4: - message.isSynced = reader.bool(); - break; - case 5: - message.syncProgress = reader.double(); + message.incremental = reader.double(); break; default: reader.skipType(tag & 7); @@ -1847,219 +1877,117 @@ $root.org = (function() { }; /** - * Decodes a Masternode message from the specified reader or buffer, length delimited. + * Decodes a NetworkFee message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Masternode} Masternode + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} NetworkFee * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Masternode.decodeDelimited = function decodeDelimited(reader) { + NetworkFee.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Masternode message. + * Verifies a NetworkFee message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Masternode.verify = function verify(message) { + NetworkFee.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.status != null && message.hasOwnProperty("status")) - switch (message.status) { - default: - return "status: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - break; - } - if (message.proTxHash != null && message.hasOwnProperty("proTxHash")) - if (!(message.proTxHash && typeof message.proTxHash.length === "number" || $util.isString(message.proTxHash))) - return "proTxHash: buffer expected"; - if (message.posePenalty != null && message.hasOwnProperty("posePenalty")) - if (!$util.isInteger(message.posePenalty)) - return "posePenalty: integer expected"; - if (message.isSynced != null && message.hasOwnProperty("isSynced")) - if (typeof message.isSynced !== "boolean") - return "isSynced: boolean expected"; - if (message.syncProgress != null && message.hasOwnProperty("syncProgress")) - if (typeof message.syncProgress !== "number") - return "syncProgress: number expected"; + if (message.relay != null && message.hasOwnProperty("relay")) + if (typeof message.relay !== "number") + return "relay: number expected"; + if (message.incremental != null && message.hasOwnProperty("incremental")) + if (typeof message.incremental !== "number") + return "incremental: number expected"; return null; }; /** - * Creates a Masternode message from a plain object. Also converts values to their respective internal types. + * Creates a NetworkFee message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Masternode} Masternode + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} NetworkFee */ - Masternode.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetStatusResponse.Masternode) + NetworkFee.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee) return object; - var message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Masternode(); - switch (object.status) { - case "UNKNOWN": - case 0: - message.status = 0; - break; - case "WAITING_FOR_PROTX": - case 1: - message.status = 1; - break; - case "POSE_BANNED": - case 2: - message.status = 2; - break; - case "REMOVED": - case 3: - message.status = 3; - break; - case "OPERATOR_KEY_CHANGED": - case 4: - message.status = 4; - break; - case "PROTX_IP_CHANGED": - case 5: - message.status = 5; - break; - case "READY": - case 6: - message.status = 6; - break; - case "ERROR": - case 7: - message.status = 7; - break; - } - if (object.proTxHash != null) - if (typeof object.proTxHash === "string") - $util.base64.decode(object.proTxHash, message.proTxHash = $util.newBuffer($util.base64.length(object.proTxHash)), 0); - else if (object.proTxHash.length >= 0) - message.proTxHash = object.proTxHash; - if (object.posePenalty != null) - message.posePenalty = object.posePenalty >>> 0; - if (object.isSynced != null) - message.isSynced = Boolean(object.isSynced); - if (object.syncProgress != null) - message.syncProgress = Number(object.syncProgress); + var message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee(); + if (object.relay != null) + message.relay = Number(object.relay); + if (object.incremental != null) + message.incremental = Number(object.incremental); return message; }; /** - * Creates a plain object from a Masternode message. Also converts values to other types if specified. + * Creates a plain object from a NetworkFee message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.Masternode} message Masternode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} message NetworkFee * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Masternode.toObject = function toObject(message, options) { + NetworkFee.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.status = options.enums === String ? "UNKNOWN" : 0; - if (options.bytes === String) - object.proTxHash = ""; - else { - object.proTxHash = []; - if (options.bytes !== Array) - object.proTxHash = $util.newBuffer(object.proTxHash); - } - object.posePenalty = 0; - object.isSynced = false; - object.syncProgress = 0; + object.relay = 0; + object.incremental = 0; } - if (message.status != null && message.hasOwnProperty("status")) - object.status = options.enums === String ? $root.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status[message.status] : message.status; - if (message.proTxHash != null && message.hasOwnProperty("proTxHash")) - object.proTxHash = options.bytes === String ? $util.base64.encode(message.proTxHash, 0, message.proTxHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.proTxHash) : message.proTxHash; - if (message.posePenalty != null && message.hasOwnProperty("posePenalty")) - object.posePenalty = message.posePenalty; - if (message.isSynced != null && message.hasOwnProperty("isSynced")) - object.isSynced = message.isSynced; - if (message.syncProgress != null && message.hasOwnProperty("syncProgress")) - object.syncProgress = options.json && !isFinite(message.syncProgress) ? String(message.syncProgress) : message.syncProgress; + if (message.relay != null && message.hasOwnProperty("relay")) + object.relay = options.json && !isFinite(message.relay) ? String(message.relay) : message.relay; + if (message.incremental != null && message.hasOwnProperty("incremental")) + object.incremental = options.json && !isFinite(message.incremental) ? String(message.incremental) : message.incremental; return object; }; /** - * Converts this Masternode to JSON. + * Converts this NetworkFee to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Masternode + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee * @instance * @returns {Object.} JSON object */ - Masternode.prototype.toJSON = function toJSON() { + NetworkFee.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * Status enum. - * @name org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status - * @enum {number} - * @property {number} UNKNOWN=0 UNKNOWN value - * @property {number} WAITING_FOR_PROTX=1 WAITING_FOR_PROTX value - * @property {number} POSE_BANNED=2 POSE_BANNED value - * @property {number} REMOVED=3 REMOVED value - * @property {number} OPERATOR_KEY_CHANGED=4 OPERATOR_KEY_CHANGED value - * @property {number} PROTX_IP_CHANGED=5 PROTX_IP_CHANGED value - * @property {number} READY=6 READY value - * @property {number} ERROR=7 ERROR value - */ - Masternode.Status = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN"] = 0; - values[valuesById[1] = "WAITING_FOR_PROTX"] = 1; - values[valuesById[2] = "POSE_BANNED"] = 2; - values[valuesById[3] = "REMOVED"] = 3; - values[valuesById[4] = "OPERATOR_KEY_CHANGED"] = 4; - values[valuesById[5] = "PROTX_IP_CHANGED"] = 5; - values[valuesById[6] = "READY"] = 6; - values[valuesById[7] = "ERROR"] = 7; - return values; - })(); - - return Masternode; + return NetworkFee; })(); - GetStatusResponse.NetworkFee = (function() { + GetBlockchainStatusResponse.Network = (function() { /** - * Properties of a NetworkFee. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse - * @interface INetworkFee - * @property {number|null} [relay] NetworkFee relay - * @property {number|null} [incremental] NetworkFee incremental + * Properties of a Network. + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse + * @interface INetwork + * @property {number|null} [peersCount] Network peersCount + * @property {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetworkFee|null} [fee] Network fee */ /** - * Constructs a new NetworkFee. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse - * @classdesc Represents a NetworkFee. - * @implements INetworkFee + * Constructs a new Network. + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse + * @classdesc Represents a Network. + * @implements INetwork * @constructor - * @param {org.dash.platform.dapi.v0.GetStatusResponse.INetworkFee=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetwork=} [properties] Properties to set */ - function NetworkFee(properties) { + function Network(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2067,88 +1995,88 @@ $root.org = (function() { } /** - * NetworkFee relay. - * @member {number} relay - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * Network peersCount. + * @member {number} peersCount + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @instance */ - NetworkFee.prototype.relay = 0; + Network.prototype.peersCount = 0; /** - * NetworkFee incremental. - * @member {number} incremental - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * Network fee. + * @member {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetworkFee|null|undefined} fee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @instance */ - NetworkFee.prototype.incremental = 0; + Network.prototype.fee = null; /** - * Creates a new NetworkFee instance using the specified properties. + * Creates a new Network instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.INetworkFee=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} NetworkFee instance + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetwork=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} Network instance */ - NetworkFee.create = function create(properties) { - return new NetworkFee(properties); + Network.create = function create(properties) { + return new Network(properties); }; /** - * Encodes the specified NetworkFee message. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.verify|verify} messages. + * Encodes the specified Network message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.INetworkFee} message NetworkFee message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetwork} message Network message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NetworkFee.encode = function encode(message, writer) { + Network.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.relay != null && Object.hasOwnProperty.call(message, "relay")) - writer.uint32(/* id 1, wireType 1 =*/9).double(message.relay); - if (message.incremental != null && Object.hasOwnProperty.call(message, "incremental")) - writer.uint32(/* id 2, wireType 1 =*/17).double(message.incremental); + if (message.peersCount != null && Object.hasOwnProperty.call(message, "peersCount")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.peersCount); + if (message.fee != null && Object.hasOwnProperty.call(message, "fee")) + $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.encode(message.fee, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified NetworkFee message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.verify|verify} messages. + * Encodes the specified Network message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.INetworkFee} message NetworkFee message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.INetwork} message Network message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NetworkFee.encodeDelimited = function encodeDelimited(message, writer) { + Network.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a NetworkFee message from the specified reader or buffer. + * Decodes a Network message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} NetworkFee + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} Network * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NetworkFee.decode = function decode(reader, length) { + Network.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.relay = reader.double(); + message.peersCount = reader.uint32(); break; case 2: - message.incremental = reader.double(); + message.fee = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -2159,335 +2087,1066 @@ $root.org = (function() { }; /** - * Decodes a NetworkFee message from the specified reader or buffer, length delimited. + * Decodes a Network message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} NetworkFee + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} Network * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NetworkFee.decodeDelimited = function decodeDelimited(reader) { + Network.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a NetworkFee message. + * Verifies a Network message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - NetworkFee.verify = function verify(message) { + Network.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.relay != null && message.hasOwnProperty("relay")) - if (typeof message.relay !== "number") - return "relay: number expected"; - if (message.incremental != null && message.hasOwnProperty("incremental")) - if (typeof message.incremental !== "number") - return "incremental: number expected"; + if (message.peersCount != null && message.hasOwnProperty("peersCount")) + if (!$util.isInteger(message.peersCount)) + return "peersCount: integer expected"; + if (message.fee != null && message.hasOwnProperty("fee")) { + var error = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.verify(message.fee); + if (error) + return "fee." + error; + } return null; }; /** - * Creates a NetworkFee message from a plain object. Also converts values to their respective internal types. + * Creates a Network message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} NetworkFee + * @returns {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} Network */ - NetworkFee.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee) + Network.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network) return object; - var message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee(); - if (object.relay != null) - message.relay = Number(object.relay); - if (object.incremental != null) - message.incremental = Number(object.incremental); + var message = new $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network(); + if (object.peersCount != null) + message.peersCount = object.peersCount >>> 0; + if (object.fee != null) { + if (typeof object.fee !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.fee: object expected"); + message.fee = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.fromObject(object.fee); + } return message; }; /** - * Creates a plain object from a NetworkFee message. Also converts values to other types if specified. + * Creates a plain object from a Network message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} message NetworkFee + * @param {org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} message Network * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - NetworkFee.toObject = function toObject(message, options) { + Network.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.relay = 0; - object.incremental = 0; + object.peersCount = 0; + object.fee = null; } - if (message.relay != null && message.hasOwnProperty("relay")) - object.relay = options.json && !isFinite(message.relay) ? String(message.relay) : message.relay; - if (message.incremental != null && message.hasOwnProperty("incremental")) - object.incremental = options.json && !isFinite(message.incremental) ? String(message.incremental) : message.incremental; + if (message.peersCount != null && message.hasOwnProperty("peersCount")) + object.peersCount = message.peersCount; + if (message.fee != null && message.hasOwnProperty("fee")) + object.fee = $root.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.toObject(message.fee, options); return object; }; /** - * Converts this NetworkFee to JSON. + * Converts this Network to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee + * @memberof org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network * @instance * @returns {Object.} JSON object */ - NetworkFee.prototype.toJSON = function toJSON() { + Network.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return NetworkFee; + return Network; })(); - GetStatusResponse.Network = (function() { - - /** - * Properties of a Network. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse - * @interface INetwork - * @property {number|null} [peersCount] Network peersCount - * @property {org.dash.platform.dapi.v0.GetStatusResponse.INetworkFee|null} [fee] Network fee - */ + return GetBlockchainStatusResponse; + })(); - /** - * Constructs a new Network. - * @memberof org.dash.platform.dapi.v0.GetStatusResponse - * @classdesc Represents a Network. - * @implements INetwork - * @constructor - * @param {org.dash.platform.dapi.v0.GetStatusResponse.INetwork=} [properties] Properties to set - */ - function Network(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v0.GetMasternodeStatusRequest = (function() { - /** - * Network peersCount. - * @member {number} peersCount - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @instance - */ - Network.prototype.peersCount = 0; + /** + * Properties of a GetMasternodeStatusRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetMasternodeStatusRequest + */ - /** - * Network fee. - * @member {org.dash.platform.dapi.v0.GetStatusResponse.INetworkFee|null|undefined} fee - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @instance - */ - Network.prototype.fee = null; + /** + * Constructs a new GetMasternodeStatusRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetMasternodeStatusRequest. + * @implements IGetMasternodeStatusRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusRequest=} [properties] Properties to set + */ + function GetMasternodeStatusRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new Network instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.INetwork=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Network} Network instance - */ - Network.create = function create(properties) { - return new Network(properties); - }; + /** + * Creates a new GetMasternodeStatusRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetMasternodeStatusRequest} GetMasternodeStatusRequest instance + */ + GetMasternodeStatusRequest.create = function create(properties) { + return new GetMasternodeStatusRequest(properties); + }; - /** - * Encodes the specified Network message. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Network.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.INetwork} message Network message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Network.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.peersCount != null && Object.hasOwnProperty.call(message, "peersCount")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.peersCount); - if (message.fee != null && Object.hasOwnProperty.call(message, "fee")) - $root.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.encode(message.fee, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; + /** + * Encodes the specified GetMasternodeStatusRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetMasternodeStatusRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusRequest} message GetMasternodeStatusRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetMasternodeStatusRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; - /** - * Encodes the specified Network message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetStatusResponse.Network.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.INetwork} message Network message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Network.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified GetMasternodeStatusRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetMasternodeStatusRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusRequest} message GetMasternodeStatusRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetMasternodeStatusRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a Network message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Network} Network - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Network.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Network(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.peersCount = reader.uint32(); - break; - case 2: - message.fee = $root.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } + /** + * Decodes a GetMasternodeStatusRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetMasternodeStatusRequest} GetMasternodeStatusRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetMasternodeStatusRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetMasternodeStatusRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; } - return message; - }; - - /** - * Decodes a Network message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Network} Network - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Network.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + } + return message; + }; - /** - * Verifies a Network message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Network.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.peersCount != null && message.hasOwnProperty("peersCount")) - if (!$util.isInteger(message.peersCount)) - return "peersCount: integer expected"; - if (message.fee != null && message.hasOwnProperty("fee")) { - var error = $root.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.verify(message.fee); - if (error) - return "fee." + error; - } - return null; - }; + /** + * Decodes a GetMasternodeStatusRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetMasternodeStatusRequest} GetMasternodeStatusRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetMasternodeStatusRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a Network message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetStatusResponse.Network} Network - */ - Network.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetStatusResponse.Network) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetStatusResponse.Network(); - if (object.peersCount != null) - message.peersCount = object.peersCount >>> 0; - if (object.fee != null) { - if (typeof object.fee !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetStatusResponse.Network.fee: object expected"); - message.fee = $root.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.fromObject(object.fee); - } - return message; - }; + /** + * Verifies a GetMasternodeStatusRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetMasternodeStatusRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; - /** - * Creates a plain object from a Network message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @static - * @param {org.dash.platform.dapi.v0.GetStatusResponse.Network} message Network - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Network.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.peersCount = 0; - object.fee = null; + /** + * Creates a GetMasternodeStatusRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetMasternodeStatusRequest} GetMasternodeStatusRequest + */ + GetMasternodeStatusRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetMasternodeStatusRequest) + return object; + return new $root.org.dash.platform.dapi.v0.GetMasternodeStatusRequest(); + }; + + /** + * Creates a plain object from a GetMasternodeStatusRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusRequest + * @static + * @param {org.dash.platform.dapi.v0.GetMasternodeStatusRequest} message GetMasternodeStatusRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetMasternodeStatusRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this GetMasternodeStatusRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusRequest + * @instance + * @returns {Object.} JSON object + */ + GetMasternodeStatusRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetMasternodeStatusRequest; + })(); + + v0.GetMasternodeStatusResponse = (function() { + + /** + * Properties of a GetMasternodeStatusResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetMasternodeStatusResponse + * @property {org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status|null} [status] GetMasternodeStatusResponse status + * @property {Uint8Array|null} [proTxHash] GetMasternodeStatusResponse proTxHash + * @property {number|null} [posePenalty] GetMasternodeStatusResponse posePenalty + * @property {boolean|null} [isSynced] GetMasternodeStatusResponse isSynced + * @property {number|null} [syncProgress] GetMasternodeStatusResponse syncProgress + */ + + /** + * Constructs a new GetMasternodeStatusResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetMasternodeStatusResponse. + * @implements IGetMasternodeStatusResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusResponse=} [properties] Properties to set + */ + function GetMasternodeStatusResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetMasternodeStatusResponse status. + * @member {org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status} status + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @instance + */ + GetMasternodeStatusResponse.prototype.status = 0; + + /** + * GetMasternodeStatusResponse proTxHash. + * @member {Uint8Array} proTxHash + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @instance + */ + GetMasternodeStatusResponse.prototype.proTxHash = $util.newBuffer([]); + + /** + * GetMasternodeStatusResponse posePenalty. + * @member {number} posePenalty + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @instance + */ + GetMasternodeStatusResponse.prototype.posePenalty = 0; + + /** + * GetMasternodeStatusResponse isSynced. + * @member {boolean} isSynced + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @instance + */ + GetMasternodeStatusResponse.prototype.isSynced = false; + + /** + * GetMasternodeStatusResponse syncProgress. + * @member {number} syncProgress + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @instance + */ + GetMasternodeStatusResponse.prototype.syncProgress = 0; + + /** + * Creates a new GetMasternodeStatusResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetMasternodeStatusResponse} GetMasternodeStatusResponse instance + */ + GetMasternodeStatusResponse.create = function create(properties) { + return new GetMasternodeStatusResponse(properties); + }; + + /** + * Encodes the specified GetMasternodeStatusResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetMasternodeStatusResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusResponse} message GetMasternodeStatusResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetMasternodeStatusResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.status); + if (message.proTxHash != null && Object.hasOwnProperty.call(message, "proTxHash")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proTxHash); + if (message.posePenalty != null && Object.hasOwnProperty.call(message, "posePenalty")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.posePenalty); + if (message.isSynced != null && Object.hasOwnProperty.call(message, "isSynced")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.isSynced); + if (message.syncProgress != null && Object.hasOwnProperty.call(message, "syncProgress")) + writer.uint32(/* id 5, wireType 1 =*/41).double(message.syncProgress); + return writer; + }; + + /** + * Encodes the specified GetMasternodeStatusResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetMasternodeStatusResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetMasternodeStatusResponse} message GetMasternodeStatusResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetMasternodeStatusResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetMasternodeStatusResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetMasternodeStatusResponse} GetMasternodeStatusResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetMasternodeStatusResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetMasternodeStatusResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.status = reader.int32(); + break; + case 2: + message.proTxHash = reader.bytes(); + break; + case 3: + message.posePenalty = reader.uint32(); + break; + case 4: + message.isSynced = reader.bool(); + break; + case 5: + message.syncProgress = reader.double(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetMasternodeStatusResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetMasternodeStatusResponse} GetMasternodeStatusResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetMasternodeStatusResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetMasternodeStatusResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetMasternodeStatusResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.status != null && message.hasOwnProperty("status")) + switch (message.status) { + default: + return "status: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.proTxHash != null && message.hasOwnProperty("proTxHash")) + if (!(message.proTxHash && typeof message.proTxHash.length === "number" || $util.isString(message.proTxHash))) + return "proTxHash: buffer expected"; + if (message.posePenalty != null && message.hasOwnProperty("posePenalty")) + if (!$util.isInteger(message.posePenalty)) + return "posePenalty: integer expected"; + if (message.isSynced != null && message.hasOwnProperty("isSynced")) + if (typeof message.isSynced !== "boolean") + return "isSynced: boolean expected"; + if (message.syncProgress != null && message.hasOwnProperty("syncProgress")) + if (typeof message.syncProgress !== "number") + return "syncProgress: number expected"; + return null; + }; + + /** + * Creates a GetMasternodeStatusResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetMasternodeStatusResponse} GetMasternodeStatusResponse + */ + GetMasternodeStatusResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetMasternodeStatusResponse) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetMasternodeStatusResponse(); + switch (object.status) { + case "UNKNOWN": + case 0: + message.status = 0; + break; + case "WAITING_FOR_PROTX": + case 1: + message.status = 1; + break; + case "POSE_BANNED": + case 2: + message.status = 2; + break; + case "REMOVED": + case 3: + message.status = 3; + break; + case "OPERATOR_KEY_CHANGED": + case 4: + message.status = 4; + break; + case "PROTX_IP_CHANGED": + case 5: + message.status = 5; + break; + case "READY": + case 6: + message.status = 6; + break; + case "ERROR": + case 7: + message.status = 7; + break; + } + if (object.proTxHash != null) + if (typeof object.proTxHash === "string") + $util.base64.decode(object.proTxHash, message.proTxHash = $util.newBuffer($util.base64.length(object.proTxHash)), 0); + else if (object.proTxHash.length >= 0) + message.proTxHash = object.proTxHash; + if (object.posePenalty != null) + message.posePenalty = object.posePenalty >>> 0; + if (object.isSynced != null) + message.isSynced = Boolean(object.isSynced); + if (object.syncProgress != null) + message.syncProgress = Number(object.syncProgress); + return message; + }; + + /** + * Creates a plain object from a GetMasternodeStatusResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @static + * @param {org.dash.platform.dapi.v0.GetMasternodeStatusResponse} message GetMasternodeStatusResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetMasternodeStatusResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.status = options.enums === String ? "UNKNOWN" : 0; + if (options.bytes === String) + object.proTxHash = ""; + else { + object.proTxHash = []; + if (options.bytes !== Array) + object.proTxHash = $util.newBuffer(object.proTxHash); + } + object.posePenalty = 0; + object.isSynced = false; + object.syncProgress = 0; + } + if (message.status != null && message.hasOwnProperty("status")) + object.status = options.enums === String ? $root.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status[message.status] : message.status; + if (message.proTxHash != null && message.hasOwnProperty("proTxHash")) + object.proTxHash = options.bytes === String ? $util.base64.encode(message.proTxHash, 0, message.proTxHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.proTxHash) : message.proTxHash; + if (message.posePenalty != null && message.hasOwnProperty("posePenalty")) + object.posePenalty = message.posePenalty; + if (message.isSynced != null && message.hasOwnProperty("isSynced")) + object.isSynced = message.isSynced; + if (message.syncProgress != null && message.hasOwnProperty("syncProgress")) + object.syncProgress = options.json && !isFinite(message.syncProgress) ? String(message.syncProgress) : message.syncProgress; + return object; + }; + + /** + * Converts this GetMasternodeStatusResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetMasternodeStatusResponse + * @instance + * @returns {Object.} JSON object + */ + GetMasternodeStatusResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Status enum. + * @name org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} WAITING_FOR_PROTX=1 WAITING_FOR_PROTX value + * @property {number} POSE_BANNED=2 POSE_BANNED value + * @property {number} REMOVED=3 REMOVED value + * @property {number} OPERATOR_KEY_CHANGED=4 OPERATOR_KEY_CHANGED value + * @property {number} PROTX_IP_CHANGED=5 PROTX_IP_CHANGED value + * @property {number} READY=6 READY value + * @property {number} ERROR=7 ERROR value + */ + GetMasternodeStatusResponse.Status = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "WAITING_FOR_PROTX"] = 1; + values[valuesById[2] = "POSE_BANNED"] = 2; + values[valuesById[3] = "REMOVED"] = 3; + values[valuesById[4] = "OPERATOR_KEY_CHANGED"] = 4; + values[valuesById[5] = "PROTX_IP_CHANGED"] = 5; + values[valuesById[6] = "READY"] = 6; + values[valuesById[7] = "ERROR"] = 7; + return values; + })(); + + return GetMasternodeStatusResponse; + })(); + + v0.GetBlockRequest = (function() { + + /** + * Properties of a GetBlockRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetBlockRequest + * @property {number|null} [height] GetBlockRequest height + * @property {string|null} [hash] GetBlockRequest hash + */ + + /** + * Constructs a new GetBlockRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetBlockRequest. + * @implements IGetBlockRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IGetBlockRequest=} [properties] Properties to set + */ + function GetBlockRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetBlockRequest height. + * @member {number} height + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @instance + */ + GetBlockRequest.prototype.height = 0; + + /** + * GetBlockRequest hash. + * @member {string} hash + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @instance + */ + GetBlockRequest.prototype.hash = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetBlockRequest block. + * @member {"height"|"hash"|undefined} block + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @instance + */ + Object.defineProperty(GetBlockRequest.prototype, "block", { + get: $util.oneOfGetter($oneOfFields = ["height", "hash"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetBlockRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetBlockRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBlockRequest} GetBlockRequest instance + */ + GetBlockRequest.create = function create(properties) { + return new GetBlockRequest(properties); + }; + + /** + * Encodes the specified GetBlockRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetBlockRequest} message GetBlockRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBlockRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.height); + if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.hash); + return writer; + }; + + /** + * Encodes the specified GetBlockRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetBlockRequest} message GetBlockRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBlockRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetBlockRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetBlockRequest} GetBlockRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBlockRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.uint32(); + break; + case 2: + message.hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; } - if (message.peersCount != null && message.hasOwnProperty("peersCount")) - object.peersCount = message.peersCount; - if (message.fee != null && message.hasOwnProperty("fee")) - object.fee = $root.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.toObject(message.fee, options); + } + return message; + }; + + /** + * Decodes a GetBlockRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetBlockRequest} GetBlockRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBlockRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetBlockRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetBlockRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.height != null && message.hasOwnProperty("height")) { + properties.block = 1; + if (!$util.isInteger(message.height)) + return "height: integer expected"; + } + if (message.hash != null && message.hasOwnProperty("hash")) { + if (properties.block === 1) + return "block: multiple values"; + properties.block = 1; + if (!$util.isString(message.hash)) + return "hash: string expected"; + } + return null; + }; + + /** + * Creates a GetBlockRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetBlockRequest} GetBlockRequest + */ + GetBlockRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetBlockRequest(); + if (object.height != null) + message.height = object.height >>> 0; + if (object.hash != null) + message.hash = String(object.hash); + return message; + }; + + /** + * Creates a plain object from a GetBlockRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @static + * @param {org.dash.platform.dapi.v0.GetBlockRequest} message GetBlockRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetBlockRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.height != null && message.hasOwnProperty("height")) { + object.height = message.height; + if (options.oneofs) + object.block = "height"; + } + if (message.hash != null && message.hasOwnProperty("hash")) { + object.hash = message.hash; + if (options.oneofs) + object.block = "hash"; + } + return object; + }; + + /** + * Converts this GetBlockRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @instance + * @returns {Object.} JSON object + */ + GetBlockRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetBlockRequest; + })(); + + v0.GetBlockResponse = (function() { + + /** + * Properties of a GetBlockResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetBlockResponse + * @property {Uint8Array|null} [block] GetBlockResponse block + */ + + /** + * Constructs a new GetBlockResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetBlockResponse. + * @implements IGetBlockResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetBlockResponse=} [properties] Properties to set + */ + function GetBlockResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetBlockResponse block. + * @member {Uint8Array} block + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @instance + */ + GetBlockResponse.prototype.block = $util.newBuffer([]); + + /** + * Creates a new GetBlockResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetBlockResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBlockResponse} GetBlockResponse instance + */ + GetBlockResponse.create = function create(properties) { + return new GetBlockResponse(properties); + }; + + /** + * Encodes the specified GetBlockResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetBlockResponse} message GetBlockResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBlockResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.block != null && Object.hasOwnProperty.call(message, "block")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.block); + return writer; + }; + + /** + * Encodes the specified GetBlockResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetBlockResponse} message GetBlockResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBlockResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetBlockResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetBlockResponse} GetBlockResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBlockResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetBlockResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetBlockResponse} GetBlockResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBlockResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetBlockResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetBlockResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.block != null && message.hasOwnProperty("block")) + if (!(message.block && typeof message.block.length === "number" || $util.isString(message.block))) + return "block: buffer expected"; + return null; + }; + + /** + * Creates a GetBlockResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetBlockResponse} GetBlockResponse + */ + GetBlockResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockResponse) return object; - }; + var message = new $root.org.dash.platform.dapi.v0.GetBlockResponse(); + if (object.block != null) + if (typeof object.block === "string") + $util.base64.decode(object.block, message.block = $util.newBuffer($util.base64.length(object.block)), 0); + else if (object.block.length >= 0) + message.block = object.block; + return message; + }; - /** - * Converts this Network to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetStatusResponse.Network - * @instance - * @returns {Object.} JSON object - */ - Network.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a GetBlockResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @static + * @param {org.dash.platform.dapi.v0.GetBlockResponse} message GetBlockResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetBlockResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.block = ""; + else { + object.block = []; + if (options.bytes !== Array) + object.block = $util.newBuffer(object.block); + } + if (message.block != null && message.hasOwnProperty("block")) + object.block = options.bytes === String ? $util.base64.encode(message.block, 0, message.block.length) : options.bytes === Array ? Array.prototype.slice.call(message.block) : message.block; + return object; + }; - return Network; - })(); + /** + * Converts this GetBlockResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @instance + * @returns {Object.} JSON object + */ + GetBlockResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return GetStatusResponse; + return GetBlockResponse; })(); - v0.GetBlockRequest = (function() { + v0.GetBestBlockHeightRequest = (function() { /** - * Properties of a GetBlockRequest. + * Properties of a GetBestBlockHeightRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetBlockRequest - * @property {number|null} [height] GetBlockRequest height - * @property {string|null} [hash] GetBlockRequest hash + * @interface IGetBestBlockHeightRequest */ /** - * Constructs a new GetBlockRequest. + * Constructs a new GetBestBlockHeightRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetBlockRequest. - * @implements IGetBlockRequest + * @classdesc Represents a GetBestBlockHeightRequest. + * @implements IGetBestBlockHeightRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetBlockRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightRequest=} [properties] Properties to set */ - function GetBlockRequest(properties) { + function GetBestBlockHeightRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2495,103 +3154,63 @@ $root.org = (function() { } /** - * GetBlockRequest height. - * @member {number} height - * @memberof org.dash.platform.dapi.v0.GetBlockRequest - * @instance - */ - GetBlockRequest.prototype.height = 0; - - /** - * GetBlockRequest hash. - * @member {string} hash - * @memberof org.dash.platform.dapi.v0.GetBlockRequest - * @instance - */ - GetBlockRequest.prototype.hash = ""; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * GetBlockRequest block. - * @member {"height"|"hash"|undefined} block - * @memberof org.dash.platform.dapi.v0.GetBlockRequest - * @instance - */ - Object.defineProperty(GetBlockRequest.prototype, "block", { - get: $util.oneOfGetter($oneOfFields = ["height", "hash"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new GetBlockRequest instance using the specified properties. + * Creates a new GetBestBlockHeightRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest * @static - * @param {org.dash.platform.dapi.v0.IGetBlockRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetBlockRequest} GetBlockRequest instance + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightRequest} GetBestBlockHeightRequest instance */ - GetBlockRequest.create = function create(properties) { - return new GetBlockRequest(properties); + GetBestBlockHeightRequest.create = function create(properties) { + return new GetBestBlockHeightRequest(properties); }; /** - * Encodes the specified GetBlockRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockRequest.verify|verify} messages. + * Encodes the specified GetBestBlockHeightRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBestBlockHeightRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest * @static - * @param {org.dash.platform.dapi.v0.IGetBlockRequest} message GetBlockRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightRequest} message GetBestBlockHeightRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetBlockRequest.encode = function encode(message, writer) { + GetBestBlockHeightRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.height); - if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.hash); return writer; }; /** - * Encodes the specified GetBlockRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockRequest.verify|verify} messages. + * Encodes the specified GetBestBlockHeightRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBestBlockHeightRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest * @static - * @param {org.dash.platform.dapi.v0.IGetBlockRequest} message GetBlockRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightRequest} message GetBestBlockHeightRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetBlockRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetBestBlockHeightRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetBlockRequest message from the specified reader or buffer. + * Decodes a GetBestBlockHeightRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetBlockRequest} GetBlockRequest + * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightRequest} GetBestBlockHeightRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetBlockRequest.decode = function decode(reader, length) { + GetBestBlockHeightRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBestBlockHeightRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.height = reader.uint32(); - break; - case 2: - message.hash = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -2601,125 +3220,94 @@ $root.org = (function() { }; /** - * Decodes a GetBlockRequest message from the specified reader or buffer, length delimited. + * Decodes a GetBestBlockHeightRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetBlockRequest} GetBlockRequest + * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightRequest} GetBestBlockHeightRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetBlockRequest.decodeDelimited = function decodeDelimited(reader) { + GetBestBlockHeightRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetBlockRequest message. + * Verifies a GetBestBlockHeightRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetBlockRequest.verify = function verify(message) { + GetBestBlockHeightRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.height != null && message.hasOwnProperty("height")) { - properties.block = 1; - if (!$util.isInteger(message.height)) - return "height: integer expected"; - } - if (message.hash != null && message.hasOwnProperty("hash")) { - if (properties.block === 1) - return "block: multiple values"; - properties.block = 1; - if (!$util.isString(message.hash)) - return "hash: string expected"; - } return null; }; /** - * Creates a GetBlockRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetBestBlockHeightRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetBlockRequest} GetBlockRequest + * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightRequest} GetBestBlockHeightRequest */ - GetBlockRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockRequest) + GetBestBlockHeightRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetBestBlockHeightRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetBlockRequest(); - if (object.height != null) - message.height = object.height >>> 0; - if (object.hash != null) - message.hash = String(object.hash); - return message; + return new $root.org.dash.platform.dapi.v0.GetBestBlockHeightRequest(); }; /** - * Creates a plain object from a GetBlockRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetBestBlockHeightRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest * @static - * @param {org.dash.platform.dapi.v0.GetBlockRequest} message GetBlockRequest + * @param {org.dash.platform.dapi.v0.GetBestBlockHeightRequest} message GetBestBlockHeightRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetBlockRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.height != null && message.hasOwnProperty("height")) { - object.height = message.height; - if (options.oneofs) - object.block = "height"; - } - if (message.hash != null && message.hasOwnProperty("hash")) { - object.hash = message.hash; - if (options.oneofs) - object.block = "hash"; - } - return object; + GetBestBlockHeightRequest.toObject = function toObject() { + return {}; }; /** - * Converts this GetBlockRequest to JSON. + * Converts this GetBestBlockHeightRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetBlockRequest + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest * @instance * @returns {Object.} JSON object */ - GetBlockRequest.prototype.toJSON = function toJSON() { + GetBestBlockHeightRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetBlockRequest; + return GetBestBlockHeightRequest; })(); - v0.GetBlockResponse = (function() { + v0.GetBestBlockHeightResponse = (function() { /** - * Properties of a GetBlockResponse. + * Properties of a GetBestBlockHeightResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetBlockResponse - * @property {Uint8Array|null} [block] GetBlockResponse block + * @interface IGetBestBlockHeightResponse + * @property {number|null} [height] GetBestBlockHeightResponse height */ /** - * Constructs a new GetBlockResponse. + * Constructs a new GetBestBlockHeightResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetBlockResponse. - * @implements IGetBlockResponse + * @classdesc Represents a GetBestBlockHeightResponse. + * @implements IGetBestBlockHeightResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetBlockResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightResponse=} [properties] Properties to set */ - function GetBlockResponse(properties) { + function GetBestBlockHeightResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2727,75 +3315,75 @@ $root.org = (function() { } /** - * GetBlockResponse block. - * @member {Uint8Array} block - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * GetBestBlockHeightResponse height. + * @member {number} height + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @instance */ - GetBlockResponse.prototype.block = $util.newBuffer([]); + GetBestBlockHeightResponse.prototype.height = 0; /** - * Creates a new GetBlockResponse instance using the specified properties. + * Creates a new GetBestBlockHeightResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @static - * @param {org.dash.platform.dapi.v0.IGetBlockResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetBlockResponse} GetBlockResponse instance + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightResponse} GetBestBlockHeightResponse instance */ - GetBlockResponse.create = function create(properties) { - return new GetBlockResponse(properties); + GetBestBlockHeightResponse.create = function create(properties) { + return new GetBestBlockHeightResponse(properties); }; /** - * Encodes the specified GetBlockResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockResponse.verify|verify} messages. + * Encodes the specified GetBestBlockHeightResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBestBlockHeightResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @static - * @param {org.dash.platform.dapi.v0.IGetBlockResponse} message GetBlockResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightResponse} message GetBestBlockHeightResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetBlockResponse.encode = function encode(message, writer) { + GetBestBlockHeightResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.block != null && Object.hasOwnProperty.call(message, "block")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.block); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.height); return writer; }; /** - * Encodes the specified GetBlockResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBlockResponse.verify|verify} messages. + * Encodes the specified GetBestBlockHeightResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBestBlockHeightResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @static - * @param {org.dash.platform.dapi.v0.IGetBlockResponse} message GetBlockResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightResponse} message GetBestBlockHeightResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetBlockResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetBestBlockHeightResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetBlockResponse message from the specified reader or buffer. + * Decodes a GetBestBlockHeightResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetBlockResponse} GetBlockResponse + * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightResponse} GetBestBlockHeightResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetBlockResponse.decode = function decode(reader, length) { + GetBestBlockHeightResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBlockResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBestBlockHeightResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.block = reader.bytes(); + message.height = reader.uint32(); break; default: reader.skipType(tag & 7); @@ -2806,96 +3394,87 @@ $root.org = (function() { }; /** - * Decodes a GetBlockResponse message from the specified reader or buffer, length delimited. + * Decodes a GetBestBlockHeightResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetBlockResponse} GetBlockResponse + * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightResponse} GetBestBlockHeightResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetBlockResponse.decodeDelimited = function decodeDelimited(reader) { + GetBestBlockHeightResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetBlockResponse message. + * Verifies a GetBestBlockHeightResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetBlockResponse.verify = function verify(message) { + GetBestBlockHeightResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.block != null && message.hasOwnProperty("block")) - if (!(message.block && typeof message.block.length === "number" || $util.isString(message.block))) - return "block: buffer expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; return null; }; /** - * Creates a GetBlockResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetBestBlockHeightResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetBlockResponse} GetBlockResponse + * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightResponse} GetBestBlockHeightResponse */ - GetBlockResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetBlockResponse) + GetBestBlockHeightResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetBestBlockHeightResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetBlockResponse(); - if (object.block != null) - if (typeof object.block === "string") - $util.base64.decode(object.block, message.block = $util.newBuffer($util.base64.length(object.block)), 0); - else if (object.block.length >= 0) - message.block = object.block; + var message = new $root.org.dash.platform.dapi.v0.GetBestBlockHeightResponse(); + if (object.height != null) + message.height = object.height >>> 0; return message; }; /** - * Creates a plain object from a GetBlockResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetBestBlockHeightResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @static - * @param {org.dash.platform.dapi.v0.GetBlockResponse} message GetBlockResponse + * @param {org.dash.platform.dapi.v0.GetBestBlockHeightResponse} message GetBestBlockHeightResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetBlockResponse.toObject = function toObject(message, options) { + GetBestBlockHeightResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) - if (options.bytes === String) - object.block = ""; - else { - object.block = []; - if (options.bytes !== Array) - object.block = $util.newBuffer(object.block); - } - if (message.block != null && message.hasOwnProperty("block")) - object.block = options.bytes === String ? $util.base64.encode(message.block, 0, message.block.length) : options.bytes === Array ? Array.prototype.slice.call(message.block) : message.block; + object.height = 0; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; return object; }; /** - * Converts this GetBlockResponse to JSON. + * Converts this GetBestBlockHeightResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetBlockResponse + * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse * @instance * @returns {Object.} JSON object */ - GetBlockResponse.prototype.toJSON = function toJSON() { + GetBestBlockHeightResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetBlockResponse; + return GetBestBlockHeightResponse; })(); v0.BroadcastTransactionRequest = (function() { @@ -6170,6 +6749,362 @@ $root.org = (function() { return InstantSendLockMessages; })(); + v0.MasternodeListRequest = (function() { + + /** + * Properties of a MasternodeListRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IMasternodeListRequest + */ + + /** + * Constructs a new MasternodeListRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a MasternodeListRequest. + * @implements IMasternodeListRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IMasternodeListRequest=} [properties] Properties to set + */ + function MasternodeListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new MasternodeListRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.MasternodeListRequest + * @static + * @param {org.dash.platform.dapi.v0.IMasternodeListRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.MasternodeListRequest} MasternodeListRequest instance + */ + MasternodeListRequest.create = function create(properties) { + return new MasternodeListRequest(properties); + }; + + /** + * Encodes the specified MasternodeListRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.MasternodeListRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.MasternodeListRequest + * @static + * @param {org.dash.platform.dapi.v0.IMasternodeListRequest} message MasternodeListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MasternodeListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MasternodeListRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.MasternodeListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.MasternodeListRequest + * @static + * @param {org.dash.platform.dapi.v0.IMasternodeListRequest} message MasternodeListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MasternodeListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MasternodeListRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.MasternodeListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.MasternodeListRequest} MasternodeListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MasternodeListRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.MasternodeListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MasternodeListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.MasternodeListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.MasternodeListRequest} MasternodeListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MasternodeListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MasternodeListRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.MasternodeListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MasternodeListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MasternodeListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.MasternodeListRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.MasternodeListRequest} MasternodeListRequest + */ + MasternodeListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.MasternodeListRequest) + return object; + return new $root.org.dash.platform.dapi.v0.MasternodeListRequest(); + }; + + /** + * Creates a plain object from a MasternodeListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.MasternodeListRequest + * @static + * @param {org.dash.platform.dapi.v0.MasternodeListRequest} message MasternodeListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MasternodeListRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MasternodeListRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.MasternodeListRequest + * @instance + * @returns {Object.} JSON object + */ + MasternodeListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MasternodeListRequest; + })(); + + v0.MasternodeListResponse = (function() { + + /** + * Properties of a MasternodeListResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IMasternodeListResponse + * @property {Uint8Array|null} [masternodeListDiff] MasternodeListResponse masternodeListDiff + */ + + /** + * Constructs a new MasternodeListResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a MasternodeListResponse. + * @implements IMasternodeListResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IMasternodeListResponse=} [properties] Properties to set + */ + function MasternodeListResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MasternodeListResponse masternodeListDiff. + * @member {Uint8Array} masternodeListDiff + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @instance + */ + MasternodeListResponse.prototype.masternodeListDiff = $util.newBuffer([]); + + /** + * Creates a new MasternodeListResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @static + * @param {org.dash.platform.dapi.v0.IMasternodeListResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.MasternodeListResponse} MasternodeListResponse instance + */ + MasternodeListResponse.create = function create(properties) { + return new MasternodeListResponse(properties); + }; + + /** + * Encodes the specified MasternodeListResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.MasternodeListResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @static + * @param {org.dash.platform.dapi.v0.IMasternodeListResponse} message MasternodeListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MasternodeListResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.masternodeListDiff != null && Object.hasOwnProperty.call(message, "masternodeListDiff")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.masternodeListDiff); + return writer; + }; + + /** + * Encodes the specified MasternodeListResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.MasternodeListResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @static + * @param {org.dash.platform.dapi.v0.IMasternodeListResponse} message MasternodeListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MasternodeListResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MasternodeListResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.MasternodeListResponse} MasternodeListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MasternodeListResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.MasternodeListResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.masternodeListDiff = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MasternodeListResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.MasternodeListResponse} MasternodeListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MasternodeListResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MasternodeListResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MasternodeListResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.masternodeListDiff != null && message.hasOwnProperty("masternodeListDiff")) + if (!(message.masternodeListDiff && typeof message.masternodeListDiff.length === "number" || $util.isString(message.masternodeListDiff))) + return "masternodeListDiff: buffer expected"; + return null; + }; + + /** + * Creates a MasternodeListResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.MasternodeListResponse} MasternodeListResponse + */ + MasternodeListResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.MasternodeListResponse) + return object; + var message = new $root.org.dash.platform.dapi.v0.MasternodeListResponse(); + if (object.masternodeListDiff != null) + if (typeof object.masternodeListDiff === "string") + $util.base64.decode(object.masternodeListDiff, message.masternodeListDiff = $util.newBuffer($util.base64.length(object.masternodeListDiff)), 0); + else if (object.masternodeListDiff.length >= 0) + message.masternodeListDiff = object.masternodeListDiff; + return message; + }; + + /** + * Creates a plain object from a MasternodeListResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @static + * @param {org.dash.platform.dapi.v0.MasternodeListResponse} message MasternodeListResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MasternodeListResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.masternodeListDiff = ""; + else { + object.masternodeListDiff = []; + if (options.bytes !== Array) + object.masternodeListDiff = $util.newBuffer(object.masternodeListDiff); + } + if (message.masternodeListDiff != null && message.hasOwnProperty("masternodeListDiff")) + object.masternodeListDiff = options.bytes === String ? $util.base64.encode(message.masternodeListDiff, 0, message.masternodeListDiff.length) : options.bytes === Array ? Array.prototype.slice.call(message.masternodeListDiff) : message.masternodeListDiff; + return object; + }; + + /** + * Converts this MasternodeListResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.MasternodeListResponse + * @instance + * @returns {Object.} JSON object + */ + MasternodeListResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MasternodeListResponse; + })(); + return v0; })(); diff --git a/packages/dapi-grpc/clients/core/v0/nodejs/core_protoc.js b/packages/dapi-grpc/clients/core/v0/nodejs/core_protoc.js index ae974b2f814..5bf2a3edaeb 100644 --- a/packages/dapi-grpc/clients/core/v0/nodejs/core_protoc.js +++ b/packages/dapi-grpc/clients/core/v0/nodejs/core_protoc.js @@ -23,24 +23,29 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.BlockHeadersWithChainLocksRes goog.exportSymbol('proto.org.dash.platform.dapi.v0.BloomFilter', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.BroadcastTransactionRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.BroadcastTransactionResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockRequest.BlockCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEstimatedTransactionFeeRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEstimatedTransactionFeeResponse', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusRequest', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Network', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Status', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Time', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Version', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTransactionRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTransactionResponse', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.InstantSendLockMessages', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.MasternodeListRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.MasternodeListResponse', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.RawTransactions', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.TransactionsWithProofsRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.TransactionsWithProofsRequest.FromBlockCase', null, { proto }); @@ -56,16 +61,16 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.TransactionsWithProofsRespons * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusRequest = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusRequest'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest'; } /** * Generated by JsPbCodeGenerator. @@ -77,16 +82,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse'; } /** * Generated by JsPbCodeGenerator. @@ -98,16 +103,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Version, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Version'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version'; } /** * Generated by JsPbCodeGenerator. @@ -119,16 +124,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Time, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Time'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time'; } /** * Generated by JsPbCodeGenerator. @@ -140,16 +145,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain'; } /** * Generated by JsPbCodeGenerator. @@ -161,16 +166,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee'; } /** * Generated by JsPbCodeGenerator. @@ -182,16 +187,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network'; } /** * Generated by JsPbCodeGenerator. @@ -203,16 +208,37 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Network, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Network'; + proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse'; } /** * Generated by JsPbCodeGenerator. @@ -256,6 +282,48 @@ if (goog.DEBUG && !COMPILED) { */ proto.org.dash.platform.dapi.v0.GetBlockResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockResponse'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -550,6 +618,48 @@ if (goog.DEBUG && !COMPILED) { */ proto.org.dash.platform.dapi.v0.InstantSendLockMessages.displayName = 'proto.org.dash.platform.dapi.v0.InstantSendLockMessages'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.MasternodeListRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.MasternodeListRequest.displayName = 'proto.org.dash.platform.dapi.v0.MasternodeListRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.MasternodeListResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.MasternodeListResponse.displayName = 'proto.org.dash.platform.dapi.v0.MasternodeListResponse'; +} @@ -566,8 +676,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.toObject(opt_includeInstance, this); }; @@ -576,11 +686,11 @@ proto.org.dash.platform.dapi.v0.GetStatusRequest.prototype.toObject = function(o * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.toObject = function(includeInstance, msg) { var f, obj = { }; @@ -596,23 +706,23 @@ proto.org.dash.platform.dapi.v0.GetStatusRequest.toObject = function(includeInst /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusRequest; - return proto.org.dash.platform.dapi.v0.GetStatusRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -632,9 +742,9 @@ proto.org.dash.platform.dapi.v0.GetStatusRequest.deserializeBinaryFromReader = f * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -642,11 +752,11 @@ proto.org.dash.platform.dapi.v0.GetStatusRequest.prototype.serializeBinary = fun /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; @@ -667,8 +777,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.toObject(opt_includeInstance, this); }; @@ -677,19 +787,18 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.toObject = function( * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.toObject = function(includeInstance, msg) { var f, obj = { - version: (f = msg.getVersion()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.toObject(includeInstance, f), - time: (f = msg.getTime()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.toObject(includeInstance, f), + version: (f = msg.getVersion()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.toObject(includeInstance, f), + time: (f = msg.getTime()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.toObject(includeInstance, f), status: jspb.Message.getFieldWithDefault(msg, 3, 0), syncProgress: jspb.Message.getFloatingPointFieldWithDefault(msg, 4, 0.0), - chain: (f = msg.getChain()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.toObject(includeInstance, f), - masternode: (f = msg.getMasternode()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.toObject(includeInstance, f), - network: (f = msg.getNetwork()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.toObject(includeInstance, f) + chain: (f = msg.getChain()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.toObject(includeInstance, f), + network: (f = msg.getNetwork()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.toObject(includeInstance, f) }; if (includeInstance) { @@ -703,23 +812,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.toObject = function(includeIns /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -727,17 +836,17 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader = var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Version; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.deserializeBinaryFromReader); msg.setVersion(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Time; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.deserializeBinaryFromReader); msg.setTime(value); break; case 3: - var value = /** @type {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Status} */ (reader.readEnum()); + var value = /** @type {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status} */ (reader.readEnum()); msg.setStatus(value); break; case 4: @@ -745,18 +854,13 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader = msg.setSyncProgress(value); break; case 5: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.deserializeBinaryFromReader); msg.setChain(value); break; - case 6: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFromReader); - msg.setMasternode(value); - break; case 7: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Network; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.deserializeBinaryFromReader); msg.setNetwork(value); break; default: @@ -772,9 +876,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader = * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -782,18 +886,18 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.serializeBinary = fu /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getVersion(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.serializeBinaryToWriter ); } f = message.getTime(); @@ -801,7 +905,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = func writer.writeMessage( 2, f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.serializeBinaryToWriter ); } f = message.getStatus(); @@ -823,15 +927,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = func writer.writeMessage( 5, f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.serializeBinaryToWriter - ); - } - f = message.getMasternode(); - if (f != null) { - writer.writeMessage( - 6, - f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.serializeBinaryToWriter ); } f = message.getNetwork(); @@ -839,7 +935,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = func writer.writeMessage( 7, f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.serializeBinaryToWriter ); } }; @@ -848,7 +944,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = func /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Status = { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status = { NOT_STARTED: 0, SYNCING: 1, READY: 2, @@ -871,8 +967,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.toObject(opt_includeInstance, this); }; @@ -881,11 +977,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.toObject = f * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.toObject = function(includeInstance, msg) { var f, obj = { protocol: jspb.Message.getFieldWithDefault(msg, 1, 0), software: jspb.Message.getFieldWithDefault(msg, 2, 0), @@ -903,23 +999,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.toObject = function(in /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Version; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -951,9 +1047,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinaryFromR * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -961,11 +1057,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.serializeBin /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getProtocol(); if (f !== 0) { @@ -995,16 +1091,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.serializeBinaryToWrite * optional uint32 protocol = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.getProtocol = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.getProtocol = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setProtocol = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.setProtocol = function(value) { return jspb.Message.setProto3IntField(this, 1, value); }; @@ -1013,16 +1109,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setProtocol * optional uint32 software = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.getSoftware = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.getSoftware = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setSoftware = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.setSoftware = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; @@ -1031,16 +1127,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setSoftware * optional string agent = 3; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.getAgent = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.getAgent = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setAgent = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.setAgent = function(value) { return jspb.Message.setProto3StringField(this, 3, value); }; @@ -1061,8 +1157,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.toObject(opt_includeInstance, this); }; @@ -1071,11 +1167,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.toObject = func * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.toObject = function(includeInstance, msg) { var f, obj = { now: jspb.Message.getFieldWithDefault(msg, 1, 0), offset: jspb.Message.getFieldWithDefault(msg, 2, 0), @@ -1093,23 +1189,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.toObject = function(inclu /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Time; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1141,9 +1237,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinaryFromRead * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1151,11 +1247,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getNow(); if (f !== 0) { @@ -1185,16 +1281,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.serializeBinaryToWriter = * optional uint32 now = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.getNow = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.getNow = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setNow = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.setNow = function(value) { return jspb.Message.setProto3IntField(this, 1, value); }; @@ -1203,16 +1299,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setNow = functi * optional int32 offset = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.getOffset = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.getOffset = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setOffset = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.setOffset = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; @@ -1221,16 +1317,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setOffset = fun * optional uint32 median = 3; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.getMedian = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.getMedian = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setMedian = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.setMedian = function(value) { return jspb.Message.setProto3IntField(this, 3, value); }; @@ -1251,8 +1347,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.toObject(opt_includeInstance, this); }; @@ -1261,11 +1357,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.toObject = fun * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.toObject = function(includeInstance, msg) { var f, obj = { name: jspb.Message.getFieldWithDefault(msg, 1, ""), headersCount: jspb.Message.getFieldWithDefault(msg, 2, 0), @@ -1288,23 +1384,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.toObject = function(incl /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1356,9 +1452,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinaryFromRea * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1366,11 +1462,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.serializeBinar /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getName(); if (f.length > 0) { @@ -1435,16 +1531,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.serializeBinaryToWriter * optional string name = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getName = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getName = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setName = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setName = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; @@ -1453,16 +1549,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setName = func * optional uint32 headers_count = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getHeadersCount = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getHeadersCount = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setHeadersCount = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setHeadersCount = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; @@ -1471,16 +1567,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setHeadersCoun * optional uint32 blocks_count = 3; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBlocksCount = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getBlocksCount = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setBlocksCount = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setBlocksCount = function(value) { return jspb.Message.setProto3IntField(this, 3, value); }; @@ -1489,7 +1585,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setBlocksCount * optional bytes best_block_hash = 4; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHash = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getBestBlockHash = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; @@ -1499,7 +1595,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHa * This is a type-conversion wrapper around `getBestBlockHash()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHash_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getBestBlockHash_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getBestBlockHash())); }; @@ -1512,7 +1608,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHa * This is a type-conversion wrapper around `getBestBlockHash()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHash_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getBestBlockHash_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getBestBlockHash())); }; @@ -1520,9 +1616,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHa /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setBestBlockHash = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setBestBlockHash = function(value) { return jspb.Message.setProto3BytesField(this, 4, value); }; @@ -1531,16 +1627,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setBestBlockHa * optional double difficulty = 5; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getDifficulty = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getDifficulty = function() { return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setDifficulty = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setDifficulty = function(value) { return jspb.Message.setProto3FloatField(this, 5, value); }; @@ -1549,7 +1645,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setDifficulty * optional bytes chain_work = 6; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getChainWork = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); }; @@ -1559,7 +1655,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork = * This is a type-conversion wrapper around `getChainWork()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getChainWork_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getChainWork())); }; @@ -1572,7 +1668,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork_a * This is a type-conversion wrapper around `getChainWork()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getChainWork_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getChainWork())); }; @@ -1580,9 +1676,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork_a /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setChainWork = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setChainWork = function(value) { return jspb.Message.setProto3BytesField(this, 6, value); }; @@ -1591,16 +1687,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setChainWork = * optional bool is_synced = 7; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getIsSynced = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getIsSynced = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 7, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setIsSynced = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setIsSynced = function(value) { return jspb.Message.setProto3BooleanField(this, 7, value); }; @@ -1609,16 +1705,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setIsSynced = * optional double sync_progress = 8; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getSyncProgress = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getSyncProgress = function() { return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 8, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setSyncProgress = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setSyncProgress = function(value) { return jspb.Message.setProto3FloatField(this, 8, value); }; @@ -1639,8 +1735,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.toObject(opt_includeInstance, this); }; @@ -1649,17 +1745,14 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.toObject * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.toObject = function(includeInstance, msg) { var f, obj = { - status: jspb.Message.getFieldWithDefault(msg, 1, 0), - proTxHash: msg.getProTxHash_asB64(), - posePenalty: jspb.Message.getFieldWithDefault(msg, 3, 0), - isSynced: jspb.Message.getBooleanFieldWithDefault(msg, 4, false), - syncProgress: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0) + relay: jspb.Message.getFloatingPointFieldWithDefault(msg, 1, 0.0), + incremental: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0) }; if (includeInstance) { @@ -1673,23 +1766,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.toObject = function /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1697,24 +1790,12 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFr var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status} */ (reader.readEnum()); - msg.setStatus(value); + var value = /** @type {number} */ (reader.readDouble()); + msg.setRelay(value); break; case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setProTxHash(value); - break; - case 3: - var value = /** @type {number} */ (reader.readUint32()); - msg.setPosePenalty(value); - break; - case 4: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setIsSynced(value); - break; - case 5: var value = /** @type {number} */ (reader.readDouble()); - msg.setSyncProgress(value); + msg.setIncremental(value); break; default: reader.skipField(); @@ -1729,9 +1810,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFr * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1739,44 +1820,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.serialize /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getStatus(); + f = message.getRelay(); if (f !== 0.0) { - writer.writeEnum( + writer.writeDouble( 1, f ); } - f = message.getProTxHash_asU8(); - if (f.length > 0) { - writer.writeBytes( - 2, - f - ); - } - f = message.getPosePenalty(); - if (f !== 0) { - writer.writeUint32( - 3, - f - ); - } - f = message.getIsSynced(); - if (f) { - writer.writeBool( - 4, - f - ); - } - f = message.getSyncProgress(); + f = message.getIncremental(); if (f !== 0.0) { writer.writeDouble( - 5, + 2, f ); } @@ -1784,130 +1844,38 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.serializeBinaryToWr /** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status = { - UNKNOWN: 0, - WAITING_FOR_PROTX: 1, - POSE_BANNED: 2, - REMOVED: 3, - OPERATOR_KEY_CHANGED: 4, - PROTX_IP_CHANGED: 5, - READY: 6, - ERROR: 7 -}; - -/** - * optional Status status = 1; - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getStatus = function() { - return /** @type {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setStatus = function(value) { - return jspb.Message.setProto3EnumField(this, 1, value); -}; - - -/** - * optional bytes pro_tx_hash = 2; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getProTxHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * optional bytes pro_tx_hash = 2; - * This is a type-conversion wrapper around `getProTxHash()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getProTxHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getProTxHash())); -}; - - -/** - * optional bytes pro_tx_hash = 2; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getProTxHash()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getProTxHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getProTxHash())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setProTxHash = function(value) { - return jspb.Message.setProto3BytesField(this, 2, value); -}; - - -/** - * optional uint32 pose_penalty = 3; + * optional double relay = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getPosePenalty = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.getRelay = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setPosePenalty = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); -}; - - -/** - * optional bool is_synced = 4; - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getIsSynced = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setIsSynced = function(value) { - return jspb.Message.setProto3BooleanField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.setRelay = function(value) { + return jspb.Message.setProto3FloatField(this, 1, value); }; /** - * optional double sync_progress = 5; + * optional double incremental = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getSyncProgress = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.getIncremental = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setSyncProgress = function(value) { - return jspb.Message.setProto3FloatField(this, 5, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.setIncremental = function(value) { + return jspb.Message.setProto3FloatField(this, 2, value); }; @@ -1927,8 +1895,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.toObject(opt_includeInstance, this); }; @@ -1937,14 +1905,14 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.toObject * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.toObject = function(includeInstance, msg) { var f, obj = { - relay: jspb.Message.getFloatingPointFieldWithDefault(msg, 1, 0.0), - incremental: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0) + peersCount: jspb.Message.getFieldWithDefault(msg, 1, 0), + fee: (f = msg.getFee()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.toObject(includeInstance, f) }; if (includeInstance) { @@ -1958,23 +1926,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.toObject = function /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1982,12 +1950,13 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFr var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readDouble()); - msg.setRelay(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setPeersCount(value); break; case 2: - var value = /** @type {number} */ (reader.readDouble()); - msg.setIncremental(value); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.deserializeBinaryFromReader); + msg.setFee(value); break; default: reader.skipField(); @@ -2002,9 +1971,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFr * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2012,234 +1981,220 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.serialize /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getRelay(); - if (f !== 0.0) { - writer.writeDouble( + f = message.getPeersCount(); + if (f !== 0) { + writer.writeUint32( 1, f ); } - f = message.getIncremental(); - if (f !== 0.0) { - writer.writeDouble( + f = message.getFee(); + if (f != null) { + writer.writeMessage( 2, - f + f, + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.serializeBinaryToWriter ); } }; /** - * optional double relay = 1; + * optional uint32 peers_count = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.getRelay = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.getPeersCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.setRelay = function(value) { - return jspb.Message.setProto3FloatField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.setPeersCount = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; /** - * optional double incremental = 2; - * @return {number} + * optional NetworkFee fee = 2; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.getIncremental = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.getFee = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee, 2)); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} returns this +*/ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.setFee = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.setIncremental = function(value) { - return jspb.Message.setProto3FloatField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.clearFee = function() { + return this.setFee(undefined); }; +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.hasFee = function() { + return jspb.Message.getField(this, 2) != null; +}; +/** + * optional Version version = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} + */ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getVersion = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version, 1)); +}; + -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setVersion = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.clearVersion = function() { + return this.setVersion(undefined); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.toObject = function(includeInstance, msg) { - var f, obj = { - peersCount: jspb.Message.getFieldWithDefault(msg, 1, 0), - fee: (f = msg.getFee()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.toObject(includeInstance, f) - }; +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.hasVersion = function() { + return jspb.Message.getField(this, 1) != null; +}; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; + +/** + * optional Time time = 2; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} + */ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getTime = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time, 2)); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setTime = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Network; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.clearTime = function() { + return this.setTime(undefined); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readUint32()); - msg.setPeersCount(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFromReader); - msg.setFee(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.hasTime = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * optional Status status = 3; + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getStatus = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getPeersCount(); - if (f !== 0) { - writer.writeUint32( - 1, - f - ); - } - f = message.getFee(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setStatus = function(value) { + return jspb.Message.setProto3EnumField(this, 3, value); }; /** - * optional uint32 peers_count = 1; + * optional double sync_progress = 4; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.getPeersCount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getSyncProgress = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 4, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.setPeersCount = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setSyncProgress = function(value) { + return jspb.Message.setProto3FloatField(this, 4, value); }; /** - * optional NetworkFee fee = 2; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} + * optional Chain chain = 5; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.getFee = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee, 2)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getChain = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain, 5)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.setFee = function(value) { - return jspb.Message.setWrapperField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setChain = function(value) { + return jspb.Message.setWrapperField(this, 5, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.clearFee = function() { - return this.setFee(undefined); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.clearChain = function() { + return this.setChain(undefined); }; @@ -2247,36 +2202,36 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.clearFee = f * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.hasFee = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.hasChain = function() { + return jspb.Message.getField(this, 5) != null; }; /** - * optional Version version = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} + * optional Network network = 7; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getVersion = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Version, 1)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getNetwork = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network, 7)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Version|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setVersion = function(value) { - return jspb.Message.setWrapperField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setNetwork = function(value) { + return jspb.Message.setWrapperField(this, 7, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearVersion = function() { - return this.setVersion(undefined); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.clearNetwork = function() { + return this.setNetwork(undefined); }; @@ -2284,192 +2239,397 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearVersion = funct * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasVersion = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.hasNetwork = function() { + return jspb.Message.getField(this, 7) != null; }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional Time time = 2; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getTime = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Time, 2)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.toObject(opt_includeInstance, this); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Time|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setTime = function(value) { - return jspb.Message.setWrapperField(this, 2, value); + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearTime = function() { - return this.setTime(undefined); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest; + return proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.deserializeBinaryFromReader(msg, reader); }; /** - * Returns whether this field is set. - * @return {boolean} + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasTime = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional Status status = 3; - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Status} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getStatus = function() { - return /** @type {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Status} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Status} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setStatus = function(value) { - return jspb.Message.setProto3EnumField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional double sync_progress = 4; - * @return {number} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getSyncProgress = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 4, 0.0)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.toObject(opt_includeInstance, this); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setSyncProgress = function(value) { - return jspb.Message.setProto3FloatField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.toObject = function(includeInstance, msg) { + var f, obj = { + status: jspb.Message.getFieldWithDefault(msg, 1, 0), + proTxHash: msg.getProTxHash_asB64(), + posePenalty: jspb.Message.getFieldWithDefault(msg, 3, 0), + isSynced: jspb.Message.getBooleanFieldWithDefault(msg, 4, false), + syncProgress: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional Chain chain = 5; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getChain = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain, 5)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse; + return proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.deserializeBinaryFromReader(msg, reader); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setChain = function(value) { - return jspb.Message.setWrapperField(this, 5, value); + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status} */ (reader.readEnum()); + msg.setStatus(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setProTxHash(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setPosePenalty(value); + break; + case 4: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setIsSynced(value); + break; + case 5: + var value = /** @type {number} */ (reader.readDouble()); + msg.setSyncProgress(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearChain = function() { - return this.setChain(undefined); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * Returns whether this field is set. - * @return {boolean} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasChain = function() { - return jspb.Message.getField(this, 5) != null; +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStatus(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getProTxHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getPosePenalty(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } + f = message.getIsSynced(); + if (f) { + writer.writeBool( + 4, + f + ); + } + f = message.getSyncProgress(); + if (f !== 0.0) { + writer.writeDouble( + 5, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status = { + UNKNOWN: 0, + WAITING_FOR_PROTX: 1, + POSE_BANNED: 2, + REMOVED: 3, + OPERATOR_KEY_CHANGED: 4, + PROTX_IP_CHANGED: 5, + READY: 6, + ERROR: 7 +}; + +/** + * optional Status status = 1; + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getStatus = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * optional Masternode masternode = 6; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getMasternode = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode, 6)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setStatus = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setMasternode = function(value) { - return jspb.Message.setWrapperField(this, 6, value); + * optional bytes pro_tx_hash = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getProTxHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes pro_tx_hash = 2; + * This is a type-conversion wrapper around `getProTxHash()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getProTxHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getProTxHash())); +}; + + +/** + * optional bytes pro_tx_hash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getProTxHash()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getProTxHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getProTxHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setProTxHash = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * optional uint32 pose_penalty = 3; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearMasternode = function() { - return this.setMasternode(undefined); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getPosePenalty = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasMasternode = function() { - return jspb.Message.getField(this, 6) != null; +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setPosePenalty = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); }; /** - * optional Network network = 7; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} + * optional bool is_synced = 4; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getNetwork = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Network, 7)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getIsSynced = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Network|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setNetwork = function(value) { - return jspb.Message.setWrapperField(this, 7, value); + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setIsSynced = function(value) { + return jspb.Message.setProto3BooleanField(this, 4, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * optional double sync_progress = 5; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearNetwork = function() { - return this.setNetwork(undefined); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getSyncProgress = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasNetwork = function() { - return jspb.Message.getField(this, 7) != null; +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setSyncProgress = function(value) { + return jspb.Message.setProto3FloatField(this, 5, value); }; @@ -2783,7 +2943,262 @@ proto.org.dash.platform.dapi.v0.GetBlockResponse.deserializeBinaryFromReader = f */ proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBlock_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes block = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes block = 1; + * This is a type-conversion wrapper around `getBlock()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBlock())); +}; + + +/** + * optional bytes block = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getBlock()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBlock())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.setBlock = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest; + return proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse; + return proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setHeight(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2791,15 +3206,15 @@ proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.serializeBinary = fun /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetBlockResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getBlock_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getHeight(); + if (f !== 0) { + writer.writeUint32( 1, f ); @@ -2808,44 +3223,20 @@ proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter = funct /** - * optional bytes block = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes block = 1; - * This is a type-conversion wrapper around `getBlock()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getBlock())); -}; - - -/** - * optional bytes block = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getBlock()` - * @return {!Uint8Array} + * optional uint32 height = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getBlock())); +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetBlockResponse} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.setBlock = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; @@ -5878,4 +6269,259 @@ proto.org.dash.platform.dapi.v0.InstantSendLockMessages.prototype.clearMessagesL }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.MasternodeListRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.MasternodeListRequest; + return proto.org.dash.platform.dapi.v0.MasternodeListRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.MasternodeListRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.MasternodeListResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.toObject = function(includeInstance, msg) { + var f, obj = { + masternodeListDiff: msg.getMasternodeListDiff_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.MasternodeListResponse; + return proto.org.dash.platform.dapi.v0.MasternodeListResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setMasternodeListDiff(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.MasternodeListResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMasternodeListDiff_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes masternode_list_diff = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.getMasternodeListDiff = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes masternode_list_diff = 1; + * This is a type-conversion wrapper around `getMasternodeListDiff()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.getMasternodeListDiff_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getMasternodeListDiff())); +}; + + +/** + * optional bytes masternode_list_diff = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getMasternodeListDiff()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.getMasternodeListDiff_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getMasternodeListDiff())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} returns this + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.setMasternodeListDiff = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + goog.object.extend(exports, proto.org.dash.platform.dapi.v0); diff --git a/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbobjc.h b/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbobjc.h index 7a4dec55e5b..a9fc68a2b30 100644 --- a/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbobjc.h +++ b/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbobjc.h @@ -29,66 +29,65 @@ CF_EXTERN_C_BEGIN @class BlockHeaders; @class BloomFilter; -@class GetStatusResponse_Chain; -@class GetStatusResponse_Masternode; -@class GetStatusResponse_Network; -@class GetStatusResponse_NetworkFee; -@class GetStatusResponse_Time; -@class GetStatusResponse_Version; +@class GetBlockchainStatusResponse_Chain; +@class GetBlockchainStatusResponse_Network; +@class GetBlockchainStatusResponse_NetworkFee; +@class GetBlockchainStatusResponse_Time; +@class GetBlockchainStatusResponse_Version; @class InstantSendLockMessages; @class RawTransactions; NS_ASSUME_NONNULL_BEGIN -#pragma mark - Enum GetStatusResponse_Status +#pragma mark - Enum GetBlockchainStatusResponse_Status -typedef GPB_ENUM(GetStatusResponse_Status) { +typedef GPB_ENUM(GetBlockchainStatusResponse_Status) { /** * Value used if any message's field encounters a value that is not defined * by this enum. The message will also have C functions to get/set the rawValue * of the field. **/ - GetStatusResponse_Status_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, - GetStatusResponse_Status_NotStarted = 0, - GetStatusResponse_Status_Syncing = 1, - GetStatusResponse_Status_Ready = 2, - GetStatusResponse_Status_Error = 3, + GetBlockchainStatusResponse_Status_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, + GetBlockchainStatusResponse_Status_NotStarted = 0, + GetBlockchainStatusResponse_Status_Syncing = 1, + GetBlockchainStatusResponse_Status_Ready = 2, + GetBlockchainStatusResponse_Status_Error = 3, }; -GPBEnumDescriptor *GetStatusResponse_Status_EnumDescriptor(void); +GPBEnumDescriptor *GetBlockchainStatusResponse_Status_EnumDescriptor(void); /** * Checks to see if the given value is defined by the enum or was not known at * the time this source was generated. **/ -BOOL GetStatusResponse_Status_IsValidValue(int32_t value); +BOOL GetBlockchainStatusResponse_Status_IsValidValue(int32_t value); -#pragma mark - Enum GetStatusResponse_Masternode_Status +#pragma mark - Enum GetMasternodeStatusResponse_Status -typedef GPB_ENUM(GetStatusResponse_Masternode_Status) { +typedef GPB_ENUM(GetMasternodeStatusResponse_Status) { /** * Value used if any message's field encounters a value that is not defined * by this enum. The message will also have C functions to get/set the rawValue * of the field. **/ - GetStatusResponse_Masternode_Status_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, - GetStatusResponse_Masternode_Status_Unknown = 0, - GetStatusResponse_Masternode_Status_WaitingForProtx = 1, - GetStatusResponse_Masternode_Status_PoseBanned = 2, - GetStatusResponse_Masternode_Status_Removed = 3, - GetStatusResponse_Masternode_Status_OperatorKeyChanged = 4, - GetStatusResponse_Masternode_Status_ProtxIpChanged = 5, - GetStatusResponse_Masternode_Status_Ready = 6, - GetStatusResponse_Masternode_Status_Error = 7, + GetMasternodeStatusResponse_Status_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, + GetMasternodeStatusResponse_Status_Unknown = 0, + GetMasternodeStatusResponse_Status_WaitingForProtx = 1, + GetMasternodeStatusResponse_Status_PoseBanned = 2, + GetMasternodeStatusResponse_Status_Removed = 3, + GetMasternodeStatusResponse_Status_OperatorKeyChanged = 4, + GetMasternodeStatusResponse_Status_ProtxIpChanged = 5, + GetMasternodeStatusResponse_Status_Ready = 6, + GetMasternodeStatusResponse_Status_Error = 7, }; -GPBEnumDescriptor *GetStatusResponse_Masternode_Status_EnumDescriptor(void); +GPBEnumDescriptor *GetMasternodeStatusResponse_Status_EnumDescriptor(void); /** * Checks to see if the given value is defined by the enum or was not known at * the time this source was generated. **/ -BOOL GetStatusResponse_Masternode_Status_IsValidValue(int32_t value); +BOOL GetMasternodeStatusResponse_Status_IsValidValue(int32_t value); #pragma mark - CoreRoot @@ -105,73 +104,68 @@ BOOL GetStatusResponse_Masternode_Status_IsValidValue(int32_t value); GPB_FINAL @interface CoreRoot : GPBRootObject @end -#pragma mark - GetStatusRequest +#pragma mark - GetBlockchainStatusRequest -GPB_FINAL @interface GetStatusRequest : GPBMessage +GPB_FINAL @interface GetBlockchainStatusRequest : GPBMessage @end -#pragma mark - GetStatusResponse +#pragma mark - GetBlockchainStatusResponse -typedef GPB_ENUM(GetStatusResponse_FieldNumber) { - GetStatusResponse_FieldNumber_Version = 1, - GetStatusResponse_FieldNumber_Time = 2, - GetStatusResponse_FieldNumber_Status = 3, - GetStatusResponse_FieldNumber_SyncProgress = 4, - GetStatusResponse_FieldNumber_Chain = 5, - GetStatusResponse_FieldNumber_Masternode = 6, - GetStatusResponse_FieldNumber_Network = 7, +typedef GPB_ENUM(GetBlockchainStatusResponse_FieldNumber) { + GetBlockchainStatusResponse_FieldNumber_Version = 1, + GetBlockchainStatusResponse_FieldNumber_Time = 2, + GetBlockchainStatusResponse_FieldNumber_Status = 3, + GetBlockchainStatusResponse_FieldNumber_SyncProgress = 4, + GetBlockchainStatusResponse_FieldNumber_Chain = 5, + GetBlockchainStatusResponse_FieldNumber_Network = 7, }; -GPB_FINAL @interface GetStatusResponse : GPBMessage +GPB_FINAL @interface GetBlockchainStatusResponse : GPBMessage -@property(nonatomic, readwrite, strong, null_resettable) GetStatusResponse_Version *version; +@property(nonatomic, readwrite, strong, null_resettable) GetBlockchainStatusResponse_Version *version; /** Test to see if @c version has been set. */ @property(nonatomic, readwrite) BOOL hasVersion; -@property(nonatomic, readwrite, strong, null_resettable) GetStatusResponse_Time *time; +@property(nonatomic, readwrite, strong, null_resettable) GetBlockchainStatusResponse_Time *time; /** Test to see if @c time has been set. */ @property(nonatomic, readwrite) BOOL hasTime; -@property(nonatomic, readwrite) GetStatusResponse_Status status; +@property(nonatomic, readwrite) GetBlockchainStatusResponse_Status status; @property(nonatomic, readwrite) double syncProgress; -@property(nonatomic, readwrite, strong, null_resettable) GetStatusResponse_Chain *chain; +@property(nonatomic, readwrite, strong, null_resettable) GetBlockchainStatusResponse_Chain *chain; /** Test to see if @c chain has been set. */ @property(nonatomic, readwrite) BOOL hasChain; -@property(nonatomic, readwrite, strong, null_resettable) GetStatusResponse_Masternode *masternode; -/** Test to see if @c masternode has been set. */ -@property(nonatomic, readwrite) BOOL hasMasternode; - -@property(nonatomic, readwrite, strong, null_resettable) GetStatusResponse_Network *network; +@property(nonatomic, readwrite, strong, null_resettable) GetBlockchainStatusResponse_Network *network; /** Test to see if @c network has been set. */ @property(nonatomic, readwrite) BOOL hasNetwork; @end /** - * Fetches the raw value of a @c GetStatusResponse's @c status property, even + * Fetches the raw value of a @c GetBlockchainStatusResponse's @c status property, even * if the value was not defined by the enum at the time the code was generated. **/ -int32_t GetStatusResponse_Status_RawValue(GetStatusResponse *message); +int32_t GetBlockchainStatusResponse_Status_RawValue(GetBlockchainStatusResponse *message); /** - * Sets the raw value of an @c GetStatusResponse's @c status property, allowing + * Sets the raw value of an @c GetBlockchainStatusResponse's @c status property, allowing * it to be set to a value that was not defined by the enum at the time the code * was generated. **/ -void SetGetStatusResponse_Status_RawValue(GetStatusResponse *message, int32_t value); +void SetGetBlockchainStatusResponse_Status_RawValue(GetBlockchainStatusResponse *message, int32_t value); -#pragma mark - GetStatusResponse_Version +#pragma mark - GetBlockchainStatusResponse_Version -typedef GPB_ENUM(GetStatusResponse_Version_FieldNumber) { - GetStatusResponse_Version_FieldNumber_Protocol = 1, - GetStatusResponse_Version_FieldNumber_Software = 2, - GetStatusResponse_Version_FieldNumber_Agent = 3, +typedef GPB_ENUM(GetBlockchainStatusResponse_Version_FieldNumber) { + GetBlockchainStatusResponse_Version_FieldNumber_Protocol = 1, + GetBlockchainStatusResponse_Version_FieldNumber_Software = 2, + GetBlockchainStatusResponse_Version_FieldNumber_Agent = 3, }; -GPB_FINAL @interface GetStatusResponse_Version : GPBMessage +GPB_FINAL @interface GetBlockchainStatusResponse_Version : GPBMessage @property(nonatomic, readwrite) uint32_t protocol; @@ -181,15 +175,15 @@ GPB_FINAL @interface GetStatusResponse_Version : GPBMessage @end -#pragma mark - GetStatusResponse_Time +#pragma mark - GetBlockchainStatusResponse_Time -typedef GPB_ENUM(GetStatusResponse_Time_FieldNumber) { - GetStatusResponse_Time_FieldNumber_Now = 1, - GetStatusResponse_Time_FieldNumber_Offset = 2, - GetStatusResponse_Time_FieldNumber_Median = 3, +typedef GPB_ENUM(GetBlockchainStatusResponse_Time_FieldNumber) { + GetBlockchainStatusResponse_Time_FieldNumber_Now = 1, + GetBlockchainStatusResponse_Time_FieldNumber_Offset = 2, + GetBlockchainStatusResponse_Time_FieldNumber_Median = 3, }; -GPB_FINAL @interface GetStatusResponse_Time : GPBMessage +GPB_FINAL @interface GetBlockchainStatusResponse_Time : GPBMessage @property(nonatomic, readwrite) uint32_t now; @@ -199,20 +193,20 @@ GPB_FINAL @interface GetStatusResponse_Time : GPBMessage @end -#pragma mark - GetStatusResponse_Chain - -typedef GPB_ENUM(GetStatusResponse_Chain_FieldNumber) { - GetStatusResponse_Chain_FieldNumber_Name = 1, - GetStatusResponse_Chain_FieldNumber_HeadersCount = 2, - GetStatusResponse_Chain_FieldNumber_BlocksCount = 3, - GetStatusResponse_Chain_FieldNumber_BestBlockHash = 4, - GetStatusResponse_Chain_FieldNumber_Difficulty = 5, - GetStatusResponse_Chain_FieldNumber_ChainWork = 6, - GetStatusResponse_Chain_FieldNumber_IsSynced = 7, - GetStatusResponse_Chain_FieldNumber_SyncProgress = 8, +#pragma mark - GetBlockchainStatusResponse_Chain + +typedef GPB_ENUM(GetBlockchainStatusResponse_Chain_FieldNumber) { + GetBlockchainStatusResponse_Chain_FieldNumber_Name = 1, + GetBlockchainStatusResponse_Chain_FieldNumber_HeadersCount = 2, + GetBlockchainStatusResponse_Chain_FieldNumber_BlocksCount = 3, + GetBlockchainStatusResponse_Chain_FieldNumber_BestBlockHash = 4, + GetBlockchainStatusResponse_Chain_FieldNumber_Difficulty = 5, + GetBlockchainStatusResponse_Chain_FieldNumber_ChainWork = 6, + GetBlockchainStatusResponse_Chain_FieldNumber_IsSynced = 7, + GetBlockchainStatusResponse_Chain_FieldNumber_SyncProgress = 8, }; -GPB_FINAL @interface GetStatusResponse_Chain : GPBMessage +GPB_FINAL @interface GetBlockchainStatusResponse_Chain : GPBMessage @property(nonatomic, readwrite, copy, null_resettable) NSString *name; @@ -232,74 +226,80 @@ GPB_FINAL @interface GetStatusResponse_Chain : GPBMessage @end -#pragma mark - GetStatusResponse_Masternode +#pragma mark - GetBlockchainStatusResponse_NetworkFee -typedef GPB_ENUM(GetStatusResponse_Masternode_FieldNumber) { - GetStatusResponse_Masternode_FieldNumber_Status = 1, - GetStatusResponse_Masternode_FieldNumber_ProTxHash = 2, - GetStatusResponse_Masternode_FieldNumber_PosePenalty = 3, - GetStatusResponse_Masternode_FieldNumber_IsSynced = 4, - GetStatusResponse_Masternode_FieldNumber_SyncProgress = 5, +typedef GPB_ENUM(GetBlockchainStatusResponse_NetworkFee_FieldNumber) { + GetBlockchainStatusResponse_NetworkFee_FieldNumber_Relay = 1, + GetBlockchainStatusResponse_NetworkFee_FieldNumber_Incremental = 2, }; -GPB_FINAL @interface GetStatusResponse_Masternode : GPBMessage +GPB_FINAL @interface GetBlockchainStatusResponse_NetworkFee : GPBMessage -@property(nonatomic, readwrite) GetStatusResponse_Masternode_Status status; +@property(nonatomic, readwrite) double relay; -@property(nonatomic, readwrite, copy, null_resettable) NSData *proTxHash; +@property(nonatomic, readwrite) double incremental; -@property(nonatomic, readwrite) uint32_t posePenalty; +@end -@property(nonatomic, readwrite) BOOL isSynced; +#pragma mark - GetBlockchainStatusResponse_Network -@property(nonatomic, readwrite) double syncProgress; - -@end +typedef GPB_ENUM(GetBlockchainStatusResponse_Network_FieldNumber) { + GetBlockchainStatusResponse_Network_FieldNumber_PeersCount = 1, + GetBlockchainStatusResponse_Network_FieldNumber_Fee = 2, +}; -/** - * Fetches the raw value of a @c GetStatusResponse_Masternode's @c status property, even - * if the value was not defined by the enum at the time the code was generated. - **/ -int32_t GetStatusResponse_Masternode_Status_RawValue(GetStatusResponse_Masternode *message); -/** - * Sets the raw value of an @c GetStatusResponse_Masternode's @c status property, allowing - * it to be set to a value that was not defined by the enum at the time the code - * was generated. - **/ -void SetGetStatusResponse_Masternode_Status_RawValue(GetStatusResponse_Masternode *message, int32_t value); +GPB_FINAL @interface GetBlockchainStatusResponse_Network : GPBMessage -#pragma mark - GetStatusResponse_NetworkFee +@property(nonatomic, readwrite) uint32_t peersCount; -typedef GPB_ENUM(GetStatusResponse_NetworkFee_FieldNumber) { - GetStatusResponse_NetworkFee_FieldNumber_Relay = 1, - GetStatusResponse_NetworkFee_FieldNumber_Incremental = 2, -}; +@property(nonatomic, readwrite, strong, null_resettable) GetBlockchainStatusResponse_NetworkFee *fee; +/** Test to see if @c fee has been set. */ +@property(nonatomic, readwrite) BOOL hasFee; -GPB_FINAL @interface GetStatusResponse_NetworkFee : GPBMessage +@end -@property(nonatomic, readwrite) double relay; +#pragma mark - GetMasternodeStatusRequest -@property(nonatomic, readwrite) double incremental; +GPB_FINAL @interface GetMasternodeStatusRequest : GPBMessage @end -#pragma mark - GetStatusResponse_Network +#pragma mark - GetMasternodeStatusResponse -typedef GPB_ENUM(GetStatusResponse_Network_FieldNumber) { - GetStatusResponse_Network_FieldNumber_PeersCount = 1, - GetStatusResponse_Network_FieldNumber_Fee = 2, +typedef GPB_ENUM(GetMasternodeStatusResponse_FieldNumber) { + GetMasternodeStatusResponse_FieldNumber_Status = 1, + GetMasternodeStatusResponse_FieldNumber_ProTxHash = 2, + GetMasternodeStatusResponse_FieldNumber_PosePenalty = 3, + GetMasternodeStatusResponse_FieldNumber_IsSynced = 4, + GetMasternodeStatusResponse_FieldNumber_SyncProgress = 5, }; -GPB_FINAL @interface GetStatusResponse_Network : GPBMessage +GPB_FINAL @interface GetMasternodeStatusResponse : GPBMessage -@property(nonatomic, readwrite) uint32_t peersCount; +@property(nonatomic, readwrite) GetMasternodeStatusResponse_Status status; -@property(nonatomic, readwrite, strong, null_resettable) GetStatusResponse_NetworkFee *fee; -/** Test to see if @c fee has been set. */ -@property(nonatomic, readwrite) BOOL hasFee; +@property(nonatomic, readwrite, copy, null_resettable) NSData *proTxHash; + +@property(nonatomic, readwrite) uint32_t posePenalty; + +@property(nonatomic, readwrite) BOOL isSynced; + +@property(nonatomic, readwrite) double syncProgress; @end +/** + * Fetches the raw value of a @c GetMasternodeStatusResponse's @c status property, even + * if the value was not defined by the enum at the time the code was generated. + **/ +int32_t GetMasternodeStatusResponse_Status_RawValue(GetMasternodeStatusResponse *message); +/** + * Sets the raw value of an @c GetMasternodeStatusResponse's @c status property, allowing + * it to be set to a value that was not defined by the enum at the time the code + * was generated. + **/ +void SetGetMasternodeStatusResponse_Status_RawValue(GetMasternodeStatusResponse *message, int32_t value); + #pragma mark - GetBlockRequest typedef GPB_ENUM(GetBlockRequest_FieldNumber) { @@ -340,6 +340,24 @@ GPB_FINAL @interface GetBlockResponse : GPBMessage @end +#pragma mark - GetBestBlockHeightRequest + +GPB_FINAL @interface GetBestBlockHeightRequest : GPBMessage + +@end + +#pragma mark - GetBestBlockHeightResponse + +typedef GPB_ENUM(GetBestBlockHeightResponse_FieldNumber) { + GetBestBlockHeightResponse_FieldNumber_Height = 1, +}; + +GPB_FINAL @interface GetBestBlockHeightResponse : GPBMessage + +@property(nonatomic, readwrite) uint32_t height; + +@end + #pragma mark - BroadcastTransactionRequest typedef GPB_ENUM(BroadcastTransactionRequest_FieldNumber) { @@ -626,6 +644,24 @@ GPB_FINAL @interface InstantSendLockMessages : GPBMessage @end +#pragma mark - MasternodeListRequest + +GPB_FINAL @interface MasternodeListRequest : GPBMessage + +@end + +#pragma mark - MasternodeListResponse + +typedef GPB_ENUM(MasternodeListResponse_FieldNumber) { + MasternodeListResponse_FieldNumber_MasternodeListDiff = 1, +}; + +GPB_FINAL @interface MasternodeListResponse : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *masternodeListDiff; + +@end + NS_ASSUME_NONNULL_END CF_EXTERN_C_END diff --git a/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbobjc.m b/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbobjc.m index 86ff51575a1..9a928f3742a 100644 --- a/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbobjc.m +++ b/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbobjc.m @@ -29,13 +29,12 @@ // We don't use [Foo class] because it is not a static value. GPBObjCClassDeclaration(BlockHeaders); GPBObjCClassDeclaration(BloomFilter); -GPBObjCClassDeclaration(GetStatusResponse); -GPBObjCClassDeclaration(GetStatusResponse_Chain); -GPBObjCClassDeclaration(GetStatusResponse_Masternode); -GPBObjCClassDeclaration(GetStatusResponse_Network); -GPBObjCClassDeclaration(GetStatusResponse_NetworkFee); -GPBObjCClassDeclaration(GetStatusResponse_Time); -GPBObjCClassDeclaration(GetStatusResponse_Version); +GPBObjCClassDeclaration(GetBlockchainStatusResponse); +GPBObjCClassDeclaration(GetBlockchainStatusResponse_Chain); +GPBObjCClassDeclaration(GetBlockchainStatusResponse_Network); +GPBObjCClassDeclaration(GetBlockchainStatusResponse_NetworkFee); +GPBObjCClassDeclaration(GetBlockchainStatusResponse_Time); +GPBObjCClassDeclaration(GetBlockchainStatusResponse_Version); GPBObjCClassDeclaration(InstantSendLockMessages); GPBObjCClassDeclaration(RawTransactions); @@ -62,14 +61,14 @@ @implementation CoreRoot return descriptor; } -#pragma mark - GetStatusRequest +#pragma mark - GetBlockchainStatusRequest -@implementation GetStatusRequest +@implementation GetBlockchainStatusRequest -typedef struct GetStatusRequest__storage_ { +typedef struct GetBlockchainStatusRequest__storage_ { uint32_t _has_storage_[1]; -} GetStatusRequest__storage_; +} GetBlockchainStatusRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -77,12 +76,12 @@ + (GPBDescriptor *)descriptor { static GPBDescriptor *descriptor = nil; if (!descriptor) { GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetStatusRequest class] + [GPBDescriptor allocDescriptorForClass:[GetBlockchainStatusRequest class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() fields:NULL fieldCount:0 - storageSize:sizeof(GetStatusRequest__storage_) + storageSize:sizeof(GetBlockchainStatusRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); @@ -94,28 +93,26 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetStatusResponse +#pragma mark - GetBlockchainStatusResponse -@implementation GetStatusResponse +@implementation GetBlockchainStatusResponse @dynamic hasVersion, version; @dynamic hasTime, time; @dynamic status; @dynamic syncProgress; @dynamic hasChain, chain; -@dynamic hasMasternode, masternode; @dynamic hasNetwork, network; -typedef struct GetStatusResponse__storage_ { +typedef struct GetBlockchainStatusResponse__storage_ { uint32_t _has_storage_[1]; - GetStatusResponse_Status status; - GetStatusResponse_Version *version; - GetStatusResponse_Time *time; - GetStatusResponse_Chain *chain; - GetStatusResponse_Masternode *masternode; - GetStatusResponse_Network *network; + GetBlockchainStatusResponse_Status status; + GetBlockchainStatusResponse_Version *version; + GetBlockchainStatusResponse_Time *time; + GetBlockchainStatusResponse_Chain *chain; + GetBlockchainStatusResponse_Network *network; double syncProgress; -} GetStatusResponse__storage_; +} GetBlockchainStatusResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -125,75 +122,66 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "version", - .dataTypeSpecific.clazz = GPBObjCClass(GetStatusResponse_Version), - .number = GetStatusResponse_FieldNumber_Version, + .dataTypeSpecific.clazz = GPBObjCClass(GetBlockchainStatusResponse_Version), + .number = GetBlockchainStatusResponse_FieldNumber_Version, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetStatusResponse__storage_, version), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse__storage_, version), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "time", - .dataTypeSpecific.clazz = GPBObjCClass(GetStatusResponse_Time), - .number = GetStatusResponse_FieldNumber_Time, + .dataTypeSpecific.clazz = GPBObjCClass(GetBlockchainStatusResponse_Time), + .number = GetBlockchainStatusResponse_FieldNumber_Time, .hasIndex = 1, - .offset = (uint32_t)offsetof(GetStatusResponse__storage_, time), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse__storage_, time), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "status", - .dataTypeSpecific.enumDescFunc = GetStatusResponse_Status_EnumDescriptor, - .number = GetStatusResponse_FieldNumber_Status, + .dataTypeSpecific.enumDescFunc = GetBlockchainStatusResponse_Status_EnumDescriptor, + .number = GetBlockchainStatusResponse_FieldNumber_Status, .hasIndex = 2, - .offset = (uint32_t)offsetof(GetStatusResponse__storage_, status), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse__storage_, status), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeEnum, }, { .name = "syncProgress", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_FieldNumber_SyncProgress, + .number = GetBlockchainStatusResponse_FieldNumber_SyncProgress, .hasIndex = 3, - .offset = (uint32_t)offsetof(GetStatusResponse__storage_, syncProgress), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse__storage_, syncProgress), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeDouble, }, { .name = "chain", - .dataTypeSpecific.clazz = GPBObjCClass(GetStatusResponse_Chain), - .number = GetStatusResponse_FieldNumber_Chain, + .dataTypeSpecific.clazz = GPBObjCClass(GetBlockchainStatusResponse_Chain), + .number = GetBlockchainStatusResponse_FieldNumber_Chain, .hasIndex = 4, - .offset = (uint32_t)offsetof(GetStatusResponse__storage_, chain), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "masternode", - .dataTypeSpecific.clazz = GPBObjCClass(GetStatusResponse_Masternode), - .number = GetStatusResponse_FieldNumber_Masternode, - .hasIndex = 5, - .offset = (uint32_t)offsetof(GetStatusResponse__storage_, masternode), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse__storage_, chain), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "network", - .dataTypeSpecific.clazz = GPBObjCClass(GetStatusResponse_Network), - .number = GetStatusResponse_FieldNumber_Network, - .hasIndex = 6, - .offset = (uint32_t)offsetof(GetStatusResponse__storage_, network), + .dataTypeSpecific.clazz = GPBObjCClass(GetBlockchainStatusResponse_Network), + .number = GetBlockchainStatusResponse_FieldNumber_Network, + .hasIndex = 5, + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse__storage_, network), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetStatusResponse class] + [GPBDescriptor allocDescriptorForClass:[GetBlockchainStatusResponse class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetStatusResponse__storage_) + storageSize:sizeof(GetBlockchainStatusResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); @@ -205,37 +193,37 @@ + (GPBDescriptor *)descriptor { @end -int32_t GetStatusResponse_Status_RawValue(GetStatusResponse *message) { - GPBDescriptor *descriptor = [GetStatusResponse descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetStatusResponse_FieldNumber_Status]; +int32_t GetBlockchainStatusResponse_Status_RawValue(GetBlockchainStatusResponse *message) { + GPBDescriptor *descriptor = [GetBlockchainStatusResponse descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetBlockchainStatusResponse_FieldNumber_Status]; return GPBGetMessageRawEnumField(message, field); } -void SetGetStatusResponse_Status_RawValue(GetStatusResponse *message, int32_t value) { - GPBDescriptor *descriptor = [GetStatusResponse descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetStatusResponse_FieldNumber_Status]; +void SetGetBlockchainStatusResponse_Status_RawValue(GetBlockchainStatusResponse *message, int32_t value) { + GPBDescriptor *descriptor = [GetBlockchainStatusResponse descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetBlockchainStatusResponse_FieldNumber_Status]; GPBSetMessageRawEnumField(message, field, value); } -#pragma mark - Enum GetStatusResponse_Status +#pragma mark - Enum GetBlockchainStatusResponse_Status -GPBEnumDescriptor *GetStatusResponse_Status_EnumDescriptor(void) { +GPBEnumDescriptor *GetBlockchainStatusResponse_Status_EnumDescriptor(void) { static _Atomic(GPBEnumDescriptor*) descriptor = nil; if (!descriptor) { static const char *valueNames = "NotStarted\000Syncing\000Ready\000Error\000"; static const int32_t values[] = { - GetStatusResponse_Status_NotStarted, - GetStatusResponse_Status_Syncing, - GetStatusResponse_Status_Ready, - GetStatusResponse_Status_Error, + GetBlockchainStatusResponse_Status_NotStarted, + GetBlockchainStatusResponse_Status_Syncing, + GetBlockchainStatusResponse_Status_Ready, + GetBlockchainStatusResponse_Status_Error, }; GPBEnumDescriptor *worker = - [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GetStatusResponse_Status) + [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GetBlockchainStatusResponse_Status) valueNames:valueNames values:values count:(uint32_t)(sizeof(values) / sizeof(int32_t)) - enumVerifier:GetStatusResponse_Status_IsValidValue]; + enumVerifier:GetBlockchainStatusResponse_Status_IsValidValue]; GPBEnumDescriptor *expected = nil; if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) { [worker release]; @@ -244,32 +232,32 @@ void SetGetStatusResponse_Status_RawValue(GetStatusResponse *message, int32_t va return descriptor; } -BOOL GetStatusResponse_Status_IsValidValue(int32_t value__) { +BOOL GetBlockchainStatusResponse_Status_IsValidValue(int32_t value__) { switch (value__) { - case GetStatusResponse_Status_NotStarted: - case GetStatusResponse_Status_Syncing: - case GetStatusResponse_Status_Ready: - case GetStatusResponse_Status_Error: + case GetBlockchainStatusResponse_Status_NotStarted: + case GetBlockchainStatusResponse_Status_Syncing: + case GetBlockchainStatusResponse_Status_Ready: + case GetBlockchainStatusResponse_Status_Error: return YES; default: return NO; } } -#pragma mark - GetStatusResponse_Version +#pragma mark - GetBlockchainStatusResponse_Version -@implementation GetStatusResponse_Version +@implementation GetBlockchainStatusResponse_Version @dynamic protocol; @dynamic software; @dynamic agent; -typedef struct GetStatusResponse_Version__storage_ { +typedef struct GetBlockchainStatusResponse_Version__storage_ { uint32_t _has_storage_[1]; uint32_t protocol; uint32_t software; NSString *agent; -} GetStatusResponse_Version__storage_; +} GetBlockchainStatusResponse_Version__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -280,40 +268,40 @@ + (GPBDescriptor *)descriptor { { .name = "protocol", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Version_FieldNumber_Protocol, + .number = GetBlockchainStatusResponse_Version_FieldNumber_Protocol, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetStatusResponse_Version__storage_, protocol), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Version__storage_, protocol), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeUInt32, }, { .name = "software", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Version_FieldNumber_Software, + .number = GetBlockchainStatusResponse_Version_FieldNumber_Software, .hasIndex = 1, - .offset = (uint32_t)offsetof(GetStatusResponse_Version__storage_, software), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Version__storage_, software), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeUInt32, }, { .name = "agent", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Version_FieldNumber_Agent, + .number = GetBlockchainStatusResponse_Version_FieldNumber_Agent, .hasIndex = 2, - .offset = (uint32_t)offsetof(GetStatusResponse_Version__storage_, agent), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Version__storage_, agent), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeString, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetStatusResponse_Version class] + [GPBDescriptor allocDescriptorForClass:[GetBlockchainStatusResponse_Version class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetStatusResponse_Version__storage_) + storageSize:sizeof(GetBlockchainStatusResponse_Version__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetStatusResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetBlockchainStatusResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -324,20 +312,20 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetStatusResponse_Time +#pragma mark - GetBlockchainStatusResponse_Time -@implementation GetStatusResponse_Time +@implementation GetBlockchainStatusResponse_Time @dynamic now; @dynamic offset; @dynamic median; -typedef struct GetStatusResponse_Time__storage_ { +typedef struct GetBlockchainStatusResponse_Time__storage_ { uint32_t _has_storage_[1]; uint32_t now; int32_t offset; uint32_t median; -} GetStatusResponse_Time__storage_; +} GetBlockchainStatusResponse_Time__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -348,40 +336,40 @@ + (GPBDescriptor *)descriptor { { .name = "now", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Time_FieldNumber_Now, + .number = GetBlockchainStatusResponse_Time_FieldNumber_Now, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetStatusResponse_Time__storage_, now), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Time__storage_, now), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeUInt32, }, { .name = "offset", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Time_FieldNumber_Offset, + .number = GetBlockchainStatusResponse_Time_FieldNumber_Offset, .hasIndex = 1, - .offset = (uint32_t)offsetof(GetStatusResponse_Time__storage_, offset), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Time__storage_, offset), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeInt32, }, { .name = "median", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Time_FieldNumber_Median, + .number = GetBlockchainStatusResponse_Time_FieldNumber_Median, .hasIndex = 2, - .offset = (uint32_t)offsetof(GetStatusResponse_Time__storage_, median), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Time__storage_, median), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeUInt32, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetStatusResponse_Time class] + [GPBDescriptor allocDescriptorForClass:[GetBlockchainStatusResponse_Time class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetStatusResponse_Time__storage_) + storageSize:sizeof(GetBlockchainStatusResponse_Time__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetStatusResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetBlockchainStatusResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -392,9 +380,9 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetStatusResponse_Chain +#pragma mark - GetBlockchainStatusResponse_Chain -@implementation GetStatusResponse_Chain +@implementation GetBlockchainStatusResponse_Chain @dynamic name; @dynamic headersCount; @@ -405,7 +393,7 @@ @implementation GetStatusResponse_Chain @dynamic isSynced; @dynamic syncProgress; -typedef struct GetStatusResponse_Chain__storage_ { +typedef struct GetBlockchainStatusResponse_Chain__storage_ { uint32_t _has_storage_[1]; uint32_t headersCount; uint32_t blocksCount; @@ -414,7 +402,7 @@ @implementation GetStatusResponse_Chain NSData *chainWork; double difficulty; double syncProgress; -} GetStatusResponse_Chain__storage_; +} GetBlockchainStatusResponse_Chain__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -425,61 +413,61 @@ + (GPBDescriptor *)descriptor { { .name = "name", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Chain_FieldNumber_Name, + .number = GetBlockchainStatusResponse_Chain_FieldNumber_Name, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetStatusResponse_Chain__storage_, name), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Chain__storage_, name), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeString, }, { .name = "headersCount", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Chain_FieldNumber_HeadersCount, + .number = GetBlockchainStatusResponse_Chain_FieldNumber_HeadersCount, .hasIndex = 1, - .offset = (uint32_t)offsetof(GetStatusResponse_Chain__storage_, headersCount), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Chain__storage_, headersCount), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeUInt32, }, { .name = "blocksCount", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Chain_FieldNumber_BlocksCount, + .number = GetBlockchainStatusResponse_Chain_FieldNumber_BlocksCount, .hasIndex = 2, - .offset = (uint32_t)offsetof(GetStatusResponse_Chain__storage_, blocksCount), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Chain__storage_, blocksCount), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeUInt32, }, { .name = "bestBlockHash", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Chain_FieldNumber_BestBlockHash, + .number = GetBlockchainStatusResponse_Chain_FieldNumber_BestBlockHash, .hasIndex = 3, - .offset = (uint32_t)offsetof(GetStatusResponse_Chain__storage_, bestBlockHash), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Chain__storage_, bestBlockHash), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBytes, }, { .name = "difficulty", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Chain_FieldNumber_Difficulty, + .number = GetBlockchainStatusResponse_Chain_FieldNumber_Difficulty, .hasIndex = 4, - .offset = (uint32_t)offsetof(GetStatusResponse_Chain__storage_, difficulty), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Chain__storage_, difficulty), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeDouble, }, { .name = "chainWork", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Chain_FieldNumber_ChainWork, + .number = GetBlockchainStatusResponse_Chain_FieldNumber_ChainWork, .hasIndex = 5, - .offset = (uint32_t)offsetof(GetStatusResponse_Chain__storage_, chainWork), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Chain__storage_, chainWork), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBytes, }, { .name = "isSynced", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Chain_FieldNumber_IsSynced, + .number = GetBlockchainStatusResponse_Chain_FieldNumber_IsSynced, .hasIndex = 6, .offset = 7, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), @@ -488,22 +476,79 @@ + (GPBDescriptor *)descriptor { { .name = "syncProgress", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Chain_FieldNumber_SyncProgress, + .number = GetBlockchainStatusResponse_Chain_FieldNumber_SyncProgress, .hasIndex = 8, - .offset = (uint32_t)offsetof(GetStatusResponse_Chain__storage_, syncProgress), + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Chain__storage_, syncProgress), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeDouble, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetBlockchainStatusResponse_Chain class] + rootClass:[CoreRoot class] + file:CoreRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetBlockchainStatusResponse_Chain__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetBlockchainStatusResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetBlockchainStatusResponse_NetworkFee + +@implementation GetBlockchainStatusResponse_NetworkFee + +@dynamic relay; +@dynamic incremental; + +typedef struct GetBlockchainStatusResponse_NetworkFee__storage_ { + uint32_t _has_storage_[1]; + double relay; + double incremental; +} GetBlockchainStatusResponse_NetworkFee__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "relay", + .dataTypeSpecific.clazz = Nil, + .number = GetBlockchainStatusResponse_NetworkFee_FieldNumber_Relay, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_NetworkFee__storage_, relay), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeDouble, + }, + { + .name = "incremental", + .dataTypeSpecific.clazz = Nil, + .number = GetBlockchainStatusResponse_NetworkFee_FieldNumber_Incremental, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_NetworkFee__storage_, incremental), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeDouble, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetStatusResponse_Chain class] + [GPBDescriptor allocDescriptorForClass:[GetBlockchainStatusResponse_NetworkFee class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetStatusResponse_Chain__storage_) + storageSize:sizeof(GetBlockchainStatusResponse_NetworkFee__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetStatusResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetBlockchainStatusResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -514,9 +559,98 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetStatusResponse_Masternode +#pragma mark - GetBlockchainStatusResponse_Network + +@implementation GetBlockchainStatusResponse_Network + +@dynamic peersCount; +@dynamic hasFee, fee; -@implementation GetStatusResponse_Masternode +typedef struct GetBlockchainStatusResponse_Network__storage_ { + uint32_t _has_storage_[1]; + uint32_t peersCount; + GetBlockchainStatusResponse_NetworkFee *fee; +} GetBlockchainStatusResponse_Network__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "peersCount", + .dataTypeSpecific.clazz = Nil, + .number = GetBlockchainStatusResponse_Network_FieldNumber_PeersCount, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Network__storage_, peersCount), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt32, + }, + { + .name = "fee", + .dataTypeSpecific.clazz = GPBObjCClass(GetBlockchainStatusResponse_NetworkFee), + .number = GetBlockchainStatusResponse_Network_FieldNumber_Fee, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetBlockchainStatusResponse_Network__storage_, fee), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetBlockchainStatusResponse_Network class] + rootClass:[CoreRoot class] + file:CoreRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetBlockchainStatusResponse_Network__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetBlockchainStatusResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetMasternodeStatusRequest + +@implementation GetMasternodeStatusRequest + + +typedef struct GetMasternodeStatusRequest__storage_ { + uint32_t _has_storage_[1]; +} GetMasternodeStatusRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetMasternodeStatusRequest class] + rootClass:[CoreRoot class] + file:CoreRoot_FileDescriptor() + fields:NULL + fieldCount:0 + storageSize:sizeof(GetMasternodeStatusRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetMasternodeStatusResponse + +@implementation GetMasternodeStatusResponse @dynamic status; @dynamic proTxHash; @@ -524,13 +658,13 @@ @implementation GetStatusResponse_Masternode @dynamic isSynced; @dynamic syncProgress; -typedef struct GetStatusResponse_Masternode__storage_ { +typedef struct GetMasternodeStatusResponse__storage_ { uint32_t _has_storage_[1]; - GetStatusResponse_Masternode_Status status; + GetMasternodeStatusResponse_Status status; uint32_t posePenalty; NSData *proTxHash; double syncProgress; -} GetStatusResponse_Masternode__storage_; +} GetMasternodeStatusResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -540,35 +674,35 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "status", - .dataTypeSpecific.enumDescFunc = GetStatusResponse_Masternode_Status_EnumDescriptor, - .number = GetStatusResponse_Masternode_FieldNumber_Status, + .dataTypeSpecific.enumDescFunc = GetMasternodeStatusResponse_Status_EnumDescriptor, + .number = GetMasternodeStatusResponse_FieldNumber_Status, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetStatusResponse_Masternode__storage_, status), + .offset = (uint32_t)offsetof(GetMasternodeStatusResponse__storage_, status), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeEnum, }, { .name = "proTxHash", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Masternode_FieldNumber_ProTxHash, + .number = GetMasternodeStatusResponse_FieldNumber_ProTxHash, .hasIndex = 1, - .offset = (uint32_t)offsetof(GetStatusResponse_Masternode__storage_, proTxHash), + .offset = (uint32_t)offsetof(GetMasternodeStatusResponse__storage_, proTxHash), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBytes, }, { .name = "posePenalty", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Masternode_FieldNumber_PosePenalty, + .number = GetMasternodeStatusResponse_FieldNumber_PosePenalty, .hasIndex = 2, - .offset = (uint32_t)offsetof(GetStatusResponse_Masternode__storage_, posePenalty), + .offset = (uint32_t)offsetof(GetMasternodeStatusResponse__storage_, posePenalty), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeUInt32, }, { .name = "isSynced", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Masternode_FieldNumber_IsSynced, + .number = GetMasternodeStatusResponse_FieldNumber_IsSynced, .hasIndex = 3, .offset = 4, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), @@ -577,22 +711,21 @@ + (GPBDescriptor *)descriptor { { .name = "syncProgress", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Masternode_FieldNumber_SyncProgress, + .number = GetMasternodeStatusResponse_FieldNumber_SyncProgress, .hasIndex = 5, - .offset = (uint32_t)offsetof(GetStatusResponse_Masternode__storage_, syncProgress), + .offset = (uint32_t)offsetof(GetMasternodeStatusResponse__storage_, syncProgress), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeDouble, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetStatusResponse_Masternode class] + [GPBDescriptor allocDescriptorForClass:[GetMasternodeStatusResponse class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetStatusResponse_Masternode__storage_) + storageSize:sizeof(GetMasternodeStatusResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetStatusResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -603,21 +736,21 @@ + (GPBDescriptor *)descriptor { @end -int32_t GetStatusResponse_Masternode_Status_RawValue(GetStatusResponse_Masternode *message) { - GPBDescriptor *descriptor = [GetStatusResponse_Masternode descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetStatusResponse_Masternode_FieldNumber_Status]; +int32_t GetMasternodeStatusResponse_Status_RawValue(GetMasternodeStatusResponse *message) { + GPBDescriptor *descriptor = [GetMasternodeStatusResponse descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetMasternodeStatusResponse_FieldNumber_Status]; return GPBGetMessageRawEnumField(message, field); } -void SetGetStatusResponse_Masternode_Status_RawValue(GetStatusResponse_Masternode *message, int32_t value) { - GPBDescriptor *descriptor = [GetStatusResponse_Masternode descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetStatusResponse_Masternode_FieldNumber_Status]; +void SetGetMasternodeStatusResponse_Status_RawValue(GetMasternodeStatusResponse *message, int32_t value) { + GPBDescriptor *descriptor = [GetMasternodeStatusResponse descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetMasternodeStatusResponse_FieldNumber_Status]; GPBSetMessageRawEnumField(message, field, value); } -#pragma mark - Enum GetStatusResponse_Masternode_Status +#pragma mark - Enum GetMasternodeStatusResponse_Status -GPBEnumDescriptor *GetStatusResponse_Masternode_Status_EnumDescriptor(void) { +GPBEnumDescriptor *GetMasternodeStatusResponse_Status_EnumDescriptor(void) { static _Atomic(GPBEnumDescriptor*) descriptor = nil; if (!descriptor) { static const char *valueNames = @@ -625,21 +758,21 @@ void SetGetStatusResponse_Masternode_Status_RawValue(GetStatusResponse_Masternod "ed\000OperatorKeyChanged\000ProtxIpChanged\000Rea" "dy\000Error\000"; static const int32_t values[] = { - GetStatusResponse_Masternode_Status_Unknown, - GetStatusResponse_Masternode_Status_WaitingForProtx, - GetStatusResponse_Masternode_Status_PoseBanned, - GetStatusResponse_Masternode_Status_Removed, - GetStatusResponse_Masternode_Status_OperatorKeyChanged, - GetStatusResponse_Masternode_Status_ProtxIpChanged, - GetStatusResponse_Masternode_Status_Ready, - GetStatusResponse_Masternode_Status_Error, + GetMasternodeStatusResponse_Status_Unknown, + GetMasternodeStatusResponse_Status_WaitingForProtx, + GetMasternodeStatusResponse_Status_PoseBanned, + GetMasternodeStatusResponse_Status_Removed, + GetMasternodeStatusResponse_Status_OperatorKeyChanged, + GetMasternodeStatusResponse_Status_ProtxIpChanged, + GetMasternodeStatusResponse_Status_Ready, + GetMasternodeStatusResponse_Status_Error, }; GPBEnumDescriptor *worker = - [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GetStatusResponse_Masternode_Status) + [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GetMasternodeStatusResponse_Status) valueNames:valueNames values:values count:(uint32_t)(sizeof(values) / sizeof(int32_t)) - enumVerifier:GetStatusResponse_Masternode_Status_IsValidValue]; + enumVerifier:GetMasternodeStatusResponse_Status_IsValidValue]; GPBEnumDescriptor *expected = nil; if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) { [worker release]; @@ -648,34 +781,35 @@ void SetGetStatusResponse_Masternode_Status_RawValue(GetStatusResponse_Masternod return descriptor; } -BOOL GetStatusResponse_Masternode_Status_IsValidValue(int32_t value__) { +BOOL GetMasternodeStatusResponse_Status_IsValidValue(int32_t value__) { switch (value__) { - case GetStatusResponse_Masternode_Status_Unknown: - case GetStatusResponse_Masternode_Status_WaitingForProtx: - case GetStatusResponse_Masternode_Status_PoseBanned: - case GetStatusResponse_Masternode_Status_Removed: - case GetStatusResponse_Masternode_Status_OperatorKeyChanged: - case GetStatusResponse_Masternode_Status_ProtxIpChanged: - case GetStatusResponse_Masternode_Status_Ready: - case GetStatusResponse_Masternode_Status_Error: + case GetMasternodeStatusResponse_Status_Unknown: + case GetMasternodeStatusResponse_Status_WaitingForProtx: + case GetMasternodeStatusResponse_Status_PoseBanned: + case GetMasternodeStatusResponse_Status_Removed: + case GetMasternodeStatusResponse_Status_OperatorKeyChanged: + case GetMasternodeStatusResponse_Status_ProtxIpChanged: + case GetMasternodeStatusResponse_Status_Ready: + case GetMasternodeStatusResponse_Status_Error: return YES; default: return NO; } } -#pragma mark - GetStatusResponse_NetworkFee +#pragma mark - GetBlockRequest -@implementation GetStatusResponse_NetworkFee +@implementation GetBlockRequest -@dynamic relay; -@dynamic incremental; +@dynamic blockOneOfCase; +@dynamic height; +@dynamic hash_p; -typedef struct GetStatusResponse_NetworkFee__storage_ { - uint32_t _has_storage_[1]; - double relay; - double incremental; -} GetStatusResponse_NetworkFee__storage_; +typedef struct GetBlockRequest__storage_ { + uint32_t _has_storage_[2]; + uint32_t height; + NSString *hash_p; +} GetBlockRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -684,33 +818,38 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "relay", + .name = "height", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_NetworkFee_FieldNumber_Relay, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetStatusResponse_NetworkFee__storage_, relay), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeDouble, + .number = GetBlockRequest_FieldNumber_Height, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetBlockRequest__storage_, height), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeUInt32, }, { - .name = "incremental", + .name = "hash_p", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_NetworkFee_FieldNumber_Incremental, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetStatusResponse_NetworkFee__storage_, incremental), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeDouble, + .number = GetBlockRequest_FieldNumber_Hash_p, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetBlockRequest__storage_, hash_p), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetStatusResponse_NetworkFee class] + [GPBDescriptor allocDescriptorForClass:[GetBlockRequest class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetStatusResponse_NetworkFee__storage_) + storageSize:sizeof(GetBlockRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetStatusResponse)]; + static const char *oneofs[] = { + "block", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -721,18 +860,21 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetStatusResponse_Network +void GetBlockRequest_ClearBlockOneOfCase(GetBlockRequest *message) { + GPBDescriptor *descriptor = [GetBlockRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetBlockResponse -@implementation GetStatusResponse_Network +@implementation GetBlockResponse -@dynamic peersCount; -@dynamic hasFee, fee; +@dynamic block; -typedef struct GetStatusResponse_Network__storage_ { +typedef struct GetBlockResponse__storage_ { uint32_t _has_storage_[1]; - uint32_t peersCount; - GetStatusResponse_NetworkFee *fee; -} GetStatusResponse_Network__storage_; + NSData *block; +} GetBlockResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -741,33 +883,23 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "peersCount", + .name = "block", .dataTypeSpecific.clazz = Nil, - .number = GetStatusResponse_Network_FieldNumber_PeersCount, + .number = GetBlockResponse_FieldNumber_Block, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetStatusResponse_Network__storage_, peersCount), + .offset = (uint32_t)offsetof(GetBlockResponse__storage_, block), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeUInt32, - }, - { - .name = "fee", - .dataTypeSpecific.clazz = GPBObjCClass(GetStatusResponse_NetworkFee), - .number = GetStatusResponse_Network_FieldNumber_Fee, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetStatusResponse_Network__storage_, fee), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .dataType = GPBDataTypeBytes, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetStatusResponse_Network class] + [GPBDescriptor allocDescriptorForClass:[GetBlockResponse class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetStatusResponse_Network__storage_) + storageSize:sizeof(GetBlockResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetStatusResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -778,59 +910,28 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetBlockRequest +#pragma mark - GetBestBlockHeightRequest -@implementation GetBlockRequest +@implementation GetBestBlockHeightRequest -@dynamic blockOneOfCase; -@dynamic height; -@dynamic hash_p; -typedef struct GetBlockRequest__storage_ { - uint32_t _has_storage_[2]; - uint32_t height; - NSString *hash_p; -} GetBlockRequest__storage_; +typedef struct GetBestBlockHeightRequest__storage_ { + uint32_t _has_storage_[1]; +} GetBestBlockHeightRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. + (GPBDescriptor *)descriptor { static GPBDescriptor *descriptor = nil; if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "height", - .dataTypeSpecific.clazz = Nil, - .number = GetBlockRequest_FieldNumber_Height, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetBlockRequest__storage_, height), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeUInt32, - }, - { - .name = "hash_p", - .dataTypeSpecific.clazz = Nil, - .number = GetBlockRequest_FieldNumber_Hash_p, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetBlockRequest__storage_, hash_p), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeString, - }, - }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetBlockRequest class] + [GPBDescriptor allocDescriptorForClass:[GetBestBlockHeightRequest class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() - fields:fields - fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetBlockRequest__storage_) + fields:NULL + fieldCount:0 + storageSize:sizeof(GetBestBlockHeightRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "block", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -841,21 +942,16 @@ + (GPBDescriptor *)descriptor { @end -void GetBlockRequest_ClearBlockOneOfCase(GetBlockRequest *message) { - GPBDescriptor *descriptor = [GetBlockRequest descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} -#pragma mark - GetBlockResponse +#pragma mark - GetBestBlockHeightResponse -@implementation GetBlockResponse +@implementation GetBestBlockHeightResponse -@dynamic block; +@dynamic height; -typedef struct GetBlockResponse__storage_ { +typedef struct GetBestBlockHeightResponse__storage_ { uint32_t _has_storage_[1]; - NSData *block; -} GetBlockResponse__storage_; + uint32_t height; +} GetBestBlockHeightResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -864,22 +960,22 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "block", + .name = "height", .dataTypeSpecific.clazz = Nil, - .number = GetBlockResponse_FieldNumber_Block, + .number = GetBestBlockHeightResponse_FieldNumber_Height, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetBlockResponse__storage_, block), + .offset = (uint32_t)offsetof(GetBestBlockHeightResponse__storage_, height), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, + .dataType = GPBDataTypeUInt32, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetBlockResponse class] + [GPBDescriptor allocDescriptorForClass:[GetBestBlockHeightResponse class] rootClass:[CoreRoot class] file:CoreRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetBlockResponse__storage_) + storageSize:sizeof(GetBestBlockHeightResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); @@ -1773,6 +1869,83 @@ + (GPBDescriptor *)descriptor { @end +#pragma mark - MasternodeListRequest + +@implementation MasternodeListRequest + + +typedef struct MasternodeListRequest__storage_ { + uint32_t _has_storage_[1]; +} MasternodeListRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[MasternodeListRequest class] + rootClass:[CoreRoot class] + file:CoreRoot_FileDescriptor() + fields:NULL + fieldCount:0 + storageSize:sizeof(MasternodeListRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - MasternodeListResponse + +@implementation MasternodeListResponse + +@dynamic masternodeListDiff; + +typedef struct MasternodeListResponse__storage_ { + uint32_t _has_storage_[1]; + NSData *masternodeListDiff; +} MasternodeListResponse__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "masternodeListDiff", + .dataTypeSpecific.clazz = Nil, + .number = MasternodeListResponse_FieldNumber_MasternodeListDiff, + .hasIndex = 0, + .offset = (uint32_t)offsetof(MasternodeListResponse__storage_, masternodeListDiff), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[MasternodeListResponse class] + rootClass:[CoreRoot class] + file:CoreRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(MasternodeListResponse__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + #pragma clang diagnostic pop diff --git a/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbrpc.h b/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbrpc.h index a5016dbd657..96b789ae4b2 100644 --- a/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbrpc.h +++ b/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbrpc.h @@ -18,14 +18,20 @@ @class BlockHeadersWithChainLocksResponse; @class BroadcastTransactionRequest; @class BroadcastTransactionResponse; +@class GetBestBlockHeightRequest; +@class GetBestBlockHeightResponse; @class GetBlockRequest; @class GetBlockResponse; +@class GetBlockchainStatusRequest; +@class GetBlockchainStatusResponse; @class GetEstimatedTransactionFeeRequest; @class GetEstimatedTransactionFeeResponse; -@class GetStatusRequest; -@class GetStatusResponse; +@class GetMasternodeStatusRequest; +@class GetMasternodeStatusResponse; @class GetTransactionRequest; @class GetTransactionResponse; +@class MasternodeListRequest; +@class MasternodeListResponse; @class TransactionsWithProofsRequest; @class TransactionsWithProofsResponse; @@ -43,14 +49,22 @@ NS_ASSUME_NONNULL_BEGIN @protocol Core2 -#pragma mark getStatus(GetStatusRequest) returns (GetStatusResponse) +#pragma mark getBlockchainStatus(GetBlockchainStatusRequest) returns (GetBlockchainStatusResponse) -- (GRPCUnaryProtoCall *)getStatusWithMessage:(GetStatusRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; +- (GRPCUnaryProtoCall *)getBlockchainStatusWithMessage:(GetBlockchainStatusRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + +#pragma mark getMasternodeStatus(GetMasternodeStatusRequest) returns (GetMasternodeStatusResponse) + +- (GRPCUnaryProtoCall *)getMasternodeStatusWithMessage:(GetMasternodeStatusRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; #pragma mark getBlock(GetBlockRequest) returns (GetBlockResponse) - (GRPCUnaryProtoCall *)getBlockWithMessage:(GetBlockRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; +#pragma mark getBestBlockHeight(GetBestBlockHeightRequest) returns (GetBestBlockHeightResponse) + +- (GRPCUnaryProtoCall *)getBestBlockHeightWithMessage:(GetBestBlockHeightRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + #pragma mark broadcastTransaction(BroadcastTransactionRequest) returns (BroadcastTransactionResponse) - (GRPCUnaryProtoCall *)broadcastTransactionWithMessage:(BroadcastTransactionRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; @@ -71,6 +85,10 @@ NS_ASSUME_NONNULL_BEGIN - (GRPCUnaryProtoCall *)subscribeToTransactionsWithProofsWithMessage:(TransactionsWithProofsRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; +#pragma mark subscribeToMasternodeList(MasternodeListRequest) returns (stream MasternodeListResponse) + +- (GRPCUnaryProtoCall *)subscribeToMasternodeListWithMessage:(MasternodeListRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + @end /** @@ -79,11 +97,18 @@ NS_ASSUME_NONNULL_BEGIN */ @protocol Core -#pragma mark getStatus(GetStatusRequest) returns (GetStatusResponse) +#pragma mark getBlockchainStatus(GetBlockchainStatusRequest) returns (GetBlockchainStatusResponse) + +- (void)getBlockchainStatusWithRequest:(GetBlockchainStatusRequest *)request handler:(void(^)(GetBlockchainStatusResponse *_Nullable response, NSError *_Nullable error))handler; + +- (GRPCProtoCall *)RPCTogetBlockchainStatusWithRequest:(GetBlockchainStatusRequest *)request handler:(void(^)(GetBlockchainStatusResponse *_Nullable response, NSError *_Nullable error))handler; + -- (void)getStatusWithRequest:(GetStatusRequest *)request handler:(void(^)(GetStatusResponse *_Nullable response, NSError *_Nullable error))handler; +#pragma mark getMasternodeStatus(GetMasternodeStatusRequest) returns (GetMasternodeStatusResponse) -- (GRPCProtoCall *)RPCTogetStatusWithRequest:(GetStatusRequest *)request handler:(void(^)(GetStatusResponse *_Nullable response, NSError *_Nullable error))handler; +- (void)getMasternodeStatusWithRequest:(GetMasternodeStatusRequest *)request handler:(void(^)(GetMasternodeStatusResponse *_Nullable response, NSError *_Nullable error))handler; + +- (GRPCProtoCall *)RPCTogetMasternodeStatusWithRequest:(GetMasternodeStatusRequest *)request handler:(void(^)(GetMasternodeStatusResponse *_Nullable response, NSError *_Nullable error))handler; #pragma mark getBlock(GetBlockRequest) returns (GetBlockResponse) @@ -93,6 +118,13 @@ NS_ASSUME_NONNULL_BEGIN - (GRPCProtoCall *)RPCTogetBlockWithRequest:(GetBlockRequest *)request handler:(void(^)(GetBlockResponse *_Nullable response, NSError *_Nullable error))handler; +#pragma mark getBestBlockHeight(GetBestBlockHeightRequest) returns (GetBestBlockHeightResponse) + +- (void)getBestBlockHeightWithRequest:(GetBestBlockHeightRequest *)request handler:(void(^)(GetBestBlockHeightResponse *_Nullable response, NSError *_Nullable error))handler; + +- (GRPCProtoCall *)RPCTogetBestBlockHeightWithRequest:(GetBestBlockHeightRequest *)request handler:(void(^)(GetBestBlockHeightResponse *_Nullable response, NSError *_Nullable error))handler; + + #pragma mark broadcastTransaction(BroadcastTransactionRequest) returns (BroadcastTransactionResponse) - (void)broadcastTransactionWithRequest:(BroadcastTransactionRequest *)request handler:(void(^)(BroadcastTransactionResponse *_Nullable response, NSError *_Nullable error))handler; @@ -128,6 +160,13 @@ NS_ASSUME_NONNULL_BEGIN - (GRPCProtoCall *)RPCTosubscribeToTransactionsWithProofsWithRequest:(TransactionsWithProofsRequest *)request eventHandler:(void(^)(BOOL done, TransactionsWithProofsResponse *_Nullable response, NSError *_Nullable error))eventHandler; +#pragma mark subscribeToMasternodeList(MasternodeListRequest) returns (stream MasternodeListResponse) + +- (void)subscribeToMasternodeListWithRequest:(MasternodeListRequest *)request eventHandler:(void(^)(BOOL done, MasternodeListResponse *_Nullable response, NSError *_Nullable error))eventHandler; + +- (GRPCProtoCall *)RPCTosubscribeToMasternodeListWithRequest:(MasternodeListRequest *)request eventHandler:(void(^)(BOOL done, MasternodeListResponse *_Nullable response, NSError *_Nullable error))eventHandler; + + @end diff --git a/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbrpc.m b/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbrpc.m index 2c16c550ac9..2eb5f351c16 100644 --- a/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbrpc.m +++ b/packages/dapi-grpc/clients/core/v0/objective-c/Core.pbrpc.m @@ -55,24 +55,44 @@ + (instancetype)serviceWithHost:(NSString *)host callOptions:(GRPCCallOptions *_ #pragma mark - Method Implementations -#pragma mark getStatus(GetStatusRequest) returns (GetStatusResponse) +#pragma mark getBlockchainStatus(GetBlockchainStatusRequest) returns (GetBlockchainStatusResponse) -- (void)getStatusWithRequest:(GetStatusRequest *)request handler:(void(^)(GetStatusResponse *_Nullable response, NSError *_Nullable error))handler{ - [[self RPCTogetStatusWithRequest:request handler:handler] start]; +- (void)getBlockchainStatusWithRequest:(GetBlockchainStatusRequest *)request handler:(void(^)(GetBlockchainStatusResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetBlockchainStatusWithRequest:request handler:handler] start]; } // Returns a not-yet-started RPC object. -- (GRPCProtoCall *)RPCTogetStatusWithRequest:(GetStatusRequest *)request handler:(void(^)(GetStatusResponse *_Nullable response, NSError *_Nullable error))handler{ - return [self RPCToMethod:@"getStatus" +- (GRPCProtoCall *)RPCTogetBlockchainStatusWithRequest:(GetBlockchainStatusRequest *)request handler:(void(^)(GetBlockchainStatusResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getBlockchainStatus" requestsWriter:[GRXWriter writerWithValue:request] - responseClass:[GetStatusResponse class] + responseClass:[GetBlockchainStatusResponse class] responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; } -- (GRPCUnaryProtoCall *)getStatusWithMessage:(GetStatusRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { - return [self RPCToMethod:@"getStatus" +- (GRPCUnaryProtoCall *)getBlockchainStatusWithMessage:(GetBlockchainStatusRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getBlockchainStatus" message:message responseHandler:handler callOptions:callOptions - responseClass:[GetStatusResponse class]]; + responseClass:[GetBlockchainStatusResponse class]]; +} + +#pragma mark getMasternodeStatus(GetMasternodeStatusRequest) returns (GetMasternodeStatusResponse) + +- (void)getMasternodeStatusWithRequest:(GetMasternodeStatusRequest *)request handler:(void(^)(GetMasternodeStatusResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetMasternodeStatusWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +- (GRPCProtoCall *)RPCTogetMasternodeStatusWithRequest:(GetMasternodeStatusRequest *)request handler:(void(^)(GetMasternodeStatusResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getMasternodeStatus" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[GetMasternodeStatusResponse class] + responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; +} +- (GRPCUnaryProtoCall *)getMasternodeStatusWithMessage:(GetMasternodeStatusRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getMasternodeStatus" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[GetMasternodeStatusResponse class]]; } #pragma mark getBlock(GetBlockRequest) returns (GetBlockResponse) @@ -95,6 +115,26 @@ - (GRPCUnaryProtoCall *)getBlockWithMessage:(GetBlockRequest *)message responseH responseClass:[GetBlockResponse class]]; } +#pragma mark getBestBlockHeight(GetBestBlockHeightRequest) returns (GetBestBlockHeightResponse) + +- (void)getBestBlockHeightWithRequest:(GetBestBlockHeightRequest *)request handler:(void(^)(GetBestBlockHeightResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetBestBlockHeightWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +- (GRPCProtoCall *)RPCTogetBestBlockHeightWithRequest:(GetBestBlockHeightRequest *)request handler:(void(^)(GetBestBlockHeightResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getBestBlockHeight" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[GetBestBlockHeightResponse class] + responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; +} +- (GRPCUnaryProtoCall *)getBestBlockHeightWithMessage:(GetBestBlockHeightRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getBestBlockHeight" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[GetBestBlockHeightResponse class]]; +} + #pragma mark broadcastTransaction(BroadcastTransactionRequest) returns (BroadcastTransactionResponse) - (void)broadcastTransactionWithRequest:(BroadcastTransactionRequest *)request handler:(void(^)(BroadcastTransactionResponse *_Nullable response, NSError *_Nullable error))handler{ @@ -195,5 +235,25 @@ - (GRPCUnaryProtoCall *)subscribeToTransactionsWithProofsWithMessage:(Transactio responseClass:[TransactionsWithProofsResponse class]]; } +#pragma mark subscribeToMasternodeList(MasternodeListRequest) returns (stream MasternodeListResponse) + +- (void)subscribeToMasternodeListWithRequest:(MasternodeListRequest *)request eventHandler:(void(^)(BOOL done, MasternodeListResponse *_Nullable response, NSError *_Nullable error))eventHandler{ + [[self RPCTosubscribeToMasternodeListWithRequest:request eventHandler:eventHandler] start]; +} +// Returns a not-yet-started RPC object. +- (GRPCProtoCall *)RPCTosubscribeToMasternodeListWithRequest:(MasternodeListRequest *)request eventHandler:(void(^)(BOOL done, MasternodeListResponse *_Nullable response, NSError *_Nullable error))eventHandler{ + return [self RPCToMethod:@"subscribeToMasternodeList" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[MasternodeListResponse class] + responsesWriteable:[GRXWriteable writeableWithEventHandler:eventHandler]]; +} +- (GRPCUnaryProtoCall *)subscribeToMasternodeListWithMessage:(MasternodeListRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"subscribeToMasternodeList" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[MasternodeListResponse class]]; +} + @end #endif diff --git a/packages/dapi-grpc/clients/core/v0/python/core_pb2.py b/packages/dapi-grpc/clients/core/v0/python/core_pb2.py index cc79763de81..7a3ce10c143 100644 --- a/packages/dapi-grpc/clients/core/v0/python/core_pb2.py +++ b/packages/dapi-grpc/clients/core/v0/python/core_pb2.py @@ -19,105 +19,105 @@ syntax='proto3', serialized_options=None, create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\ncore.proto\x12\x19org.dash.platform.dapi.v0\"\x12\n\x10GetStatusRequest\"\x8e\n\n\x11GetStatusResponse\x12\x45\n\x07version\x18\x01 \x01(\x0b\x32\x34.org.dash.platform.dapi.v0.GetStatusResponse.Version\x12?\n\x04time\x18\x02 \x01(\x0b\x32\x31.org.dash.platform.dapi.v0.GetStatusResponse.Time\x12\x43\n\x06status\x18\x03 \x01(\x0e\x32\x33.org.dash.platform.dapi.v0.GetStatusResponse.Status\x12\x15\n\rsync_progress\x18\x04 \x01(\x01\x12\x41\n\x05\x63hain\x18\x05 \x01(\x0b\x32\x32.org.dash.platform.dapi.v0.GetStatusResponse.Chain\x12K\n\nmasternode\x18\x06 \x01(\x0b\x32\x37.org.dash.platform.dapi.v0.GetStatusResponse.Masternode\x12\x45\n\x07network\x18\x07 \x01(\x0b\x32\x34.org.dash.platform.dapi.v0.GetStatusResponse.Network\x1a<\n\x07Version\x12\x10\n\x08protocol\x18\x01 \x01(\r\x12\x10\n\x08software\x18\x02 \x01(\r\x12\r\n\x05\x61gent\x18\x03 \x01(\t\x1a\x33\n\x04Time\x12\x0b\n\x03now\x18\x01 \x01(\r\x12\x0e\n\x06offset\x18\x02 \x01(\x05\x12\x0e\n\x06median\x18\x03 \x01(\r\x1a\xad\x01\n\x05\x43hain\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x15\n\rheaders_count\x18\x02 \x01(\r\x12\x14\n\x0c\x62locks_count\x18\x03 \x01(\r\x12\x17\n\x0f\x62\x65st_block_hash\x18\x04 \x01(\x0c\x12\x12\n\ndifficulty\x18\x05 \x01(\x01\x12\x12\n\nchain_work\x18\x06 \x01(\x0c\x12\x11\n\tis_synced\x18\x07 \x01(\x08\x12\x15\n\rsync_progress\x18\x08 \x01(\x01\x1a\xc4\x02\n\nMasternode\x12N\n\x06status\x18\x01 \x01(\x0e\x32>.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status\x12\x13\n\x0bpro_tx_hash\x18\x02 \x01(\x0c\x12\x14\n\x0cpose_penalty\x18\x03 \x01(\r\x12\x11\n\tis_synced\x18\x04 \x01(\x08\x12\x15\n\rsync_progress\x18\x05 \x01(\x01\"\x90\x01\n\x06Status\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x15\n\x11WAITING_FOR_PROTX\x10\x01\x12\x0f\n\x0bPOSE_BANNED\x10\x02\x12\x0b\n\x07REMOVED\x10\x03\x12\x18\n\x14OPERATOR_KEY_CHANGED\x10\x04\x12\x14\n\x10PROTX_IP_CHANGED\x10\x05\x12\t\n\x05READY\x10\x06\x12\t\n\x05\x45RROR\x10\x07\x1a\x30\n\nNetworkFee\x12\r\n\x05relay\x18\x01 \x01(\x01\x12\x13\n\x0bincremental\x18\x02 \x01(\x01\x1a\x64\n\x07Network\x12\x13\n\x0bpeers_count\x18\x01 \x01(\r\x12\x44\n\x03\x66\x65\x65\x18\x02 \x01(\x0b\x32\x37.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee\"<\n\x06Status\x12\x0f\n\x0bNOT_STARTED\x10\x00\x12\x0b\n\x07SYNCING\x10\x01\x12\t\n\x05READY\x10\x02\x12\t\n\x05\x45RROR\x10\x03\"<\n\x0fGetBlockRequest\x12\x10\n\x06height\x18\x01 \x01(\rH\x00\x12\x0e\n\x04hash\x18\x02 \x01(\tH\x00\x42\x07\n\x05\x62lock\"!\n\x10GetBlockResponse\x12\r\n\x05\x62lock\x18\x01 \x01(\x0c\"b\n\x1b\x42roadcastTransactionRequest\x12\x13\n\x0btransaction\x18\x01 \x01(\x0c\x12\x17\n\x0f\x61llow_high_fees\x18\x02 \x01(\x08\x12\x15\n\rbypass_limits\x18\x03 \x01(\x08\"6\n\x1c\x42roadcastTransactionResponse\x12\x16\n\x0etransaction_id\x18\x01 \x01(\t\"#\n\x15GetTransactionRequest\x12\n\n\x02id\x18\x01 \x01(\t\"\x9c\x01\n\x16GetTransactionResponse\x12\x13\n\x0btransaction\x18\x01 \x01(\x0c\x12\x12\n\nblock_hash\x18\x02 \x01(\x0c\x12\x0e\n\x06height\x18\x03 \x01(\r\x12\x15\n\rconfirmations\x18\x04 \x01(\r\x12\x19\n\x11is_instant_locked\x18\x05 \x01(\x08\x12\x17\n\x0fis_chain_locked\x18\x06 \x01(\x08\"x\n!BlockHeadersWithChainLocksRequest\x12\x19\n\x0f\x66rom_block_hash\x18\x01 \x01(\x0cH\x00\x12\x1b\n\x11\x66rom_block_height\x18\x02 \x01(\rH\x00\x12\r\n\x05\x63ount\x18\x03 \x01(\rB\x0c\n\nfrom_block\"\x89\x01\n\"BlockHeadersWithChainLocksResponse\x12@\n\rblock_headers\x18\x01 \x01(\x0b\x32\'.org.dash.platform.dapi.v0.BlockHeadersH\x00\x12\x14\n\nchain_lock\x18\x02 \x01(\x0cH\x00\x42\x0b\n\tresponses\"\x1f\n\x0c\x42lockHeaders\x12\x0f\n\x07headers\x18\x01 \x03(\x0c\"3\n!GetEstimatedTransactionFeeRequest\x12\x0e\n\x06\x62locks\x18\x01 \x01(\r\"1\n\"GetEstimatedTransactionFeeResponse\x12\x0b\n\x03\x66\x65\x65\x18\x01 \x01(\x01\"\xd3\x01\n\x1dTransactionsWithProofsRequest\x12<\n\x0c\x62loom_filter\x18\x01 \x01(\x0b\x32&.org.dash.platform.dapi.v0.BloomFilter\x12\x19\n\x0f\x66rom_block_hash\x18\x02 \x01(\x0cH\x00\x12\x1b\n\x11\x66rom_block_height\x18\x03 \x01(\rH\x00\x12\r\n\x05\x63ount\x18\x04 \x01(\r\x12\x1f\n\x17send_transaction_hashes\x18\x05 \x01(\x08\x42\x0c\n\nfrom_block\"U\n\x0b\x42loomFilter\x12\x0e\n\x06v_data\x18\x01 \x01(\x0c\x12\x14\n\x0cn_hash_funcs\x18\x02 \x01(\r\x12\x0f\n\x07n_tweak\x18\x03 \x01(\r\x12\x0f\n\x07n_flags\x18\x04 \x01(\r\"\xeb\x01\n\x1eTransactionsWithProofsResponse\x12\x46\n\x10raw_transactions\x18\x01 \x01(\x0b\x32*.org.dash.platform.dapi.v0.RawTransactionsH\x00\x12X\n\x1ainstant_send_lock_messages\x18\x02 \x01(\x0b\x32\x32.org.dash.platform.dapi.v0.InstantSendLockMessagesH\x00\x12\x1a\n\x10raw_merkle_block\x18\x03 \x01(\x0cH\x00\x42\x0b\n\tresponses\"\'\n\x0fRawTransactions\x12\x14\n\x0ctransactions\x18\x01 \x03(\x0c\"+\n\x17InstantSendLockMessages\x12\x10\n\x08messages\x18\x01 \x03(\x0c\x32\xb6\x07\n\x04\x43ore\x12\x66\n\tgetStatus\x12+.org.dash.platform.dapi.v0.GetStatusRequest\x1a,.org.dash.platform.dapi.v0.GetStatusResponse\x12\x63\n\x08getBlock\x12*.org.dash.platform.dapi.v0.GetBlockRequest\x1a+.org.dash.platform.dapi.v0.GetBlockResponse\x12\x87\x01\n\x14\x62roadcastTransaction\x12\x36.org.dash.platform.dapi.v0.BroadcastTransactionRequest\x1a\x37.org.dash.platform.dapi.v0.BroadcastTransactionResponse\x12u\n\x0egetTransaction\x12\x30.org.dash.platform.dapi.v0.GetTransactionRequest\x1a\x31.org.dash.platform.dapi.v0.GetTransactionResponse\x12\x99\x01\n\x1agetEstimatedTransactionFee\x12<.org.dash.platform.dapi.v0.GetEstimatedTransactionFeeRequest\x1a=.org.dash.platform.dapi.v0.GetEstimatedTransactionFeeResponse\x12\xa6\x01\n%subscribeToBlockHeadersWithChainLocks\x12<.org.dash.platform.dapi.v0.BlockHeadersWithChainLocksRequest\x1a=.org.dash.platform.dapi.v0.BlockHeadersWithChainLocksResponse0\x01\x12\x9a\x01\n!subscribeToTransactionsWithProofs\x12\x38.org.dash.platform.dapi.v0.TransactionsWithProofsRequest\x1a\x39.org.dash.platform.dapi.v0.TransactionsWithProofsResponse0\x01\x62\x06proto3' + serialized_pb=b'\n\ncore.proto\x12\x19org.dash.platform.dapi.v0\"\x1c\n\x1aGetBlockchainStatusRequest\"\xc0\x07\n\x1bGetBlockchainStatusResponse\x12O\n\x07version\x18\x01 \x01(\x0b\x32>.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version\x12I\n\x04time\x18\x02 \x01(\x0b\x32;.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time\x12M\n\x06status\x18\x03 \x01(\x0e\x32=.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status\x12\x15\n\rsync_progress\x18\x04 \x01(\x01\x12K\n\x05\x63hain\x18\x05 \x01(\x0b\x32<.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain\x12O\n\x07network\x18\x07 \x01(\x0b\x32>.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network\x1a<\n\x07Version\x12\x10\n\x08protocol\x18\x01 \x01(\r\x12\x10\n\x08software\x18\x02 \x01(\r\x12\r\n\x05\x61gent\x18\x03 \x01(\t\x1a\x33\n\x04Time\x12\x0b\n\x03now\x18\x01 \x01(\r\x12\x0e\n\x06offset\x18\x02 \x01(\x05\x12\x0e\n\x06median\x18\x03 \x01(\r\x1a\xad\x01\n\x05\x43hain\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x15\n\rheaders_count\x18\x02 \x01(\r\x12\x14\n\x0c\x62locks_count\x18\x03 \x01(\r\x12\x17\n\x0f\x62\x65st_block_hash\x18\x04 \x01(\x0c\x12\x12\n\ndifficulty\x18\x05 \x01(\x01\x12\x12\n\nchain_work\x18\x06 \x01(\x0c\x12\x11\n\tis_synced\x18\x07 \x01(\x08\x12\x15\n\rsync_progress\x18\x08 \x01(\x01\x1a\x30\n\nNetworkFee\x12\r\n\x05relay\x18\x01 \x01(\x01\x12\x13\n\x0bincremental\x18\x02 \x01(\x01\x1an\n\x07Network\x12\x13\n\x0bpeers_count\x18\x01 \x01(\r\x12N\n\x03\x66\x65\x65\x18\x02 \x01(\x0b\x32\x41.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee\"<\n\x06Status\x12\x0f\n\x0bNOT_STARTED\x10\x00\x12\x0b\n\x07SYNCING\x10\x01\x12\t\n\x05READY\x10\x02\x12\t\n\x05\x45RROR\x10\x03\"\x1c\n\x1aGetMasternodeStatusRequest\"\xd4\x02\n\x1bGetMasternodeStatusResponse\x12M\n\x06status\x18\x01 \x01(\x0e\x32=.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status\x12\x13\n\x0bpro_tx_hash\x18\x02 \x01(\x0c\x12\x14\n\x0cpose_penalty\x18\x03 \x01(\r\x12\x11\n\tis_synced\x18\x04 \x01(\x08\x12\x15\n\rsync_progress\x18\x05 \x01(\x01\"\x90\x01\n\x06Status\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x15\n\x11WAITING_FOR_PROTX\x10\x01\x12\x0f\n\x0bPOSE_BANNED\x10\x02\x12\x0b\n\x07REMOVED\x10\x03\x12\x18\n\x14OPERATOR_KEY_CHANGED\x10\x04\x12\x14\n\x10PROTX_IP_CHANGED\x10\x05\x12\t\n\x05READY\x10\x06\x12\t\n\x05\x45RROR\x10\x07\"<\n\x0fGetBlockRequest\x12\x10\n\x06height\x18\x01 \x01(\rH\x00\x12\x0e\n\x04hash\x18\x02 \x01(\tH\x00\x42\x07\n\x05\x62lock\"!\n\x10GetBlockResponse\x12\r\n\x05\x62lock\x18\x01 \x01(\x0c\"\x1b\n\x19GetBestBlockHeightRequest\",\n\x1aGetBestBlockHeightResponse\x12\x0e\n\x06height\x18\x01 \x01(\r\"b\n\x1b\x42roadcastTransactionRequest\x12\x13\n\x0btransaction\x18\x01 \x01(\x0c\x12\x17\n\x0f\x61llow_high_fees\x18\x02 \x01(\x08\x12\x15\n\rbypass_limits\x18\x03 \x01(\x08\"6\n\x1c\x42roadcastTransactionResponse\x12\x16\n\x0etransaction_id\x18\x01 \x01(\t\"#\n\x15GetTransactionRequest\x12\n\n\x02id\x18\x01 \x01(\t\"\x9c\x01\n\x16GetTransactionResponse\x12\x13\n\x0btransaction\x18\x01 \x01(\x0c\x12\x12\n\nblock_hash\x18\x02 \x01(\x0c\x12\x0e\n\x06height\x18\x03 \x01(\r\x12\x15\n\rconfirmations\x18\x04 \x01(\r\x12\x19\n\x11is_instant_locked\x18\x05 \x01(\x08\x12\x17\n\x0fis_chain_locked\x18\x06 \x01(\x08\"x\n!BlockHeadersWithChainLocksRequest\x12\x19\n\x0f\x66rom_block_hash\x18\x01 \x01(\x0cH\x00\x12\x1b\n\x11\x66rom_block_height\x18\x02 \x01(\rH\x00\x12\r\n\x05\x63ount\x18\x03 \x01(\rB\x0c\n\nfrom_block\"\x89\x01\n\"BlockHeadersWithChainLocksResponse\x12@\n\rblock_headers\x18\x01 \x01(\x0b\x32\'.org.dash.platform.dapi.v0.BlockHeadersH\x00\x12\x14\n\nchain_lock\x18\x02 \x01(\x0cH\x00\x42\x0b\n\tresponses\"\x1f\n\x0c\x42lockHeaders\x12\x0f\n\x07headers\x18\x01 \x03(\x0c\"3\n!GetEstimatedTransactionFeeRequest\x12\x0e\n\x06\x62locks\x18\x01 \x01(\r\"1\n\"GetEstimatedTransactionFeeResponse\x12\x0b\n\x03\x66\x65\x65\x18\x01 \x01(\x01\"\xd3\x01\n\x1dTransactionsWithProofsRequest\x12<\n\x0c\x62loom_filter\x18\x01 \x01(\x0b\x32&.org.dash.platform.dapi.v0.BloomFilter\x12\x19\n\x0f\x66rom_block_hash\x18\x02 \x01(\x0cH\x00\x12\x1b\n\x11\x66rom_block_height\x18\x03 \x01(\rH\x00\x12\r\n\x05\x63ount\x18\x04 \x01(\r\x12\x1f\n\x17send_transaction_hashes\x18\x05 \x01(\x08\x42\x0c\n\nfrom_block\"U\n\x0b\x42loomFilter\x12\x0e\n\x06v_data\x18\x01 \x01(\x0c\x12\x14\n\x0cn_hash_funcs\x18\x02 \x01(\r\x12\x0f\n\x07n_tweak\x18\x03 \x01(\r\x12\x0f\n\x07n_flags\x18\x04 \x01(\r\"\xeb\x01\n\x1eTransactionsWithProofsResponse\x12\x46\n\x10raw_transactions\x18\x01 \x01(\x0b\x32*.org.dash.platform.dapi.v0.RawTransactionsH\x00\x12X\n\x1ainstant_send_lock_messages\x18\x02 \x01(\x0b\x32\x32.org.dash.platform.dapi.v0.InstantSendLockMessagesH\x00\x12\x1a\n\x10raw_merkle_block\x18\x03 \x01(\x0cH\x00\x42\x0b\n\tresponses\"\'\n\x0fRawTransactions\x12\x14\n\x0ctransactions\x18\x01 \x03(\x0c\"+\n\x17InstantSendLockMessages\x12\x10\n\x08messages\x18\x01 \x03(\x0c\"\x17\n\x15MasternodeListRequest\"6\n\x16MasternodeListResponse\x12\x1c\n\x14masternode_list_diff\x18\x01 \x01(\x0c\x32\xe5\n\n\x04\x43ore\x12\x84\x01\n\x13getBlockchainStatus\x12\x35.org.dash.platform.dapi.v0.GetBlockchainStatusRequest\x1a\x36.org.dash.platform.dapi.v0.GetBlockchainStatusResponse\x12\x84\x01\n\x13getMasternodeStatus\x12\x35.org.dash.platform.dapi.v0.GetMasternodeStatusRequest\x1a\x36.org.dash.platform.dapi.v0.GetMasternodeStatusResponse\x12\x63\n\x08getBlock\x12*.org.dash.platform.dapi.v0.GetBlockRequest\x1a+.org.dash.platform.dapi.v0.GetBlockResponse\x12\x81\x01\n\x12getBestBlockHeight\x12\x34.org.dash.platform.dapi.v0.GetBestBlockHeightRequest\x1a\x35.org.dash.platform.dapi.v0.GetBestBlockHeightResponse\x12\x87\x01\n\x14\x62roadcastTransaction\x12\x36.org.dash.platform.dapi.v0.BroadcastTransactionRequest\x1a\x37.org.dash.platform.dapi.v0.BroadcastTransactionResponse\x12u\n\x0egetTransaction\x12\x30.org.dash.platform.dapi.v0.GetTransactionRequest\x1a\x31.org.dash.platform.dapi.v0.GetTransactionResponse\x12\x99\x01\n\x1agetEstimatedTransactionFee\x12<.org.dash.platform.dapi.v0.GetEstimatedTransactionFeeRequest\x1a=.org.dash.platform.dapi.v0.GetEstimatedTransactionFeeResponse\x12\xa6\x01\n%subscribeToBlockHeadersWithChainLocks\x12<.org.dash.platform.dapi.v0.BlockHeadersWithChainLocksRequest\x1a=.org.dash.platform.dapi.v0.BlockHeadersWithChainLocksResponse0\x01\x12\x9a\x01\n!subscribeToTransactionsWithProofs\x12\x38.org.dash.platform.dapi.v0.TransactionsWithProofsRequest\x1a\x39.org.dash.platform.dapi.v0.TransactionsWithProofsResponse0\x01\x12\x82\x01\n\x19subscribeToMasternodeList\x12\x30.org.dash.platform.dapi.v0.MasternodeListRequest\x1a\x31.org.dash.platform.dapi.v0.MasternodeListResponse0\x01\x62\x06proto3' ) -_GETSTATUSRESPONSE_MASTERNODE_STATUS = _descriptor.EnumDescriptor( +_GETBLOCKCHAINSTATUSRESPONSE_STATUS = _descriptor.EnumDescriptor( name='Status', - full_name='org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status', + full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status', filename=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key, values=[ _descriptor.EnumValueDescriptor( - name='UNKNOWN', index=0, number=0, + name='NOT_STARTED', index=0, number=0, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor( - name='WAITING_FOR_PROTX', index=1, number=1, + name='SYNCING', index=1, number=1, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor( - name='POSE_BANNED', index=2, number=2, + name='READY', index=2, number=2, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor( - name='REMOVED', index=3, number=3, + name='ERROR', index=3, number=3, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=972, + serialized_end=1032, +) +_sym_db.RegisterEnumDescriptor(_GETBLOCKCHAINSTATUSRESPONSE_STATUS) + +_GETMASTERNODESTATUSRESPONSE_STATUS = _descriptor.EnumDescriptor( + name='Status', + full_name='org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ _descriptor.EnumValueDescriptor( - name='OPERATOR_KEY_CHANGED', index=4, number=4, + name='UNKNOWN', index=0, number=0, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor( - name='PROTX_IP_CHANGED', index=5, number=5, + name='WAITING_FOR_PROTX', index=1, number=1, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor( - name='READY', index=6, number=6, + name='POSE_BANNED', index=2, number=2, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor( - name='ERROR', index=7, number=7, + name='REMOVED', index=3, number=3, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=998, - serialized_end=1142, -) -_sym_db.RegisterEnumDescriptor(_GETSTATUSRESPONSE_MASTERNODE_STATUS) - -_GETSTATUSRESPONSE_STATUS = _descriptor.EnumDescriptor( - name='Status', - full_name='org.dash.platform.dapi.v0.GetStatusResponse.Status', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ _descriptor.EnumValueDescriptor( - name='NOT_STARTED', index=0, number=0, + name='OPERATOR_KEY_CHANGED', index=4, number=4, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor( - name='SYNCING', index=1, number=1, + name='PROTX_IP_CHANGED', index=5, number=5, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor( - name='READY', index=2, number=2, + name='READY', index=6, number=6, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor( - name='ERROR', index=3, number=3, + name='ERROR', index=7, number=7, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), ], containing_type=None, serialized_options=None, - serialized_start=1296, - serialized_end=1356, + serialized_start=1261, + serialized_end=1405, ) -_sym_db.RegisterEnumDescriptor(_GETSTATUSRESPONSE_STATUS) +_sym_db.RegisterEnumDescriptor(_GETMASTERNODESTATUSRESPONSE_STATUS) -_GETSTATUSREQUEST = _descriptor.Descriptor( - name='GetStatusRequest', - full_name='org.dash.platform.dapi.v0.GetStatusRequest', +_GETBLOCKCHAINSTATUSREQUEST = _descriptor.Descriptor( + name='GetBlockchainStatusRequest', + full_name='org.dash.platform.dapi.v0.GetBlockchainStatusRequest', filename=None, file=DESCRIPTOR, containing_type=None, @@ -136,34 +136,34 @@ oneofs=[ ], serialized_start=41, - serialized_end=59, + serialized_end=69, ) -_GETSTATUSRESPONSE_VERSION = _descriptor.Descriptor( +_GETBLOCKCHAINSTATUSRESPONSE_VERSION = _descriptor.Descriptor( name='Version', - full_name='org.dash.platform.dapi.v0.GetStatusResponse.Version', + full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='protocol', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Version.protocol', index=0, + name='protocol', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.protocol', index=0, number=1, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='software', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Version.software', index=1, + name='software', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.software', index=1, number=2, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='agent', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Version.agent', index=2, + name='agent', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.agent', index=2, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b"".decode('utf-8'), message_type=None, enum_type=None, containing_type=None, @@ -181,34 +181,34 @@ extension_ranges=[], oneofs=[ ], - serialized_start=526, - serialized_end=586, + serialized_start=519, + serialized_end=579, ) -_GETSTATUSRESPONSE_TIME = _descriptor.Descriptor( +_GETBLOCKCHAINSTATUSRESPONSE_TIME = _descriptor.Descriptor( name='Time', - full_name='org.dash.platform.dapi.v0.GetStatusResponse.Time', + full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='now', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Time.now', index=0, + name='now', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.now', index=0, number=1, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='offset', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Time.offset', index=1, + name='offset', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.offset', index=1, number=2, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='median', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Time.median', index=2, + name='median', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.median', index=2, number=3, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, @@ -226,69 +226,69 @@ extension_ranges=[], oneofs=[ ], - serialized_start=588, - serialized_end=639, + serialized_start=581, + serialized_end=632, ) -_GETSTATUSRESPONSE_CHAIN = _descriptor.Descriptor( +_GETBLOCKCHAINSTATUSRESPONSE_CHAIN = _descriptor.Descriptor( name='Chain', - full_name='org.dash.platform.dapi.v0.GetStatusResponse.Chain', + full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='name', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Chain.name', index=0, + name='name', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.name', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b"".decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='headers_count', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Chain.headers_count', index=1, + name='headers_count', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.headers_count', index=1, number=2, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='blocks_count', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Chain.blocks_count', index=2, + name='blocks_count', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.blocks_count', index=2, number=3, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='best_block_hash', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Chain.best_block_hash', index=3, + name='best_block_hash', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.best_block_hash', index=3, number=4, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='difficulty', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Chain.difficulty', index=4, + name='difficulty', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.difficulty', index=4, number=5, type=1, cpp_type=5, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='chain_work', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Chain.chain_work', index=5, + name='chain_work', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.chain_work', index=5, number=6, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='is_synced', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Chain.is_synced', index=6, + name='is_synced', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.is_synced', index=6, number=7, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='sync_progress', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Chain.sync_progress', index=7, + name='sync_progress', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.sync_progress', index=7, number=8, type=1, cpp_type=5, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, @@ -306,49 +306,28 @@ extension_ranges=[], oneofs=[ ], - serialized_start=642, - serialized_end=815, + serialized_start=635, + serialized_end=808, ) -_GETSTATUSRESPONSE_MASTERNODE = _descriptor.Descriptor( - name='Masternode', - full_name='org.dash.platform.dapi.v0.GetStatusResponse.Masternode', +_GETBLOCKCHAINSTATUSRESPONSE_NETWORKFEE = _descriptor.Descriptor( + name='NetworkFee', + full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='status', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Masternode.status', index=0, - number=1, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='pro_tx_hash', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Masternode.pro_tx_hash', index=1, - number=2, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='pose_penalty', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Masternode.pose_penalty', index=2, - number=3, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='is_synced', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Masternode.is_synced', index=3, - number=4, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, + name='relay', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.relay', index=0, + number=1, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='sync_progress', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Masternode.sync_progress', index=4, - number=5, type=1, cpp_type=5, label=1, + name='incremental', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.incremental', index=1, + number=2, type=1, cpp_type=5, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, @@ -358,7 +337,6 @@ ], nested_types=[], enum_types=[ - _GETSTATUSRESPONSE_MASTERNODE_STATUS, ], serialized_options=None, is_extendable=False, @@ -366,29 +344,29 @@ extension_ranges=[], oneofs=[ ], - serialized_start=818, - serialized_end=1142, + serialized_start=810, + serialized_end=858, ) -_GETSTATUSRESPONSE_NETWORKFEE = _descriptor.Descriptor( - name='NetworkFee', - full_name='org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee', +_GETBLOCKCHAINSTATUSRESPONSE_NETWORK = _descriptor.Descriptor( + name='Network', + full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='relay', full_name='org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.relay', index=0, - number=1, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), + name='peers_count', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.peers_count', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='incremental', full_name='org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.incremental', index=1, - number=2, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), + name='fee', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.fee', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), @@ -404,32 +382,86 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1144, - serialized_end=1192, + serialized_start=860, + serialized_end=970, ) -_GETSTATUSRESPONSE_NETWORK = _descriptor.Descriptor( - name='Network', - full_name='org.dash.platform.dapi.v0.GetStatusResponse.Network', +_GETBLOCKCHAINSTATUSRESPONSE = _descriptor.Descriptor( + name='GetBlockchainStatusResponse', + full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='peers_count', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Network.peers_count', index=0, - number=1, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, + name='version', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.version', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='fee', full_name='org.dash.platform.dapi.v0.GetStatusResponse.Network.fee', index=1, + name='time', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.time', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='status', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.status', index=2, + number=3, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sync_progress', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.sync_progress', index=3, + number=4, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='chain', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.chain', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='network', full_name='org.dash.platform.dapi.v0.GetBlockchainStatusResponse.network', index=5, + number=7, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETBLOCKCHAINSTATUSRESPONSE_VERSION, _GETBLOCKCHAINSTATUSRESPONSE_TIME, _GETBLOCKCHAINSTATUSRESPONSE_CHAIN, _GETBLOCKCHAINSTATUSRESPONSE_NETWORKFEE, _GETBLOCKCHAINSTATUSRESPONSE_NETWORK, ], + enum_types=[ + _GETBLOCKCHAINSTATUSRESPONSE_STATUS, + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=72, + serialized_end=1032, +) + + +_GETMASTERNODESTATUSREQUEST = _descriptor.Descriptor( + name='GetMasternodeStatusRequest', + full_name='org.dash.platform.dapi.v0.GetMasternodeStatusRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ ], extensions=[ ], @@ -442,73 +474,60 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1194, - serialized_end=1294, + serialized_start=1034, + serialized_end=1062, ) -_GETSTATUSRESPONSE = _descriptor.Descriptor( - name='GetStatusResponse', - full_name='org.dash.platform.dapi.v0.GetStatusResponse', + +_GETMASTERNODESTATUSRESPONSE = _descriptor.Descriptor( + name='GetMasternodeStatusResponse', + full_name='org.dash.platform.dapi.v0.GetMasternodeStatusResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetStatusResponse.version', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='time', full_name='org.dash.platform.dapi.v0.GetStatusResponse.time', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='status', full_name='org.dash.platform.dapi.v0.GetStatusResponse.status', index=2, - number=3, type=14, cpp_type=8, label=1, + name='status', full_name='org.dash.platform.dapi.v0.GetMasternodeStatusResponse.status', index=0, + number=1, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='sync_progress', full_name='org.dash.platform.dapi.v0.GetStatusResponse.sync_progress', index=3, - number=4, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), + name='pro_tx_hash', full_name='org.dash.platform.dapi.v0.GetMasternodeStatusResponse.pro_tx_hash', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='chain', full_name='org.dash.platform.dapi.v0.GetStatusResponse.chain', index=4, - number=5, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='pose_penalty', full_name='org.dash.platform.dapi.v0.GetMasternodeStatusResponse.pose_penalty', index=2, + number=3, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='masternode', full_name='org.dash.platform.dapi.v0.GetStatusResponse.masternode', index=5, - number=6, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='is_synced', full_name='org.dash.platform.dapi.v0.GetMasternodeStatusResponse.is_synced', index=3, + number=4, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='network', full_name='org.dash.platform.dapi.v0.GetStatusResponse.network', index=6, - number=7, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='sync_progress', full_name='org.dash.platform.dapi.v0.GetMasternodeStatusResponse.sync_progress', index=4, + number=5, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], - nested_types=[_GETSTATUSRESPONSE_VERSION, _GETSTATUSRESPONSE_TIME, _GETSTATUSRESPONSE_CHAIN, _GETSTATUSRESPONSE_MASTERNODE, _GETSTATUSRESPONSE_NETWORKFEE, _GETSTATUSRESPONSE_NETWORK, ], + nested_types=[], enum_types=[ - _GETSTATUSRESPONSE_STATUS, + _GETMASTERNODESTATUSRESPONSE_STATUS, ], serialized_options=None, is_extendable=False, @@ -516,8 +535,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=62, - serialized_end=1356, + serialized_start=1065, + serialized_end=1405, ) @@ -560,8 +579,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=1358, - serialized_end=1418, + serialized_start=1407, + serialized_end=1467, ) @@ -592,8 +611,65 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1420, - serialized_end=1453, + serialized_start=1469, + serialized_end=1502, +) + + +_GETBESTBLOCKHEIGHTREQUEST = _descriptor.Descriptor( + name='GetBestBlockHeightRequest', + full_name='org.dash.platform.dapi.v0.GetBestBlockHeightRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1504, + serialized_end=1531, +) + + +_GETBESTBLOCKHEIGHTRESPONSE = _descriptor.Descriptor( + name='GetBestBlockHeightResponse', + full_name='org.dash.platform.dapi.v0.GetBestBlockHeightResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='height', full_name='org.dash.platform.dapi.v0.GetBestBlockHeightResponse.height', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1533, + serialized_end=1577, ) @@ -638,8 +714,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1455, - serialized_end=1553, + serialized_start=1579, + serialized_end=1677, ) @@ -670,8 +746,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1555, - serialized_end=1609, + serialized_start=1679, + serialized_end=1733, ) @@ -702,8 +778,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1611, - serialized_end=1646, + serialized_start=1735, + serialized_end=1770, ) @@ -769,8 +845,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1649, - serialized_end=1805, + serialized_start=1773, + serialized_end=1929, ) @@ -820,8 +896,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=1807, - serialized_end=1927, + serialized_start=1931, + serialized_end=2051, ) @@ -864,8 +940,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=1930, - serialized_end=2067, + serialized_start=2054, + serialized_end=2191, ) @@ -896,8 +972,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2069, - serialized_end=2100, + serialized_start=2193, + serialized_end=2224, ) @@ -928,8 +1004,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2102, - serialized_end=2153, + serialized_start=2226, + serialized_end=2277, ) @@ -960,8 +1036,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2155, - serialized_end=2204, + serialized_start=2279, + serialized_end=2328, ) @@ -1025,8 +1101,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=2207, - serialized_end=2418, + serialized_start=2331, + serialized_end=2542, ) @@ -1078,8 +1154,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2420, - serialized_end=2505, + serialized_start=2544, + serialized_end=2629, ) @@ -1129,8 +1205,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=2508, - serialized_end=2743, + serialized_start=2632, + serialized_end=2867, ) @@ -1161,8 +1237,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2745, - serialized_end=2784, + serialized_start=2869, + serialized_end=2908, ) @@ -1193,26 +1269,81 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2786, - serialized_end=2829, + serialized_start=2910, + serialized_end=2953, +) + + +_MASTERNODELISTREQUEST = _descriptor.Descriptor( + name='MasternodeListRequest', + full_name='org.dash.platform.dapi.v0.MasternodeListRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2955, + serialized_end=2978, ) -_GETSTATUSRESPONSE_VERSION.containing_type = _GETSTATUSRESPONSE -_GETSTATUSRESPONSE_TIME.containing_type = _GETSTATUSRESPONSE -_GETSTATUSRESPONSE_CHAIN.containing_type = _GETSTATUSRESPONSE -_GETSTATUSRESPONSE_MASTERNODE.fields_by_name['status'].enum_type = _GETSTATUSRESPONSE_MASTERNODE_STATUS -_GETSTATUSRESPONSE_MASTERNODE.containing_type = _GETSTATUSRESPONSE -_GETSTATUSRESPONSE_MASTERNODE_STATUS.containing_type = _GETSTATUSRESPONSE_MASTERNODE -_GETSTATUSRESPONSE_NETWORKFEE.containing_type = _GETSTATUSRESPONSE -_GETSTATUSRESPONSE_NETWORK.fields_by_name['fee'].message_type = _GETSTATUSRESPONSE_NETWORKFEE -_GETSTATUSRESPONSE_NETWORK.containing_type = _GETSTATUSRESPONSE -_GETSTATUSRESPONSE.fields_by_name['version'].message_type = _GETSTATUSRESPONSE_VERSION -_GETSTATUSRESPONSE.fields_by_name['time'].message_type = _GETSTATUSRESPONSE_TIME -_GETSTATUSRESPONSE.fields_by_name['status'].enum_type = _GETSTATUSRESPONSE_STATUS -_GETSTATUSRESPONSE.fields_by_name['chain'].message_type = _GETSTATUSRESPONSE_CHAIN -_GETSTATUSRESPONSE.fields_by_name['masternode'].message_type = _GETSTATUSRESPONSE_MASTERNODE -_GETSTATUSRESPONSE.fields_by_name['network'].message_type = _GETSTATUSRESPONSE_NETWORK -_GETSTATUSRESPONSE_STATUS.containing_type = _GETSTATUSRESPONSE + +_MASTERNODELISTRESPONSE = _descriptor.Descriptor( + name='MasternodeListResponse', + full_name='org.dash.platform.dapi.v0.MasternodeListResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='masternode_list_diff', full_name='org.dash.platform.dapi.v0.MasternodeListResponse.masternode_list_diff', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2980, + serialized_end=3034, +) + +_GETBLOCKCHAINSTATUSRESPONSE_VERSION.containing_type = _GETBLOCKCHAINSTATUSRESPONSE +_GETBLOCKCHAINSTATUSRESPONSE_TIME.containing_type = _GETBLOCKCHAINSTATUSRESPONSE +_GETBLOCKCHAINSTATUSRESPONSE_CHAIN.containing_type = _GETBLOCKCHAINSTATUSRESPONSE +_GETBLOCKCHAINSTATUSRESPONSE_NETWORKFEE.containing_type = _GETBLOCKCHAINSTATUSRESPONSE +_GETBLOCKCHAINSTATUSRESPONSE_NETWORK.fields_by_name['fee'].message_type = _GETBLOCKCHAINSTATUSRESPONSE_NETWORKFEE +_GETBLOCKCHAINSTATUSRESPONSE_NETWORK.containing_type = _GETBLOCKCHAINSTATUSRESPONSE +_GETBLOCKCHAINSTATUSRESPONSE.fields_by_name['version'].message_type = _GETBLOCKCHAINSTATUSRESPONSE_VERSION +_GETBLOCKCHAINSTATUSRESPONSE.fields_by_name['time'].message_type = _GETBLOCKCHAINSTATUSRESPONSE_TIME +_GETBLOCKCHAINSTATUSRESPONSE.fields_by_name['status'].enum_type = _GETBLOCKCHAINSTATUSRESPONSE_STATUS +_GETBLOCKCHAINSTATUSRESPONSE.fields_by_name['chain'].message_type = _GETBLOCKCHAINSTATUSRESPONSE_CHAIN +_GETBLOCKCHAINSTATUSRESPONSE.fields_by_name['network'].message_type = _GETBLOCKCHAINSTATUSRESPONSE_NETWORK +_GETBLOCKCHAINSTATUSRESPONSE_STATUS.containing_type = _GETBLOCKCHAINSTATUSRESPONSE +_GETMASTERNODESTATUSRESPONSE.fields_by_name['status'].enum_type = _GETMASTERNODESTATUSRESPONSE_STATUS +_GETMASTERNODESTATUSRESPONSE_STATUS.containing_type = _GETMASTERNODESTATUSRESPONSE _GETBLOCKREQUEST.oneofs_by_name['block'].fields.append( _GETBLOCKREQUEST.fields_by_name['height']) _GETBLOCKREQUEST.fields_by_name['height'].containing_oneof = _GETBLOCKREQUEST.oneofs_by_name['block'] @@ -1250,10 +1381,14 @@ _TRANSACTIONSWITHPROOFSRESPONSE.oneofs_by_name['responses'].fields.append( _TRANSACTIONSWITHPROOFSRESPONSE.fields_by_name['raw_merkle_block']) _TRANSACTIONSWITHPROOFSRESPONSE.fields_by_name['raw_merkle_block'].containing_oneof = _TRANSACTIONSWITHPROOFSRESPONSE.oneofs_by_name['responses'] -DESCRIPTOR.message_types_by_name['GetStatusRequest'] = _GETSTATUSREQUEST -DESCRIPTOR.message_types_by_name['GetStatusResponse'] = _GETSTATUSRESPONSE +DESCRIPTOR.message_types_by_name['GetBlockchainStatusRequest'] = _GETBLOCKCHAINSTATUSREQUEST +DESCRIPTOR.message_types_by_name['GetBlockchainStatusResponse'] = _GETBLOCKCHAINSTATUSRESPONSE +DESCRIPTOR.message_types_by_name['GetMasternodeStatusRequest'] = _GETMASTERNODESTATUSREQUEST +DESCRIPTOR.message_types_by_name['GetMasternodeStatusResponse'] = _GETMASTERNODESTATUSRESPONSE DESCRIPTOR.message_types_by_name['GetBlockRequest'] = _GETBLOCKREQUEST DESCRIPTOR.message_types_by_name['GetBlockResponse'] = _GETBLOCKRESPONSE +DESCRIPTOR.message_types_by_name['GetBestBlockHeightRequest'] = _GETBESTBLOCKHEIGHTREQUEST +DESCRIPTOR.message_types_by_name['GetBestBlockHeightResponse'] = _GETBESTBLOCKHEIGHTRESPONSE DESCRIPTOR.message_types_by_name['BroadcastTransactionRequest'] = _BROADCASTTRANSACTIONREQUEST DESCRIPTOR.message_types_by_name['BroadcastTransactionResponse'] = _BROADCASTTRANSACTIONRESPONSE DESCRIPTOR.message_types_by_name['GetTransactionRequest'] = _GETTRANSACTIONREQUEST @@ -1268,69 +1403,77 @@ DESCRIPTOR.message_types_by_name['TransactionsWithProofsResponse'] = _TRANSACTIONSWITHPROOFSRESPONSE DESCRIPTOR.message_types_by_name['RawTransactions'] = _RAWTRANSACTIONS DESCRIPTOR.message_types_by_name['InstantSendLockMessages'] = _INSTANTSENDLOCKMESSAGES +DESCRIPTOR.message_types_by_name['MasternodeListRequest'] = _MASTERNODELISTREQUEST +DESCRIPTOR.message_types_by_name['MasternodeListResponse'] = _MASTERNODELISTRESPONSE _sym_db.RegisterFileDescriptor(DESCRIPTOR) -GetStatusRequest = _reflection.GeneratedProtocolMessageType('GetStatusRequest', (_message.Message,), { - 'DESCRIPTOR' : _GETSTATUSREQUEST, +GetBlockchainStatusRequest = _reflection.GeneratedProtocolMessageType('GetBlockchainStatusRequest', (_message.Message,), { + 'DESCRIPTOR' : _GETBLOCKCHAINSTATUSREQUEST, '__module__' : 'core_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetStatusRequest) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetBlockchainStatusRequest) }) -_sym_db.RegisterMessage(GetStatusRequest) +_sym_db.RegisterMessage(GetBlockchainStatusRequest) -GetStatusResponse = _reflection.GeneratedProtocolMessageType('GetStatusResponse', (_message.Message,), { +GetBlockchainStatusResponse = _reflection.GeneratedProtocolMessageType('GetBlockchainStatusResponse', (_message.Message,), { 'Version' : _reflection.GeneratedProtocolMessageType('Version', (_message.Message,), { - 'DESCRIPTOR' : _GETSTATUSRESPONSE_VERSION, + 'DESCRIPTOR' : _GETBLOCKCHAINSTATUSRESPONSE_VERSION, '__module__' : 'core_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetStatusResponse.Version) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version) }) , 'Time' : _reflection.GeneratedProtocolMessageType('Time', (_message.Message,), { - 'DESCRIPTOR' : _GETSTATUSRESPONSE_TIME, + 'DESCRIPTOR' : _GETBLOCKCHAINSTATUSRESPONSE_TIME, '__module__' : 'core_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetStatusResponse.Time) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time) }) , 'Chain' : _reflection.GeneratedProtocolMessageType('Chain', (_message.Message,), { - 'DESCRIPTOR' : _GETSTATUSRESPONSE_CHAIN, - '__module__' : 'core_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetStatusResponse.Chain) - }) - , - - 'Masternode' : _reflection.GeneratedProtocolMessageType('Masternode', (_message.Message,), { - 'DESCRIPTOR' : _GETSTATUSRESPONSE_MASTERNODE, + 'DESCRIPTOR' : _GETBLOCKCHAINSTATUSRESPONSE_CHAIN, '__module__' : 'core_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetStatusResponse.Masternode) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain) }) , 'NetworkFee' : _reflection.GeneratedProtocolMessageType('NetworkFee', (_message.Message,), { - 'DESCRIPTOR' : _GETSTATUSRESPONSE_NETWORKFEE, + 'DESCRIPTOR' : _GETBLOCKCHAINSTATUSRESPONSE_NETWORKFEE, '__module__' : 'core_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee) }) , 'Network' : _reflection.GeneratedProtocolMessageType('Network', (_message.Message,), { - 'DESCRIPTOR' : _GETSTATUSRESPONSE_NETWORK, + 'DESCRIPTOR' : _GETBLOCKCHAINSTATUSRESPONSE_NETWORK, '__module__' : 'core_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetStatusResponse.Network) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network) }) , - 'DESCRIPTOR' : _GETSTATUSRESPONSE, + 'DESCRIPTOR' : _GETBLOCKCHAINSTATUSRESPONSE, '__module__' : 'core_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetStatusResponse) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetBlockchainStatusResponse) }) -_sym_db.RegisterMessage(GetStatusResponse) -_sym_db.RegisterMessage(GetStatusResponse.Version) -_sym_db.RegisterMessage(GetStatusResponse.Time) -_sym_db.RegisterMessage(GetStatusResponse.Chain) -_sym_db.RegisterMessage(GetStatusResponse.Masternode) -_sym_db.RegisterMessage(GetStatusResponse.NetworkFee) -_sym_db.RegisterMessage(GetStatusResponse.Network) +_sym_db.RegisterMessage(GetBlockchainStatusResponse) +_sym_db.RegisterMessage(GetBlockchainStatusResponse.Version) +_sym_db.RegisterMessage(GetBlockchainStatusResponse.Time) +_sym_db.RegisterMessage(GetBlockchainStatusResponse.Chain) +_sym_db.RegisterMessage(GetBlockchainStatusResponse.NetworkFee) +_sym_db.RegisterMessage(GetBlockchainStatusResponse.Network) + +GetMasternodeStatusRequest = _reflection.GeneratedProtocolMessageType('GetMasternodeStatusRequest', (_message.Message,), { + 'DESCRIPTOR' : _GETMASTERNODESTATUSREQUEST, + '__module__' : 'core_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetMasternodeStatusRequest) + }) +_sym_db.RegisterMessage(GetMasternodeStatusRequest) + +GetMasternodeStatusResponse = _reflection.GeneratedProtocolMessageType('GetMasternodeStatusResponse', (_message.Message,), { + 'DESCRIPTOR' : _GETMASTERNODESTATUSRESPONSE, + '__module__' : 'core_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetMasternodeStatusResponse) + }) +_sym_db.RegisterMessage(GetMasternodeStatusResponse) GetBlockRequest = _reflection.GeneratedProtocolMessageType('GetBlockRequest', (_message.Message,), { 'DESCRIPTOR' : _GETBLOCKREQUEST, @@ -1346,6 +1489,20 @@ }) _sym_db.RegisterMessage(GetBlockResponse) +GetBestBlockHeightRequest = _reflection.GeneratedProtocolMessageType('GetBestBlockHeightRequest', (_message.Message,), { + 'DESCRIPTOR' : _GETBESTBLOCKHEIGHTREQUEST, + '__module__' : 'core_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetBestBlockHeightRequest) + }) +_sym_db.RegisterMessage(GetBestBlockHeightRequest) + +GetBestBlockHeightResponse = _reflection.GeneratedProtocolMessageType('GetBestBlockHeightResponse', (_message.Message,), { + 'DESCRIPTOR' : _GETBESTBLOCKHEIGHTRESPONSE, + '__module__' : 'core_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetBestBlockHeightResponse) + }) +_sym_db.RegisterMessage(GetBestBlockHeightResponse) + BroadcastTransactionRequest = _reflection.GeneratedProtocolMessageType('BroadcastTransactionRequest', (_message.Message,), { 'DESCRIPTOR' : _BROADCASTTRANSACTIONREQUEST, '__module__' : 'core_pb2' @@ -1444,6 +1601,20 @@ }) _sym_db.RegisterMessage(InstantSendLockMessages) +MasternodeListRequest = _reflection.GeneratedProtocolMessageType('MasternodeListRequest', (_message.Message,), { + 'DESCRIPTOR' : _MASTERNODELISTREQUEST, + '__module__' : 'core_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.MasternodeListRequest) + }) +_sym_db.RegisterMessage(MasternodeListRequest) + +MasternodeListResponse = _reflection.GeneratedProtocolMessageType('MasternodeListResponse', (_message.Message,), { + 'DESCRIPTOR' : _MASTERNODELISTRESPONSE, + '__module__' : 'core_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.MasternodeListResponse) + }) +_sym_db.RegisterMessage(MasternodeListResponse) + _CORE = _descriptor.ServiceDescriptor( @@ -1453,33 +1624,53 @@ index=0, serialized_options=None, create_key=_descriptor._internal_create_key, - serialized_start=2832, - serialized_end=3782, + serialized_start=3037, + serialized_end=4418, methods=[ _descriptor.MethodDescriptor( - name='getStatus', - full_name='org.dash.platform.dapi.v0.Core.getStatus', + name='getBlockchainStatus', + full_name='org.dash.platform.dapi.v0.Core.getBlockchainStatus', index=0, containing_service=None, - input_type=_GETSTATUSREQUEST, - output_type=_GETSTATUSRESPONSE, + input_type=_GETBLOCKCHAINSTATUSREQUEST, + output_type=_GETBLOCKCHAINSTATUSRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='getMasternodeStatus', + full_name='org.dash.platform.dapi.v0.Core.getMasternodeStatus', + index=1, + containing_service=None, + input_type=_GETMASTERNODESTATUSREQUEST, + output_type=_GETMASTERNODESTATUSRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='getBlock', full_name='org.dash.platform.dapi.v0.Core.getBlock', - index=1, + index=2, containing_service=None, input_type=_GETBLOCKREQUEST, output_type=_GETBLOCKRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), + _descriptor.MethodDescriptor( + name='getBestBlockHeight', + full_name='org.dash.platform.dapi.v0.Core.getBestBlockHeight', + index=3, + containing_service=None, + input_type=_GETBESTBLOCKHEIGHTREQUEST, + output_type=_GETBESTBLOCKHEIGHTRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), _descriptor.MethodDescriptor( name='broadcastTransaction', full_name='org.dash.platform.dapi.v0.Core.broadcastTransaction', - index=2, + index=4, containing_service=None, input_type=_BROADCASTTRANSACTIONREQUEST, output_type=_BROADCASTTRANSACTIONRESPONSE, @@ -1489,7 +1680,7 @@ _descriptor.MethodDescriptor( name='getTransaction', full_name='org.dash.platform.dapi.v0.Core.getTransaction', - index=3, + index=5, containing_service=None, input_type=_GETTRANSACTIONREQUEST, output_type=_GETTRANSACTIONRESPONSE, @@ -1499,7 +1690,7 @@ _descriptor.MethodDescriptor( name='getEstimatedTransactionFee', full_name='org.dash.platform.dapi.v0.Core.getEstimatedTransactionFee', - index=4, + index=6, containing_service=None, input_type=_GETESTIMATEDTRANSACTIONFEEREQUEST, output_type=_GETESTIMATEDTRANSACTIONFEERESPONSE, @@ -1509,7 +1700,7 @@ _descriptor.MethodDescriptor( name='subscribeToBlockHeadersWithChainLocks', full_name='org.dash.platform.dapi.v0.Core.subscribeToBlockHeadersWithChainLocks', - index=5, + index=7, containing_service=None, input_type=_BLOCKHEADERSWITHCHAINLOCKSREQUEST, output_type=_BLOCKHEADERSWITHCHAINLOCKSRESPONSE, @@ -1519,13 +1710,23 @@ _descriptor.MethodDescriptor( name='subscribeToTransactionsWithProofs', full_name='org.dash.platform.dapi.v0.Core.subscribeToTransactionsWithProofs', - index=6, + index=8, containing_service=None, input_type=_TRANSACTIONSWITHPROOFSREQUEST, output_type=_TRANSACTIONSWITHPROOFSRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), + _descriptor.MethodDescriptor( + name='subscribeToMasternodeList', + full_name='org.dash.platform.dapi.v0.Core.subscribeToMasternodeList', + index=9, + containing_service=None, + input_type=_MASTERNODELISTREQUEST, + output_type=_MASTERNODELISTRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), ]) _sym_db.RegisterServiceDescriptor(_CORE) diff --git a/packages/dapi-grpc/clients/core/v0/python/core_pb2_grpc.py b/packages/dapi-grpc/clients/core/v0/python/core_pb2_grpc.py index e8a4eec3513..1ec1d99748b 100644 --- a/packages/dapi-grpc/clients/core/v0/python/core_pb2_grpc.py +++ b/packages/dapi-grpc/clients/core/v0/python/core_pb2_grpc.py @@ -14,16 +14,26 @@ def __init__(self, channel): Args: channel: A grpc.Channel. """ - self.getStatus = channel.unary_unary( - '/org.dash.platform.dapi.v0.Core/getStatus', - request_serializer=core__pb2.GetStatusRequest.SerializeToString, - response_deserializer=core__pb2.GetStatusResponse.FromString, + self.getBlockchainStatus = channel.unary_unary( + '/org.dash.platform.dapi.v0.Core/getBlockchainStatus', + request_serializer=core__pb2.GetBlockchainStatusRequest.SerializeToString, + response_deserializer=core__pb2.GetBlockchainStatusResponse.FromString, + ) + self.getMasternodeStatus = channel.unary_unary( + '/org.dash.platform.dapi.v0.Core/getMasternodeStatus', + request_serializer=core__pb2.GetMasternodeStatusRequest.SerializeToString, + response_deserializer=core__pb2.GetMasternodeStatusResponse.FromString, ) self.getBlock = channel.unary_unary( '/org.dash.platform.dapi.v0.Core/getBlock', request_serializer=core__pb2.GetBlockRequest.SerializeToString, response_deserializer=core__pb2.GetBlockResponse.FromString, ) + self.getBestBlockHeight = channel.unary_unary( + '/org.dash.platform.dapi.v0.Core/getBestBlockHeight', + request_serializer=core__pb2.GetBestBlockHeightRequest.SerializeToString, + response_deserializer=core__pb2.GetBestBlockHeightResponse.FromString, + ) self.broadcastTransaction = channel.unary_unary( '/org.dash.platform.dapi.v0.Core/broadcastTransaction', request_serializer=core__pb2.BroadcastTransactionRequest.SerializeToString, @@ -49,12 +59,23 @@ def __init__(self, channel): request_serializer=core__pb2.TransactionsWithProofsRequest.SerializeToString, response_deserializer=core__pb2.TransactionsWithProofsResponse.FromString, ) + self.subscribeToMasternodeList = channel.unary_stream( + '/org.dash.platform.dapi.v0.Core/subscribeToMasternodeList', + request_serializer=core__pb2.MasternodeListRequest.SerializeToString, + response_deserializer=core__pb2.MasternodeListResponse.FromString, + ) class CoreServicer(object): """Missing associated documentation comment in .proto file.""" - def getStatus(self, request, context): + def getBlockchainStatus(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def getMasternodeStatus(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') @@ -66,6 +87,12 @@ def getBlock(self, request, context): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') + def getBestBlockHeight(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + def broadcastTransaction(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) @@ -96,19 +123,35 @@ def subscribeToTransactionsWithProofs(self, request, context): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') + def subscribeToMasternodeList(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + def add_CoreServicer_to_server(servicer, server): rpc_method_handlers = { - 'getStatus': grpc.unary_unary_rpc_method_handler( - servicer.getStatus, - request_deserializer=core__pb2.GetStatusRequest.FromString, - response_serializer=core__pb2.GetStatusResponse.SerializeToString, + 'getBlockchainStatus': grpc.unary_unary_rpc_method_handler( + servicer.getBlockchainStatus, + request_deserializer=core__pb2.GetBlockchainStatusRequest.FromString, + response_serializer=core__pb2.GetBlockchainStatusResponse.SerializeToString, + ), + 'getMasternodeStatus': grpc.unary_unary_rpc_method_handler( + servicer.getMasternodeStatus, + request_deserializer=core__pb2.GetMasternodeStatusRequest.FromString, + response_serializer=core__pb2.GetMasternodeStatusResponse.SerializeToString, ), 'getBlock': grpc.unary_unary_rpc_method_handler( servicer.getBlock, request_deserializer=core__pb2.GetBlockRequest.FromString, response_serializer=core__pb2.GetBlockResponse.SerializeToString, ), + 'getBestBlockHeight': grpc.unary_unary_rpc_method_handler( + servicer.getBestBlockHeight, + request_deserializer=core__pb2.GetBestBlockHeightRequest.FromString, + response_serializer=core__pb2.GetBestBlockHeightResponse.SerializeToString, + ), 'broadcastTransaction': grpc.unary_unary_rpc_method_handler( servicer.broadcastTransaction, request_deserializer=core__pb2.BroadcastTransactionRequest.FromString, @@ -134,6 +177,11 @@ def add_CoreServicer_to_server(servicer, server): request_deserializer=core__pb2.TransactionsWithProofsRequest.FromString, response_serializer=core__pb2.TransactionsWithProofsResponse.SerializeToString, ), + 'subscribeToMasternodeList': grpc.unary_stream_rpc_method_handler( + servicer.subscribeToMasternodeList, + request_deserializer=core__pb2.MasternodeListRequest.FromString, + response_serializer=core__pb2.MasternodeListResponse.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( 'org.dash.platform.dapi.v0.Core', rpc_method_handlers) @@ -145,7 +193,24 @@ class Core(object): """Missing associated documentation comment in .proto file.""" @staticmethod - def getStatus(request, + def getBlockchainStatus(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Core/getBlockchainStatus', + core__pb2.GetBlockchainStatusRequest.SerializeToString, + core__pb2.GetBlockchainStatusResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def getMasternodeStatus(request, target, options=(), channel_credentials=None, @@ -155,9 +220,9 @@ def getStatus(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Core/getStatus', - core__pb2.GetStatusRequest.SerializeToString, - core__pb2.GetStatusResponse.FromString, + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Core/getMasternodeStatus', + core__pb2.GetMasternodeStatusRequest.SerializeToString, + core__pb2.GetMasternodeStatusResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -178,6 +243,23 @@ def getBlock(request, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + @staticmethod + def getBestBlockHeight(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Core/getBestBlockHeight', + core__pb2.GetBestBlockHeightRequest.SerializeToString, + core__pb2.GetBestBlockHeightResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + @staticmethod def broadcastTransaction(request, target, @@ -262,3 +344,20 @@ def subscribeToTransactionsWithProofs(request, core__pb2.TransactionsWithProofsResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def subscribeToMasternodeList(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/org.dash.platform.dapi.v0.Core/subscribeToMasternodeList', + core__pb2.MasternodeListRequest.SerializeToString, + core__pb2.MasternodeListResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/packages/dapi-grpc/clients/core/v0/rust/core_example.rs b/packages/dapi-grpc/clients/core/v0/rust/core_example.rs index 8acc5f5030c..e33cf000143 100644 --- a/packages/dapi-grpc/clients/core/v0/rust/core_example.rs +++ b/packages/dapi-grpc/clients/core/v0/rust/core_example.rs @@ -1,5 +1,5 @@ use dapi_grpc::core::v0 as core; -use prost::Message; +use dapi_grpc::Message; fn main() { let request = core::GetBlockRequest { diff --git a/packages/dapi-grpc/clients/core/v0/web/CorePromiseClient.js b/packages/dapi-grpc/clients/core/v0/web/CorePromiseClient.js index eecb1ced181..3f1549d8058 100644 --- a/packages/dapi-grpc/clients/core/v0/web/CorePromiseClient.js +++ b/packages/dapi-grpc/clients/core/v0/web/CorePromiseClient.js @@ -52,15 +52,29 @@ class CorePromiseClient { } /** - * @param {!GetStatusRequest} getStatusRequest + * @param {!GetBlockchainStatusRequest} getBlockchainStatusRequest * @param {?Object} metadata - * @return {Promise} + * @return {Promise} */ - getStatus(getStatusRequest, metadata = {}) { + getBlockchainStatus(getBlockchainStatusRequest, metadata = {}) { return promisify( - this.client.getStatus.bind(this.client), + this.client.getBlockchainStatus.bind(this.client), )( - getStatusRequest, + getBlockchainStatusRequest, + metadata, + ); + } + + /** + * @param {!GetMasternodeStatusRequest} getMasternodeStatusRequest + * @param {?Object} metadata + * @return {Promise} + */ + getMasternodeStatus(getMasternodeStatusRequest, metadata = {}) { + return promisify( + this.client.getMasternodeStatus.bind(this.client), + )( + getMasternodeStatusRequest, metadata, ); } @@ -79,6 +93,20 @@ class CorePromiseClient { ); } + /** + * @param {!GetBestBlockHeightRequest} getBestBlockHeightRequest + * @param {?Object} metadata + * @return {Promise} + */ + getBestBlockHeight(getBestBlockHeightRequest, metadata = {}) { + return promisify( + this.client.getBestBlockHeight.bind(this.client), + )( + getBestBlockHeightRequest, + metadata, + ); + } + /** * @param {!BroadcastTransactionRequest} broadcastTransactionRequest * @param {?Object} metadata @@ -154,6 +182,22 @@ class CorePromiseClient { rewireStream(stream); return stream; } + + /** + * @param {MasternodeListRequest} masternodeListRequest The request proto + * @param {?Object} metadata User defined call metadata + * @return {!grpc.web.ClientReadableStream|undefined} + */ + subscribeToMasternodeList(masternodeListRequest, metadata = {}) { + const stream = this.client.subscribeToMasternodeList( + masternodeListRequest, + metadata + ) + + rewireStream(stream); + + return stream; + } } module.exports = CorePromiseClient; diff --git a/packages/dapi-grpc/clients/core/v0/web/core_pb.d.ts b/packages/dapi-grpc/clients/core/v0/web/core_pb.d.ts index b96051c0b3a..4c5b85cc11b 100644 --- a/packages/dapi-grpc/clients/core/v0/web/core_pb.d.ts +++ b/packages/dapi-grpc/clients/core/v0/web/core_pb.d.ts @@ -3,73 +3,67 @@ import * as jspb from "google-protobuf"; -export class GetStatusRequest extends jspb.Message { +export class GetBlockchainStatusRequest extends jspb.Message { serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetStatusRequest.AsObject; - static toObject(includeInstance: boolean, msg: GetStatusRequest): GetStatusRequest.AsObject; + toObject(includeInstance?: boolean): GetBlockchainStatusRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetBlockchainStatusRequest): GetBlockchainStatusRequest.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetStatusRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetStatusRequest; - static deserializeBinaryFromReader(message: GetStatusRequest, reader: jspb.BinaryReader): GetStatusRequest; + static serializeBinaryToWriter(message: GetBlockchainStatusRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetBlockchainStatusRequest; + static deserializeBinaryFromReader(message: GetBlockchainStatusRequest, reader: jspb.BinaryReader): GetBlockchainStatusRequest; } -export namespace GetStatusRequest { +export namespace GetBlockchainStatusRequest { export type AsObject = { } } -export class GetStatusResponse extends jspb.Message { +export class GetBlockchainStatusResponse extends jspb.Message { hasVersion(): boolean; clearVersion(): void; - getVersion(): GetStatusResponse.Version | undefined; - setVersion(value?: GetStatusResponse.Version): void; + getVersion(): GetBlockchainStatusResponse.Version | undefined; + setVersion(value?: GetBlockchainStatusResponse.Version): void; hasTime(): boolean; clearTime(): void; - getTime(): GetStatusResponse.Time | undefined; - setTime(value?: GetStatusResponse.Time): void; + getTime(): GetBlockchainStatusResponse.Time | undefined; + setTime(value?: GetBlockchainStatusResponse.Time): void; - getStatus(): GetStatusResponse.StatusMap[keyof GetStatusResponse.StatusMap]; - setStatus(value: GetStatusResponse.StatusMap[keyof GetStatusResponse.StatusMap]): void; + getStatus(): GetBlockchainStatusResponse.StatusMap[keyof GetBlockchainStatusResponse.StatusMap]; + setStatus(value: GetBlockchainStatusResponse.StatusMap[keyof GetBlockchainStatusResponse.StatusMap]): void; getSyncProgress(): number; setSyncProgress(value: number): void; hasChain(): boolean; clearChain(): void; - getChain(): GetStatusResponse.Chain | undefined; - setChain(value?: GetStatusResponse.Chain): void; - - hasMasternode(): boolean; - clearMasternode(): void; - getMasternode(): GetStatusResponse.Masternode | undefined; - setMasternode(value?: GetStatusResponse.Masternode): void; + getChain(): GetBlockchainStatusResponse.Chain | undefined; + setChain(value?: GetBlockchainStatusResponse.Chain): void; hasNetwork(): boolean; clearNetwork(): void; - getNetwork(): GetStatusResponse.Network | undefined; - setNetwork(value?: GetStatusResponse.Network): void; + getNetwork(): GetBlockchainStatusResponse.Network | undefined; + setNetwork(value?: GetBlockchainStatusResponse.Network): void; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetStatusResponse.AsObject; - static toObject(includeInstance: boolean, msg: GetStatusResponse): GetStatusResponse.AsObject; + toObject(includeInstance?: boolean): GetBlockchainStatusResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetBlockchainStatusResponse): GetBlockchainStatusResponse.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetStatusResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetStatusResponse; - static deserializeBinaryFromReader(message: GetStatusResponse, reader: jspb.BinaryReader): GetStatusResponse; + static serializeBinaryToWriter(message: GetBlockchainStatusResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetBlockchainStatusResponse; + static deserializeBinaryFromReader(message: GetBlockchainStatusResponse, reader: jspb.BinaryReader): GetBlockchainStatusResponse; } -export namespace GetStatusResponse { +export namespace GetBlockchainStatusResponse { export type AsObject = { - version?: GetStatusResponse.Version.AsObject, - time?: GetStatusResponse.Time.AsObject, - status: GetStatusResponse.StatusMap[keyof GetStatusResponse.StatusMap], + version?: GetBlockchainStatusResponse.Version.AsObject, + time?: GetBlockchainStatusResponse.Time.AsObject, + status: GetBlockchainStatusResponse.StatusMap[keyof GetBlockchainStatusResponse.StatusMap], syncProgress: number, - chain?: GetStatusResponse.Chain.AsObject, - masternode?: GetStatusResponse.Masternode.AsObject, - network?: GetStatusResponse.Network.AsObject, + chain?: GetBlockchainStatusResponse.Chain.AsObject, + network?: GetBlockchainStatusResponse.Network.AsObject, } export class Version extends jspb.Message { @@ -180,57 +174,6 @@ export namespace GetStatusResponse { } } - export class Masternode extends jspb.Message { - getStatus(): GetStatusResponse.Masternode.StatusMap[keyof GetStatusResponse.Masternode.StatusMap]; - setStatus(value: GetStatusResponse.Masternode.StatusMap[keyof GetStatusResponse.Masternode.StatusMap]): void; - - getProTxHash(): Uint8Array | string; - getProTxHash_asU8(): Uint8Array; - getProTxHash_asB64(): string; - setProTxHash(value: Uint8Array | string): void; - - getPosePenalty(): number; - setPosePenalty(value: number): void; - - getIsSynced(): boolean; - setIsSynced(value: boolean): void; - - getSyncProgress(): number; - setSyncProgress(value: number): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Masternode.AsObject; - static toObject(includeInstance: boolean, msg: Masternode): Masternode.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: Masternode, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Masternode; - static deserializeBinaryFromReader(message: Masternode, reader: jspb.BinaryReader): Masternode; - } - - export namespace Masternode { - export type AsObject = { - status: GetStatusResponse.Masternode.StatusMap[keyof GetStatusResponse.Masternode.StatusMap], - proTxHash: Uint8Array | string, - posePenalty: number, - isSynced: boolean, - syncProgress: number, - } - - export interface StatusMap { - UNKNOWN: 0; - WAITING_FOR_PROTX: 1; - POSE_BANNED: 2; - REMOVED: 3; - OPERATOR_KEY_CHANGED: 4; - PROTX_IP_CHANGED: 5; - READY: 6; - ERROR: 7; - } - - export const Status: StatusMap; - } - export class NetworkFee extends jspb.Message { getRelay(): number; setRelay(value: number): void; @@ -261,8 +204,8 @@ export namespace GetStatusResponse { hasFee(): boolean; clearFee(): void; - getFee(): GetStatusResponse.NetworkFee | undefined; - setFee(value?: GetStatusResponse.NetworkFee): void; + getFee(): GetBlockchainStatusResponse.NetworkFee | undefined; + setFee(value?: GetBlockchainStatusResponse.NetworkFee): void; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Network.AsObject; @@ -277,7 +220,7 @@ export namespace GetStatusResponse { export namespace Network { export type AsObject = { peersCount: number, - fee?: GetStatusResponse.NetworkFee.AsObject, + fee?: GetBlockchainStatusResponse.NetworkFee.AsObject, } } @@ -291,6 +234,73 @@ export namespace GetStatusResponse { export const Status: StatusMap; } +export class GetMasternodeStatusRequest extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetMasternodeStatusRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetMasternodeStatusRequest): GetMasternodeStatusRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetMasternodeStatusRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetMasternodeStatusRequest; + static deserializeBinaryFromReader(message: GetMasternodeStatusRequest, reader: jspb.BinaryReader): GetMasternodeStatusRequest; +} + +export namespace GetMasternodeStatusRequest { + export type AsObject = { + } +} + +export class GetMasternodeStatusResponse extends jspb.Message { + getStatus(): GetMasternodeStatusResponse.StatusMap[keyof GetMasternodeStatusResponse.StatusMap]; + setStatus(value: GetMasternodeStatusResponse.StatusMap[keyof GetMasternodeStatusResponse.StatusMap]): void; + + getProTxHash(): Uint8Array | string; + getProTxHash_asU8(): Uint8Array; + getProTxHash_asB64(): string; + setProTxHash(value: Uint8Array | string): void; + + getPosePenalty(): number; + setPosePenalty(value: number): void; + + getIsSynced(): boolean; + setIsSynced(value: boolean): void; + + getSyncProgress(): number; + setSyncProgress(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetMasternodeStatusResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetMasternodeStatusResponse): GetMasternodeStatusResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetMasternodeStatusResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetMasternodeStatusResponse; + static deserializeBinaryFromReader(message: GetMasternodeStatusResponse, reader: jspb.BinaryReader): GetMasternodeStatusResponse; +} + +export namespace GetMasternodeStatusResponse { + export type AsObject = { + status: GetMasternodeStatusResponse.StatusMap[keyof GetMasternodeStatusResponse.StatusMap], + proTxHash: Uint8Array | string, + posePenalty: number, + isSynced: boolean, + syncProgress: number, + } + + export interface StatusMap { + UNKNOWN: 0; + WAITING_FOR_PROTX: 1; + POSE_BANNED: 2; + REMOVED: 3; + OPERATOR_KEY_CHANGED: 4; + PROTX_IP_CHANGED: 5; + READY: 6; + ERROR: 7; + } + + export const Status: StatusMap; +} + export class GetBlockRequest extends jspb.Message { hasHeight(): boolean; clearHeight(): void; @@ -348,6 +358,42 @@ export namespace GetBlockResponse { } } +export class GetBestBlockHeightRequest extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetBestBlockHeightRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetBestBlockHeightRequest): GetBestBlockHeightRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetBestBlockHeightRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetBestBlockHeightRequest; + static deserializeBinaryFromReader(message: GetBestBlockHeightRequest, reader: jspb.BinaryReader): GetBestBlockHeightRequest; +} + +export namespace GetBestBlockHeightRequest { + export type AsObject = { + } +} + +export class GetBestBlockHeightResponse extends jspb.Message { + getHeight(): number; + setHeight(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetBestBlockHeightResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetBestBlockHeightResponse): GetBestBlockHeightResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetBestBlockHeightResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetBestBlockHeightResponse; + static deserializeBinaryFromReader(message: GetBestBlockHeightResponse, reader: jspb.BinaryReader): GetBestBlockHeightResponse; +} + +export namespace GetBestBlockHeightResponse { + export type AsObject = { + height: number, + } +} + export class BroadcastTransactionRequest extends jspb.Message { getTransaction(): Uint8Array | string; getTransaction_asU8(): Uint8Array; @@ -781,3 +827,41 @@ export namespace InstantSendLockMessages { } } +export class MasternodeListRequest extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): MasternodeListRequest.AsObject; + static toObject(includeInstance: boolean, msg: MasternodeListRequest): MasternodeListRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MasternodeListRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MasternodeListRequest; + static deserializeBinaryFromReader(message: MasternodeListRequest, reader: jspb.BinaryReader): MasternodeListRequest; +} + +export namespace MasternodeListRequest { + export type AsObject = { + } +} + +export class MasternodeListResponse extends jspb.Message { + getMasternodeListDiff(): Uint8Array | string; + getMasternodeListDiff_asU8(): Uint8Array; + getMasternodeListDiff_asB64(): string; + setMasternodeListDiff(value: Uint8Array | string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): MasternodeListResponse.AsObject; + static toObject(includeInstance: boolean, msg: MasternodeListResponse): MasternodeListResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MasternodeListResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MasternodeListResponse; + static deserializeBinaryFromReader(message: MasternodeListResponse, reader: jspb.BinaryReader): MasternodeListResponse; +} + +export namespace MasternodeListResponse { + export type AsObject = { + masternodeListDiff: Uint8Array | string, + } +} + diff --git a/packages/dapi-grpc/clients/core/v0/web/core_pb.js b/packages/dapi-grpc/clients/core/v0/web/core_pb.js index ae974b2f814..5bf2a3edaeb 100644 --- a/packages/dapi-grpc/clients/core/v0/web/core_pb.js +++ b/packages/dapi-grpc/clients/core/v0/web/core_pb.js @@ -23,24 +23,29 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.BlockHeadersWithChainLocksRes goog.exportSymbol('proto.org.dash.platform.dapi.v0.BloomFilter', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.BroadcastTransactionRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.BroadcastTransactionResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockRequest.BlockCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEstimatedTransactionFeeRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEstimatedTransactionFeeResponse', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusRequest', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Network', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Status', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Time', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetStatusResponse.Version', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTransactionRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetTransactionResponse', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.InstantSendLockMessages', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.MasternodeListRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.MasternodeListResponse', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.RawTransactions', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.TransactionsWithProofsRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.TransactionsWithProofsRequest.FromBlockCase', null, { proto }); @@ -56,16 +61,16 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.TransactionsWithProofsRespons * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusRequest = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusRequest'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest'; } /** * Generated by JsPbCodeGenerator. @@ -77,16 +82,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse'; } /** * Generated by JsPbCodeGenerator. @@ -98,16 +103,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Version, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Version'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version'; } /** * Generated by JsPbCodeGenerator. @@ -119,16 +124,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Time, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Time'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time'; } /** * Generated by JsPbCodeGenerator. @@ -140,16 +145,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain'; } /** * Generated by JsPbCodeGenerator. @@ -161,16 +166,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee'; } /** * Generated by JsPbCodeGenerator. @@ -182,16 +187,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee'; + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network'; } /** * Generated by JsPbCodeGenerator. @@ -203,16 +208,37 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetStatusResponse.Network, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.displayName = 'proto.org.dash.platform.dapi.v0.GetStatusResponse.Network'; + proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse'; } /** * Generated by JsPbCodeGenerator. @@ -256,6 +282,48 @@ if (goog.DEBUG && !COMPILED) { */ proto.org.dash.platform.dapi.v0.GetBlockResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetBlockResponse'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -550,6 +618,48 @@ if (goog.DEBUG && !COMPILED) { */ proto.org.dash.platform.dapi.v0.InstantSendLockMessages.displayName = 'proto.org.dash.platform.dapi.v0.InstantSendLockMessages'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.MasternodeListRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.MasternodeListRequest.displayName = 'proto.org.dash.platform.dapi.v0.MasternodeListRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.MasternodeListResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.MasternodeListResponse.displayName = 'proto.org.dash.platform.dapi.v0.MasternodeListResponse'; +} @@ -566,8 +676,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.toObject(opt_includeInstance, this); }; @@ -576,11 +686,11 @@ proto.org.dash.platform.dapi.v0.GetStatusRequest.prototype.toObject = function(o * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.toObject = function(includeInstance, msg) { var f, obj = { }; @@ -596,23 +706,23 @@ proto.org.dash.platform.dapi.v0.GetStatusRequest.toObject = function(includeInst /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusRequest; - return proto.org.dash.platform.dapi.v0.GetStatusRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -632,9 +742,9 @@ proto.org.dash.platform.dapi.v0.GetStatusRequest.deserializeBinaryFromReader = f * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -642,11 +752,11 @@ proto.org.dash.platform.dapi.v0.GetStatusRequest.prototype.serializeBinary = fun /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; @@ -667,8 +777,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.toObject(opt_includeInstance, this); }; @@ -677,19 +787,18 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.toObject = function( * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.toObject = function(includeInstance, msg) { var f, obj = { - version: (f = msg.getVersion()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.toObject(includeInstance, f), - time: (f = msg.getTime()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.toObject(includeInstance, f), + version: (f = msg.getVersion()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.toObject(includeInstance, f), + time: (f = msg.getTime()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.toObject(includeInstance, f), status: jspb.Message.getFieldWithDefault(msg, 3, 0), syncProgress: jspb.Message.getFloatingPointFieldWithDefault(msg, 4, 0.0), - chain: (f = msg.getChain()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.toObject(includeInstance, f), - masternode: (f = msg.getMasternode()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.toObject(includeInstance, f), - network: (f = msg.getNetwork()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.toObject(includeInstance, f) + chain: (f = msg.getChain()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.toObject(includeInstance, f), + network: (f = msg.getNetwork()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.toObject(includeInstance, f) }; if (includeInstance) { @@ -703,23 +812,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.toObject = function(includeIns /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -727,17 +836,17 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader = var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Version; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.deserializeBinaryFromReader); msg.setVersion(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Time; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.deserializeBinaryFromReader); msg.setTime(value); break; case 3: - var value = /** @type {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Status} */ (reader.readEnum()); + var value = /** @type {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status} */ (reader.readEnum()); msg.setStatus(value); break; case 4: @@ -745,18 +854,13 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader = msg.setSyncProgress(value); break; case 5: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.deserializeBinaryFromReader); msg.setChain(value); break; - case 6: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFromReader); - msg.setMasternode(value); - break; case 7: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Network; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.deserializeBinaryFromReader); msg.setNetwork(value); break; default: @@ -772,9 +876,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.deserializeBinaryFromReader = * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -782,18 +886,18 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.serializeBinary = fu /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getVersion(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.serializeBinaryToWriter ); } f = message.getTime(); @@ -801,7 +905,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = func writer.writeMessage( 2, f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.serializeBinaryToWriter ); } f = message.getStatus(); @@ -823,15 +927,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = func writer.writeMessage( 5, f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.serializeBinaryToWriter - ); - } - f = message.getMasternode(); - if (f != null) { - writer.writeMessage( - 6, - f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.serializeBinaryToWriter ); } f = message.getNetwork(); @@ -839,7 +935,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = func writer.writeMessage( 7, f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.serializeBinaryToWriter ); } }; @@ -848,7 +944,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.serializeBinaryToWriter = func /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Status = { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status = { NOT_STARTED: 0, SYNCING: 1, READY: 2, @@ -871,8 +967,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.toObject(opt_includeInstance, this); }; @@ -881,11 +977,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.toObject = f * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.toObject = function(includeInstance, msg) { var f, obj = { protocol: jspb.Message.getFieldWithDefault(msg, 1, 0), software: jspb.Message.getFieldWithDefault(msg, 2, 0), @@ -903,23 +999,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.toObject = function(in /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Version; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -951,9 +1047,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.deserializeBinaryFromR * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -961,11 +1057,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.serializeBin /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getProtocol(); if (f !== 0) { @@ -995,16 +1091,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.serializeBinaryToWrite * optional uint32 protocol = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.getProtocol = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.getProtocol = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setProtocol = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.setProtocol = function(value) { return jspb.Message.setProto3IntField(this, 1, value); }; @@ -1013,16 +1109,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setProtocol * optional uint32 software = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.getSoftware = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.getSoftware = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setSoftware = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.setSoftware = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; @@ -1031,16 +1127,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setSoftware * optional string agent = 3; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.getAgent = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.getAgent = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Version.prototype.setAgent = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version.prototype.setAgent = function(value) { return jspb.Message.setProto3StringField(this, 3, value); }; @@ -1061,8 +1157,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.toObject(opt_includeInstance, this); }; @@ -1071,11 +1167,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.toObject = func * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.toObject = function(includeInstance, msg) { var f, obj = { now: jspb.Message.getFieldWithDefault(msg, 1, 0), offset: jspb.Message.getFieldWithDefault(msg, 2, 0), @@ -1093,23 +1189,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.toObject = function(inclu /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Time; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1141,9 +1237,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.deserializeBinaryFromRead * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1151,11 +1247,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getNow(); if (f !== 0) { @@ -1185,16 +1281,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.serializeBinaryToWriter = * optional uint32 now = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.getNow = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.getNow = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setNow = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.setNow = function(value) { return jspb.Message.setProto3IntField(this, 1, value); }; @@ -1203,16 +1299,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setNow = functi * optional int32 offset = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.getOffset = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.getOffset = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setOffset = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.setOffset = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; @@ -1221,16 +1317,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setOffset = fun * optional uint32 median = 3; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.getMedian = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.getMedian = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Time.prototype.setMedian = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time.prototype.setMedian = function(value) { return jspb.Message.setProto3IntField(this, 3, value); }; @@ -1251,8 +1347,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.toObject(opt_includeInstance, this); }; @@ -1261,11 +1357,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.toObject = fun * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.toObject = function(includeInstance, msg) { var f, obj = { name: jspb.Message.getFieldWithDefault(msg, 1, ""), headersCount: jspb.Message.getFieldWithDefault(msg, 2, 0), @@ -1288,23 +1384,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.toObject = function(incl /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1356,9 +1452,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.deserializeBinaryFromRea * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1366,11 +1462,11 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.serializeBinar /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getName(); if (f.length > 0) { @@ -1435,16 +1531,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.serializeBinaryToWriter * optional string name = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getName = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getName = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setName = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setName = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; @@ -1453,16 +1549,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setName = func * optional uint32 headers_count = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getHeadersCount = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getHeadersCount = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setHeadersCount = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setHeadersCount = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; @@ -1471,16 +1567,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setHeadersCoun * optional uint32 blocks_count = 3; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBlocksCount = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getBlocksCount = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setBlocksCount = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setBlocksCount = function(value) { return jspb.Message.setProto3IntField(this, 3, value); }; @@ -1489,7 +1585,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setBlocksCount * optional bytes best_block_hash = 4; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHash = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getBestBlockHash = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; @@ -1499,7 +1595,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHa * This is a type-conversion wrapper around `getBestBlockHash()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHash_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getBestBlockHash_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getBestBlockHash())); }; @@ -1512,7 +1608,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHa * This is a type-conversion wrapper around `getBestBlockHash()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHash_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getBestBlockHash_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getBestBlockHash())); }; @@ -1520,9 +1616,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getBestBlockHa /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setBestBlockHash = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setBestBlockHash = function(value) { return jspb.Message.setProto3BytesField(this, 4, value); }; @@ -1531,16 +1627,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setBestBlockHa * optional double difficulty = 5; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getDifficulty = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getDifficulty = function() { return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setDifficulty = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setDifficulty = function(value) { return jspb.Message.setProto3FloatField(this, 5, value); }; @@ -1549,7 +1645,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setDifficulty * optional bytes chain_work = 6; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getChainWork = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); }; @@ -1559,7 +1655,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork = * This is a type-conversion wrapper around `getChainWork()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getChainWork_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getChainWork())); }; @@ -1572,7 +1668,7 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork_a * This is a type-conversion wrapper around `getChainWork()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getChainWork_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getChainWork())); }; @@ -1580,9 +1676,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getChainWork_a /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setChainWork = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setChainWork = function(value) { return jspb.Message.setProto3BytesField(this, 6, value); }; @@ -1591,16 +1687,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setChainWork = * optional bool is_synced = 7; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getIsSynced = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getIsSynced = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 7, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setIsSynced = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setIsSynced = function(value) { return jspb.Message.setProto3BooleanField(this, 7, value); }; @@ -1609,16 +1705,16 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setIsSynced = * optional double sync_progress = 8; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.getSyncProgress = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.getSyncProgress = function() { return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 8, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain.prototype.setSyncProgress = function(value) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain.prototype.setSyncProgress = function(value) { return jspb.Message.setProto3FloatField(this, 8, value); }; @@ -1639,8 +1735,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.toObject(opt_includeInstance, this); }; @@ -1649,17 +1745,14 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.toObject * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.toObject = function(includeInstance, msg) { var f, obj = { - status: jspb.Message.getFieldWithDefault(msg, 1, 0), - proTxHash: msg.getProTxHash_asB64(), - posePenalty: jspb.Message.getFieldWithDefault(msg, 3, 0), - isSynced: jspb.Message.getBooleanFieldWithDefault(msg, 4, false), - syncProgress: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0) + relay: jspb.Message.getFloatingPointFieldWithDefault(msg, 1, 0.0), + incremental: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0) }; if (includeInstance) { @@ -1673,23 +1766,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.toObject = function /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1697,24 +1790,12 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFr var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status} */ (reader.readEnum()); - msg.setStatus(value); + var value = /** @type {number} */ (reader.readDouble()); + msg.setRelay(value); break; case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setProTxHash(value); - break; - case 3: - var value = /** @type {number} */ (reader.readUint32()); - msg.setPosePenalty(value); - break; - case 4: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setIsSynced(value); - break; - case 5: var value = /** @type {number} */ (reader.readDouble()); - msg.setSyncProgress(value); + msg.setIncremental(value); break; default: reader.skipField(); @@ -1729,9 +1810,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.deserializeBinaryFr * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1739,44 +1820,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.serialize /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getStatus(); + f = message.getRelay(); if (f !== 0.0) { - writer.writeEnum( + writer.writeDouble( 1, f ); } - f = message.getProTxHash_asU8(); - if (f.length > 0) { - writer.writeBytes( - 2, - f - ); - } - f = message.getPosePenalty(); - if (f !== 0) { - writer.writeUint32( - 3, - f - ); - } - f = message.getIsSynced(); - if (f) { - writer.writeBool( - 4, - f - ); - } - f = message.getSyncProgress(); + f = message.getIncremental(); if (f !== 0.0) { writer.writeDouble( - 5, + 2, f ); } @@ -1784,130 +1844,38 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.serializeBinaryToWr /** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status = { - UNKNOWN: 0, - WAITING_FOR_PROTX: 1, - POSE_BANNED: 2, - REMOVED: 3, - OPERATOR_KEY_CHANGED: 4, - PROTX_IP_CHANGED: 5, - READY: 6, - ERROR: 7 -}; - -/** - * optional Status status = 1; - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getStatus = function() { - return /** @type {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.Status} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setStatus = function(value) { - return jspb.Message.setProto3EnumField(this, 1, value); -}; - - -/** - * optional bytes pro_tx_hash = 2; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getProTxHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * optional bytes pro_tx_hash = 2; - * This is a type-conversion wrapper around `getProTxHash()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getProTxHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getProTxHash())); -}; - - -/** - * optional bytes pro_tx_hash = 2; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getProTxHash()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getProTxHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getProTxHash())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setProTxHash = function(value) { - return jspb.Message.setProto3BytesField(this, 2, value); -}; - - -/** - * optional uint32 pose_penalty = 3; + * optional double relay = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getPosePenalty = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.getRelay = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setPosePenalty = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); -}; - - -/** - * optional bool is_synced = 4; - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getIsSynced = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setIsSynced = function(value) { - return jspb.Message.setProto3BooleanField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.setRelay = function(value) { + return jspb.Message.setProto3FloatField(this, 1, value); }; /** - * optional double sync_progress = 5; + * optional double incremental = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.getSyncProgress = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.getIncremental = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode.prototype.setSyncProgress = function(value) { - return jspb.Message.setProto3FloatField(this, 5, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.prototype.setIncremental = function(value) { + return jspb.Message.setProto3FloatField(this, 2, value); }; @@ -1927,8 +1895,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.toObject(opt_includeInstance, this); }; @@ -1937,14 +1905,14 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.toObject * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.toObject = function(includeInstance, msg) { var f, obj = { - relay: jspb.Message.getFloatingPointFieldWithDefault(msg, 1, 0.0), - incremental: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0) + peersCount: jspb.Message.getFieldWithDefault(msg, 1, 0), + fee: (f = msg.getFee()) && proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.toObject(includeInstance, f) }; if (includeInstance) { @@ -1958,23 +1926,23 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.toObject = function /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network; + return proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1982,12 +1950,13 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFr var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readDouble()); - msg.setRelay(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setPeersCount(value); break; case 2: - var value = /** @type {number} */ (reader.readDouble()); - msg.setIncremental(value); + var value = new proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.deserializeBinaryFromReader); + msg.setFee(value); break; default: reader.skipField(); @@ -2002,9 +1971,9 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFr * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2012,234 +1981,220 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.serialize /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} message + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getRelay(); - if (f !== 0.0) { - writer.writeDouble( + f = message.getPeersCount(); + if (f !== 0) { + writer.writeUint32( 1, f ); } - f = message.getIncremental(); - if (f !== 0.0) { - writer.writeDouble( + f = message.getFee(); + if (f != null) { + writer.writeMessage( 2, - f + f, + proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee.serializeBinaryToWriter ); } }; /** - * optional double relay = 1; + * optional uint32 peers_count = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.getRelay = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.getPeersCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.setRelay = function(value) { - return jspb.Message.setProto3FloatField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.setPeersCount = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; /** - * optional double incremental = 2; - * @return {number} + * optional NetworkFee fee = 2; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.getIncremental = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.getFee = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee, 2)); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.NetworkFee|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} returns this +*/ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.setFee = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.prototype.setIncremental = function(value) { - return jspb.Message.setProto3FloatField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.clearFee = function() { + return this.setFee(undefined); }; +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network.prototype.hasFee = function() { + return jspb.Message.getField(this, 2) != null; +}; +/** + * optional Version version = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} + */ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getVersion = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version, 1)); +}; + -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Version|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setVersion = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.clearVersion = function() { + return this.setVersion(undefined); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.toObject = function(includeInstance, msg) { - var f, obj = { - peersCount: jspb.Message.getFieldWithDefault(msg, 1, 0), - fee: (f = msg.getFee()) && proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.toObject(includeInstance, f) - }; +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.hasVersion = function() { + return jspb.Message.getField(this, 1) != null; +}; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; + +/** + * optional Time time = 2; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} + */ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getTime = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time, 2)); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Time|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setTime = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetStatusResponse.Network; - return proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.clearTime = function() { + return this.setTime(undefined); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readUint32()); - msg.setPeersCount(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.deserializeBinaryFromReader); - msg.setFee(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.hasTime = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * optional Status status = 3; + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getStatus = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Status} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getPeersCount(); - if (f !== 0) { - writer.writeUint32( - 1, - f - ); - } - f = message.getFee(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setStatus = function(value) { + return jspb.Message.setProto3EnumField(this, 3, value); }; /** - * optional uint32 peers_count = 1; + * optional double sync_progress = 4; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.getPeersCount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getSyncProgress = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 4, 0.0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.setPeersCount = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setSyncProgress = function(value) { + return jspb.Message.setProto3FloatField(this, 4, value); }; /** - * optional NetworkFee fee = 2; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} + * optional Chain chain = 5; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.getFee = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee, 2)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getChain = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain, 5)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.NetworkFee|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Chain|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.setFee = function(value) { - return jspb.Message.setWrapperField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setChain = function(value) { + return jspb.Message.setWrapperField(this, 5, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.clearFee = function() { - return this.setFee(undefined); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.clearChain = function() { + return this.setChain(undefined); }; @@ -2247,36 +2202,36 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.clearFee = f * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.Network.prototype.hasFee = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.hasChain = function() { + return jspb.Message.getField(this, 5) != null; }; /** - * optional Version version = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} + * optional Network network = 7; + * @return {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getVersion = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Version} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Version, 1)); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.getNetwork = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network, 7)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Version|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.Network|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setVersion = function(value) { - return jspb.Message.setWrapperField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.setNetwork = function(value) { + return jspb.Message.setWrapperField(this, 7, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearVersion = function() { - return this.setVersion(undefined); +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.clearNetwork = function() { + return this.setNetwork(undefined); }; @@ -2284,192 +2239,397 @@ proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearVersion = funct * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasVersion = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetBlockchainStatusResponse.prototype.hasNetwork = function() { + return jspb.Message.getField(this, 7) != null; }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional Time time = 2; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getTime = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Time} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Time, 2)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.toObject(opt_includeInstance, this); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Time|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setTime = function(value) { - return jspb.Message.setWrapperField(this, 2, value); + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearTime = function() { - return this.setTime(undefined); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest; + return proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.deserializeBinaryFromReader(msg, reader); }; /** - * Returns whether this field is set. - * @return {boolean} + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasTime = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional Status status = 3; - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Status} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getStatus = function() { - return /** @type {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Status} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetStatusResponse.Status} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setStatus = function(value) { - return jspb.Message.setProto3EnumField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional double sync_progress = 4; - * @return {number} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getSyncProgress = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 4, 0.0)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.toObject(opt_includeInstance, this); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setSyncProgress = function(value) { - return jspb.Message.setProto3FloatField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.toObject = function(includeInstance, msg) { + var f, obj = { + status: jspb.Message.getFieldWithDefault(msg, 1, 0), + proTxHash: msg.getProTxHash_asB64(), + posePenalty: jspb.Message.getFieldWithDefault(msg, 3, 0), + isSynced: jspb.Message.getBooleanFieldWithDefault(msg, 4, false), + syncProgress: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional Chain chain = 5; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getChain = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain, 5)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse; + return proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.deserializeBinaryFromReader(msg, reader); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Chain|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setChain = function(value) { - return jspb.Message.setWrapperField(this, 5, value); + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status} */ (reader.readEnum()); + msg.setStatus(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setProTxHash(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setPosePenalty(value); + break; + case 4: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setIsSynced(value); + break; + case 5: + var value = /** @type {number} */ (reader.readDouble()); + msg.setSyncProgress(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearChain = function() { - return this.setChain(undefined); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * Returns whether this field is set. - * @return {boolean} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasChain = function() { - return jspb.Message.getField(this, 5) != null; +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStatus(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getProTxHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getPosePenalty(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } + f = message.getIsSynced(); + if (f) { + writer.writeBool( + 4, + f + ); + } + f = message.getSyncProgress(); + if (f !== 0.0) { + writer.writeDouble( + 5, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status = { + UNKNOWN: 0, + WAITING_FOR_PROTX: 1, + POSE_BANNED: 2, + REMOVED: 3, + OPERATOR_KEY_CHANGED: 4, + PROTX_IP_CHANGED: 5, + READY: 6, + ERROR: 7 +}; + +/** + * optional Status status = 1; + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getStatus = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * optional Masternode masternode = 6; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} + * @param {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.Status} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getMasternode = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode, 6)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setStatus = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Masternode|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setMasternode = function(value) { - return jspb.Message.setWrapperField(this, 6, value); + * optional bytes pro_tx_hash = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getProTxHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes pro_tx_hash = 2; + * This is a type-conversion wrapper around `getProTxHash()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getProTxHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getProTxHash())); +}; + + +/** + * optional bytes pro_tx_hash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getProTxHash()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getProTxHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getProTxHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setProTxHash = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * optional uint32 pose_penalty = 3; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearMasternode = function() { - return this.setMasternode(undefined); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getPosePenalty = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasMasternode = function() { - return jspb.Message.getField(this, 6) != null; +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setPosePenalty = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); }; /** - * optional Network network = 7; - * @return {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} + * optional bool is_synced = 4; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.getNetwork = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetStatusResponse.Network} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetStatusResponse.Network, 7)); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getIsSynced = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetStatusResponse.Network|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this -*/ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.setNetwork = function(value) { - return jspb.Message.setWrapperField(this, 7, value); + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setIsSynced = function(value) { + return jspb.Message.setProto3BooleanField(this, 4, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetStatusResponse} returns this + * optional double sync_progress = 5; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.clearNetwork = function() { - return this.setNetwork(undefined); +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.getSyncProgress = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetStatusResponse.prototype.hasNetwork = function() { - return jspb.Message.getField(this, 7) != null; +proto.org.dash.platform.dapi.v0.GetMasternodeStatusResponse.prototype.setSyncProgress = function(value) { + return jspb.Message.setProto3FloatField(this, 5, value); }; @@ -2783,7 +2943,262 @@ proto.org.dash.platform.dapi.v0.GetBlockResponse.deserializeBinaryFromReader = f */ proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetBlockResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBlock_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes block = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes block = 1; + * This is a type-conversion wrapper around `getBlock()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBlock())); +}; + + +/** + * optional bytes block = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getBlock()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBlock())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetBlockResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.setBlock = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest; + return proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse; + return proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setHeight(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2791,15 +3206,15 @@ proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.serializeBinary = fun /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetBlockResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getBlock_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getHeight(); + if (f !== 0) { + writer.writeUint32( 1, f ); @@ -2808,44 +3223,20 @@ proto.org.dash.platform.dapi.v0.GetBlockResponse.serializeBinaryToWriter = funct /** - * optional bytes block = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes block = 1; - * This is a type-conversion wrapper around `getBlock()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getBlock())); -}; - - -/** - * optional bytes block = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getBlock()` - * @return {!Uint8Array} + * optional uint32 height = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.getBlock_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getBlock())); +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetBlockResponse} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetBlockResponse.prototype.setBlock = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetBestBlockHeightResponse.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; @@ -5878,4 +6269,259 @@ proto.org.dash.platform.dapi.v0.InstantSendLockMessages.prototype.clearMessagesL }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.MasternodeListRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.MasternodeListRequest; + return proto.org.dash.platform.dapi.v0.MasternodeListRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.MasternodeListRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.MasternodeListRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.MasternodeListResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.toObject = function(includeInstance, msg) { + var f, obj = { + masternodeListDiff: msg.getMasternodeListDiff_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.MasternodeListResponse; + return proto.org.dash.platform.dapi.v0.MasternodeListResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setMasternodeListDiff(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.MasternodeListResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMasternodeListDiff_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes masternode_list_diff = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.getMasternodeListDiff = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes masternode_list_diff = 1; + * This is a type-conversion wrapper around `getMasternodeListDiff()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.getMasternodeListDiff_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getMasternodeListDiff())); +}; + + +/** + * optional bytes masternode_list_diff = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getMasternodeListDiff()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.getMasternodeListDiff_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getMasternodeListDiff())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.MasternodeListResponse} returns this + */ +proto.org.dash.platform.dapi.v0.MasternodeListResponse.prototype.setMasternodeListDiff = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + goog.object.extend(exports, proto.org.dash.platform.dapi.v0); diff --git a/packages/dapi-grpc/clients/core/v0/web/core_pb_service.d.ts b/packages/dapi-grpc/clients/core/v0/web/core_pb_service.d.ts index 9b635554bac..4181c8f8526 100644 --- a/packages/dapi-grpc/clients/core/v0/web/core_pb_service.d.ts +++ b/packages/dapi-grpc/clients/core/v0/web/core_pb_service.d.ts @@ -4,13 +4,22 @@ import * as core_pb from "./core_pb"; import {grpc} from "@improbable-eng/grpc-web"; -type CoregetStatus = { +type CoregetBlockchainStatus = { readonly methodName: string; readonly service: typeof Core; readonly requestStream: false; readonly responseStream: false; - readonly requestType: typeof core_pb.GetStatusRequest; - readonly responseType: typeof core_pb.GetStatusResponse; + readonly requestType: typeof core_pb.GetBlockchainStatusRequest; + readonly responseType: typeof core_pb.GetBlockchainStatusResponse; +}; + +type CoregetMasternodeStatus = { + readonly methodName: string; + readonly service: typeof Core; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof core_pb.GetMasternodeStatusRequest; + readonly responseType: typeof core_pb.GetMasternodeStatusResponse; }; type CoregetBlock = { @@ -22,6 +31,15 @@ type CoregetBlock = { readonly responseType: typeof core_pb.GetBlockResponse; }; +type CoregetBestBlockHeight = { + readonly methodName: string; + readonly service: typeof Core; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof core_pb.GetBestBlockHeightRequest; + readonly responseType: typeof core_pb.GetBestBlockHeightResponse; +}; + type CorebroadcastTransaction = { readonly methodName: string; readonly service: typeof Core; @@ -67,15 +85,27 @@ type CoresubscribeToTransactionsWithProofs = { readonly responseType: typeof core_pb.TransactionsWithProofsResponse; }; +type CoresubscribeToMasternodeList = { + readonly methodName: string; + readonly service: typeof Core; + readonly requestStream: false; + readonly responseStream: true; + readonly requestType: typeof core_pb.MasternodeListRequest; + readonly responseType: typeof core_pb.MasternodeListResponse; +}; + export class Core { static readonly serviceName: string; - static readonly getStatus: CoregetStatus; + static readonly getBlockchainStatus: CoregetBlockchainStatus; + static readonly getMasternodeStatus: CoregetMasternodeStatus; static readonly getBlock: CoregetBlock; + static readonly getBestBlockHeight: CoregetBestBlockHeight; static readonly broadcastTransaction: CorebroadcastTransaction; static readonly getTransaction: CoregetTransaction; static readonly getEstimatedTransactionFee: CoregetEstimatedTransactionFee; static readonly subscribeToBlockHeadersWithChainLocks: CoresubscribeToBlockHeadersWithChainLocks; static readonly subscribeToTransactionsWithProofs: CoresubscribeToTransactionsWithProofs; + static readonly subscribeToMasternodeList: CoresubscribeToMasternodeList; } export type ServiceError = { message: string, code: number; metadata: grpc.Metadata } @@ -110,14 +140,23 @@ export class CoreClient { readonly serviceHost: string; constructor(serviceHost: string, options?: grpc.RpcOptions); - getStatus( - requestMessage: core_pb.GetStatusRequest, + getBlockchainStatus( + requestMessage: core_pb.GetBlockchainStatusRequest, metadata: grpc.Metadata, - callback: (error: ServiceError|null, responseMessage: core_pb.GetStatusResponse|null) => void + callback: (error: ServiceError|null, responseMessage: core_pb.GetBlockchainStatusResponse|null) => void ): UnaryResponse; - getStatus( - requestMessage: core_pb.GetStatusRequest, - callback: (error: ServiceError|null, responseMessage: core_pb.GetStatusResponse|null) => void + getBlockchainStatus( + requestMessage: core_pb.GetBlockchainStatusRequest, + callback: (error: ServiceError|null, responseMessage: core_pb.GetBlockchainStatusResponse|null) => void + ): UnaryResponse; + getMasternodeStatus( + requestMessage: core_pb.GetMasternodeStatusRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: core_pb.GetMasternodeStatusResponse|null) => void + ): UnaryResponse; + getMasternodeStatus( + requestMessage: core_pb.GetMasternodeStatusRequest, + callback: (error: ServiceError|null, responseMessage: core_pb.GetMasternodeStatusResponse|null) => void ): UnaryResponse; getBlock( requestMessage: core_pb.GetBlockRequest, @@ -128,6 +167,15 @@ export class CoreClient { requestMessage: core_pb.GetBlockRequest, callback: (error: ServiceError|null, responseMessage: core_pb.GetBlockResponse|null) => void ): UnaryResponse; + getBestBlockHeight( + requestMessage: core_pb.GetBestBlockHeightRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: core_pb.GetBestBlockHeightResponse|null) => void + ): UnaryResponse; + getBestBlockHeight( + requestMessage: core_pb.GetBestBlockHeightRequest, + callback: (error: ServiceError|null, responseMessage: core_pb.GetBestBlockHeightResponse|null) => void + ): UnaryResponse; broadcastTransaction( requestMessage: core_pb.BroadcastTransactionRequest, metadata: grpc.Metadata, @@ -157,5 +205,6 @@ export class CoreClient { ): UnaryResponse; subscribeToBlockHeadersWithChainLocks(requestMessage: core_pb.BlockHeadersWithChainLocksRequest, metadata?: grpc.Metadata): ResponseStream; subscribeToTransactionsWithProofs(requestMessage: core_pb.TransactionsWithProofsRequest, metadata?: grpc.Metadata): ResponseStream; + subscribeToMasternodeList(requestMessage: core_pb.MasternodeListRequest, metadata?: grpc.Metadata): ResponseStream; } diff --git a/packages/dapi-grpc/clients/core/v0/web/core_pb_service.js b/packages/dapi-grpc/clients/core/v0/web/core_pb_service.js index 7eeda0af881..b810654314a 100644 --- a/packages/dapi-grpc/clients/core/v0/web/core_pb_service.js +++ b/packages/dapi-grpc/clients/core/v0/web/core_pb_service.js @@ -10,13 +10,22 @@ var Core = (function () { return Core; }()); -Core.getStatus = { - methodName: "getStatus", +Core.getBlockchainStatus = { + methodName: "getBlockchainStatus", service: Core, requestStream: false, responseStream: false, - requestType: core_pb.GetStatusRequest, - responseType: core_pb.GetStatusResponse + requestType: core_pb.GetBlockchainStatusRequest, + responseType: core_pb.GetBlockchainStatusResponse +}; + +Core.getMasternodeStatus = { + methodName: "getMasternodeStatus", + service: Core, + requestStream: false, + responseStream: false, + requestType: core_pb.GetMasternodeStatusRequest, + responseType: core_pb.GetMasternodeStatusResponse }; Core.getBlock = { @@ -28,6 +37,15 @@ Core.getBlock = { responseType: core_pb.GetBlockResponse }; +Core.getBestBlockHeight = { + methodName: "getBestBlockHeight", + service: Core, + requestStream: false, + responseStream: false, + requestType: core_pb.GetBestBlockHeightRequest, + responseType: core_pb.GetBestBlockHeightResponse +}; + Core.broadcastTransaction = { methodName: "broadcastTransaction", service: Core, @@ -73,6 +91,15 @@ Core.subscribeToTransactionsWithProofs = { responseType: core_pb.TransactionsWithProofsResponse }; +Core.subscribeToMasternodeList = { + methodName: "subscribeToMasternodeList", + service: Core, + requestStream: false, + responseStream: true, + requestType: core_pb.MasternodeListRequest, + responseType: core_pb.MasternodeListResponse +}; + exports.Core = Core; function CoreClient(serviceHost, options) { @@ -80,11 +107,42 @@ function CoreClient(serviceHost, options) { this.options = options || {}; } -CoreClient.prototype.getStatus = function getStatus(requestMessage, metadata, callback) { +CoreClient.prototype.getBlockchainStatus = function getBlockchainStatus(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Core.getStatus, { + var client = grpc.unary(Core.getBlockchainStatus, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +CoreClient.prototype.getMasternodeStatus = function getMasternodeStatus(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(Core.getMasternodeStatus, { request: requestMessage, host: this.serviceHost, metadata: metadata, @@ -142,6 +200,37 @@ CoreClient.prototype.getBlock = function getBlock(requestMessage, metadata, call }; }; +CoreClient.prototype.getBestBlockHeight = function getBestBlockHeight(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(Core.getBestBlockHeight, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + CoreClient.prototype.broadcastTransaction = function broadcastTransaction(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; @@ -313,5 +402,44 @@ CoreClient.prototype.subscribeToTransactionsWithProofs = function subscribeToTra }; }; +CoreClient.prototype.subscribeToMasternodeList = function subscribeToMasternodeList(requestMessage, metadata) { + var listeners = { + data: [], + end: [], + status: [] + }; + var client = grpc.invoke(Core.subscribeToMasternodeList, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onMessage: function (responseMessage) { + listeners.data.forEach(function (handler) { + handler(responseMessage); + }); + }, + onEnd: function (status, statusMessage, trailers) { + listeners.status.forEach(function (handler) { + handler({ code: status, details: statusMessage, metadata: trailers }); + }); + listeners.end.forEach(function (handler) { + handler({ code: status, details: statusMessage, metadata: trailers }); + }); + listeners = null; + } + }); + return { + on: function (type, handler) { + listeners[type].push(handler); + return this; + }, + cancel: function () { + listeners = null; + client.close(); + } + }; +}; + exports.CoreClient = CoreClient; diff --git a/packages/dapi-grpc/clients/platform/v0/java/org/dash/platform/dapi/v0/PlatformGrpc.java b/packages/dapi-grpc/clients/platform/v0/java/org/dash/platform/dapi/v0/PlatformGrpc.java index a27ed63482d..1223bc5e01e 100644 --- a/packages/dapi-grpc/clients/platform/v0/java/org/dash/platform/dapi/v0/PlatformGrpc.java +++ b/packages/dapi-grpc/clients/platform/v0/java/org/dash/platform/dapi/v0/PlatformGrpc.java @@ -77,37 +77,6 @@ org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityResponse> getGetIdentity return getGetIdentityMethod; } - private static volatile io.grpc.MethodDescriptor getGetIdentitiesMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "getIdentities", - requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesRequest.class, - responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor getGetIdentitiesMethod() { - io.grpc.MethodDescriptor getGetIdentitiesMethod; - if ((getGetIdentitiesMethod = PlatformGrpc.getGetIdentitiesMethod) == null) { - synchronized (PlatformGrpc.class) { - if ((getGetIdentitiesMethod = PlatformGrpc.getGetIdentitiesMethod) == null) { - PlatformGrpc.getGetIdentitiesMethod = getGetIdentitiesMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getIdentities")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesResponse.getDefaultInstance())) - .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getIdentities")) - .build(); - } - } - } - return getGetIdentitiesMethod; - } - private static volatile io.grpc.MethodDescriptor getGetIdentityKeysMethod; @@ -139,6 +108,99 @@ org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysResponse> getGetIden return getGetIdentityKeysMethod; } + private static volatile io.grpc.MethodDescriptor getGetIdentitiesContractKeysMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getIdentitiesContractKeys", + requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysRequest.class, + responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetIdentitiesContractKeysMethod() { + io.grpc.MethodDescriptor getGetIdentitiesContractKeysMethod; + if ((getGetIdentitiesContractKeysMethod = PlatformGrpc.getGetIdentitiesContractKeysMethod) == null) { + synchronized (PlatformGrpc.class) { + if ((getGetIdentitiesContractKeysMethod = PlatformGrpc.getGetIdentitiesContractKeysMethod) == null) { + PlatformGrpc.getGetIdentitiesContractKeysMethod = getGetIdentitiesContractKeysMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getIdentitiesContractKeys")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysResponse.getDefaultInstance())) + .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getIdentitiesContractKeys")) + .build(); + } + } + } + return getGetIdentitiesContractKeysMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetIdentityNonceMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getIdentityNonce", + requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceRequest.class, + responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetIdentityNonceMethod() { + io.grpc.MethodDescriptor getGetIdentityNonceMethod; + if ((getGetIdentityNonceMethod = PlatformGrpc.getGetIdentityNonceMethod) == null) { + synchronized (PlatformGrpc.class) { + if ((getGetIdentityNonceMethod = PlatformGrpc.getGetIdentityNonceMethod) == null) { + PlatformGrpc.getGetIdentityNonceMethod = getGetIdentityNonceMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getIdentityNonce")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceResponse.getDefaultInstance())) + .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getIdentityNonce")) + .build(); + } + } + } + return getGetIdentityNonceMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetIdentityContractNonceMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getIdentityContractNonce", + requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceRequest.class, + responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetIdentityContractNonceMethod() { + io.grpc.MethodDescriptor getGetIdentityContractNonceMethod; + if ((getGetIdentityContractNonceMethod = PlatformGrpc.getGetIdentityContractNonceMethod) == null) { + synchronized (PlatformGrpc.class) { + if ((getGetIdentityContractNonceMethod = PlatformGrpc.getGetIdentityContractNonceMethod) == null) { + PlatformGrpc.getGetIdentityContractNonceMethod = getGetIdentityContractNonceMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getIdentityContractNonce")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceResponse.getDefaultInstance())) + .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getIdentityContractNonce")) + .build(); + } + } + } + return getGetIdentityContractNonceMethod; + } + private static volatile io.grpc.MethodDescriptor getGetIdentityBalanceMethod; @@ -356,37 +418,6 @@ org.dash.platform.dapi.v0.PlatformOuterClass.GetDocumentsResponse> getGetDocumen return getGetDocumentsMethod; } - private static volatile io.grpc.MethodDescriptor getGetIdentitiesByPublicKeyHashesMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "getIdentitiesByPublicKeyHashes", - requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesRequest.class, - responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor getGetIdentitiesByPublicKeyHashesMethod() { - io.grpc.MethodDescriptor getGetIdentitiesByPublicKeyHashesMethod; - if ((getGetIdentitiesByPublicKeyHashesMethod = PlatformGrpc.getGetIdentitiesByPublicKeyHashesMethod) == null) { - synchronized (PlatformGrpc.class) { - if ((getGetIdentitiesByPublicKeyHashesMethod = PlatformGrpc.getGetIdentitiesByPublicKeyHashesMethod) == null) { - PlatformGrpc.getGetIdentitiesByPublicKeyHashesMethod = getGetIdentitiesByPublicKeyHashesMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getIdentitiesByPublicKeyHashes")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesResponse.getDefaultInstance())) - .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getIdentitiesByPublicKeyHashes")) - .build(); - } - } - } - return getGetIdentitiesByPublicKeyHashesMethod; - } - private static volatile io.grpc.MethodDescriptor getGetIdentityByPublicKeyHashMethod; @@ -573,6 +604,37 @@ org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochsInfoResponse> getGetEpochs return getGetEpochsInfoMethod; } + private static volatile io.grpc.MethodDescriptor getGetPathElementsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "getPathElements", + requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsRequest.class, + responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetPathElementsMethod() { + io.grpc.MethodDescriptor getGetPathElementsMethod; + if ((getGetPathElementsMethod = PlatformGrpc.getGetPathElementsMethod) == null) { + synchronized (PlatformGrpc.class) { + if ((getGetPathElementsMethod = PlatformGrpc.getGetPathElementsMethod) == null) { + PlatformGrpc.getGetPathElementsMethod = getGetPathElementsMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getPathElements")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsResponse.getDefaultInstance())) + .setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getPathElements")) + .build(); + } + } + } + return getGetPathElementsMethod; + } + /** * Creates a new async stub that supports all call types for the service */ @@ -637,16 +699,30 @@ public void getIdentity(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentity /** */ - public void getIdentities(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetIdentitiesMethod(), responseObserver); + public void getIdentityKeys(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetIdentityKeysMethod(), responseObserver); } /** */ - public void getIdentityKeys(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetIdentityKeysMethod(), responseObserver); + public void getIdentitiesContractKeys(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetIdentitiesContractKeysMethod(), responseObserver); + } + + /** + */ + public void getIdentityNonce(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetIdentityNonceMethod(), responseObserver); + } + + /** + */ + public void getIdentityContractNonce(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetIdentityContractNonceMethod(), responseObserver); } /** @@ -698,13 +774,6 @@ public void getDocuments(org.dash.platform.dapi.v0.PlatformOuterClass.GetDocumen io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetDocumentsMethod(), responseObserver); } - /** - */ - public void getIdentitiesByPublicKeyHashes(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetIdentitiesByPublicKeyHashesMethod(), responseObserver); - } - /** */ public void getIdentityByPublicKeyHash(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityByPublicKeyHashRequest request, @@ -747,6 +816,13 @@ public void getEpochsInfo(org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochs io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetEpochsInfoMethod(), responseObserver); } + /** + */ + public void getPathElements(org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetPathElementsMethod(), responseObserver); + } + @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) .addMethod( @@ -763,13 +839,6 @@ public void getEpochsInfo(org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochs org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityRequest, org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityResponse>( this, METHODID_GET_IDENTITY))) - .addMethod( - getGetIdentitiesMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesRequest, - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesResponse>( - this, METHODID_GET_IDENTITIES))) .addMethod( getGetIdentityKeysMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( @@ -777,6 +846,27 @@ public void getEpochsInfo(org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochs org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest, org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysResponse>( this, METHODID_GET_IDENTITY_KEYS))) + .addMethod( + getGetIdentitiesContractKeysMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysRequest, + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysResponse>( + this, METHODID_GET_IDENTITIES_CONTRACT_KEYS))) + .addMethod( + getGetIdentityNonceMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceRequest, + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceResponse>( + this, METHODID_GET_IDENTITY_NONCE))) + .addMethod( + getGetIdentityContractNonceMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceRequest, + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceResponse>( + this, METHODID_GET_IDENTITY_CONTRACT_NONCE))) .addMethod( getGetIdentityBalanceMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( @@ -826,13 +916,6 @@ public void getEpochsInfo(org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochs org.dash.platform.dapi.v0.PlatformOuterClass.GetDocumentsRequest, org.dash.platform.dapi.v0.PlatformOuterClass.GetDocumentsResponse>( this, METHODID_GET_DOCUMENTS))) - .addMethod( - getGetIdentitiesByPublicKeyHashesMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesRequest, - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesResponse>( - this, METHODID_GET_IDENTITIES_BY_PUBLIC_KEY_HASHES))) .addMethod( getGetIdentityByPublicKeyHashMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( @@ -875,6 +958,13 @@ public void getEpochsInfo(org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochs org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochsInfoRequest, org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochsInfoResponse>( this, METHODID_GET_EPOCHS_INFO))) + .addMethod( + getGetPathElementsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsRequest, + org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsResponse>( + this, METHODID_GET_PATH_ELEMENTS))) .build(); } } @@ -911,18 +1001,34 @@ public void getIdentity(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentity /** */ - public void getIdentities(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesRequest request, - io.grpc.stub.StreamObserver responseObserver) { + public void getIdentityKeys(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest request, + io.grpc.stub.StreamObserver responseObserver) { io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getGetIdentitiesMethod(), getCallOptions()), request, responseObserver); + getChannel().newCall(getGetIdentityKeysMethod(), getCallOptions()), request, responseObserver); } /** */ - public void getIdentityKeys(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest request, - io.grpc.stub.StreamObserver responseObserver) { + public void getIdentitiesContractKeys(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysRequest request, + io.grpc.stub.StreamObserver responseObserver) { io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getGetIdentityKeysMethod(), getCallOptions()), request, responseObserver); + getChannel().newCall(getGetIdentitiesContractKeysMethod(), getCallOptions()), request, responseObserver); + } + + /** + */ + public void getIdentityNonce(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetIdentityNonceMethod(), getCallOptions()), request, responseObserver); + } + + /** + */ + public void getIdentityContractNonce(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetIdentityContractNonceMethod(), getCallOptions()), request, responseObserver); } /** @@ -981,14 +1087,6 @@ public void getDocuments(org.dash.platform.dapi.v0.PlatformOuterClass.GetDocumen getChannel().newCall(getGetDocumentsMethod(), getCallOptions()), request, responseObserver); } - /** - */ - public void getIdentitiesByPublicKeyHashes(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getGetIdentitiesByPublicKeyHashesMethod(), getCallOptions()), request, responseObserver); - } - /** */ public void getIdentityByPublicKeyHash(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityByPublicKeyHashRequest request, @@ -1036,6 +1134,14 @@ public void getEpochsInfo(org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochs io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getGetEpochsInfoMethod(), getCallOptions()), request, responseObserver); } + + /** + */ + public void getPathElements(org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetPathElementsMethod(), getCallOptions()), request, responseObserver); + } } /** @@ -1068,16 +1174,30 @@ public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityResponse getIdent /** */ - public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesResponse getIdentities(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesRequest request) { + public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysResponse getIdentityKeys(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest request) { return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getGetIdentitiesMethod(), getCallOptions(), request); + getChannel(), getGetIdentityKeysMethod(), getCallOptions(), request); } /** */ - public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysResponse getIdentityKeys(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest request) { + public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysResponse getIdentitiesContractKeys(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysRequest request) { return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getGetIdentityKeysMethod(), getCallOptions(), request); + getChannel(), getGetIdentitiesContractKeysMethod(), getCallOptions(), request); + } + + /** + */ + public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceResponse getIdentityNonce(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetIdentityNonceMethod(), getCallOptions(), request); + } + + /** + */ + public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceResponse getIdentityContractNonce(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetIdentityContractNonceMethod(), getCallOptions(), request); } /** @@ -1129,13 +1249,6 @@ public org.dash.platform.dapi.v0.PlatformOuterClass.GetDocumentsResponse getDocu getChannel(), getGetDocumentsMethod(), getCallOptions(), request); } - /** - */ - public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesResponse getIdentitiesByPublicKeyHashes(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getGetIdentitiesByPublicKeyHashesMethod(), getCallOptions(), request); - } - /** */ public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityByPublicKeyHashResponse getIdentityByPublicKeyHash(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityByPublicKeyHashRequest request) { @@ -1177,6 +1290,13 @@ public org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochsInfoResponse getEpo return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getGetEpochsInfoMethod(), getCallOptions(), request); } + + /** + */ + public org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsResponse getPathElements(org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetPathElementsMethod(), getCallOptions(), request); + } } /** @@ -1211,18 +1331,34 @@ public com.google.common.util.concurrent.ListenableFuture getIdentities( - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesRequest request) { + public com.google.common.util.concurrent.ListenableFuture getIdentityKeys( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest request) { return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getGetIdentitiesMethod(), getCallOptions()), request); + getChannel().newCall(getGetIdentityKeysMethod(), getCallOptions()), request); } /** */ - public com.google.common.util.concurrent.ListenableFuture getIdentityKeys( - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest request) { + public com.google.common.util.concurrent.ListenableFuture getIdentitiesContractKeys( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysRequest request) { return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getGetIdentityKeysMethod(), getCallOptions()), request); + getChannel().newCall(getGetIdentitiesContractKeysMethod(), getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture getIdentityNonce( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetIdentityNonceMethod(), getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture getIdentityContractNonce( + org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetIdentityContractNonceMethod(), getCallOptions()), request); } /** @@ -1281,14 +1417,6 @@ public com.google.common.util.concurrent.ListenableFuture getIdentitiesByPublicKeyHashes( - org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getGetIdentitiesByPublicKeyHashesMethod(), getCallOptions()), request); - } - /** */ public com.google.common.util.concurrent.ListenableFuture getIdentityByPublicKeyHash( @@ -1336,26 +1464,36 @@ public com.google.common.util.concurrent.ListenableFuture getPathElements( + org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetPathElementsMethod(), getCallOptions()), request); + } } private static final int METHODID_BROADCAST_STATE_TRANSITION = 0; private static final int METHODID_GET_IDENTITY = 1; - private static final int METHODID_GET_IDENTITIES = 2; - private static final int METHODID_GET_IDENTITY_KEYS = 3; - private static final int METHODID_GET_IDENTITY_BALANCE = 4; - private static final int METHODID_GET_IDENTITY_BALANCE_AND_REVISION = 5; - private static final int METHODID_GET_PROOFS = 6; - private static final int METHODID_GET_DATA_CONTRACT = 7; - private static final int METHODID_GET_DATA_CONTRACT_HISTORY = 8; - private static final int METHODID_GET_DATA_CONTRACTS = 9; - private static final int METHODID_GET_DOCUMENTS = 10; - private static final int METHODID_GET_IDENTITIES_BY_PUBLIC_KEY_HASHES = 11; - private static final int METHODID_GET_IDENTITY_BY_PUBLIC_KEY_HASH = 12; - private static final int METHODID_WAIT_FOR_STATE_TRANSITION_RESULT = 13; - private static final int METHODID_GET_CONSENSUS_PARAMS = 14; - private static final int METHODID_GET_PROTOCOL_VERSION_UPGRADE_STATE = 15; - private static final int METHODID_GET_PROTOCOL_VERSION_UPGRADE_VOTE_STATUS = 16; - private static final int METHODID_GET_EPOCHS_INFO = 17; + private static final int METHODID_GET_IDENTITY_KEYS = 2; + private static final int METHODID_GET_IDENTITIES_CONTRACT_KEYS = 3; + private static final int METHODID_GET_IDENTITY_NONCE = 4; + private static final int METHODID_GET_IDENTITY_CONTRACT_NONCE = 5; + private static final int METHODID_GET_IDENTITY_BALANCE = 6; + private static final int METHODID_GET_IDENTITY_BALANCE_AND_REVISION = 7; + private static final int METHODID_GET_PROOFS = 8; + private static final int METHODID_GET_DATA_CONTRACT = 9; + private static final int METHODID_GET_DATA_CONTRACT_HISTORY = 10; + private static final int METHODID_GET_DATA_CONTRACTS = 11; + private static final int METHODID_GET_DOCUMENTS = 12; + private static final int METHODID_GET_IDENTITY_BY_PUBLIC_KEY_HASH = 13; + private static final int METHODID_WAIT_FOR_STATE_TRANSITION_RESULT = 14; + private static final int METHODID_GET_CONSENSUS_PARAMS = 15; + private static final int METHODID_GET_PROTOCOL_VERSION_UPGRADE_STATE = 16; + private static final int METHODID_GET_PROTOCOL_VERSION_UPGRADE_VOTE_STATUS = 17; + private static final int METHODID_GET_EPOCHS_INFO = 18; + private static final int METHODID_GET_PATH_ELEMENTS = 19; private static final class MethodHandlers implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -1382,14 +1520,22 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv serviceImpl.getIdentity((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; - case METHODID_GET_IDENTITIES: - serviceImpl.getIdentities((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; case METHODID_GET_IDENTITY_KEYS: serviceImpl.getIdentityKeys((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityKeysRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_GET_IDENTITIES_CONTRACT_KEYS: + serviceImpl.getIdentitiesContractKeys((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesContractKeysRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_IDENTITY_NONCE: + serviceImpl.getIdentityNonce((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityNonceRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_IDENTITY_CONTRACT_NONCE: + serviceImpl.getIdentityContractNonce((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityContractNonceRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; case METHODID_GET_IDENTITY_BALANCE: serviceImpl.getIdentityBalance((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityBalanceRequest) request, (io.grpc.stub.StreamObserver) responseObserver); @@ -1418,10 +1564,6 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv serviceImpl.getDocuments((org.dash.platform.dapi.v0.PlatformOuterClass.GetDocumentsRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; - case METHODID_GET_IDENTITIES_BY_PUBLIC_KEY_HASHES: - serviceImpl.getIdentitiesByPublicKeyHashes((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesByPublicKeyHashesRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; case METHODID_GET_IDENTITY_BY_PUBLIC_KEY_HASH: serviceImpl.getIdentityByPublicKeyHash((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityByPublicKeyHashRequest) request, (io.grpc.stub.StreamObserver) responseObserver); @@ -1446,6 +1588,10 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv serviceImpl.getEpochsInfo((org.dash.platform.dapi.v0.PlatformOuterClass.GetEpochsInfoRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_GET_PATH_ELEMENTS: + serviceImpl.getPathElements((org.dash.platform.dapi.v0.PlatformOuterClass.GetPathElementsRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; default: throw new AssertionError(); } @@ -1509,8 +1655,10 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .setSchemaDescriptor(new PlatformFileDescriptorSupplier()) .addMethod(getBroadcastStateTransitionMethod()) .addMethod(getGetIdentityMethod()) - .addMethod(getGetIdentitiesMethod()) .addMethod(getGetIdentityKeysMethod()) + .addMethod(getGetIdentitiesContractKeysMethod()) + .addMethod(getGetIdentityNonceMethod()) + .addMethod(getGetIdentityContractNonceMethod()) .addMethod(getGetIdentityBalanceMethod()) .addMethod(getGetIdentityBalanceAndRevisionMethod()) .addMethod(getGetProofsMethod()) @@ -1518,13 +1666,13 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .addMethod(getGetDataContractHistoryMethod()) .addMethod(getGetDataContractsMethod()) .addMethod(getGetDocumentsMethod()) - .addMethod(getGetIdentitiesByPublicKeyHashesMethod()) .addMethod(getGetIdentityByPublicKeyHashMethod()) .addMethod(getWaitForStateTransitionResultMethod()) .addMethod(getGetConsensusParamsMethod()) .addMethod(getGetProtocolVersionUpgradeStateMethod()) .addMethod(getGetProtocolVersionUpgradeVoteStatusMethod()) .addMethod(getGetEpochsInfoMethod()) + .addMethod(getGetPathElementsMethod()) .build(); } } diff --git a/packages/dapi-grpc/clients/platform/v0/nodejs/PlatformPromiseClient.js b/packages/dapi-grpc/clients/platform/v0/nodejs/PlatformPromiseClient.js index 6f38579c6c5..d56eaf8f304 100644 --- a/packages/dapi-grpc/clients/platform/v0/nodejs/PlatformPromiseClient.js +++ b/packages/dapi-grpc/clients/platform/v0/nodejs/PlatformPromiseClient.js @@ -28,14 +28,16 @@ const { BroadcastStateTransitionResponse: PBJSBroadcastStateTransitionResponse, GetIdentityRequest: PBJSGetIdentityRequest, GetIdentityResponse: PBJSGetIdentityResponse, + GetIdentitiesContractKeysRequest: PBJSGetIdentitiesContractKeysRequest, + GetIdentitiesContractKeysResponse: PBJSGetIdentitiesContractKeysResponse, GetDataContractRequest: PBJSGetDataContractRequest, GetDataContractResponse: PBJSGetDataContractResponse, GetDataContractHistoryRequest: PBJSGetDataContractHistoryRequest, GetDataContractHistoryResponse: PBJSGetDataContractHistoryResponse, GetDocumentsRequest: PBJSGetDocumentsRequest, GetDocumentsResponse: PBJSGetDocumentsResponse, - GetIdentitiesByPublicKeyHashesRequest: PBJSGetIdentitiesByPublicKeyHashesRequest, - GetIdentitiesByPublicKeyHashesResponse: PBJSGetIdentitiesByPublicKeyHashesResponse, + GetIdentityByPublicKeyHashRequest: PBJSGetIdentityByPublicKeyHashRequest, + GetIdentityByPublicKeyHashResponse: PBJSGetIdentityByPublicKeyHashResponse, WaitForStateTransitionResultRequest: PBJSWaitForStateTransitionResultRequest, WaitForStateTransitionResultResponse: PBJSWaitForStateTransitionResultResponse, GetConsensusParamsRequest: PBJSGetConsensusParamsRequest, @@ -48,6 +50,14 @@ const { PBJSGetProtocolVersionUpgradeVoteStatusResponse, GetProtocolVersionUpgradeStateRequest: PBJSGetProtocolVersionUpgradeStateRequest, GetProtocolVersionUpgradeStateResponse: PBJSGetProtocolVersionUpgradeStateResponse, + GetProofsRequest: PBJSGetProofsRequest, + GetProofsResponse: PBJSGetProofsResponse, + GetIdentityContractNonceRequest: PBJSGetIdentityContractNonceRequest, + GetIdentityContractNonceResponse: PBJSGetIdentityContractNonceResponse, + GetIdentityNonceRequest: PBJSGetIdentityNonceRequest, + GetIdentityNonceResponse: PBJSGetIdentityNonceResponse, + GetIdentityKeysRequest: PBJSGetIdentityKeysRequest, + GetIdentityKeysResponse: PBJSGetIdentityKeysResponse, }, }, }, @@ -58,15 +68,20 @@ const { const { BroadcastStateTransitionResponse: ProtocBroadcastStateTransitionResponse, GetIdentityResponse: ProtocGetIdentityResponse, + GetIdentitiesContractKeysResponse: ProtocGetIdentitiesContractKeysResponse, GetDataContractResponse: ProtocGetDataContractResponse, GetDataContractHistoryResponse: ProtocGetDataContractHistoryResponse, GetDocumentsResponse: ProtocGetDocumentsResponse, - GetIdentitiesByPublicKeyHashesResponse: ProtocGetIdentitiesByPublicKeyHashesResponse, + GetIdentityByPublicKeyHashResponse: ProtocGetIdentityByPublicKeyHashResponse, WaitForStateTransitionResultResponse: ProtocWaitForStateTransitionResultResponse, GetConsensusParamsResponse: ProtocGetConsensusParamsResponse, GetEpochsInfoResponse: ProtocGetEpochsInfoResponse, GetProtocolVersionUpgradeVoteStatusResponse: ProtocGetProtocolVersionUpgradeVoteStatusResponse, GetProtocolVersionUpgradeStateResponse: ProtocGetProtocolVersionUpgradeStateResponse, + GetProofsResponse: ProtocGetProofsResponse, + GetIdentityContractNonceResponse: ProtocGetIdentityContractNonceResponse, + GetIdentityNonceResponse: ProtocGetIdentityNonceResponse, + GetIdentityKeysResponse: ProtocGetIdentityKeysResponse, } = require('./platform_protoc'); const getPlatformDefinition = require('../../../../lib/getPlatformDefinition'); @@ -101,6 +116,10 @@ class PlatformPromiseClient { this.client.getIdentity.bind(this.client), ); + this.client.getIdentitiesContractKeys = promisify( + this.client.getIdentitiesContractKeys.bind(this.client), + ); + this.client.getDataContract = promisify( this.client.getDataContract.bind(this.client), ); @@ -113,8 +132,8 @@ class PlatformPromiseClient { this.client.getDocuments.bind(this.client), ); - this.client.getIdentitiesByPublicKeyHashes = promisify( - this.client.getIdentitiesByPublicKeyHashes.bind(this.client), + this.client.getIdentityByPublicKeyHash = promisify( + this.client.getIdentityByPublicKeyHash.bind(this.client), ); this.client.waitForStateTransitionResult = promisify( @@ -137,6 +156,22 @@ class PlatformPromiseClient { this.client.getProtocolVersionUpgradeState.bind(this.client), ); + this.client.getProofs = promisify( + this.client.getProofs.bind(this.client), + ); + + this.client.getIdentityContractNonce = promisify( + this.client.getIdentityContractNonce.bind(this.client), + ); + + this.client.getIdentityNonce = promisify( + this.client.getIdentityNonce.bind(this.client), + ); + + this.client.getIdentityKeys = promisify( + this.client.getIdentityKeys.bind(this.client), + ); + this.protocolVersion = undefined; } @@ -202,6 +237,40 @@ class PlatformPromiseClient { ); } + /** + * @param {!GetIdentitiesContractKeysRequest} getIdentitiesContractKeysRequest + * @param {?Object} metadata + * @param {CallOptions} [options={}] + * @returns {Promise} + */ + getIdentitiesContractKeys( + getIdentitiesContractKeysRequest, + metadata = {}, + options = {}, + ) { + if (!isObject(metadata)) { + throw new Error('metadata must be an object'); + } + return this.client.getIdentitiesContractKeys( + getIdentitiesContractKeysRequest, + convertObjectToMetadata(metadata), + { + interceptors: [ + jsonToProtobufInterceptorFactory( + jsonToProtobufFactory( + ProtocGetIdentitiesContractKeysResponse, + PBJSGetIdentitiesContractKeysResponse, + ), + protobufToJsonFactory( + PBJSGetIdentitiesContractKeysRequest, + ), + ), + ], + ...options, + }, + ); + } + /** * * @param {!GetDataContractRequest} getDataContractRequest @@ -299,13 +368,13 @@ class PlatformPromiseClient { } /** - * @param {!GetIdentitiesByPublicKeyHashesRequest} getIdentitiesByPublicKeyHashesRequest + * @param {!GetIdentityByPublicKeyHashRequest} getIdentityByPublicKeyHashRequest * @param {?Object} metadata * @param {CallOptions} [options={}] - * @returns {Promise} + * @returns {Promise} */ - getIdentitiesByPublicKeyHashes( - getIdentitiesByPublicKeyHashesRequest, + getIdentityByPublicKeyHash( + getIdentityByPublicKeyHashRequest, metadata = {}, options = {}, ) { @@ -313,18 +382,18 @@ class PlatformPromiseClient { throw new Error('metadata must be an object'); } - return this.client.getIdentitiesByPublicKeyHashes( - getIdentitiesByPublicKeyHashesRequest, + return this.client.getIdentityByPublicKeyHash( + getIdentityByPublicKeyHashRequest, convertObjectToMetadata(metadata), { interceptors: [ jsonToProtobufInterceptorFactory( jsonToProtobufFactory( - ProtocGetIdentitiesByPublicKeyHashesResponse, - PBJSGetIdentitiesByPublicKeyHashesResponse, + ProtocGetIdentityByPublicKeyHashResponse, + PBJSGetIdentityByPublicKeyHashResponse, ), protobufToJsonFactory( - PBJSGetIdentitiesByPublicKeyHashesRequest, + PBJSGetIdentityByPublicKeyHashRequest, ), ), ], @@ -496,6 +565,131 @@ class PlatformPromiseClient { ); } + /** + * + * @param {!GetProofsRequest} request + * @param {?Object} metadata + * @param {CallOptions} [options={}] + * @returns {Promise} + */ + getProofs(request, metadata = {}, options = {}) { + if (!isObject(metadata)) { + throw new Error('metadata must be an object'); + } + + return this.client.getProofs( + request, + convertObjectToMetadata(metadata), + { + interceptors: [ + jsonToProtobufInterceptorFactory( + jsonToProtobufFactory( + ProtocGetProofsResponse, + PBJSGetProofsResponse, + ), + protobufToJsonFactory( + PBJSGetProofsRequest, + ), + ), + ], + ...options, + }, + ); + } + + /** + * @param {!PBJSGetIdentityContractNonceRequest} getIdentityContractNonceRequest + * @param {?Object} metadata + * @param {CallOptions} [options={}] + * @return {Promise} + */ + getIdentityContractNonce( + getIdentityContractNonceRequest, + metadata = {}, + options = {}, + ) { + if (!isObject(metadata)) { + throw new Error('metadata must be an object'); + } + + return this.client.getIdentityContractNonce( + getIdentityContractNonceRequest, + convertObjectToMetadata(metadata), + { + interceptors: [ + jsonToProtobufInterceptorFactory( + jsonToProtobufFactory( + ProtocGetIdentityContractNonceResponse, + PBJSGetIdentityContractNonceResponse, + ), + protobufToJsonFactory( + PBJSGetIdentityContractNonceRequest, + ), + ), + ], + ...options, + }, + ); + } + + getIdentityNonce( + getIdentityNonceRequest, + metadata = {}, + options = {}, + ) { + if (!isObject(metadata)) { + throw new Error('metadata must be an object'); + } + + return this.client.getIdentityNonce( + getIdentityNonceRequest, + convertObjectToMetadata(metadata), + { + interceptors: [ + jsonToProtobufInterceptorFactory( + jsonToProtobufFactory( + ProtocGetIdentityNonceResponse, + PBJSGetIdentityNonceResponse, + ), + protobufToJsonFactory( + PBJSGetIdentityNonceRequest, + ), + ), + ], + ...options, + }, + ); + } + + getIdentityKeys( + getIdentityKeysRequest, + metadata = {}, + options = {}, + ) { + if (!isObject(metadata)) { + throw new Error('metadata must be an object'); + } + + return this.client.getIdentityKeys( + getIdentityKeysRequest, + convertObjectToMetadata(metadata), + { + interceptors: [ + jsonToProtobufInterceptorFactory( + jsonToProtobufFactory( + ProtocGetIdentityKeysResponse, + PBJSGetIdentityKeysResponse, + ), + protobufToJsonFactory( + PBJSGetIdentityKeysRequest, + ), + ), + ], + ...options, + }, + ); + } + /** * @param {string} protocolVersion */ diff --git a/packages/dapi-grpc/clients/platform/v0/nodejs/platform_pbjs.js b/packages/dapi-grpc/clients/platform/v0/nodejs/platform_pbjs.js index f1dafcc9299..7cc9498b9ee 100644 --- a/packages/dapi-grpc/clients/platform/v0/nodejs/platform_pbjs.js +++ b/packages/dapi-grpc/clients/platform/v0/nodejs/platform_pbjs.js @@ -153,68 +153,134 @@ $root.org = (function() { */ /** - * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getIdentities}. + * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getIdentityKeys}. * @memberof org.dash.platform.dapi.v0.Platform - * @typedef getIdentitiesCallback + * @typedef getIdentityKeysCallback * @type {function} * @param {Error|null} error Error, if any - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse} [response] GetIdentitiesResponse + * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse} [response] GetIdentityKeysResponse */ /** - * Calls getIdentities. - * @function getIdentities + * Calls getIdentityKeys. + * @function getIdentityKeys * @memberof org.dash.platform.dapi.v0.Platform * @instance - * @param {org.dash.platform.dapi.v0.IGetIdentitiesRequest} request GetIdentitiesRequest message or plain object - * @param {org.dash.platform.dapi.v0.Platform.getIdentitiesCallback} callback Node-style callback called with the error, if any, and GetIdentitiesResponse + * @param {org.dash.platform.dapi.v0.IGetIdentityKeysRequest} request GetIdentityKeysRequest message or plain object + * @param {org.dash.platform.dapi.v0.Platform.getIdentityKeysCallback} callback Node-style callback called with the error, if any, and GetIdentityKeysResponse * @returns {undefined} * @variation 1 */ - Object.defineProperty(Platform.prototype.getIdentities = function getIdentities(request, callback) { - return this.rpcCall(getIdentities, $root.org.dash.platform.dapi.v0.GetIdentitiesRequest, $root.org.dash.platform.dapi.v0.GetIdentitiesResponse, request, callback); - }, "name", { value: "getIdentities" }); + Object.defineProperty(Platform.prototype.getIdentityKeys = function getIdentityKeys(request, callback) { + return this.rpcCall(getIdentityKeys, $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest, $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse, request, callback); + }, "name", { value: "getIdentityKeys" }); /** - * Calls getIdentities. - * @function getIdentities + * Calls getIdentityKeys. + * @function getIdentityKeys * @memberof org.dash.platform.dapi.v0.Platform * @instance - * @param {org.dash.platform.dapi.v0.IGetIdentitiesRequest} request GetIdentitiesRequest message or plain object - * @returns {Promise} Promise + * @param {org.dash.platform.dapi.v0.IGetIdentityKeysRequest} request GetIdentityKeysRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getIdentityKeys}. + * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getIdentitiesContractKeys}. * @memberof org.dash.platform.dapi.v0.Platform - * @typedef getIdentityKeysCallback + * @typedef getIdentitiesContractKeysCallback * @type {function} * @param {Error|null} error Error, if any - * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse} [response] GetIdentityKeysResponse + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} [response] GetIdentitiesContractKeysResponse */ /** - * Calls getIdentityKeys. - * @function getIdentityKeys + * Calls getIdentitiesContractKeys. + * @function getIdentitiesContractKeys * @memberof org.dash.platform.dapi.v0.Platform * @instance - * @param {org.dash.platform.dapi.v0.IGetIdentityKeysRequest} request GetIdentityKeysRequest message or plain object - * @param {org.dash.platform.dapi.v0.Platform.getIdentityKeysCallback} callback Node-style callback called with the error, if any, and GetIdentityKeysResponse + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysRequest} request GetIdentitiesContractKeysRequest message or plain object + * @param {org.dash.platform.dapi.v0.Platform.getIdentitiesContractKeysCallback} callback Node-style callback called with the error, if any, and GetIdentitiesContractKeysResponse * @returns {undefined} * @variation 1 */ - Object.defineProperty(Platform.prototype.getIdentityKeys = function getIdentityKeys(request, callback) { - return this.rpcCall(getIdentityKeys, $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest, $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse, request, callback); - }, "name", { value: "getIdentityKeys" }); + Object.defineProperty(Platform.prototype.getIdentitiesContractKeys = function getIdentitiesContractKeys(request, callback) { + return this.rpcCall(getIdentitiesContractKeys, $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest, $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse, request, callback); + }, "name", { value: "getIdentitiesContractKeys" }); /** - * Calls getIdentityKeys. - * @function getIdentityKeys + * Calls getIdentitiesContractKeys. + * @function getIdentitiesContractKeys * @memberof org.dash.platform.dapi.v0.Platform * @instance - * @param {org.dash.platform.dapi.v0.IGetIdentityKeysRequest} request GetIdentityKeysRequest message or plain object - * @returns {Promise} Promise + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysRequest} request GetIdentitiesContractKeysRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getIdentityNonce}. + * @memberof org.dash.platform.dapi.v0.Platform + * @typedef getIdentityNonceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.GetIdentityNonceResponse} [response] GetIdentityNonceResponse + */ + + /** + * Calls getIdentityNonce. + * @function getIdentityNonce + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceRequest} request GetIdentityNonceRequest message or plain object + * @param {org.dash.platform.dapi.v0.Platform.getIdentityNonceCallback} callback Node-style callback called with the error, if any, and GetIdentityNonceResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Platform.prototype.getIdentityNonce = function getIdentityNonce(request, callback) { + return this.rpcCall(getIdentityNonce, $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest, $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse, request, callback); + }, "name", { value: "getIdentityNonce" }); + + /** + * Calls getIdentityNonce. + * @function getIdentityNonce + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceRequest} request GetIdentityNonceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getIdentityContractNonce}. + * @memberof org.dash.platform.dapi.v0.Platform + * @typedef getIdentityContractNonceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} [response] GetIdentityContractNonceResponse + */ + + /** + * Calls getIdentityContractNonce. + * @function getIdentityContractNonce + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceRequest} request GetIdentityContractNonceRequest message or plain object + * @param {org.dash.platform.dapi.v0.Platform.getIdentityContractNonceCallback} callback Node-style callback called with the error, if any, and GetIdentityContractNonceResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Platform.prototype.getIdentityContractNonce = function getIdentityContractNonce(request, callback) { + return this.rpcCall(getIdentityContractNonce, $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest, $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse, request, callback); + }, "name", { value: "getIdentityContractNonce" }); + + /** + * Calls getIdentityContractNonce. + * @function getIdentityContractNonce + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceRequest} request GetIdentityContractNonceRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ @@ -449,39 +515,6 @@ $root.org = (function() { * @variation 2 */ - /** - * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getIdentitiesByPublicKeyHashes}. - * @memberof org.dash.platform.dapi.v0.Platform - * @typedef getIdentitiesByPublicKeyHashesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} [response] GetIdentitiesByPublicKeyHashesResponse - */ - - /** - * Calls getIdentitiesByPublicKeyHashes. - * @function getIdentitiesByPublicKeyHashes - * @memberof org.dash.platform.dapi.v0.Platform - * @instance - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesRequest} request GetIdentitiesByPublicKeyHashesRequest message or plain object - * @param {org.dash.platform.dapi.v0.Platform.getIdentitiesByPublicKeyHashesCallback} callback Node-style callback called with the error, if any, and GetIdentitiesByPublicKeyHashesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Platform.prototype.getIdentitiesByPublicKeyHashes = function getIdentitiesByPublicKeyHashes(request, callback) { - return this.rpcCall(getIdentitiesByPublicKeyHashes, $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest, $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse, request, callback); - }, "name", { value: "getIdentitiesByPublicKeyHashes" }); - - /** - * Calls getIdentitiesByPublicKeyHashes. - * @function getIdentitiesByPublicKeyHashes - * @memberof org.dash.platform.dapi.v0.Platform - * @instance - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesRequest} request GetIdentitiesByPublicKeyHashesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - /** * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getIdentityByPublicKeyHash}. * @memberof org.dash.platform.dapi.v0.Platform @@ -680,6 +713,39 @@ $root.org = (function() { * @variation 2 */ + /** + * Callback as used by {@link org.dash.platform.dapi.v0.Platform#getPathElements}. + * @memberof org.dash.platform.dapi.v0.Platform + * @typedef getPathElementsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse} [response] GetPathElementsResponse + */ + + /** + * Calls getPathElements. + * @function getPathElements + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetPathElementsRequest} request GetPathElementsRequest message or plain object + * @param {org.dash.platform.dapi.v0.Platform.getPathElementsCallback} callback Node-style callback called with the error, if any, and GetPathElementsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Platform.prototype.getPathElements = function getPathElements(request, callback) { + return this.rpcCall(getPathElements, $root.org.dash.platform.dapi.v0.GetPathElementsRequest, $root.org.dash.platform.dapi.v0.GetPathElementsResponse, request, callback); + }, "name", { value: "getPathElements" }); + + /** + * Calls getPathElements. + * @function getPathElements + * @memberof org.dash.platform.dapi.v0.Platform + * @instance + * @param {org.dash.platform.dapi.v0.IGetPathElementsRequest} request GetPathElementsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return Platform; })(); @@ -1584,6 +1650,26 @@ $root.org = (function() { return StateTransitionBroadcastError; })(); + /** + * KeyPurpose enum. + * @name org.dash.platform.dapi.v0.KeyPurpose + * @enum {number} + * @property {number} AUTHENTICATION=0 AUTHENTICATION value + * @property {number} ENCRYPTION=1 ENCRYPTION value + * @property {number} DECRYPTION=2 DECRYPTION value + * @property {number} TRANSFER=3 TRANSFER value + * @property {number} VOTING=5 VOTING value + */ + v0.KeyPurpose = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AUTHENTICATION"] = 0; + values[valuesById[1] = "ENCRYPTION"] = 1; + values[valuesById[2] = "DECRYPTION"] = 2; + values[valuesById[3] = "TRANSFER"] = 3; + values[valuesById[5] = "VOTING"] = 5; + return values; + })(); + v0.BroadcastStateTransitionRequest = (function() { /** @@ -2370,24 +2456,24 @@ $root.org = (function() { return GetIdentityRequest; })(); - v0.GetIdentityBalanceRequest = (function() { + v0.GetIdentityNonceRequest = (function() { /** - * Properties of a GetIdentityBalanceRequest. + * Properties of a GetIdentityNonceRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentityBalanceRequest - * @property {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0|null} [v0] GetIdentityBalanceRequest v0 + * @interface IGetIdentityNonceRequest + * @property {org.dash.platform.dapi.v0.GetIdentityNonceRequest.IGetIdentityNonceRequestV0|null} [v0] GetIdentityNonceRequest v0 */ /** - * Constructs a new GetIdentityBalanceRequest. + * Constructs a new GetIdentityNonceRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentityBalanceRequest. - * @implements IGetIdentityBalanceRequest + * @classdesc Represents a GetIdentityNonceRequest. + * @implements IGetIdentityNonceRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceRequest=} [properties] Properties to set */ - function GetIdentityBalanceRequest(properties) { + function GetIdentityNonceRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2395,89 +2481,89 @@ $root.org = (function() { } /** - * GetIdentityBalanceRequest v0. - * @member {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * GetIdentityNonceRequest v0. + * @member {org.dash.platform.dapi.v0.GetIdentityNonceRequest.IGetIdentityNonceRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @instance */ - GetIdentityBalanceRequest.prototype.v0 = null; + GetIdentityNonceRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentityBalanceRequest version. + * GetIdentityNonceRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @instance */ - Object.defineProperty(GetIdentityBalanceRequest.prototype, "version", { + Object.defineProperty(GetIdentityNonceRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentityBalanceRequest instance using the specified properties. + * Creates a new GetIdentityNonceRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} GetIdentityBalanceRequest instance + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceRequest} GetIdentityNonceRequest instance */ - GetIdentityBalanceRequest.create = function create(properties) { - return new GetIdentityBalanceRequest(properties); + GetIdentityNonceRequest.create = function create(properties) { + return new GetIdentityNonceRequest(properties); }; /** - * Encodes the specified GetIdentityBalanceRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceRequest.verify|verify} messages. + * Encodes the specified GetIdentityNonceRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityNonceRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceRequest} message GetIdentityBalanceRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceRequest} message GetIdentityNonceRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceRequest.encode = function encode(message, writer) { + GetIdentityNonceRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentityBalanceRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceRequest.verify|verify} messages. + * Encodes the specified GetIdentityNonceRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityNonceRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceRequest} message GetIdentityBalanceRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceRequest} message GetIdentityNonceRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityNonceRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityBalanceRequest message from the specified reader or buffer. + * Decodes a GetIdentityNonceRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} GetIdentityBalanceRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceRequest} GetIdentityNonceRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceRequest.decode = function decode(reader, length) { + GetIdentityNonceRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -2488,37 +2574,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityBalanceRequest message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityNonceRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} GetIdentityBalanceRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceRequest} GetIdentityNonceRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceRequest.decodeDelimited = function decodeDelimited(reader) { + GetIdentityNonceRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityBalanceRequest message. + * Verifies a GetIdentityNonceRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityBalanceRequest.verify = function verify(message) { + GetIdentityNonceRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -2527,40 +2613,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentityBalanceRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityNonceRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} GetIdentityBalanceRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceRequest} GetIdentityNonceRequest */ - GetIdentityBalanceRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest) + GetIdentityNonceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityNonceRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentityBalanceRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityNonceRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} message GetIdentityBalanceRequest + * @param {org.dash.platform.dapi.v0.GetIdentityNonceRequest} message GetIdentityNonceRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityBalanceRequest.toObject = function toObject(message, options) { + GetIdentityNonceRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -2568,35 +2654,35 @@ $root.org = (function() { }; /** - * Converts this GetIdentityBalanceRequest to JSON. + * Converts this GetIdentityNonceRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest * @instance * @returns {Object.} JSON object */ - GetIdentityBalanceRequest.prototype.toJSON = function toJSON() { + GetIdentityNonceRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 = (function() { + GetIdentityNonceRequest.GetIdentityNonceRequestV0 = (function() { /** - * Properties of a GetIdentityBalanceRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest - * @interface IGetIdentityBalanceRequestV0 - * @property {Uint8Array|null} [id] GetIdentityBalanceRequestV0 id - * @property {boolean|null} [prove] GetIdentityBalanceRequestV0 prove + * Properties of a GetIdentityNonceRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest + * @interface IGetIdentityNonceRequestV0 + * @property {Uint8Array|null} [identityId] GetIdentityNonceRequestV0 identityId + * @property {boolean|null} [prove] GetIdentityNonceRequestV0 prove */ /** - * Constructs a new GetIdentityBalanceRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest - * @classdesc Represents a GetIdentityBalanceRequestV0. - * @implements IGetIdentityBalanceRequestV0 + * Constructs a new GetIdentityNonceRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest + * @classdesc Represents a GetIdentityNonceRequestV0. + * @implements IGetIdentityNonceRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentityNonceRequest.IGetIdentityNonceRequestV0=} [properties] Properties to set */ - function GetIdentityBalanceRequestV0(properties) { + function GetIdentityNonceRequestV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2604,85 +2690,85 @@ $root.org = (function() { } /** - * GetIdentityBalanceRequestV0 id. - * @member {Uint8Array} id - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * GetIdentityNonceRequestV0 identityId. + * @member {Uint8Array} identityId + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @instance */ - GetIdentityBalanceRequestV0.prototype.id = $util.newBuffer([]); + GetIdentityNonceRequestV0.prototype.identityId = $util.newBuffer([]); /** - * GetIdentityBalanceRequestV0 prove. + * GetIdentityNonceRequestV0 prove. * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @instance */ - GetIdentityBalanceRequestV0.prototype.prove = false; + GetIdentityNonceRequestV0.prototype.prove = false; /** - * Creates a new GetIdentityBalanceRequestV0 instance using the specified properties. + * Creates a new GetIdentityNonceRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} GetIdentityBalanceRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetIdentityNonceRequest.IGetIdentityNonceRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} GetIdentityNonceRequestV0 instance */ - GetIdentityBalanceRequestV0.create = function create(properties) { - return new GetIdentityBalanceRequestV0(properties); + GetIdentityNonceRequestV0.create = function create(properties) { + return new GetIdentityNonceRequestV0(properties); }; /** - * Encodes the specified GetIdentityBalanceRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.verify|verify} messages. + * Encodes the specified GetIdentityNonceRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0} message GetIdentityBalanceRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityNonceRequest.IGetIdentityNonceRequestV0} message GetIdentityNonceRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceRequestV0.encode = function encode(message, writer) { + GetIdentityNonceRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.id); + if (message.identityId != null && Object.hasOwnProperty.call(message, "identityId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identityId); if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); return writer; }; /** - * Encodes the specified GetIdentityBalanceRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.verify|verify} messages. + * Encodes the specified GetIdentityNonceRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0} message GetIdentityBalanceRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityNonceRequest.IGetIdentityNonceRequestV0} message GetIdentityNonceRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityNonceRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityBalanceRequestV0 message from the specified reader or buffer. + * Decodes a GetIdentityNonceRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} GetIdentityBalanceRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} GetIdentityNonceRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceRequestV0.decode = function decode(reader, length) { + GetIdentityNonceRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.id = reader.bytes(); + message.identityId = reader.bytes(); break; case 2: message.prove = reader.bool(); @@ -2696,35 +2782,35 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityBalanceRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityNonceRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} GetIdentityBalanceRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} GetIdentityNonceRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetIdentityNonceRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityBalanceRequestV0 message. + * Verifies a GetIdentityNonceRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityBalanceRequestV0.verify = function verify(message) { + GetIdentityNonceRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!(message.id && typeof message.id.length === "number" || $util.isString(message.id))) - return "id: buffer expected"; + if (message.identityId != null && message.hasOwnProperty("identityId")) + if (!(message.identityId && typeof message.identityId.length === "number" || $util.isString(message.identityId))) + return "identityId: buffer expected"; if (message.prove != null && message.hasOwnProperty("prove")) if (typeof message.prove !== "boolean") return "prove: boolean expected"; @@ -2732,92 +2818,92 @@ $root.org = (function() { }; /** - * Creates a GetIdentityBalanceRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityNonceRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} GetIdentityBalanceRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} GetIdentityNonceRequestV0 */ - GetIdentityBalanceRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0) + GetIdentityNonceRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0(); - if (object.id != null) - if (typeof object.id === "string") - $util.base64.decode(object.id, message.id = $util.newBuffer($util.base64.length(object.id)), 0); - else if (object.id.length >= 0) - message.id = object.id; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0(); + if (object.identityId != null) + if (typeof object.identityId === "string") + $util.base64.decode(object.identityId, message.identityId = $util.newBuffer($util.base64.length(object.identityId)), 0); + else if (object.identityId.length >= 0) + message.identityId = object.identityId; if (object.prove != null) message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetIdentityBalanceRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityNonceRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} message GetIdentityBalanceRequestV0 + * @param {org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} message GetIdentityNonceRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityBalanceRequestV0.toObject = function toObject(message, options) { + GetIdentityNonceRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { if (options.bytes === String) - object.id = ""; + object.identityId = ""; else { - object.id = []; + object.identityId = []; if (options.bytes !== Array) - object.id = $util.newBuffer(object.id); + object.identityId = $util.newBuffer(object.identityId); } object.prove = false; } - if (message.id != null && message.hasOwnProperty("id")) - object.id = options.bytes === String ? $util.base64.encode(message.id, 0, message.id.length) : options.bytes === Array ? Array.prototype.slice.call(message.id) : message.id; - if (message.prove != null && message.hasOwnProperty("prove")) + if (message.identityId != null && message.hasOwnProperty("identityId")) + object.identityId = options.bytes === String ? $util.base64.encode(message.identityId, 0, message.identityId.length) : options.bytes === Array ? Array.prototype.slice.call(message.identityId) : message.identityId; + if (message.prove != null && message.hasOwnProperty("prove")) object.prove = message.prove; return object; }; /** - * Converts this GetIdentityBalanceRequestV0 to JSON. + * Converts this GetIdentityNonceRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 * @instance * @returns {Object.} JSON object */ - GetIdentityBalanceRequestV0.prototype.toJSON = function toJSON() { + GetIdentityNonceRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetIdentityBalanceRequestV0; + return GetIdentityNonceRequestV0; })(); - return GetIdentityBalanceRequest; + return GetIdentityNonceRequest; })(); - v0.GetIdentityBalanceAndRevisionRequest = (function() { + v0.GetIdentityContractNonceRequest = (function() { /** - * Properties of a GetIdentityBalanceAndRevisionRequest. + * Properties of a GetIdentityContractNonceRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentityBalanceAndRevisionRequest - * @property {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0|null} [v0] GetIdentityBalanceAndRevisionRequest v0 + * @interface IGetIdentityContractNonceRequest + * @property {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.IGetIdentityContractNonceRequestV0|null} [v0] GetIdentityContractNonceRequest v0 */ /** - * Constructs a new GetIdentityBalanceAndRevisionRequest. + * Constructs a new GetIdentityContractNonceRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentityBalanceAndRevisionRequest. - * @implements IGetIdentityBalanceAndRevisionRequest + * @classdesc Represents a GetIdentityContractNonceRequest. + * @implements IGetIdentityContractNonceRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceRequest=} [properties] Properties to set */ - function GetIdentityBalanceAndRevisionRequest(properties) { + function GetIdentityContractNonceRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2825,89 +2911,89 @@ $root.org = (function() { } /** - * GetIdentityBalanceAndRevisionRequest v0. - * @member {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * GetIdentityContractNonceRequest v0. + * @member {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.IGetIdentityContractNonceRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @instance */ - GetIdentityBalanceAndRevisionRequest.prototype.v0 = null; + GetIdentityContractNonceRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentityBalanceAndRevisionRequest version. + * GetIdentityContractNonceRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @instance */ - Object.defineProperty(GetIdentityBalanceAndRevisionRequest.prototype, "version", { + Object.defineProperty(GetIdentityContractNonceRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentityBalanceAndRevisionRequest instance using the specified properties. + * Creates a new GetIdentityContractNonceRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} GetIdentityBalanceAndRevisionRequest instance + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} GetIdentityContractNonceRequest instance */ - GetIdentityBalanceAndRevisionRequest.create = function create(properties) { - return new GetIdentityBalanceAndRevisionRequest(properties); + GetIdentityContractNonceRequest.create = function create(properties) { + return new GetIdentityContractNonceRequest(properties); }; /** - * Encodes the specified GetIdentityBalanceAndRevisionRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.verify|verify} messages. + * Encodes the specified GetIdentityContractNonceRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionRequest} message GetIdentityBalanceAndRevisionRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceRequest} message GetIdentityContractNonceRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceAndRevisionRequest.encode = function encode(message, writer) { + GetIdentityContractNonceRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentityBalanceAndRevisionRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.verify|verify} messages. + * Encodes the specified GetIdentityContractNonceRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionRequest} message GetIdentityBalanceAndRevisionRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceRequest} message GetIdentityContractNonceRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceAndRevisionRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityContractNonceRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityBalanceAndRevisionRequest message from the specified reader or buffer. + * Decodes a GetIdentityContractNonceRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} GetIdentityBalanceAndRevisionRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} GetIdentityContractNonceRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceAndRevisionRequest.decode = function decode(reader, length) { + GetIdentityContractNonceRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -2918,37 +3004,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityBalanceAndRevisionRequest message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityContractNonceRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} GetIdentityBalanceAndRevisionRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} GetIdentityContractNonceRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceAndRevisionRequest.decodeDelimited = function decodeDelimited(reader) { + GetIdentityContractNonceRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityBalanceAndRevisionRequest message. + * Verifies a GetIdentityContractNonceRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityBalanceAndRevisionRequest.verify = function verify(message) { + GetIdentityContractNonceRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -2957,40 +3043,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentityBalanceAndRevisionRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityContractNonceRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} GetIdentityBalanceAndRevisionRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} GetIdentityContractNonceRequest */ - GetIdentityBalanceAndRevisionRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest) + GetIdentityContractNonceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentityBalanceAndRevisionRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityContractNonceRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} message GetIdentityBalanceAndRevisionRequest + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} message GetIdentityContractNonceRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityBalanceAndRevisionRequest.toObject = function toObject(message, options) { + GetIdentityContractNonceRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -2998,35 +3084,36 @@ $root.org = (function() { }; /** - * Converts this GetIdentityBalanceAndRevisionRequest to JSON. + * Converts this GetIdentityContractNonceRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest * @instance * @returns {Object.} JSON object */ - GetIdentityBalanceAndRevisionRequest.prototype.toJSON = function toJSON() { + GetIdentityContractNonceRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 = (function() { + GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 = (function() { /** - * Properties of a GetIdentityBalanceAndRevisionRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest - * @interface IGetIdentityBalanceAndRevisionRequestV0 - * @property {Uint8Array|null} [id] GetIdentityBalanceAndRevisionRequestV0 id - * @property {boolean|null} [prove] GetIdentityBalanceAndRevisionRequestV0 prove + * Properties of a GetIdentityContractNonceRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest + * @interface IGetIdentityContractNonceRequestV0 + * @property {Uint8Array|null} [identityId] GetIdentityContractNonceRequestV0 identityId + * @property {Uint8Array|null} [contractId] GetIdentityContractNonceRequestV0 contractId + * @property {boolean|null} [prove] GetIdentityContractNonceRequestV0 prove */ /** - * Constructs a new GetIdentityBalanceAndRevisionRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest - * @classdesc Represents a GetIdentityBalanceAndRevisionRequestV0. - * @implements IGetIdentityBalanceAndRevisionRequestV0 + * Constructs a new GetIdentityContractNonceRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest + * @classdesc Represents a GetIdentityContractNonceRequestV0. + * @implements IGetIdentityContractNonceRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.IGetIdentityContractNonceRequestV0=} [properties] Properties to set */ - function GetIdentityBalanceAndRevisionRequestV0(properties) { + function GetIdentityContractNonceRequestV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3034,87 +3121,100 @@ $root.org = (function() { } /** - * GetIdentityBalanceAndRevisionRequestV0 id. - * @member {Uint8Array} id - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * GetIdentityContractNonceRequestV0 identityId. + * @member {Uint8Array} identityId + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @instance */ - GetIdentityBalanceAndRevisionRequestV0.prototype.id = $util.newBuffer([]); + GetIdentityContractNonceRequestV0.prototype.identityId = $util.newBuffer([]); /** - * GetIdentityBalanceAndRevisionRequestV0 prove. + * GetIdentityContractNonceRequestV0 contractId. + * @member {Uint8Array} contractId + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 + * @instance + */ + GetIdentityContractNonceRequestV0.prototype.contractId = $util.newBuffer([]); + + /** + * GetIdentityContractNonceRequestV0 prove. * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @instance */ - GetIdentityBalanceAndRevisionRequestV0.prototype.prove = false; + GetIdentityContractNonceRequestV0.prototype.prove = false; /** - * Creates a new GetIdentityBalanceAndRevisionRequestV0 instance using the specified properties. + * Creates a new GetIdentityContractNonceRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} GetIdentityBalanceAndRevisionRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.IGetIdentityContractNonceRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} GetIdentityContractNonceRequestV0 instance */ - GetIdentityBalanceAndRevisionRequestV0.create = function create(properties) { - return new GetIdentityBalanceAndRevisionRequestV0(properties); + GetIdentityContractNonceRequestV0.create = function create(properties) { + return new GetIdentityContractNonceRequestV0(properties); }; /** - * Encodes the specified GetIdentityBalanceAndRevisionRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.verify|verify} messages. + * Encodes the specified GetIdentityContractNonceRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0} message GetIdentityBalanceAndRevisionRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.IGetIdentityContractNonceRequestV0} message GetIdentityContractNonceRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceAndRevisionRequestV0.encode = function encode(message, writer) { + GetIdentityContractNonceRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.id); + if (message.identityId != null && Object.hasOwnProperty.call(message, "identityId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identityId); + if (message.contractId != null && Object.hasOwnProperty.call(message, "contractId")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.contractId); if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.prove); return writer; }; /** - * Encodes the specified GetIdentityBalanceAndRevisionRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.verify|verify} messages. + * Encodes the specified GetIdentityContractNonceRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0} message GetIdentityBalanceAndRevisionRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.IGetIdentityContractNonceRequestV0} message GetIdentityContractNonceRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceAndRevisionRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityContractNonceRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityBalanceAndRevisionRequestV0 message from the specified reader or buffer. + * Decodes a GetIdentityContractNonceRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} GetIdentityBalanceAndRevisionRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} GetIdentityContractNonceRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceAndRevisionRequestV0.decode = function decode(reader, length) { + GetIdentityContractNonceRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.id = reader.bytes(); + message.identityId = reader.bytes(); break; case 2: + message.contractId = reader.bytes(); + break; + case 3: message.prove = reader.bool(); break; default: @@ -3126,35 +3226,38 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityBalanceAndRevisionRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityContractNonceRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} GetIdentityBalanceAndRevisionRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} GetIdentityContractNonceRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceAndRevisionRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetIdentityContractNonceRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityBalanceAndRevisionRequestV0 message. + * Verifies a GetIdentityContractNonceRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityBalanceAndRevisionRequestV0.verify = function verify(message) { + GetIdentityContractNonceRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!(message.id && typeof message.id.length === "number" || $util.isString(message.id))) - return "id: buffer expected"; + if (message.identityId != null && message.hasOwnProperty("identityId")) + if (!(message.identityId && typeof message.identityId.length === "number" || $util.isString(message.identityId))) + return "identityId: buffer expected"; + if (message.contractId != null && message.hasOwnProperty("contractId")) + if (!(message.contractId && typeof message.contractId.length === "number" || $util.isString(message.contractId))) + return "contractId: buffer expected"; if (message.prove != null && message.hasOwnProperty("prove")) if (typeof message.prove !== "boolean") return "prove: boolean expected"; @@ -3162,92 +3265,106 @@ $root.org = (function() { }; /** - * Creates a GetIdentityBalanceAndRevisionRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityContractNonceRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} GetIdentityBalanceAndRevisionRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} GetIdentityContractNonceRequestV0 */ - GetIdentityBalanceAndRevisionRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0) + GetIdentityContractNonceRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0(); - if (object.id != null) - if (typeof object.id === "string") - $util.base64.decode(object.id, message.id = $util.newBuffer($util.base64.length(object.id)), 0); - else if (object.id.length >= 0) - message.id = object.id; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0(); + if (object.identityId != null) + if (typeof object.identityId === "string") + $util.base64.decode(object.identityId, message.identityId = $util.newBuffer($util.base64.length(object.identityId)), 0); + else if (object.identityId.length >= 0) + message.identityId = object.identityId; + if (object.contractId != null) + if (typeof object.contractId === "string") + $util.base64.decode(object.contractId, message.contractId = $util.newBuffer($util.base64.length(object.contractId)), 0); + else if (object.contractId.length >= 0) + message.contractId = object.contractId; if (object.prove != null) message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetIdentityBalanceAndRevisionRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityContractNonceRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} message GetIdentityBalanceAndRevisionRequestV0 + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} message GetIdentityContractNonceRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityBalanceAndRevisionRequestV0.toObject = function toObject(message, options) { + GetIdentityContractNonceRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { if (options.bytes === String) - object.id = ""; + object.identityId = ""; else { - object.id = []; + object.identityId = []; if (options.bytes !== Array) - object.id = $util.newBuffer(object.id); + object.identityId = $util.newBuffer(object.identityId); + } + if (options.bytes === String) + object.contractId = ""; + else { + object.contractId = []; + if (options.bytes !== Array) + object.contractId = $util.newBuffer(object.contractId); } object.prove = false; } - if (message.id != null && message.hasOwnProperty("id")) - object.id = options.bytes === String ? $util.base64.encode(message.id, 0, message.id.length) : options.bytes === Array ? Array.prototype.slice.call(message.id) : message.id; + if (message.identityId != null && message.hasOwnProperty("identityId")) + object.identityId = options.bytes === String ? $util.base64.encode(message.identityId, 0, message.identityId.length) : options.bytes === Array ? Array.prototype.slice.call(message.identityId) : message.identityId; + if (message.contractId != null && message.hasOwnProperty("contractId")) + object.contractId = options.bytes === String ? $util.base64.encode(message.contractId, 0, message.contractId.length) : options.bytes === Array ? Array.prototype.slice.call(message.contractId) : message.contractId; if (message.prove != null && message.hasOwnProperty("prove")) object.prove = message.prove; return object; }; /** - * Converts this GetIdentityBalanceAndRevisionRequestV0 to JSON. + * Converts this GetIdentityContractNonceRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 * @instance * @returns {Object.} JSON object */ - GetIdentityBalanceAndRevisionRequestV0.prototype.toJSON = function toJSON() { + GetIdentityContractNonceRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetIdentityBalanceAndRevisionRequestV0; + return GetIdentityContractNonceRequestV0; })(); - return GetIdentityBalanceAndRevisionRequest; + return GetIdentityContractNonceRequest; })(); - v0.GetIdentityResponse = (function() { + v0.GetIdentityBalanceRequest = (function() { /** - * Properties of a GetIdentityResponse. + * Properties of a GetIdentityBalanceRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentityResponse - * @property {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0|null} [v0] GetIdentityResponse v0 + * @interface IGetIdentityBalanceRequest + * @property {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0|null} [v0] GetIdentityBalanceRequest v0 */ /** - * Constructs a new GetIdentityResponse. + * Constructs a new GetIdentityBalanceRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentityResponse. - * @implements IGetIdentityResponse + * @classdesc Represents a GetIdentityBalanceRequest. + * @implements IGetIdentityBalanceRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentityResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceRequest=} [properties] Properties to set */ - function GetIdentityResponse(properties) { + function GetIdentityBalanceRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3255,89 +3372,89 @@ $root.org = (function() { } /** - * GetIdentityResponse v0. - * @member {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * GetIdentityBalanceRequest v0. + * @member {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @instance */ - GetIdentityResponse.prototype.v0 = null; + GetIdentityBalanceRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentityResponse version. + * GetIdentityBalanceRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @instance */ - Object.defineProperty(GetIdentityResponse.prototype, "version", { + Object.defineProperty(GetIdentityBalanceRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentityResponse instance using the specified properties. + * Creates a new GetIdentityBalanceRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityResponse} GetIdentityResponse instance + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} GetIdentityBalanceRequest instance */ - GetIdentityResponse.create = function create(properties) { - return new GetIdentityResponse(properties); + GetIdentityBalanceRequest.create = function create(properties) { + return new GetIdentityBalanceRequest(properties); }; /** - * Encodes the specified GetIdentityResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityResponse.verify|verify} messages. + * Encodes the specified GetIdentityBalanceRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityResponse} message GetIdentityResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceRequest} message GetIdentityBalanceRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityResponse.encode = function encode(message, writer) { + GetIdentityBalanceRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentityResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityResponse.verify|verify} messages. + * Encodes the specified GetIdentityBalanceRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityResponse} message GetIdentityResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceRequest} message GetIdentityBalanceRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityBalanceRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityResponse message from the specified reader or buffer. + * Decodes a GetIdentityBalanceRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityResponse} GetIdentityResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} GetIdentityBalanceRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityResponse.decode = function decode(reader, length) { + GetIdentityBalanceRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -3348,37 +3465,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityResponse message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityBalanceRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityResponse} GetIdentityResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} GetIdentityBalanceRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityResponse.decodeDelimited = function decodeDelimited(reader) { + GetIdentityBalanceRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityResponse message. + * Verifies a GetIdentityBalanceRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityResponse.verify = function verify(message) { + GetIdentityBalanceRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -3387,40 +3504,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentityResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityBalanceRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityResponse} GetIdentityResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} GetIdentityBalanceRequest */ - GetIdentityResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityResponse) + GetIdentityBalanceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentityResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityBalanceRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @static - * @param {org.dash.platform.dapi.v0.GetIdentityResponse} message GetIdentityResponse + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest} message GetIdentityBalanceRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityResponse.toObject = function toObject(message, options) { + GetIdentityBalanceRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -3428,36 +3545,35 @@ $root.org = (function() { }; /** - * Converts this GetIdentityResponse to JSON. + * Converts this GetIdentityBalanceRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest * @instance * @returns {Object.} JSON object */ - GetIdentityResponse.prototype.toJSON = function toJSON() { + GetIdentityBalanceRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentityResponse.GetIdentityResponseV0 = (function() { + GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 = (function() { /** - * Properties of a GetIdentityResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse - * @interface IGetIdentityResponseV0 - * @property {Uint8Array|null} [identity] GetIdentityResponseV0 identity - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityResponseV0 metadata + * Properties of a GetIdentityBalanceRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @interface IGetIdentityBalanceRequestV0 + * @property {Uint8Array|null} [id] GetIdentityBalanceRequestV0 id + * @property {boolean|null} [prove] GetIdentityBalanceRequestV0 prove */ /** - * Constructs a new GetIdentityResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse - * @classdesc Represents a GetIdentityResponseV0. - * @implements IGetIdentityResponseV0 + * Constructs a new GetIdentityBalanceRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest + * @classdesc Represents a GetIdentityBalanceRequestV0. + * @implements IGetIdentityBalanceRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0=} [properties] Properties to set */ - function GetIdentityResponseV0(properties) { + function GetIdentityBalanceRequestV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3465,115 +3581,88 @@ $root.org = (function() { } /** - * GetIdentityResponseV0 identity. - * @member {Uint8Array} identity - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 - * @instance - */ - GetIdentityResponseV0.prototype.identity = $util.newBuffer([]); - - /** - * GetIdentityResponseV0 proof. - * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 - * @instance - */ - GetIdentityResponseV0.prototype.proof = null; - - /** - * GetIdentityResponseV0 metadata. - * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * GetIdentityBalanceRequestV0 id. + * @member {Uint8Array} id + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @instance */ - GetIdentityResponseV0.prototype.metadata = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + GetIdentityBalanceRequestV0.prototype.id = $util.newBuffer([]); /** - * GetIdentityResponseV0 result. - * @member {"identity"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * GetIdentityBalanceRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @instance */ - Object.defineProperty(GetIdentityResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["identity", "proof"]), - set: $util.oneOfSetter($oneOfFields) - }); + GetIdentityBalanceRequestV0.prototype.prove = false; /** - * Creates a new GetIdentityResponseV0 instance using the specified properties. + * Creates a new GetIdentityBalanceRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} GetIdentityResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} GetIdentityBalanceRequestV0 instance */ - GetIdentityResponseV0.create = function create(properties) { - return new GetIdentityResponseV0(properties); + GetIdentityBalanceRequestV0.create = function create(properties) { + return new GetIdentityBalanceRequestV0(properties); }; /** - * Encodes the specified GetIdentityResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.verify|verify} messages. + * Encodes the specified GetIdentityBalanceRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0} message GetIdentityResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0} message GetIdentityBalanceRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityResponseV0.encode = function encode(message, writer) { + GetIdentityBalanceRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.identity != null && Object.hasOwnProperty.call(message, "identity")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identity); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.id); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); return writer; }; /** - * Encodes the specified GetIdentityResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.verify|verify} messages. + * Encodes the specified GetIdentityBalanceRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0} message GetIdentityResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.IGetIdentityBalanceRequestV0} message GetIdentityBalanceRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityBalanceRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityResponseV0 message from the specified reader or buffer. + * Decodes a GetIdentityBalanceRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} GetIdentityResponseV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} GetIdentityBalanceRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityResponseV0.decode = function decode(reader, length) { + GetIdentityBalanceRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.identity = reader.bytes(); + message.id = reader.bytes(); break; case 2: - message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); - break; - case 3: - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + message.prove = reader.bool(); break; default: reader.skipType(tag & 7); @@ -3584,151 +3673,128 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityBalanceRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} GetIdentityResponseV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} GetIdentityBalanceRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityResponseV0.decodeDelimited = function decodeDelimited(reader) { + GetIdentityBalanceRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityResponseV0 message. + * Verifies a GetIdentityBalanceRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityResponseV0.verify = function verify(message) { + GetIdentityBalanceRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.identity != null && message.hasOwnProperty("identity")) { - properties.result = 1; - if (!(message.identity && typeof message.identity.length === "number" || $util.isString(message.identity))) - return "identity: buffer expected"; - } - if (message.proof != null && message.hasOwnProperty("proof")) { - if (properties.result === 1) - return "result: multiple values"; - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); - if (error) - return "proof." + error; - } - } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); - if (error) - return "metadata." + error; - } + if (message.id != null && message.hasOwnProperty("id")) + if (!(message.id && typeof message.id.length === "number" || $util.isString(message.id))) + return "id: buffer expected"; + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; return null; }; /** - * Creates a GetIdentityResponseV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityBalanceRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} GetIdentityResponseV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} GetIdentityBalanceRequestV0 */ - GetIdentityResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0) + GetIdentityBalanceRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0(); - if (object.identity != null) - if (typeof object.identity === "string") - $util.base64.decode(object.identity, message.identity = $util.newBuffer($util.base64.length(object.identity)), 0); - else if (object.identity.length >= 0) - message.identity = object.identity; - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.proof: object expected"); - message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); - } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.metadata: object expected"); - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); - } + var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0(); + if (object.id != null) + if (typeof object.id === "string") + $util.base64.decode(object.id, message.id = $util.newBuffer($util.base64.length(object.id)), 0); + else if (object.id.length >= 0) + message.id = object.id; + if (object.prove != null) + message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetIdentityResponseV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityBalanceRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} message GetIdentityResponseV0 + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} message GetIdentityBalanceRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityResponseV0.toObject = function toObject(message, options) { + GetIdentityBalanceRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.metadata = null; - if (message.identity != null && message.hasOwnProperty("identity")) { - object.identity = options.bytes === String ? $util.base64.encode(message.identity, 0, message.identity.length) : options.bytes === Array ? Array.prototype.slice.call(message.identity) : message.identity; - if (options.oneofs) - object.result = "identity"; + if (options.defaults) { + if (options.bytes === String) + object.id = ""; + else { + object.id = []; + if (options.bytes !== Array) + object.id = $util.newBuffer(object.id); + } + object.prove = false; } - if (message.proof != null && message.hasOwnProperty("proof")) { - object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); - if (options.oneofs) - object.result = "proof"; - } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + if (message.id != null && message.hasOwnProperty("id")) + object.id = options.bytes === String ? $util.base64.encode(message.id, 0, message.id.length) : options.bytes === Array ? Array.prototype.slice.call(message.id) : message.id; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; return object; }; /** - * Converts this GetIdentityResponseV0 to JSON. + * Converts this GetIdentityBalanceRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 * @instance * @returns {Object.} JSON object */ - GetIdentityResponseV0.prototype.toJSON = function toJSON() { + GetIdentityBalanceRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetIdentityResponseV0; + return GetIdentityBalanceRequestV0; })(); - return GetIdentityResponse; + return GetIdentityBalanceRequest; })(); - v0.GetIdentitiesRequest = (function() { + v0.GetIdentityBalanceAndRevisionRequest = (function() { /** - * Properties of a GetIdentitiesRequest. + * Properties of a GetIdentityBalanceAndRevisionRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentitiesRequest - * @property {org.dash.platform.dapi.v0.GetIdentitiesRequest.IGetIdentitiesRequestV0|null} [v0] GetIdentitiesRequest v0 + * @interface IGetIdentityBalanceAndRevisionRequest + * @property {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0|null} [v0] GetIdentityBalanceAndRevisionRequest v0 */ /** - * Constructs a new GetIdentitiesRequest. + * Constructs a new GetIdentityBalanceAndRevisionRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentitiesRequest. - * @implements IGetIdentitiesRequest + * @classdesc Represents a GetIdentityBalanceAndRevisionRequest. + * @implements IGetIdentityBalanceAndRevisionRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentitiesRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionRequest=} [properties] Properties to set */ - function GetIdentitiesRequest(properties) { + function GetIdentityBalanceAndRevisionRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3736,89 +3802,89 @@ $root.org = (function() { } /** - * GetIdentitiesRequest v0. - * @member {org.dash.platform.dapi.v0.GetIdentitiesRequest.IGetIdentitiesRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * GetIdentityBalanceAndRevisionRequest v0. + * @member {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @instance */ - GetIdentitiesRequest.prototype.v0 = null; + GetIdentityBalanceAndRevisionRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentitiesRequest version. + * GetIdentityBalanceAndRevisionRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @instance */ - Object.defineProperty(GetIdentitiesRequest.prototype, "version", { + Object.defineProperty(GetIdentityBalanceAndRevisionRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentitiesRequest instance using the specified properties. + * Creates a new GetIdentityBalanceAndRevisionRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesRequest} GetIdentitiesRequest instance + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} GetIdentityBalanceAndRevisionRequest instance */ - GetIdentitiesRequest.create = function create(properties) { - return new GetIdentitiesRequest(properties); + GetIdentityBalanceAndRevisionRequest.create = function create(properties) { + return new GetIdentityBalanceAndRevisionRequest(properties); }; /** - * Encodes the specified GetIdentitiesRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesRequest.verify|verify} messages. + * Encodes the specified GetIdentityBalanceAndRevisionRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesRequest} message GetIdentitiesRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionRequest} message GetIdentityBalanceAndRevisionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesRequest.encode = function encode(message, writer) { + GetIdentityBalanceAndRevisionRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentitiesRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesRequest.verify|verify} messages. + * Encodes the specified GetIdentityBalanceAndRevisionRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesRequest} message GetIdentitiesRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionRequest} message GetIdentityBalanceAndRevisionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityBalanceAndRevisionRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentitiesRequest message from the specified reader or buffer. + * Decodes a GetIdentityBalanceAndRevisionRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesRequest} GetIdentitiesRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} GetIdentityBalanceAndRevisionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesRequest.decode = function decode(reader, length) { + GetIdentityBalanceAndRevisionRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -3829,37 +3895,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentitiesRequest message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityBalanceAndRevisionRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesRequest} GetIdentitiesRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} GetIdentityBalanceAndRevisionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesRequest.decodeDelimited = function decodeDelimited(reader) { + GetIdentityBalanceAndRevisionRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentitiesRequest message. + * Verifies a GetIdentityBalanceAndRevisionRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentitiesRequest.verify = function verify(message) { + GetIdentityBalanceAndRevisionRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -3868,40 +3934,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentitiesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityBalanceAndRevisionRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesRequest} GetIdentitiesRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} GetIdentityBalanceAndRevisionRequest */ - GetIdentitiesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesRequest) + GetIdentityBalanceAndRevisionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentitiesRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityBalanceAndRevisionRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesRequest} message GetIdentitiesRequest + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} message GetIdentityBalanceAndRevisionRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentitiesRequest.toObject = function toObject(message, options) { + GetIdentityBalanceAndRevisionRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -3909,36 +3975,35 @@ $root.org = (function() { }; /** - * Converts this GetIdentitiesRequest to JSON. + * Converts this GetIdentityBalanceAndRevisionRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest * @instance * @returns {Object.} JSON object */ - GetIdentitiesRequest.prototype.toJSON = function toJSON() { + GetIdentityBalanceAndRevisionRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentitiesRequest.GetIdentitiesRequestV0 = (function() { + GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 = (function() { /** - * Properties of a GetIdentitiesRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest - * @interface IGetIdentitiesRequestV0 - * @property {Array.|null} [ids] GetIdentitiesRequestV0 ids - * @property {boolean|null} [prove] GetIdentitiesRequestV0 prove + * Properties of a GetIdentityBalanceAndRevisionRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @interface IGetIdentityBalanceAndRevisionRequestV0 + * @property {Uint8Array|null} [id] GetIdentityBalanceAndRevisionRequestV0 id + * @property {boolean|null} [prove] GetIdentityBalanceAndRevisionRequestV0 prove */ /** - * Constructs a new GetIdentitiesRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest - * @classdesc Represents a GetIdentitiesRequestV0. - * @implements IGetIdentitiesRequestV0 + * Constructs a new GetIdentityBalanceAndRevisionRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest + * @classdesc Represents a GetIdentityBalanceAndRevisionRequestV0. + * @implements IGetIdentityBalanceAndRevisionRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentitiesRequest.IGetIdentitiesRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0=} [properties] Properties to set */ - function GetIdentitiesRequestV0(properties) { - this.ids = []; + function GetIdentityBalanceAndRevisionRequestV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3946,88 +4011,85 @@ $root.org = (function() { } /** - * GetIdentitiesRequestV0 ids. - * @member {Array.} ids - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * GetIdentityBalanceAndRevisionRequestV0 id. + * @member {Uint8Array} id + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @instance */ - GetIdentitiesRequestV0.prototype.ids = $util.emptyArray; + GetIdentityBalanceAndRevisionRequestV0.prototype.id = $util.newBuffer([]); /** - * GetIdentitiesRequestV0 prove. + * GetIdentityBalanceAndRevisionRequestV0 prove. * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @instance */ - GetIdentitiesRequestV0.prototype.prove = false; + GetIdentityBalanceAndRevisionRequestV0.prototype.prove = false; /** - * Creates a new GetIdentitiesRequestV0 instance using the specified properties. + * Creates a new GetIdentityBalanceAndRevisionRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesRequest.IGetIdentitiesRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} GetIdentitiesRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} GetIdentityBalanceAndRevisionRequestV0 instance */ - GetIdentitiesRequestV0.create = function create(properties) { - return new GetIdentitiesRequestV0(properties); + GetIdentityBalanceAndRevisionRequestV0.create = function create(properties) { + return new GetIdentityBalanceAndRevisionRequestV0(properties); }; /** - * Encodes the specified GetIdentitiesRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.verify|verify} messages. + * Encodes the specified GetIdentityBalanceAndRevisionRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesRequest.IGetIdentitiesRequestV0} message GetIdentitiesRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0} message GetIdentityBalanceAndRevisionRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesRequestV0.encode = function encode(message, writer) { + GetIdentityBalanceAndRevisionRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.ids != null && message.ids.length) - for (var i = 0; i < message.ids.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.ids[i]); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.id); if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); return writer; }; /** - * Encodes the specified GetIdentitiesRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.verify|verify} messages. + * Encodes the specified GetIdentityBalanceAndRevisionRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesRequest.IGetIdentitiesRequestV0} message GetIdentitiesRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.IGetIdentityBalanceAndRevisionRequestV0} message GetIdentityBalanceAndRevisionRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityBalanceAndRevisionRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentitiesRequestV0 message from the specified reader or buffer. + * Decodes a GetIdentityBalanceAndRevisionRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} GetIdentitiesRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} GetIdentityBalanceAndRevisionRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesRequestV0.decode = function decode(reader, length) { + GetIdentityBalanceAndRevisionRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.ids && message.ids.length)) - message.ids = []; - message.ids.push(reader.bytes()); + message.id = reader.bytes(); break; case 2: message.prove = reader.bool(); @@ -4041,39 +4103,35 @@ $root.org = (function() { }; /** - * Decodes a GetIdentitiesRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityBalanceAndRevisionRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} GetIdentitiesRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} GetIdentityBalanceAndRevisionRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetIdentityBalanceAndRevisionRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentitiesRequestV0 message. + * Verifies a GetIdentityBalanceAndRevisionRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentitiesRequestV0.verify = function verify(message) { + GetIdentityBalanceAndRevisionRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.ids != null && message.hasOwnProperty("ids")) { - if (!Array.isArray(message.ids)) - return "ids: array expected"; - for (var i = 0; i < message.ids.length; ++i) - if (!(message.ids[i] && typeof message.ids[i].length === "number" || $util.isString(message.ids[i]))) - return "ids: buffer[] expected"; - } + if (message.id != null && message.hasOwnProperty("id")) + if (!(message.id && typeof message.id.length === "number" || $util.isString(message.id))) + return "id: buffer expected"; if (message.prove != null && message.hasOwnProperty("prove")) if (typeof message.prove !== "boolean") return "prove: boolean expected"; @@ -4081,94 +4139,92 @@ $root.org = (function() { }; /** - * Creates a GetIdentitiesRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityBalanceAndRevisionRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} GetIdentitiesRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} GetIdentityBalanceAndRevisionRequestV0 */ - GetIdentitiesRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0) + GetIdentityBalanceAndRevisionRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0(); - if (object.ids) { - if (!Array.isArray(object.ids)) - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.ids: array expected"); - message.ids = []; - for (var i = 0; i < object.ids.length; ++i) - if (typeof object.ids[i] === "string") - $util.base64.decode(object.ids[i], message.ids[i] = $util.newBuffer($util.base64.length(object.ids[i])), 0); - else if (object.ids[i].length >= 0) - message.ids[i] = object.ids[i]; - } + var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0(); + if (object.id != null) + if (typeof object.id === "string") + $util.base64.decode(object.id, message.id = $util.newBuffer($util.base64.length(object.id)), 0); + else if (object.id.length >= 0) + message.id = object.id; if (object.prove != null) message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetIdentitiesRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityBalanceAndRevisionRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} message GetIdentitiesRequestV0 + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} message GetIdentityBalanceAndRevisionRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentitiesRequestV0.toObject = function toObject(message, options) { + GetIdentityBalanceAndRevisionRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.ids = []; - if (options.defaults) + if (options.defaults) { + if (options.bytes === String) + object.id = ""; + else { + object.id = []; + if (options.bytes !== Array) + object.id = $util.newBuffer(object.id); + } object.prove = false; - if (message.ids && message.ids.length) { - object.ids = []; - for (var j = 0; j < message.ids.length; ++j) - object.ids[j] = options.bytes === String ? $util.base64.encode(message.ids[j], 0, message.ids[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.ids[j]) : message.ids[j]; } + if (message.id != null && message.hasOwnProperty("id")) + object.id = options.bytes === String ? $util.base64.encode(message.id, 0, message.id.length) : options.bytes === Array ? Array.prototype.slice.call(message.id) : message.id; if (message.prove != null && message.hasOwnProperty("prove")) object.prove = message.prove; return object; }; /** - * Converts this GetIdentitiesRequestV0 to JSON. + * Converts this GetIdentityBalanceAndRevisionRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 * @instance * @returns {Object.} JSON object */ - GetIdentitiesRequestV0.prototype.toJSON = function toJSON() { + GetIdentityBalanceAndRevisionRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetIdentitiesRequestV0; + return GetIdentityBalanceAndRevisionRequestV0; })(); - return GetIdentitiesRequest; + return GetIdentityBalanceAndRevisionRequest; })(); - v0.GetIdentitiesResponse = (function() { + v0.GetIdentityResponse = (function() { /** - * Properties of a GetIdentitiesResponse. + * Properties of a GetIdentityResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentitiesResponse - * @property {org.dash.platform.dapi.v0.GetIdentitiesResponse.IGetIdentitiesResponseV0|null} [v0] GetIdentitiesResponse v0 + * @interface IGetIdentityResponse + * @property {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0|null} [v0] GetIdentityResponse v0 */ /** - * Constructs a new GetIdentitiesResponse. + * Constructs a new GetIdentityResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentitiesResponse. - * @implements IGetIdentitiesResponse + * @classdesc Represents a GetIdentityResponse. + * @implements IGetIdentityResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentitiesResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetIdentityResponse=} [properties] Properties to set */ - function GetIdentitiesResponse(properties) { + function GetIdentityResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4176,89 +4232,89 @@ $root.org = (function() { } /** - * GetIdentitiesResponse v0. - * @member {org.dash.platform.dapi.v0.GetIdentitiesResponse.IGetIdentitiesResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * GetIdentityResponse v0. + * @member {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @instance */ - GetIdentitiesResponse.prototype.v0 = null; + GetIdentityResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentitiesResponse version. + * GetIdentityResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @instance */ - Object.defineProperty(GetIdentitiesResponse.prototype, "version", { + Object.defineProperty(GetIdentityResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentitiesResponse instance using the specified properties. + * Creates a new GetIdentityResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse} GetIdentitiesResponse instance + * @param {org.dash.platform.dapi.v0.IGetIdentityResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityResponse} GetIdentityResponse instance */ - GetIdentitiesResponse.create = function create(properties) { - return new GetIdentitiesResponse(properties); + GetIdentityResponse.create = function create(properties) { + return new GetIdentityResponse(properties); }; /** - * Encodes the specified GetIdentitiesResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.verify|verify} messages. + * Encodes the specified GetIdentityResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesResponse} message GetIdentitiesResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityResponse} message GetIdentityResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesResponse.encode = function encode(message, writer) { + GetIdentityResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentitiesResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.verify|verify} messages. + * Encodes the specified GetIdentityResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesResponse} message GetIdentitiesResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityResponse} message GetIdentityResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentitiesResponse message from the specified reader or buffer. + * Decodes a GetIdentityResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse} GetIdentitiesResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityResponse} GetIdentityResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesResponse.decode = function decode(reader, length) { + GetIdentityResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -4269,37 +4325,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentitiesResponse message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse} GetIdentitiesResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityResponse} GetIdentityResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesResponse.decodeDelimited = function decodeDelimited(reader) { + GetIdentityResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentitiesResponse message. + * Verifies a GetIdentityResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentitiesResponse.verify = function verify(message) { + GetIdentityResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -4308,40 +4364,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentitiesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse} GetIdentitiesResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityResponse} GetIdentityResponse */ - GetIdentitiesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesResponse) + GetIdentityResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetIdentityResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentitiesResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse} message GetIdentitiesResponse + * @param {org.dash.platform.dapi.v0.GetIdentityResponse} message GetIdentityResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentitiesResponse.toObject = function toObject(message, options) { + GetIdentityResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -4349,34 +4405,36 @@ $root.org = (function() { }; /** - * Converts this GetIdentitiesResponse to JSON. + * Converts this GetIdentityResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse * @instance * @returns {Object.} JSON object */ - GetIdentitiesResponse.prototype.toJSON = function toJSON() { + GetIdentityResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentitiesResponse.IdentityValue = (function() { + GetIdentityResponse.GetIdentityResponseV0 = (function() { /** - * Properties of an IdentityValue. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse - * @interface IIdentityValue - * @property {Uint8Array|null} [value] IdentityValue value + * Properties of a GetIdentityResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @interface IGetIdentityResponseV0 + * @property {Uint8Array|null} [identity] GetIdentityResponseV0 identity + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityResponseV0 metadata */ /** - * Constructs a new IdentityValue. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse - * @classdesc Represents an IdentityValue. - * @implements IIdentityValue + * Constructs a new GetIdentityResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse + * @classdesc Represents a GetIdentityResponseV0. + * @implements IGetIdentityResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityValue=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0=} [properties] Properties to set */ - function IdentityValue(properties) { + function GetIdentityResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4384,285 +4442,115 @@ $root.org = (function() { } /** - * IdentityValue value. - * @member {Uint8Array} value - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue + * GetIdentityResponseV0 identity. + * @member {Uint8Array} identity + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @instance */ - IdentityValue.prototype.value = $util.newBuffer([]); - - /** - * Creates a new IdentityValue instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityValue=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} IdentityValue instance - */ - IdentityValue.create = function create(properties) { - return new IdentityValue(properties); - }; - - /** - * Encodes the specified IdentityValue message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityValue} message IdentityValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IdentityValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.value); - return writer; - }; - - /** - * Encodes the specified IdentityValue message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityValue} message IdentityValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IdentityValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an IdentityValue message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} IdentityValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IdentityValue.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.value = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an IdentityValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} IdentityValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IdentityValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an IdentityValue message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - IdentityValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) - return "value: buffer expected"; - return null; - }; - - /** - * Creates an IdentityValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} IdentityValue - */ - IdentityValue.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue(); - if (object.value != null) - if (typeof object.value === "string") - $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); - else if (object.value.length >= 0) - message.value = object.value; - return message; - }; - - /** - * Creates a plain object from an IdentityValue message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} message IdentityValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - IdentityValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if (options.bytes === String) - object.value = ""; - else { - object.value = []; - if (options.bytes !== Array) - object.value = $util.newBuffer(object.value); - } - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; - return object; - }; + GetIdentityResponseV0.prototype.identity = $util.newBuffer([]); /** - * Converts this IdentityValue to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue + * GetIdentityResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @instance - * @returns {Object.} JSON object - */ - IdentityValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return IdentityValue; - })(); - - GetIdentitiesResponse.IdentityEntry = (function() { - - /** - * Properties of an IdentityEntry. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse - * @interface IIdentityEntry - * @property {Uint8Array|null} [key] IdentityEntry key - * @property {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityValue|null} [value] IdentityEntry value - */ - - /** - * Constructs a new IdentityEntry. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse - * @classdesc Represents an IdentityEntry. - * @implements IIdentityEntry - * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityEntry=} [properties] Properties to set */ - function IdentityEntry(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + GetIdentityResponseV0.prototype.proof = null; /** - * IdentityEntry key. - * @member {Uint8Array} key - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * GetIdentityResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @instance */ - IdentityEntry.prototype.key = $util.newBuffer([]); + GetIdentityResponseV0.prototype.metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * IdentityEntry value. - * @member {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityValue|null|undefined} value - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * GetIdentityResponseV0 result. + * @member {"identity"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @instance */ - IdentityEntry.prototype.value = null; + Object.defineProperty(GetIdentityResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["identity", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new IdentityEntry instance using the specified properties. + * Creates a new GetIdentityResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityEntry=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} IdentityEntry instance + * @param {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} GetIdentityResponseV0 instance */ - IdentityEntry.create = function create(properties) { - return new IdentityEntry(properties); + GetIdentityResponseV0.create = function create(properties) { + return new GetIdentityResponseV0(properties); }; /** - * Encodes the specified IdentityEntry message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.verify|verify} messages. + * Encodes the specified GetIdentityResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityEntry} message IdentityEntry message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0} message GetIdentityResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - IdentityEntry.encode = function encode(message, writer) { + GetIdentityResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.encode(message.value, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.identity != null && Object.hasOwnProperty.call(message, "identity")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identity); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified IdentityEntry message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.verify|verify} messages. + * Encodes the specified GetIdentityResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentityEntry} message IdentityEntry message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityResponse.IGetIdentityResponseV0} message GetIdentityResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - IdentityEntry.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an IdentityEntry message from the specified reader or buffer. + * Decodes a GetIdentityResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} IdentityEntry + * @returns {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} GetIdentityResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - IdentityEntry.decode = function decode(reader, length) { + GetIdentityResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.key = reader.bytes(); + message.identity = reader.bytes(); break; case 2: - message.value = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.decode(reader, reader.uint32()); + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -4673,340 +4561,361 @@ $root.org = (function() { }; /** - * Decodes an IdentityEntry message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} IdentityEntry + * @returns {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} GetIdentityResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - IdentityEntry.decodeDelimited = function decodeDelimited(reader) { + GetIdentityResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an IdentityEntry message. + * Verifies a GetIdentityResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - IdentityEntry.verify = function verify(message) { + GetIdentityResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) - return "key: buffer expected"; - if (message.value != null && message.hasOwnProperty("value")) { - var error = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.verify(message.value); + var properties = {}; + if (message.identity != null && message.hasOwnProperty("identity")) { + properties.result = 1; + if (!(message.identity && typeof message.identity.length === "number" || $util.isString(message.identity))) + return "identity: buffer expected"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); if (error) - return "value." + error; + return "metadata." + error; } return null; }; /** - * Creates an IdentityEntry message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} IdentityEntry + * @returns {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} GetIdentityResponseV0 */ - IdentityEntry.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry) + GetIdentityResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry(); - if (object.key != null) - if (typeof object.key === "string") - $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); - else if (object.key.length >= 0) - message.key = object.key; - if (object.value != null) { - if (typeof object.value !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.value: object expected"); - message.value = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.fromObject(object.value); + var message = new $root.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0(); + if (object.identity != null) + if (typeof object.identity === "string") + $util.base64.decode(object.identity, message.identity = $util.newBuffer($util.base64.length(object.identity)), 0); + else if (object.identity.length >= 0) + message.identity = object.identity; + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); } return message; }; /** - * Creates a plain object from an IdentityEntry message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} message IdentityEntry + * @param {org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} message GetIdentityResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - IdentityEntry.toObject = function toObject(message, options) { + GetIdentityResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - if (options.bytes === String) - object.key = ""; - else { - object.key = []; - if (options.bytes !== Array) - object.key = $util.newBuffer(object.key); - } - object.value = null; + if (options.defaults) + object.metadata = null; + if (message.identity != null && message.hasOwnProperty("identity")) { + object.identity = options.bytes === String ? $util.base64.encode(message.identity, 0, message.identity.length) : options.bytes === Array ? Array.prototype.slice.call(message.identity) : message.identity; + if (options.oneofs) + object.result = "identity"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; } - if (message.key != null && message.hasOwnProperty("key")) - object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; - if (message.value != null && message.hasOwnProperty("value")) - object.value = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.toObject(message.value, options); + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); return object; }; /** - * Converts this IdentityEntry to JSON. + * Converts this GetIdentityResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry + * @memberof org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 * @instance * @returns {Object.} JSON object */ - IdentityEntry.prototype.toJSON = function toJSON() { + GetIdentityResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return IdentityEntry; + return GetIdentityResponseV0; })(); - GetIdentitiesResponse.Identities = (function() { + return GetIdentityResponse; + })(); - /** - * Properties of an Identities. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse - * @interface IIdentities - * @property {Array.|null} [identityEntries] Identities identityEntries - */ + v0.GetIdentityNonceResponse = (function() { - /** - * Constructs a new Identities. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse - * @classdesc Represents an Identities. - * @implements IIdentities - * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentities=} [properties] Properties to set - */ - function Identities(properties) { - this.identityEntries = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a GetIdentityNonceResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetIdentityNonceResponse + * @property {org.dash.platform.dapi.v0.GetIdentityNonceResponse.IGetIdentityNonceResponseV0|null} [v0] GetIdentityNonceResponse v0 + */ - /** - * Identities identityEntries. - * @member {Array.} identityEntries - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @instance - */ - Identities.prototype.identityEntries = $util.emptyArray; + /** + * Constructs a new GetIdentityNonceResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetIdentityNonceResponse. + * @implements IGetIdentityNonceResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceResponse=} [properties] Properties to set + */ + function GetIdentityNonceResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new Identities instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentities=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} Identities instance - */ - Identities.create = function create(properties) { - return new Identities(properties); - }; + /** + * GetIdentityNonceResponse v0. + * @member {org.dash.platform.dapi.v0.GetIdentityNonceResponse.IGetIdentityNonceResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @instance + */ + GetIdentityNonceResponse.prototype.v0 = null; - /** - * Encodes the specified Identities message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentities} message Identities message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Identities.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.identityEntries != null && message.identityEntries.length) - for (var i = 0; i < message.identityEntries.length; ++i) - $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.encode(message.identityEntries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; - /** - * Encodes the specified Identities message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentities} message Identities message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Identities.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * GetIdentityNonceResponse version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @instance + */ + Object.defineProperty(GetIdentityNonceResponse.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); - /** - * Decodes an Identities message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} Identities - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Identities.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.identityEntries && message.identityEntries.length)) - message.identityEntries = []; - message.identityEntries.push($root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates a new GetIdentityNonceResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceResponse} GetIdentityNonceResponse instance + */ + GetIdentityNonceResponse.create = function create(properties) { + return new GetIdentityNonceResponse(properties); + }; - /** - * Decodes an Identities message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} Identities - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Identities.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified GetIdentityNonceResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityNonceResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceResponse} message GetIdentityNonceResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityNonceResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; - /** - * Verifies an Identities message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Identities.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.identityEntries != null && message.hasOwnProperty("identityEntries")) { - if (!Array.isArray(message.identityEntries)) - return "identityEntries: array expected"; - for (var i = 0; i < message.identityEntries.length; ++i) { - var error = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.verify(message.identityEntries[i]); - if (error) - return "identityEntries." + error; - } - } - return null; - }; + /** + * Encodes the specified GetIdentityNonceResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityNonceResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityNonceResponse} message GetIdentityNonceResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityNonceResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates an Identities message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} Identities - */ - Identities.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities(); - if (object.identityEntries) { - if (!Array.isArray(object.identityEntries)) - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.identityEntries: array expected"); - message.identityEntries = []; - for (var i = 0; i < object.identityEntries.length; ++i) { - if (typeof object.identityEntries[i] !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.identityEntries: object expected"); - message.identityEntries[i] = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.fromObject(object.identityEntries[i]); - } + /** + * Decodes a GetIdentityNonceResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceResponse} GetIdentityNonceResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityNonceResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; } - return message; - }; + } + return message; + }; - /** - * Creates a plain object from an Identities message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} message Identities - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Identities.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.identityEntries = []; - if (message.identityEntries && message.identityEntries.length) { - object.identityEntries = []; - for (var j = 0; j < message.identityEntries.length; ++j) - object.identityEntries[j] = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.toObject(message.identityEntries[j], options); + /** + * Decodes a GetIdentityNonceResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceResponse} GetIdentityNonceResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityNonceResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIdentityNonceResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIdentityNonceResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.verify(message.v0); + if (error) + return "v0." + error; } + } + return null; + }; + + /** + * Creates a GetIdentityNonceResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceResponse} GetIdentityNonceResponse + */ + GetIdentityNonceResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse) return object; - }; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityNonceResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.fromObject(object.v0); + } + return message; + }; - /** - * Converts this Identities to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities - * @instance - * @returns {Object.} JSON object - */ - Identities.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a GetIdentityNonceResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityNonceResponse} message GetIdentityNonceResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIdentityNonceResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; - return Identities; - })(); + /** + * Converts this GetIdentityNonceResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @instance + * @returns {Object.} JSON object + */ + GetIdentityNonceResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - GetIdentitiesResponse.GetIdentitiesResponseV0 = (function() { + GetIdentityNonceResponse.GetIdentityNonceResponseV0 = (function() { /** - * Properties of a GetIdentitiesResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse - * @interface IGetIdentitiesResponseV0 - * @property {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentities|null} [identities] GetIdentitiesResponseV0 identities - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentitiesResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentitiesResponseV0 metadata + * Properties of a GetIdentityNonceResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @interface IGetIdentityNonceResponseV0 + * @property {number|Long|null} [identityNonce] GetIdentityNonceResponseV0 identityNonce + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityNonceResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityNonceResponseV0 metadata */ /** - * Constructs a new GetIdentitiesResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse - * @classdesc Represents a GetIdentitiesResponseV0. - * @implements IGetIdentitiesResponseV0 + * Constructs a new GetIdentityNonceResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse + * @classdesc Represents a GetIdentityNonceResponseV0. + * @implements IGetIdentityNonceResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IGetIdentitiesResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentityNonceResponse.IGetIdentityNonceResponseV0=} [properties] Properties to set */ - function GetIdentitiesResponseV0(properties) { + function GetIdentityNonceResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5014,69 +4923,69 @@ $root.org = (function() { } /** - * GetIdentitiesResponseV0 identities. - * @member {org.dash.platform.dapi.v0.GetIdentitiesResponse.IIdentities|null|undefined} identities - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * GetIdentityNonceResponseV0 identityNonce. + * @member {number|Long} identityNonce + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @instance */ - GetIdentitiesResponseV0.prototype.identities = null; + GetIdentityNonceResponseV0.prototype.identityNonce = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** - * GetIdentitiesResponseV0 proof. + * GetIdentityNonceResponseV0 proof. * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @instance */ - GetIdentitiesResponseV0.prototype.proof = null; + GetIdentityNonceResponseV0.prototype.proof = null; /** - * GetIdentitiesResponseV0 metadata. + * GetIdentityNonceResponseV0 metadata. * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @instance */ - GetIdentitiesResponseV0.prototype.metadata = null; + GetIdentityNonceResponseV0.prototype.metadata = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentitiesResponseV0 result. - * @member {"identities"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * GetIdentityNonceResponseV0 result. + * @member {"identityNonce"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @instance */ - Object.defineProperty(GetIdentitiesResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["identities", "proof"]), + Object.defineProperty(GetIdentityNonceResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["identityNonce", "proof"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentitiesResponseV0 instance using the specified properties. + * Creates a new GetIdentityNonceResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IGetIdentitiesResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} GetIdentitiesResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetIdentityNonceResponse.IGetIdentityNonceResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} GetIdentityNonceResponseV0 instance */ - GetIdentitiesResponseV0.create = function create(properties) { - return new GetIdentitiesResponseV0(properties); + GetIdentityNonceResponseV0.create = function create(properties) { + return new GetIdentityNonceResponseV0(properties); }; /** - * Encodes the specified GetIdentitiesResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.verify|verify} messages. + * Encodes the specified GetIdentityNonceResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IGetIdentitiesResponseV0} message GetIdentitiesResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityNonceResponse.IGetIdentityNonceResponseV0} message GetIdentityNonceResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesResponseV0.encode = function encode(message, writer) { + GetIdentityNonceResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.identities != null && Object.hasOwnProperty.call(message, "identities")) - $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.encode(message.identities, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.identityNonce != null && Object.hasOwnProperty.call(message, "identityNonce")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.identityNonce); if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) @@ -5085,38 +4994,38 @@ $root.org = (function() { }; /** - * Encodes the specified GetIdentitiesResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.verify|verify} messages. + * Encodes the specified GetIdentityNonceResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.IGetIdentitiesResponseV0} message GetIdentitiesResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityNonceResponse.IGetIdentityNonceResponseV0} message GetIdentityNonceResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityNonceResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentitiesResponseV0 message from the specified reader or buffer. + * Decodes a GetIdentityNonceResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} GetIdentitiesResponseV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} GetIdentityNonceResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesResponseV0.decode = function decode(reader, length) { + GetIdentityNonceResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.identities = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.decode(reader, reader.uint32()); + message.identityNonce = reader.uint64(); break; case 2: message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); @@ -5133,40 +5042,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentitiesResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityNonceResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} GetIdentitiesResponseV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} GetIdentityNonceResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesResponseV0.decodeDelimited = function decodeDelimited(reader) { + GetIdentityNonceResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentitiesResponseV0 message. + * Verifies a GetIdentityNonceResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentitiesResponseV0.verify = function verify(message) { + GetIdentityNonceResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.identities != null && message.hasOwnProperty("identities")) { + if (message.identityNonce != null && message.hasOwnProperty("identityNonce")) { properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.verify(message.identities); - if (error) - return "identities." + error; - } + if (!$util.isInteger(message.identityNonce) && !(message.identityNonce && $util.isInteger(message.identityNonce.low) && $util.isInteger(message.identityNonce.high))) + return "identityNonce: integer|Long expected"; } if (message.proof != null && message.hasOwnProperty("proof")) { if (properties.result === 1) @@ -5187,54 +5093,61 @@ $root.org = (function() { }; /** - * Creates a GetIdentitiesResponseV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityNonceResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} GetIdentitiesResponseV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} GetIdentityNonceResponseV0 */ - GetIdentitiesResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0) + GetIdentityNonceResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0(); - if (object.identities != null) { - if (typeof object.identities !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.identities: object expected"); - message.identities = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.fromObject(object.identities); - } + var message = new $root.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0(); + if (object.identityNonce != null) + if ($util.Long) + (message.identityNonce = $util.Long.fromValue(object.identityNonce)).unsigned = true; + else if (typeof object.identityNonce === "string") + message.identityNonce = parseInt(object.identityNonce, 10); + else if (typeof object.identityNonce === "number") + message.identityNonce = object.identityNonce; + else if (typeof object.identityNonce === "object") + message.identityNonce = new $util.LongBits(object.identityNonce.low >>> 0, object.identityNonce.high >>> 0).toNumber(true); if (object.proof != null) { if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.proof: object expected"); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.proof: object expected"); message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); } if (object.metadata != null) { if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.metadata: object expected"); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.metadata: object expected"); message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); } return message; }; /** - * Creates a plain object from a GetIdentitiesResponseV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityNonceResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} message GetIdentitiesResponseV0 + * @param {org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} message GetIdentityNonceResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentitiesResponseV0.toObject = function toObject(message, options) { + GetIdentityNonceResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) object.metadata = null; - if (message.identities != null && message.hasOwnProperty("identities")) { - object.identities = $root.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.toObject(message.identities, options); + if (message.identityNonce != null && message.hasOwnProperty("identityNonce")) { + if (typeof message.identityNonce === "number") + object.identityNonce = options.longs === String ? String(message.identityNonce) : message.identityNonce; + else + object.identityNonce = options.longs === String ? $util.Long.prototype.toString.call(message.identityNonce) : options.longs === Number ? new $util.LongBits(message.identityNonce.low >>> 0, message.identityNonce.high >>> 0).toNumber(true) : message.identityNonce; if (options.oneofs) - object.result = "identities"; + object.result = "identityNonce"; } if (message.proof != null && message.hasOwnProperty("proof")) { object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); @@ -5247,40 +5160,40 @@ $root.org = (function() { }; /** - * Converts this GetIdentitiesResponseV0 to JSON. + * Converts this GetIdentityNonceResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 * @instance * @returns {Object.} JSON object */ - GetIdentitiesResponseV0.prototype.toJSON = function toJSON() { + GetIdentityNonceResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetIdentitiesResponseV0; + return GetIdentityNonceResponseV0; })(); - return GetIdentitiesResponse; + return GetIdentityNonceResponse; })(); - v0.GetIdentityBalanceResponse = (function() { + v0.GetIdentityContractNonceResponse = (function() { /** - * Properties of a GetIdentityBalanceResponse. + * Properties of a GetIdentityContractNonceResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentityBalanceResponse - * @property {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.IGetIdentityBalanceResponseV0|null} [v0] GetIdentityBalanceResponse v0 + * @interface IGetIdentityContractNonceResponse + * @property {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.IGetIdentityContractNonceResponseV0|null} [v0] GetIdentityContractNonceResponse v0 */ /** - * Constructs a new GetIdentityBalanceResponse. + * Constructs a new GetIdentityContractNonceResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentityBalanceResponse. - * @implements IGetIdentityBalanceResponse + * @classdesc Represents a GetIdentityContractNonceResponse. + * @implements IGetIdentityContractNonceResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceResponse=} [properties] Properties to set */ - function GetIdentityBalanceResponse(properties) { + function GetIdentityContractNonceResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5288,89 +5201,89 @@ $root.org = (function() { } /** - * GetIdentityBalanceResponse v0. - * @member {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.IGetIdentityBalanceResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse + * GetIdentityContractNonceResponse v0. + * @member {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.IGetIdentityContractNonceResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse * @instance */ - GetIdentityBalanceResponse.prototype.v0 = null; + GetIdentityContractNonceResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentityBalanceResponse version. + * GetIdentityContractNonceResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse * @instance */ - Object.defineProperty(GetIdentityBalanceResponse.prototype, "version", { + Object.defineProperty(GetIdentityContractNonceResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentityBalanceResponse instance using the specified properties. + * Creates a new GetIdentityContractNonceResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceResponse} GetIdentityBalanceResponse instance + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} GetIdentityContractNonceResponse instance */ - GetIdentityBalanceResponse.create = function create(properties) { - return new GetIdentityBalanceResponse(properties); + GetIdentityContractNonceResponse.create = function create(properties) { + return new GetIdentityContractNonceResponse(properties); }; /** - * Encodes the specified GetIdentityBalanceResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceResponse.verify|verify} messages. + * Encodes the specified GetIdentityContractNonceResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceResponse} message GetIdentityBalanceResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceResponse} message GetIdentityContractNonceResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceResponse.encode = function encode(message, writer) { + GetIdentityContractNonceResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentityBalanceResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceResponse.verify|verify} messages. + * Encodes the specified GetIdentityContractNonceResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceResponse} message GetIdentityBalanceResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityContractNonceResponse} message GetIdentityContractNonceResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityContractNonceResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityBalanceResponse message from the specified reader or buffer. + * Decodes a GetIdentityContractNonceResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceResponse} GetIdentityBalanceResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} GetIdentityContractNonceResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceResponse.decode = function decode(reader, length) { + GetIdentityContractNonceResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -5381,37 +5294,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityBalanceResponse message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityContractNonceResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceResponse} GetIdentityBalanceResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} GetIdentityContractNonceResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceResponse.decodeDelimited = function decodeDelimited(reader) { + GetIdentityContractNonceResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityBalanceResponse message. + * Verifies a GetIdentityContractNonceResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityBalanceResponse.verify = function verify(message) { + GetIdentityContractNonceResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -5420,40 +5333,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentityBalanceResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityContractNonceResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceResponse} GetIdentityBalanceResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} GetIdentityContractNonceResponse */ - GetIdentityBalanceResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse) + GetIdentityContractNonceResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentityBalanceResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityContractNonceResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceResponse} message GetIdentityBalanceResponse + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} message GetIdentityContractNonceResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityBalanceResponse.toObject = function toObject(message, options) { + GetIdentityContractNonceResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -5461,36 +5374,36 @@ $root.org = (function() { }; /** - * Converts this GetIdentityBalanceResponse to JSON. + * Converts this GetIdentityContractNonceResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse * @instance * @returns {Object.} JSON object */ - GetIdentityBalanceResponse.prototype.toJSON = function toJSON() { + GetIdentityContractNonceResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 = (function() { + GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 = (function() { /** - * Properties of a GetIdentityBalanceResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse - * @interface IGetIdentityBalanceResponseV0 - * @property {number|Long|null} [balance] GetIdentityBalanceResponseV0 balance - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityBalanceResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityBalanceResponseV0 metadata + * Properties of a GetIdentityContractNonceResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse + * @interface IGetIdentityContractNonceResponseV0 + * @property {number|Long|null} [identityContractNonce] GetIdentityContractNonceResponseV0 identityContractNonce + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityContractNonceResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityContractNonceResponseV0 metadata */ /** - * Constructs a new GetIdentityBalanceResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse - * @classdesc Represents a GetIdentityBalanceResponseV0. - * @implements IGetIdentityBalanceResponseV0 + * Constructs a new GetIdentityContractNonceResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse + * @classdesc Represents a GetIdentityContractNonceResponseV0. + * @implements IGetIdentityContractNonceResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.IGetIdentityBalanceResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.IGetIdentityContractNonceResponseV0=} [properties] Properties to set */ - function GetIdentityBalanceResponseV0(properties) { + function GetIdentityContractNonceResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5498,69 +5411,69 @@ $root.org = (function() { } /** - * GetIdentityBalanceResponseV0 balance. - * @member {number|Long} balance - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 + * GetIdentityContractNonceResponseV0 identityContractNonce. + * @member {number|Long} identityContractNonce + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @instance */ - GetIdentityBalanceResponseV0.prototype.balance = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + GetIdentityContractNonceResponseV0.prototype.identityContractNonce = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** - * GetIdentityBalanceResponseV0 proof. + * GetIdentityContractNonceResponseV0 proof. * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @instance */ - GetIdentityBalanceResponseV0.prototype.proof = null; + GetIdentityContractNonceResponseV0.prototype.proof = null; /** - * GetIdentityBalanceResponseV0 metadata. + * GetIdentityContractNonceResponseV0 metadata. * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @instance */ - GetIdentityBalanceResponseV0.prototype.metadata = null; + GetIdentityContractNonceResponseV0.prototype.metadata = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentityBalanceResponseV0 result. - * @member {"balance"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 + * GetIdentityContractNonceResponseV0 result. + * @member {"identityContractNonce"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @instance */ - Object.defineProperty(GetIdentityBalanceResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["balance", "proof"]), + Object.defineProperty(GetIdentityContractNonceResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["identityContractNonce", "proof"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentityBalanceResponseV0 instance using the specified properties. + * Creates a new GetIdentityContractNonceResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.IGetIdentityBalanceResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} GetIdentityBalanceResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.IGetIdentityContractNonceResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} GetIdentityContractNonceResponseV0 instance */ - GetIdentityBalanceResponseV0.create = function create(properties) { - return new GetIdentityBalanceResponseV0(properties); + GetIdentityContractNonceResponseV0.create = function create(properties) { + return new GetIdentityContractNonceResponseV0(properties); }; /** - * Encodes the specified GetIdentityBalanceResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.verify|verify} messages. + * Encodes the specified GetIdentityContractNonceResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.IGetIdentityBalanceResponseV0} message GetIdentityBalanceResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.IGetIdentityContractNonceResponseV0} message GetIdentityContractNonceResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceResponseV0.encode = function encode(message, writer) { + GetIdentityContractNonceResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.balance != null && Object.hasOwnProperty.call(message, "balance")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.balance); + if (message.identityContractNonce != null && Object.hasOwnProperty.call(message, "identityContractNonce")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.identityContractNonce); if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) @@ -5569,38 +5482,38 @@ $root.org = (function() { }; /** - * Encodes the specified GetIdentityBalanceResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.verify|verify} messages. + * Encodes the specified GetIdentityContractNonceResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.IGetIdentityBalanceResponseV0} message GetIdentityBalanceResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.IGetIdentityContractNonceResponseV0} message GetIdentityContractNonceResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityContractNonceResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityBalanceResponseV0 message from the specified reader or buffer. + * Decodes a GetIdentityContractNonceResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} GetIdentityBalanceResponseV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} GetIdentityContractNonceResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceResponseV0.decode = function decode(reader, length) { + GetIdentityContractNonceResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.balance = reader.uint64(); + message.identityContractNonce = reader.uint64(); break; case 2: message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); @@ -5617,37 +5530,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityBalanceResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityContractNonceResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} GetIdentityBalanceResponseV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} GetIdentityContractNonceResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceResponseV0.decodeDelimited = function decodeDelimited(reader) { + GetIdentityContractNonceResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityBalanceResponseV0 message. + * Verifies a GetIdentityContractNonceResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityBalanceResponseV0.verify = function verify(message) { + GetIdentityContractNonceResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.balance != null && message.hasOwnProperty("balance")) { + if (message.identityContractNonce != null && message.hasOwnProperty("identityContractNonce")) { properties.result = 1; - if (!$util.isInteger(message.balance) && !(message.balance && $util.isInteger(message.balance.low) && $util.isInteger(message.balance.high))) - return "balance: integer|Long expected"; + if (!$util.isInteger(message.identityContractNonce) && !(message.identityContractNonce && $util.isInteger(message.identityContractNonce.low) && $util.isInteger(message.identityContractNonce.high))) + return "identityContractNonce: integer|Long expected"; } if (message.proof != null && message.hasOwnProperty("proof")) { if (properties.result === 1) @@ -5668,61 +5581,61 @@ $root.org = (function() { }; /** - * Creates a GetIdentityBalanceResponseV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityContractNonceResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} GetIdentityBalanceResponseV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} GetIdentityContractNonceResponseV0 */ - GetIdentityBalanceResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0) + GetIdentityContractNonceResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0(); - if (object.balance != null) + var message = new $root.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0(); + if (object.identityContractNonce != null) if ($util.Long) - (message.balance = $util.Long.fromValue(object.balance)).unsigned = true; - else if (typeof object.balance === "string") - message.balance = parseInt(object.balance, 10); - else if (typeof object.balance === "number") - message.balance = object.balance; - else if (typeof object.balance === "object") - message.balance = new $util.LongBits(object.balance.low >>> 0, object.balance.high >>> 0).toNumber(true); + (message.identityContractNonce = $util.Long.fromValue(object.identityContractNonce)).unsigned = true; + else if (typeof object.identityContractNonce === "string") + message.identityContractNonce = parseInt(object.identityContractNonce, 10); + else if (typeof object.identityContractNonce === "number") + message.identityContractNonce = object.identityContractNonce; + else if (typeof object.identityContractNonce === "object") + message.identityContractNonce = new $util.LongBits(object.identityContractNonce.low >>> 0, object.identityContractNonce.high >>> 0).toNumber(true); if (object.proof != null) { if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.proof: object expected"); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.proof: object expected"); message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); } if (object.metadata != null) { if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.metadata: object expected"); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.metadata: object expected"); message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); } return message; }; /** - * Creates a plain object from a GetIdentityBalanceResponseV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityContractNonceResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} message GetIdentityBalanceResponseV0 + * @param {org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} message GetIdentityContractNonceResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityBalanceResponseV0.toObject = function toObject(message, options) { + GetIdentityContractNonceResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) object.metadata = null; - if (message.balance != null && message.hasOwnProperty("balance")) { - if (typeof message.balance === "number") - object.balance = options.longs === String ? String(message.balance) : message.balance; + if (message.identityContractNonce != null && message.hasOwnProperty("identityContractNonce")) { + if (typeof message.identityContractNonce === "number") + object.identityContractNonce = options.longs === String ? String(message.identityContractNonce) : message.identityContractNonce; else - object.balance = options.longs === String ? $util.Long.prototype.toString.call(message.balance) : options.longs === Number ? new $util.LongBits(message.balance.low >>> 0, message.balance.high >>> 0).toNumber(true) : message.balance; + object.identityContractNonce = options.longs === String ? $util.Long.prototype.toString.call(message.identityContractNonce) : options.longs === Number ? new $util.LongBits(message.identityContractNonce.low >>> 0, message.identityContractNonce.high >>> 0).toNumber(true) : message.identityContractNonce; if (options.oneofs) - object.result = "balance"; + object.result = "identityContractNonce"; } if (message.proof != null && message.hasOwnProperty("proof")) { object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); @@ -5735,40 +5648,40 @@ $root.org = (function() { }; /** - * Converts this GetIdentityBalanceResponseV0 to JSON. + * Converts this GetIdentityContractNonceResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 * @instance * @returns {Object.} JSON object */ - GetIdentityBalanceResponseV0.prototype.toJSON = function toJSON() { + GetIdentityContractNonceResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetIdentityBalanceResponseV0; + return GetIdentityContractNonceResponseV0; })(); - return GetIdentityBalanceResponse; + return GetIdentityContractNonceResponse; })(); - v0.GetIdentityBalanceAndRevisionResponse = (function() { + v0.GetIdentityBalanceResponse = (function() { /** - * Properties of a GetIdentityBalanceAndRevisionResponse. + * Properties of a GetIdentityBalanceResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentityBalanceAndRevisionResponse - * @property {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.IGetIdentityBalanceAndRevisionResponseV0|null} [v0] GetIdentityBalanceAndRevisionResponse v0 + * @interface IGetIdentityBalanceResponse + * @property {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.IGetIdentityBalanceResponseV0|null} [v0] GetIdentityBalanceResponse v0 */ /** - * Constructs a new GetIdentityBalanceAndRevisionResponse. + * Constructs a new GetIdentityBalanceResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentityBalanceAndRevisionResponse. - * @implements IGetIdentityBalanceAndRevisionResponse + * @classdesc Represents a GetIdentityBalanceResponse. + * @implements IGetIdentityBalanceResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceResponse=} [properties] Properties to set */ - function GetIdentityBalanceAndRevisionResponse(properties) { + function GetIdentityBalanceResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5776,89 +5689,89 @@ $root.org = (function() { } /** - * GetIdentityBalanceAndRevisionResponse v0. - * @member {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.IGetIdentityBalanceAndRevisionResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse + * GetIdentityBalanceResponse v0. + * @member {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.IGetIdentityBalanceResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse * @instance */ - GetIdentityBalanceAndRevisionResponse.prototype.v0 = null; + GetIdentityBalanceResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentityBalanceAndRevisionResponse version. + * GetIdentityBalanceResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse * @instance */ - Object.defineProperty(GetIdentityBalanceAndRevisionResponse.prototype, "version", { + Object.defineProperty(GetIdentityBalanceResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentityBalanceAndRevisionResponse instance using the specified properties. + * Creates a new GetIdentityBalanceResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} GetIdentityBalanceAndRevisionResponse instance + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceResponse} GetIdentityBalanceResponse instance */ - GetIdentityBalanceAndRevisionResponse.create = function create(properties) { - return new GetIdentityBalanceAndRevisionResponse(properties); + GetIdentityBalanceResponse.create = function create(properties) { + return new GetIdentityBalanceResponse(properties); }; /** - * Encodes the specified GetIdentityBalanceAndRevisionResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.verify|verify} messages. + * Encodes the specified GetIdentityBalanceResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionResponse} message GetIdentityBalanceAndRevisionResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceResponse} message GetIdentityBalanceResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceAndRevisionResponse.encode = function encode(message, writer) { + GetIdentityBalanceResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentityBalanceAndRevisionResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.verify|verify} messages. + * Encodes the specified GetIdentityBalanceResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionResponse} message GetIdentityBalanceAndRevisionResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceResponse} message GetIdentityBalanceResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceAndRevisionResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityBalanceResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityBalanceAndRevisionResponse message from the specified reader or buffer. + * Decodes a GetIdentityBalanceResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} GetIdentityBalanceAndRevisionResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceResponse} GetIdentityBalanceResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceAndRevisionResponse.decode = function decode(reader, length) { + GetIdentityBalanceResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -5869,37 +5782,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityBalanceAndRevisionResponse message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityBalanceResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} GetIdentityBalanceAndRevisionResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceResponse} GetIdentityBalanceResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceAndRevisionResponse.decodeDelimited = function decodeDelimited(reader) { + GetIdentityBalanceResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityBalanceAndRevisionResponse message. + * Verifies a GetIdentityBalanceResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityBalanceAndRevisionResponse.verify = function verify(message) { + GetIdentityBalanceResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -5908,40 +5821,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentityBalanceAndRevisionResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityBalanceResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} GetIdentityBalanceAndRevisionResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceResponse} GetIdentityBalanceResponse */ - GetIdentityBalanceAndRevisionResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse) + GetIdentityBalanceResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentityBalanceAndRevisionResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityBalanceResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} message GetIdentityBalanceAndRevisionResponse + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceResponse} message GetIdentityBalanceResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityBalanceAndRevisionResponse.toObject = function toObject(message, options) { + GetIdentityBalanceResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -5949,36 +5862,36 @@ $root.org = (function() { }; /** - * Converts this GetIdentityBalanceAndRevisionResponse to JSON. + * Converts this GetIdentityBalanceResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse * @instance * @returns {Object.} JSON object */ - GetIdentityBalanceAndRevisionResponse.prototype.toJSON = function toJSON() { + GetIdentityBalanceResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 = (function() { + GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 = (function() { /** - * Properties of a GetIdentityBalanceAndRevisionResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse - * @interface IGetIdentityBalanceAndRevisionResponseV0 - * @property {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.IBalanceAndRevision|null} [balanceAndRevision] GetIdentityBalanceAndRevisionResponseV0 balanceAndRevision - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityBalanceAndRevisionResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityBalanceAndRevisionResponseV0 metadata + * Properties of a GetIdentityBalanceResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse + * @interface IGetIdentityBalanceResponseV0 + * @property {number|Long|null} [balance] GetIdentityBalanceResponseV0 balance + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityBalanceResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityBalanceResponseV0 metadata */ /** - * Constructs a new GetIdentityBalanceAndRevisionResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse - * @classdesc Represents a GetIdentityBalanceAndRevisionResponseV0. - * @implements IGetIdentityBalanceAndRevisionResponseV0 + * Constructs a new GetIdentityBalanceResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse + * @classdesc Represents a GetIdentityBalanceResponseV0. + * @implements IGetIdentityBalanceResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.IGetIdentityBalanceAndRevisionResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.IGetIdentityBalanceResponseV0=} [properties] Properties to set */ - function GetIdentityBalanceAndRevisionResponseV0(properties) { + function GetIdentityBalanceResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5986,69 +5899,69 @@ $root.org = (function() { } /** - * GetIdentityBalanceAndRevisionResponseV0 balanceAndRevision. - * @member {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.IBalanceAndRevision|null|undefined} balanceAndRevision - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * GetIdentityBalanceResponseV0 balance. + * @member {number|Long} balance + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 * @instance */ - GetIdentityBalanceAndRevisionResponseV0.prototype.balanceAndRevision = null; + GetIdentityBalanceResponseV0.prototype.balance = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** - * GetIdentityBalanceAndRevisionResponseV0 proof. + * GetIdentityBalanceResponseV0 proof. * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 * @instance */ - GetIdentityBalanceAndRevisionResponseV0.prototype.proof = null; + GetIdentityBalanceResponseV0.prototype.proof = null; /** - * GetIdentityBalanceAndRevisionResponseV0 metadata. + * GetIdentityBalanceResponseV0 metadata. * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 * @instance */ - GetIdentityBalanceAndRevisionResponseV0.prototype.metadata = null; + GetIdentityBalanceResponseV0.prototype.metadata = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentityBalanceAndRevisionResponseV0 result. - * @member {"balanceAndRevision"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * GetIdentityBalanceResponseV0 result. + * @member {"balance"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 * @instance */ - Object.defineProperty(GetIdentityBalanceAndRevisionResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["balanceAndRevision", "proof"]), + Object.defineProperty(GetIdentityBalanceResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["balance", "proof"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentityBalanceAndRevisionResponseV0 instance using the specified properties. + * Creates a new GetIdentityBalanceResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.IGetIdentityBalanceAndRevisionResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} GetIdentityBalanceAndRevisionResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.IGetIdentityBalanceResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} GetIdentityBalanceResponseV0 instance */ - GetIdentityBalanceAndRevisionResponseV0.create = function create(properties) { - return new GetIdentityBalanceAndRevisionResponseV0(properties); + GetIdentityBalanceResponseV0.create = function create(properties) { + return new GetIdentityBalanceResponseV0(properties); }; /** - * Encodes the specified GetIdentityBalanceAndRevisionResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.verify|verify} messages. + * Encodes the specified GetIdentityBalanceResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.IGetIdentityBalanceAndRevisionResponseV0} message GetIdentityBalanceAndRevisionResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.IGetIdentityBalanceResponseV0} message GetIdentityBalanceResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceAndRevisionResponseV0.encode = function encode(message, writer) { + GetIdentityBalanceResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.balanceAndRevision != null && Object.hasOwnProperty.call(message, "balanceAndRevision")) - $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.encode(message.balanceAndRevision, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.balance != null && Object.hasOwnProperty.call(message, "balance")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.balance); if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) @@ -6057,38 +5970,38 @@ $root.org = (function() { }; /** - * Encodes the specified GetIdentityBalanceAndRevisionResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.verify|verify} messages. + * Encodes the specified GetIdentityBalanceResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.IGetIdentityBalanceAndRevisionResponseV0} message GetIdentityBalanceAndRevisionResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.IGetIdentityBalanceResponseV0} message GetIdentityBalanceResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityBalanceAndRevisionResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityBalanceResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityBalanceAndRevisionResponseV0 message from the specified reader or buffer. + * Decodes a GetIdentityBalanceResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} GetIdentityBalanceAndRevisionResponseV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} GetIdentityBalanceResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceAndRevisionResponseV0.decode = function decode(reader, length) { + GetIdentityBalanceResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.balanceAndRevision = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.decode(reader, reader.uint32()); + message.balance = reader.uint64(); break; case 2: message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); @@ -6105,40 +6018,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityBalanceAndRevisionResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityBalanceResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} GetIdentityBalanceAndRevisionResponseV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} GetIdentityBalanceResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityBalanceAndRevisionResponseV0.decodeDelimited = function decodeDelimited(reader) { + GetIdentityBalanceResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityBalanceAndRevisionResponseV0 message. + * Verifies a GetIdentityBalanceResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityBalanceAndRevisionResponseV0.verify = function verify(message) { + GetIdentityBalanceResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.balanceAndRevision != null && message.hasOwnProperty("balanceAndRevision")) { + if (message.balance != null && message.hasOwnProperty("balance")) { properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.verify(message.balanceAndRevision); - if (error) - return "balanceAndRevision." + error; - } + if (!$util.isInteger(message.balance) && !(message.balance && $util.isInteger(message.balance.low) && $util.isInteger(message.balance.high))) + return "balance: integer|Long expected"; } if (message.proof != null && message.hasOwnProperty("proof")) { if (properties.result === 1) @@ -6159,54 +6069,61 @@ $root.org = (function() { }; /** - * Creates a GetIdentityBalanceAndRevisionResponseV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityBalanceResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} GetIdentityBalanceAndRevisionResponseV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} GetIdentityBalanceResponseV0 */ - GetIdentityBalanceAndRevisionResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0) + GetIdentityBalanceResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0(); - if (object.balanceAndRevision != null) { - if (typeof object.balanceAndRevision !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.balanceAndRevision: object expected"); - message.balanceAndRevision = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.fromObject(object.balanceAndRevision); - } + var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0(); + if (object.balance != null) + if ($util.Long) + (message.balance = $util.Long.fromValue(object.balance)).unsigned = true; + else if (typeof object.balance === "string") + message.balance = parseInt(object.balance, 10); + else if (typeof object.balance === "number") + message.balance = object.balance; + else if (typeof object.balance === "object") + message.balance = new $util.LongBits(object.balance.low >>> 0, object.balance.high >>> 0).toNumber(true); if (object.proof != null) { if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.proof: object expected"); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.proof: object expected"); message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); } if (object.metadata != null) { if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.metadata: object expected"); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.metadata: object expected"); message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); } return message; }; /** - * Creates a plain object from a GetIdentityBalanceAndRevisionResponseV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityBalanceResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} message GetIdentityBalanceAndRevisionResponseV0 + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} message GetIdentityBalanceResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityBalanceAndRevisionResponseV0.toObject = function toObject(message, options) { + GetIdentityBalanceResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) object.metadata = null; - if (message.balanceAndRevision != null && message.hasOwnProperty("balanceAndRevision")) { - object.balanceAndRevision = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject(message.balanceAndRevision, options); + if (message.balance != null && message.hasOwnProperty("balance")) { + if (typeof message.balance === "number") + object.balance = options.longs === String ? String(message.balance) : message.balance; + else + object.balance = options.longs === String ? $util.Long.prototype.toString.call(message.balance) : options.longs === Number ? new $util.LongBits(message.balance.low >>> 0, message.balance.high >>> 0).toNumber(true) : message.balance; if (options.oneofs) - object.result = "balanceAndRevision"; + object.result = "balance"; } if (message.proof != null && message.hasOwnProperty("proof")) { object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); @@ -6219,396 +6136,130 @@ $root.org = (function() { }; /** - * Converts this GetIdentityBalanceAndRevisionResponseV0 to JSON. + * Converts this GetIdentityBalanceResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0 * @instance * @returns {Object.} JSON object */ - GetIdentityBalanceAndRevisionResponseV0.prototype.toJSON = function toJSON() { + GetIdentityBalanceResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision = (function() { + return GetIdentityBalanceResponseV0; + })(); - /** - * Properties of a BalanceAndRevision. - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 - * @interface IBalanceAndRevision - * @property {number|Long|null} [balance] BalanceAndRevision balance - * @property {number|Long|null} [revision] BalanceAndRevision revision - */ + return GetIdentityBalanceResponse; + })(); - /** - * Constructs a new BalanceAndRevision. - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 - * @classdesc Represents a BalanceAndRevision. - * @implements IBalanceAndRevision - * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.IBalanceAndRevision=} [properties] Properties to set - */ - function BalanceAndRevision(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v0.GetIdentityBalanceAndRevisionResponse = (function() { - /** - * BalanceAndRevision balance. - * @member {number|Long} balance - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision - * @instance - */ - BalanceAndRevision.prototype.balance = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + /** + * Properties of a GetIdentityBalanceAndRevisionResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetIdentityBalanceAndRevisionResponse + * @property {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.IGetIdentityBalanceAndRevisionResponseV0|null} [v0] GetIdentityBalanceAndRevisionResponse v0 + */ - /** - * BalanceAndRevision revision. - * @member {number|Long} revision - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision - * @instance - */ - BalanceAndRevision.prototype.revision = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Creates a new BalanceAndRevision instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision - * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.IBalanceAndRevision=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} BalanceAndRevision instance - */ - BalanceAndRevision.create = function create(properties) { - return new BalanceAndRevision(properties); - }; - - /** - * Encodes the specified BalanceAndRevision message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision - * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.IBalanceAndRevision} message BalanceAndRevision message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BalanceAndRevision.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.balance != null && Object.hasOwnProperty.call(message, "balance")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.balance); - if (message.revision != null && Object.hasOwnProperty.call(message, "revision")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.revision); - return writer; - }; - - /** - * Encodes the specified BalanceAndRevision message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision - * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.IBalanceAndRevision} message BalanceAndRevision message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BalanceAndRevision.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BalanceAndRevision message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} BalanceAndRevision - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BalanceAndRevision.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.balance = reader.uint64(); - break; - case 2: - message.revision = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BalanceAndRevision message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} BalanceAndRevision - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BalanceAndRevision.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BalanceAndRevision message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BalanceAndRevision.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.balance != null && message.hasOwnProperty("balance")) - if (!$util.isInteger(message.balance) && !(message.balance && $util.isInteger(message.balance.low) && $util.isInteger(message.balance.high))) - return "balance: integer|Long expected"; - if (message.revision != null && message.hasOwnProperty("revision")) - if (!$util.isInteger(message.revision) && !(message.revision && $util.isInteger(message.revision.low) && $util.isInteger(message.revision.high))) - return "revision: integer|Long expected"; - return null; - }; - - /** - * Creates a BalanceAndRevision message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} BalanceAndRevision - */ - BalanceAndRevision.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision(); - if (object.balance != null) - if ($util.Long) - (message.balance = $util.Long.fromValue(object.balance)).unsigned = true; - else if (typeof object.balance === "string") - message.balance = parseInt(object.balance, 10); - else if (typeof object.balance === "number") - message.balance = object.balance; - else if (typeof object.balance === "object") - message.balance = new $util.LongBits(object.balance.low >>> 0, object.balance.high >>> 0).toNumber(true); - if (object.revision != null) - if ($util.Long) - (message.revision = $util.Long.fromValue(object.revision)).unsigned = true; - else if (typeof object.revision === "string") - message.revision = parseInt(object.revision, 10); - else if (typeof object.revision === "number") - message.revision = object.revision; - else if (typeof object.revision === "object") - message.revision = new $util.LongBits(object.revision.low >>> 0, object.revision.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a BalanceAndRevision message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision - * @static - * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} message BalanceAndRevision - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BalanceAndRevision.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, true); - object.balance = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.balance = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, true); - object.revision = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.revision = options.longs === String ? "0" : 0; - } - if (message.balance != null && message.hasOwnProperty("balance")) - if (typeof message.balance === "number") - object.balance = options.longs === String ? String(message.balance) : message.balance; - else - object.balance = options.longs === String ? $util.Long.prototype.toString.call(message.balance) : options.longs === Number ? new $util.LongBits(message.balance.low >>> 0, message.balance.high >>> 0).toNumber(true) : message.balance; - if (message.revision != null && message.hasOwnProperty("revision")) - if (typeof message.revision === "number") - object.revision = options.longs === String ? String(message.revision) : message.revision; - else - object.revision = options.longs === String ? $util.Long.prototype.toString.call(message.revision) : options.longs === Number ? new $util.LongBits(message.revision.low >>> 0, message.revision.high >>> 0).toNumber(true) : message.revision; - return object; - }; - - /** - * Converts this BalanceAndRevision to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision - * @instance - * @returns {Object.} JSON object - */ - BalanceAndRevision.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return BalanceAndRevision; - })(); - - return GetIdentityBalanceAndRevisionResponseV0; - })(); - - return GetIdentityBalanceAndRevisionResponse; - })(); - - v0.KeyRequestType = (function() { - - /** - * Properties of a KeyRequestType. - * @memberof org.dash.platform.dapi.v0 - * @interface IKeyRequestType - * @property {org.dash.platform.dapi.v0.IAllKeys|null} [allKeys] KeyRequestType allKeys - * @property {org.dash.platform.dapi.v0.ISpecificKeys|null} [specificKeys] KeyRequestType specificKeys - * @property {org.dash.platform.dapi.v0.ISearchKey|null} [searchKey] KeyRequestType searchKey - */ - - /** - * Constructs a new KeyRequestType. - * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a KeyRequestType. - * @implements IKeyRequestType - * @constructor - * @param {org.dash.platform.dapi.v0.IKeyRequestType=} [properties] Properties to set - */ - function KeyRequestType(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * KeyRequestType allKeys. - * @member {org.dash.platform.dapi.v0.IAllKeys|null|undefined} allKeys - * @memberof org.dash.platform.dapi.v0.KeyRequestType - * @instance - */ - KeyRequestType.prototype.allKeys = null; - - /** - * KeyRequestType specificKeys. - * @member {org.dash.platform.dapi.v0.ISpecificKeys|null|undefined} specificKeys - * @memberof org.dash.platform.dapi.v0.KeyRequestType - * @instance - */ - KeyRequestType.prototype.specificKeys = null; + /** + * Constructs a new GetIdentityBalanceAndRevisionResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetIdentityBalanceAndRevisionResponse. + * @implements IGetIdentityBalanceAndRevisionResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionResponse=} [properties] Properties to set + */ + function GetIdentityBalanceAndRevisionResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * KeyRequestType searchKey. - * @member {org.dash.platform.dapi.v0.ISearchKey|null|undefined} searchKey - * @memberof org.dash.platform.dapi.v0.KeyRequestType + * GetIdentityBalanceAndRevisionResponse v0. + * @member {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.IGetIdentityBalanceAndRevisionResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse * @instance */ - KeyRequestType.prototype.searchKey = null; + GetIdentityBalanceAndRevisionResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * KeyRequestType request. - * @member {"allKeys"|"specificKeys"|"searchKey"|undefined} request - * @memberof org.dash.platform.dapi.v0.KeyRequestType + * GetIdentityBalanceAndRevisionResponse version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse * @instance */ - Object.defineProperty(KeyRequestType.prototype, "request", { - get: $util.oneOfGetter($oneOfFields = ["allKeys", "specificKeys", "searchKey"]), + Object.defineProperty(GetIdentityBalanceAndRevisionResponse.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new KeyRequestType instance using the specified properties. + * Creates a new GetIdentityBalanceAndRevisionResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse * @static - * @param {org.dash.platform.dapi.v0.IKeyRequestType=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.KeyRequestType} KeyRequestType instance + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} GetIdentityBalanceAndRevisionResponse instance */ - KeyRequestType.create = function create(properties) { - return new KeyRequestType(properties); + GetIdentityBalanceAndRevisionResponse.create = function create(properties) { + return new GetIdentityBalanceAndRevisionResponse(properties); }; /** - * Encodes the specified KeyRequestType message. Does not implicitly {@link org.dash.platform.dapi.v0.KeyRequestType.verify|verify} messages. + * Encodes the specified GetIdentityBalanceAndRevisionResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse * @static - * @param {org.dash.platform.dapi.v0.IKeyRequestType} message KeyRequestType message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionResponse} message GetIdentityBalanceAndRevisionResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - KeyRequestType.encode = function encode(message, writer) { + GetIdentityBalanceAndRevisionResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.allKeys != null && Object.hasOwnProperty.call(message, "allKeys")) - $root.org.dash.platform.dapi.v0.AllKeys.encode(message.allKeys, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.specificKeys != null && Object.hasOwnProperty.call(message, "specificKeys")) - $root.org.dash.platform.dapi.v0.SpecificKeys.encode(message.specificKeys, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.searchKey != null && Object.hasOwnProperty.call(message, "searchKey")) - $root.org.dash.platform.dapi.v0.SearchKey.encode(message.searchKey, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified KeyRequestType message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.KeyRequestType.verify|verify} messages. + * Encodes the specified GetIdentityBalanceAndRevisionResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse * @static - * @param {org.dash.platform.dapi.v0.IKeyRequestType} message KeyRequestType message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityBalanceAndRevisionResponse} message GetIdentityBalanceAndRevisionResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - KeyRequestType.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityBalanceAndRevisionResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a KeyRequestType message from the specified reader or buffer. + * Decodes a GetIdentityBalanceAndRevisionResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.KeyRequestType} KeyRequestType + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} GetIdentityBalanceAndRevisionResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - KeyRequestType.decode = function decode(reader, length) { + GetIdentityBalanceAndRevisionResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.KeyRequestType(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.allKeys = $root.org.dash.platform.dapi.v0.AllKeys.decode(reader, reader.uint32()); - break; - case 2: - message.specificKeys = $root.org.dash.platform.dapi.v0.SpecificKeys.decode(reader, reader.uint32()); - break; - case 3: - message.searchKey = $root.org.dash.platform.dapi.v0.SearchKey.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -6619,762 +6270,2965 @@ $root.org = (function() { }; /** - * Decodes a KeyRequestType message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityBalanceAndRevisionResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.KeyRequestType} KeyRequestType + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} GetIdentityBalanceAndRevisionResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - KeyRequestType.decodeDelimited = function decodeDelimited(reader) { + GetIdentityBalanceAndRevisionResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a KeyRequestType message. + * Verifies a GetIdentityBalanceAndRevisionResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - KeyRequestType.verify = function verify(message) { + GetIdentityBalanceAndRevisionResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.allKeys != null && message.hasOwnProperty("allKeys")) { - properties.request = 1; - { - var error = $root.org.dash.platform.dapi.v0.AllKeys.verify(message.allKeys); - if (error) - return "allKeys." + error; - } - } - if (message.specificKeys != null && message.hasOwnProperty("specificKeys")) { - if (properties.request === 1) - return "request: multiple values"; - properties.request = 1; - { - var error = $root.org.dash.platform.dapi.v0.SpecificKeys.verify(message.specificKeys); - if (error) - return "specificKeys." + error; - } - } - if (message.searchKey != null && message.hasOwnProperty("searchKey")) { - if (properties.request === 1) - return "request: multiple values"; - properties.request = 1; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.SearchKey.verify(message.searchKey); + var error = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.verify(message.v0); if (error) - return "searchKey." + error; + return "v0." + error; } } return null; }; /** - * Creates a KeyRequestType message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityBalanceAndRevisionResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.KeyRequestType} KeyRequestType + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} GetIdentityBalanceAndRevisionResponse */ - KeyRequestType.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.KeyRequestType) + GetIdentityBalanceAndRevisionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.KeyRequestType(); - if (object.allKeys != null) { - if (typeof object.allKeys !== "object") - throw TypeError(".org.dash.platform.dapi.v0.KeyRequestType.allKeys: object expected"); - message.allKeys = $root.org.dash.platform.dapi.v0.AllKeys.fromObject(object.allKeys); - } - if (object.specificKeys != null) { - if (typeof object.specificKeys !== "object") - throw TypeError(".org.dash.platform.dapi.v0.KeyRequestType.specificKeys: object expected"); - message.specificKeys = $root.org.dash.platform.dapi.v0.SpecificKeys.fromObject(object.specificKeys); - } - if (object.searchKey != null) { - if (typeof object.searchKey !== "object") - throw TypeError(".org.dash.platform.dapi.v0.KeyRequestType.searchKey: object expected"); - message.searchKey = $root.org.dash.platform.dapi.v0.SearchKey.fromObject(object.searchKey); + var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a KeyRequestType message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityBalanceAndRevisionResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse * @static - * @param {org.dash.platform.dapi.v0.KeyRequestType} message KeyRequestType + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} message GetIdentityBalanceAndRevisionResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - KeyRequestType.toObject = function toObject(message, options) { + GetIdentityBalanceAndRevisionResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.allKeys != null && message.hasOwnProperty("allKeys")) { - object.allKeys = $root.org.dash.platform.dapi.v0.AllKeys.toObject(message.allKeys, options); - if (options.oneofs) - object.request = "allKeys"; - } - if (message.specificKeys != null && message.hasOwnProperty("specificKeys")) { - object.specificKeys = $root.org.dash.platform.dapi.v0.SpecificKeys.toObject(message.specificKeys, options); - if (options.oneofs) - object.request = "specificKeys"; - } - if (message.searchKey != null && message.hasOwnProperty("searchKey")) { - object.searchKey = $root.org.dash.platform.dapi.v0.SearchKey.toObject(message.searchKey, options); + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject(message.v0, options); if (options.oneofs) - object.request = "searchKey"; + object.version = "v0"; } return object; }; /** - * Converts this KeyRequestType to JSON. + * Converts this GetIdentityBalanceAndRevisionResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse * @instance * @returns {Object.} JSON object */ - KeyRequestType.prototype.toJSON = function toJSON() { + GetIdentityBalanceAndRevisionResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return KeyRequestType; - })(); + GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 = (function() { - v0.AllKeys = (function() { + /** + * Properties of a GetIdentityBalanceAndRevisionResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse + * @interface IGetIdentityBalanceAndRevisionResponseV0 + * @property {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.IBalanceAndRevision|null} [balanceAndRevision] GetIdentityBalanceAndRevisionResponseV0 balanceAndRevision + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityBalanceAndRevisionResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityBalanceAndRevisionResponseV0 metadata + */ - /** - * Properties of an AllKeys. - * @memberof org.dash.platform.dapi.v0 - * @interface IAllKeys - */ + /** + * Constructs a new GetIdentityBalanceAndRevisionResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse + * @classdesc Represents a GetIdentityBalanceAndRevisionResponseV0. + * @implements IGetIdentityBalanceAndRevisionResponseV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.IGetIdentityBalanceAndRevisionResponseV0=} [properties] Properties to set + */ + function GetIdentityBalanceAndRevisionResponseV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new AllKeys. - * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents an AllKeys. - * @implements IAllKeys - * @constructor - * @param {org.dash.platform.dapi.v0.IAllKeys=} [properties] Properties to set - */ - function AllKeys(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * GetIdentityBalanceAndRevisionResponseV0 balanceAndRevision. + * @member {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.IBalanceAndRevision|null|undefined} balanceAndRevision + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @instance + */ + GetIdentityBalanceAndRevisionResponseV0.prototype.balanceAndRevision = null; - /** - * Creates a new AllKeys instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.AllKeys - * @static - * @param {org.dash.platform.dapi.v0.IAllKeys=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.AllKeys} AllKeys instance - */ - AllKeys.create = function create(properties) { - return new AllKeys(properties); - }; + /** + * GetIdentityBalanceAndRevisionResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @instance + */ + GetIdentityBalanceAndRevisionResponseV0.prototype.proof = null; - /** - * Encodes the specified AllKeys message. Does not implicitly {@link org.dash.platform.dapi.v0.AllKeys.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.AllKeys - * @static - * @param {org.dash.platform.dapi.v0.IAllKeys} message AllKeys message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AllKeys.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; + /** + * GetIdentityBalanceAndRevisionResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @instance + */ + GetIdentityBalanceAndRevisionResponseV0.prototype.metadata = null; - /** - * Encodes the specified AllKeys message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.AllKeys.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.AllKeys - * @static - * @param {org.dash.platform.dapi.v0.IAllKeys} message AllKeys message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AllKeys.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AllKeys message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.AllKeys - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.AllKeys} AllKeys - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AllKeys.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.AllKeys(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AllKeys message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.AllKeys - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.AllKeys} AllKeys - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AllKeys.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; - /** - * Verifies an AllKeys message. - * @function verify - * @memberof org.dash.platform.dapi.v0.AllKeys - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AllKeys.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; + /** + * GetIdentityBalanceAndRevisionResponseV0 result. + * @member {"balanceAndRevision"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @instance + */ + Object.defineProperty(GetIdentityBalanceAndRevisionResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["balanceAndRevision", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); - /** - * Creates an AllKeys message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.AllKeys - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.AllKeys} AllKeys - */ - AllKeys.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.AllKeys) - return object; - return new $root.org.dash.platform.dapi.v0.AllKeys(); - }; + /** + * Creates a new GetIdentityBalanceAndRevisionResponseV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.IGetIdentityBalanceAndRevisionResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} GetIdentityBalanceAndRevisionResponseV0 instance + */ + GetIdentityBalanceAndRevisionResponseV0.create = function create(properties) { + return new GetIdentityBalanceAndRevisionResponseV0(properties); + }; - /** - * Creates a plain object from an AllKeys message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.AllKeys - * @static - * @param {org.dash.platform.dapi.v0.AllKeys} message AllKeys - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AllKeys.toObject = function toObject() { - return {}; - }; + /** + * Encodes the specified GetIdentityBalanceAndRevisionResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.IGetIdentityBalanceAndRevisionResponseV0} message GetIdentityBalanceAndRevisionResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityBalanceAndRevisionResponseV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.balanceAndRevision != null && Object.hasOwnProperty.call(message, "balanceAndRevision")) + $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.encode(message.balanceAndRevision, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; - /** - * Converts this AllKeys to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.AllKeys - * @instance - * @returns {Object.} JSON object - */ - AllKeys.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Encodes the specified GetIdentityBalanceAndRevisionResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.IGetIdentityBalanceAndRevisionResponseV0} message GetIdentityBalanceAndRevisionResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityBalanceAndRevisionResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - return AllKeys; - })(); + /** + * Decodes a GetIdentityBalanceAndRevisionResponseV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} GetIdentityBalanceAndRevisionResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityBalanceAndRevisionResponseV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.balanceAndRevision = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.decode(reader, reader.uint32()); + break; + case 2: + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - v0.SpecificKeys = (function() { + /** + * Decodes a GetIdentityBalanceAndRevisionResponseV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} GetIdentityBalanceAndRevisionResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityBalanceAndRevisionResponseV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Properties of a SpecificKeys. - * @memberof org.dash.platform.dapi.v0 - * @interface ISpecificKeys - * @property {Array.|null} [keyIds] SpecificKeys keyIds - */ + /** + * Verifies a GetIdentityBalanceAndRevisionResponseV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIdentityBalanceAndRevisionResponseV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.balanceAndRevision != null && message.hasOwnProperty("balanceAndRevision")) { + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.verify(message.balanceAndRevision); + if (error) + return "balanceAndRevision." + error; + } + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; - /** - * Constructs a new SpecificKeys. - * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a SpecificKeys. - * @implements ISpecificKeys - * @constructor - * @param {org.dash.platform.dapi.v0.ISpecificKeys=} [properties] Properties to set - */ - function SpecificKeys(properties) { - this.keyIds = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Creates a GetIdentityBalanceAndRevisionResponseV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} GetIdentityBalanceAndRevisionResponseV0 + */ + GetIdentityBalanceAndRevisionResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0(); + if (object.balanceAndRevision != null) { + if (typeof object.balanceAndRevision !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.balanceAndRevision: object expected"); + message.balanceAndRevision = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.fromObject(object.balanceAndRevision); + } + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } + return message; + }; - /** - * SpecificKeys keyIds. - * @member {Array.} keyIds - * @memberof org.dash.platform.dapi.v0.SpecificKeys - * @instance - */ - SpecificKeys.prototype.keyIds = $util.emptyArray; + /** + * Creates a plain object from a GetIdentityBalanceAndRevisionResponseV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} message GetIdentityBalanceAndRevisionResponseV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIdentityBalanceAndRevisionResponseV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.balanceAndRevision != null && message.hasOwnProperty("balanceAndRevision")) { + object.balanceAndRevision = $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject(message.balanceAndRevision, options); + if (options.oneofs) + object.result = "balanceAndRevision"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + return object; + }; - /** - * Creates a new SpecificKeys instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.SpecificKeys - * @static - * @param {org.dash.platform.dapi.v0.ISpecificKeys=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.SpecificKeys} SpecificKeys instance - */ - SpecificKeys.create = function create(properties) { - return new SpecificKeys(properties); - }; + /** + * Converts this GetIdentityBalanceAndRevisionResponseV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @instance + * @returns {Object.} JSON object + */ + GetIdentityBalanceAndRevisionResponseV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Encodes the specified SpecificKeys message. Does not implicitly {@link org.dash.platform.dapi.v0.SpecificKeys.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.SpecificKeys - * @static - * @param {org.dash.platform.dapi.v0.ISpecificKeys} message SpecificKeys message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SpecificKeys.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.keyIds != null && message.keyIds.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (var i = 0; i < message.keyIds.length; ++i) - writer.uint32(message.keyIds[i]); - writer.ldelim(); - } - return writer; - }; + GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision = (function() { - /** - * Encodes the specified SpecificKeys message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.SpecificKeys.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.SpecificKeys - * @static - * @param {org.dash.platform.dapi.v0.ISpecificKeys} message SpecificKeys message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SpecificKeys.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Properties of a BalanceAndRevision. + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @interface IBalanceAndRevision + * @property {number|Long|null} [balance] BalanceAndRevision balance + * @property {number|Long|null} [revision] BalanceAndRevision revision + */ - /** - * Decodes a SpecificKeys message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.SpecificKeys - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.SpecificKeys} SpecificKeys - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SpecificKeys.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.SpecificKeys(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.keyIds && message.keyIds.length)) - message.keyIds = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.keyIds.push(reader.uint32()); - } else - message.keyIds.push(reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Constructs a new BalanceAndRevision. + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0 + * @classdesc Represents a BalanceAndRevision. + * @implements IBalanceAndRevision + * @constructor + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.IBalanceAndRevision=} [properties] Properties to set + */ + function BalanceAndRevision(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - } - return message; - }; - /** - * Decodes a SpecificKeys message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.SpecificKeys - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.SpecificKeys} SpecificKeys - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SpecificKeys.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * BalanceAndRevision balance. + * @member {number|Long} balance + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision + * @instance + */ + BalanceAndRevision.prototype.balance = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - /** - * Verifies a SpecificKeys message. - * @function verify - * @memberof org.dash.platform.dapi.v0.SpecificKeys - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SpecificKeys.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.keyIds != null && message.hasOwnProperty("keyIds")) { - if (!Array.isArray(message.keyIds)) - return "keyIds: array expected"; - for (var i = 0; i < message.keyIds.length; ++i) - if (!$util.isInteger(message.keyIds[i])) - return "keyIds: integer[] expected"; - } - return null; - }; + /** + * BalanceAndRevision revision. + * @member {number|Long} revision + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision + * @instance + */ + BalanceAndRevision.prototype.revision = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - /** - * Creates a SpecificKeys message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.SpecificKeys - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.SpecificKeys} SpecificKeys - */ - SpecificKeys.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.SpecificKeys) - return object; - var message = new $root.org.dash.platform.dapi.v0.SpecificKeys(); - if (object.keyIds) { - if (!Array.isArray(object.keyIds)) - throw TypeError(".org.dash.platform.dapi.v0.SpecificKeys.keyIds: array expected"); - message.keyIds = []; - for (var i = 0; i < object.keyIds.length; ++i) - message.keyIds[i] = object.keyIds[i] >>> 0; - } - return message; - }; + /** + * Creates a new BalanceAndRevision instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.IBalanceAndRevision=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} BalanceAndRevision instance + */ + BalanceAndRevision.create = function create(properties) { + return new BalanceAndRevision(properties); + }; - /** - * Creates a plain object from a SpecificKeys message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.SpecificKeys - * @static - * @param {org.dash.platform.dapi.v0.SpecificKeys} message SpecificKeys - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SpecificKeys.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.keyIds = []; - if (message.keyIds && message.keyIds.length) { - object.keyIds = []; - for (var j = 0; j < message.keyIds.length; ++j) - object.keyIds[j] = message.keyIds[j]; - } - return object; - }; + /** + * Encodes the specified BalanceAndRevision message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.IBalanceAndRevision} message BalanceAndRevision message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BalanceAndRevision.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.balance != null && Object.hasOwnProperty.call(message, "balance")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.balance); + if (message.revision != null && Object.hasOwnProperty.call(message, "revision")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.revision); + return writer; + }; - /** - * Converts this SpecificKeys to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.SpecificKeys - * @instance - * @returns {Object.} JSON object - */ - SpecificKeys.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Encodes the specified BalanceAndRevision message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.IBalanceAndRevision} message BalanceAndRevision message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BalanceAndRevision.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - return SpecificKeys; + /** + * Decodes a BalanceAndRevision message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} BalanceAndRevision + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BalanceAndRevision.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.balance = reader.uint64(); + break; + case 2: + message.revision = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BalanceAndRevision message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} BalanceAndRevision + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BalanceAndRevision.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BalanceAndRevision message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BalanceAndRevision.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.balance != null && message.hasOwnProperty("balance")) + if (!$util.isInteger(message.balance) && !(message.balance && $util.isInteger(message.balance.low) && $util.isInteger(message.balance.high))) + return "balance: integer|Long expected"; + if (message.revision != null && message.hasOwnProperty("revision")) + if (!$util.isInteger(message.revision) && !(message.revision && $util.isInteger(message.revision.low) && $util.isInteger(message.revision.high))) + return "revision: integer|Long expected"; + return null; + }; + + /** + * Creates a BalanceAndRevision message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} BalanceAndRevision + */ + BalanceAndRevision.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision(); + if (object.balance != null) + if ($util.Long) + (message.balance = $util.Long.fromValue(object.balance)).unsigned = true; + else if (typeof object.balance === "string") + message.balance = parseInt(object.balance, 10); + else if (typeof object.balance === "number") + message.balance = object.balance; + else if (typeof object.balance === "object") + message.balance = new $util.LongBits(object.balance.low >>> 0, object.balance.high >>> 0).toNumber(true); + if (object.revision != null) + if ($util.Long) + (message.revision = $util.Long.fromValue(object.revision)).unsigned = true; + else if (typeof object.revision === "string") + message.revision = parseInt(object.revision, 10); + else if (typeof object.revision === "number") + message.revision = object.revision; + else if (typeof object.revision === "object") + message.revision = new $util.LongBits(object.revision.low >>> 0, object.revision.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a BalanceAndRevision message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} message BalanceAndRevision + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BalanceAndRevision.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.balance = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.balance = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.revision = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.revision = options.longs === String ? "0" : 0; + } + if (message.balance != null && message.hasOwnProperty("balance")) + if (typeof message.balance === "number") + object.balance = options.longs === String ? String(message.balance) : message.balance; + else + object.balance = options.longs === String ? $util.Long.prototype.toString.call(message.balance) : options.longs === Number ? new $util.LongBits(message.balance.low >>> 0, message.balance.high >>> 0).toNumber(true) : message.balance; + if (message.revision != null && message.hasOwnProperty("revision")) + if (typeof message.revision === "number") + object.revision = options.longs === String ? String(message.revision) : message.revision; + else + object.revision = options.longs === String ? $util.Long.prototype.toString.call(message.revision) : options.longs === Number ? new $util.LongBits(message.revision.low >>> 0, message.revision.high >>> 0).toNumber(true) : message.revision; + return object; + }; + + /** + * Converts this BalanceAndRevision to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision + * @instance + * @returns {Object.} JSON object + */ + BalanceAndRevision.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BalanceAndRevision; + })(); + + return GetIdentityBalanceAndRevisionResponseV0; + })(); + + return GetIdentityBalanceAndRevisionResponse; })(); - v0.SearchKey = (function() { + v0.KeyRequestType = (function() { /** - * Properties of a SearchKey. + * Properties of a KeyRequestType. * @memberof org.dash.platform.dapi.v0 - * @interface ISearchKey - * @property {Object.|null} [purposeMap] SearchKey purposeMap + * @interface IKeyRequestType + * @property {org.dash.platform.dapi.v0.IAllKeys|null} [allKeys] KeyRequestType allKeys + * @property {org.dash.platform.dapi.v0.ISpecificKeys|null} [specificKeys] KeyRequestType specificKeys + * @property {org.dash.platform.dapi.v0.ISearchKey|null} [searchKey] KeyRequestType searchKey */ /** - * Constructs a new SearchKey. + * Constructs a new KeyRequestType. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a SearchKey. - * @implements ISearchKey + * @classdesc Represents a KeyRequestType. + * @implements IKeyRequestType * @constructor - * @param {org.dash.platform.dapi.v0.ISearchKey=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IKeyRequestType=} [properties] Properties to set */ - function SearchKey(properties) { - this.purposeMap = {}; + function KeyRequestType(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } - /** - * SearchKey purposeMap. - * @member {Object.} purposeMap - * @memberof org.dash.platform.dapi.v0.SearchKey - * @instance - */ - SearchKey.prototype.purposeMap = $util.emptyObject; + /** + * KeyRequestType allKeys. + * @member {org.dash.platform.dapi.v0.IAllKeys|null|undefined} allKeys + * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @instance + */ + KeyRequestType.prototype.allKeys = null; + + /** + * KeyRequestType specificKeys. + * @member {org.dash.platform.dapi.v0.ISpecificKeys|null|undefined} specificKeys + * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @instance + */ + KeyRequestType.prototype.specificKeys = null; + + /** + * KeyRequestType searchKey. + * @member {org.dash.platform.dapi.v0.ISearchKey|null|undefined} searchKey + * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @instance + */ + KeyRequestType.prototype.searchKey = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * KeyRequestType request. + * @member {"allKeys"|"specificKeys"|"searchKey"|undefined} request + * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @instance + */ + Object.defineProperty(KeyRequestType.prototype, "request", { + get: $util.oneOfGetter($oneOfFields = ["allKeys", "specificKeys", "searchKey"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new KeyRequestType instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @static + * @param {org.dash.platform.dapi.v0.IKeyRequestType=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.KeyRequestType} KeyRequestType instance + */ + KeyRequestType.create = function create(properties) { + return new KeyRequestType(properties); + }; + + /** + * Encodes the specified KeyRequestType message. Does not implicitly {@link org.dash.platform.dapi.v0.KeyRequestType.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @static + * @param {org.dash.platform.dapi.v0.IKeyRequestType} message KeyRequestType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeyRequestType.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allKeys != null && Object.hasOwnProperty.call(message, "allKeys")) + $root.org.dash.platform.dapi.v0.AllKeys.encode(message.allKeys, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.specificKeys != null && Object.hasOwnProperty.call(message, "specificKeys")) + $root.org.dash.platform.dapi.v0.SpecificKeys.encode(message.specificKeys, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.searchKey != null && Object.hasOwnProperty.call(message, "searchKey")) + $root.org.dash.platform.dapi.v0.SearchKey.encode(message.searchKey, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified KeyRequestType message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.KeyRequestType.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @static + * @param {org.dash.platform.dapi.v0.IKeyRequestType} message KeyRequestType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeyRequestType.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a KeyRequestType message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.KeyRequestType} KeyRequestType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeyRequestType.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.KeyRequestType(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allKeys = $root.org.dash.platform.dapi.v0.AllKeys.decode(reader, reader.uint32()); + break; + case 2: + message.specificKeys = $root.org.dash.platform.dapi.v0.SpecificKeys.decode(reader, reader.uint32()); + break; + case 3: + message.searchKey = $root.org.dash.platform.dapi.v0.SearchKey.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a KeyRequestType message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.KeyRequestType} KeyRequestType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeyRequestType.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a KeyRequestType message. + * @function verify + * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + KeyRequestType.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.allKeys != null && message.hasOwnProperty("allKeys")) { + properties.request = 1; + { + var error = $root.org.dash.platform.dapi.v0.AllKeys.verify(message.allKeys); + if (error) + return "allKeys." + error; + } + } + if (message.specificKeys != null && message.hasOwnProperty("specificKeys")) { + if (properties.request === 1) + return "request: multiple values"; + properties.request = 1; + { + var error = $root.org.dash.platform.dapi.v0.SpecificKeys.verify(message.specificKeys); + if (error) + return "specificKeys." + error; + } + } + if (message.searchKey != null && message.hasOwnProperty("searchKey")) { + if (properties.request === 1) + return "request: multiple values"; + properties.request = 1; + { + var error = $root.org.dash.platform.dapi.v0.SearchKey.verify(message.searchKey); + if (error) + return "searchKey." + error; + } + } + return null; + }; + + /** + * Creates a KeyRequestType message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.KeyRequestType} KeyRequestType + */ + KeyRequestType.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.KeyRequestType) + return object; + var message = new $root.org.dash.platform.dapi.v0.KeyRequestType(); + if (object.allKeys != null) { + if (typeof object.allKeys !== "object") + throw TypeError(".org.dash.platform.dapi.v0.KeyRequestType.allKeys: object expected"); + message.allKeys = $root.org.dash.platform.dapi.v0.AllKeys.fromObject(object.allKeys); + } + if (object.specificKeys != null) { + if (typeof object.specificKeys !== "object") + throw TypeError(".org.dash.platform.dapi.v0.KeyRequestType.specificKeys: object expected"); + message.specificKeys = $root.org.dash.platform.dapi.v0.SpecificKeys.fromObject(object.specificKeys); + } + if (object.searchKey != null) { + if (typeof object.searchKey !== "object") + throw TypeError(".org.dash.platform.dapi.v0.KeyRequestType.searchKey: object expected"); + message.searchKey = $root.org.dash.platform.dapi.v0.SearchKey.fromObject(object.searchKey); + } + return message; + }; + + /** + * Creates a plain object from a KeyRequestType message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @static + * @param {org.dash.platform.dapi.v0.KeyRequestType} message KeyRequestType + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + KeyRequestType.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.allKeys != null && message.hasOwnProperty("allKeys")) { + object.allKeys = $root.org.dash.platform.dapi.v0.AllKeys.toObject(message.allKeys, options); + if (options.oneofs) + object.request = "allKeys"; + } + if (message.specificKeys != null && message.hasOwnProperty("specificKeys")) { + object.specificKeys = $root.org.dash.platform.dapi.v0.SpecificKeys.toObject(message.specificKeys, options); + if (options.oneofs) + object.request = "specificKeys"; + } + if (message.searchKey != null && message.hasOwnProperty("searchKey")) { + object.searchKey = $root.org.dash.platform.dapi.v0.SearchKey.toObject(message.searchKey, options); + if (options.oneofs) + object.request = "searchKey"; + } + return object; + }; + + /** + * Converts this KeyRequestType to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.KeyRequestType + * @instance + * @returns {Object.} JSON object + */ + KeyRequestType.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return KeyRequestType; + })(); + + v0.AllKeys = (function() { + + /** + * Properties of an AllKeys. + * @memberof org.dash.platform.dapi.v0 + * @interface IAllKeys + */ + + /** + * Constructs a new AllKeys. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents an AllKeys. + * @implements IAllKeys + * @constructor + * @param {org.dash.platform.dapi.v0.IAllKeys=} [properties] Properties to set + */ + function AllKeys(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new AllKeys instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.AllKeys + * @static + * @param {org.dash.platform.dapi.v0.IAllKeys=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.AllKeys} AllKeys instance + */ + AllKeys.create = function create(properties) { + return new AllKeys(properties); + }; + + /** + * Encodes the specified AllKeys message. Does not implicitly {@link org.dash.platform.dapi.v0.AllKeys.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.AllKeys + * @static + * @param {org.dash.platform.dapi.v0.IAllKeys} message AllKeys message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AllKeys.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AllKeys message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.AllKeys.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.AllKeys + * @static + * @param {org.dash.platform.dapi.v0.IAllKeys} message AllKeys message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AllKeys.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AllKeys message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.AllKeys + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.AllKeys} AllKeys + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AllKeys.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.AllKeys(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AllKeys message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.AllKeys + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.AllKeys} AllKeys + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AllKeys.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AllKeys message. + * @function verify + * @memberof org.dash.platform.dapi.v0.AllKeys + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AllKeys.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AllKeys message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.AllKeys + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.AllKeys} AllKeys + */ + AllKeys.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.AllKeys) + return object; + return new $root.org.dash.platform.dapi.v0.AllKeys(); + }; + + /** + * Creates a plain object from an AllKeys message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.AllKeys + * @static + * @param {org.dash.platform.dapi.v0.AllKeys} message AllKeys + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AllKeys.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AllKeys to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.AllKeys + * @instance + * @returns {Object.} JSON object + */ + AllKeys.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AllKeys; + })(); + + v0.SpecificKeys = (function() { + + /** + * Properties of a SpecificKeys. + * @memberof org.dash.platform.dapi.v0 + * @interface ISpecificKeys + * @property {Array.|null} [keyIds] SpecificKeys keyIds + */ + + /** + * Constructs a new SpecificKeys. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a SpecificKeys. + * @implements ISpecificKeys + * @constructor + * @param {org.dash.platform.dapi.v0.ISpecificKeys=} [properties] Properties to set + */ + function SpecificKeys(properties) { + this.keyIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SpecificKeys keyIds. + * @member {Array.} keyIds + * @memberof org.dash.platform.dapi.v0.SpecificKeys + * @instance + */ + SpecificKeys.prototype.keyIds = $util.emptyArray; + + /** + * Creates a new SpecificKeys instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.SpecificKeys + * @static + * @param {org.dash.platform.dapi.v0.ISpecificKeys=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.SpecificKeys} SpecificKeys instance + */ + SpecificKeys.create = function create(properties) { + return new SpecificKeys(properties); + }; + + /** + * Encodes the specified SpecificKeys message. Does not implicitly {@link org.dash.platform.dapi.v0.SpecificKeys.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.SpecificKeys + * @static + * @param {org.dash.platform.dapi.v0.ISpecificKeys} message SpecificKeys message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpecificKeys.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.keyIds != null && message.keyIds.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.keyIds.length; ++i) + writer.uint32(message.keyIds[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified SpecificKeys message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.SpecificKeys.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.SpecificKeys + * @static + * @param {org.dash.platform.dapi.v0.ISpecificKeys} message SpecificKeys message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpecificKeys.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SpecificKeys message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.SpecificKeys + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.SpecificKeys} SpecificKeys + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpecificKeys.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.SpecificKeys(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.keyIds && message.keyIds.length)) + message.keyIds = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.keyIds.push(reader.uint32()); + } else + message.keyIds.push(reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SpecificKeys message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.SpecificKeys + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.SpecificKeys} SpecificKeys + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpecificKeys.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SpecificKeys message. + * @function verify + * @memberof org.dash.platform.dapi.v0.SpecificKeys + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SpecificKeys.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.keyIds != null && message.hasOwnProperty("keyIds")) { + if (!Array.isArray(message.keyIds)) + return "keyIds: array expected"; + for (var i = 0; i < message.keyIds.length; ++i) + if (!$util.isInteger(message.keyIds[i])) + return "keyIds: integer[] expected"; + } + return null; + }; + + /** + * Creates a SpecificKeys message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.SpecificKeys + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.SpecificKeys} SpecificKeys + */ + SpecificKeys.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.SpecificKeys) + return object; + var message = new $root.org.dash.platform.dapi.v0.SpecificKeys(); + if (object.keyIds) { + if (!Array.isArray(object.keyIds)) + throw TypeError(".org.dash.platform.dapi.v0.SpecificKeys.keyIds: array expected"); + message.keyIds = []; + for (var i = 0; i < object.keyIds.length; ++i) + message.keyIds[i] = object.keyIds[i] >>> 0; + } + return message; + }; + + /** + * Creates a plain object from a SpecificKeys message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.SpecificKeys + * @static + * @param {org.dash.platform.dapi.v0.SpecificKeys} message SpecificKeys + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SpecificKeys.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.keyIds = []; + if (message.keyIds && message.keyIds.length) { + object.keyIds = []; + for (var j = 0; j < message.keyIds.length; ++j) + object.keyIds[j] = message.keyIds[j]; + } + return object; + }; + + /** + * Converts this SpecificKeys to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.SpecificKeys + * @instance + * @returns {Object.} JSON object + */ + SpecificKeys.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SpecificKeys; + })(); + + v0.SearchKey = (function() { + + /** + * Properties of a SearchKey. + * @memberof org.dash.platform.dapi.v0 + * @interface ISearchKey + * @property {Object.|null} [purposeMap] SearchKey purposeMap + */ + + /** + * Constructs a new SearchKey. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a SearchKey. + * @implements ISearchKey + * @constructor + * @param {org.dash.platform.dapi.v0.ISearchKey=} [properties] Properties to set + */ + function SearchKey(properties) { + this.purposeMap = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchKey purposeMap. + * @member {Object.} purposeMap + * @memberof org.dash.platform.dapi.v0.SearchKey + * @instance + */ + SearchKey.prototype.purposeMap = $util.emptyObject; + + /** + * Creates a new SearchKey instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.SearchKey + * @static + * @param {org.dash.platform.dapi.v0.ISearchKey=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.SearchKey} SearchKey instance + */ + SearchKey.create = function create(properties) { + return new SearchKey(properties); + }; + + /** + * Encodes the specified SearchKey message. Does not implicitly {@link org.dash.platform.dapi.v0.SearchKey.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.SearchKey + * @static + * @param {org.dash.platform.dapi.v0.ISearchKey} message SearchKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.purposeMap != null && Object.hasOwnProperty.call(message, "purposeMap")) + for (var keys = Object.keys(message.purposeMap), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 0 =*/8).uint32(keys[i]); + $root.org.dash.platform.dapi.v0.SecurityLevelMap.encode(message.purposeMap[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified SearchKey message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.SearchKey.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.SearchKey + * @static + * @param {org.dash.platform.dapi.v0.ISearchKey} message SearchKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchKey message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.SearchKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.SearchKey} SearchKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.SearchKey(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (message.purposeMap === $util.emptyObject) + message.purposeMap = {}; + var end2 = reader.uint32() + reader.pos; + key = 0; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.uint32(); + break; + case 2: + value = $root.org.dash.platform.dapi.v0.SecurityLevelMap.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.purposeMap[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.SearchKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.SearchKey} SearchKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchKey message. + * @function verify + * @memberof org.dash.platform.dapi.v0.SearchKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.purposeMap != null && message.hasOwnProperty("purposeMap")) { + if (!$util.isObject(message.purposeMap)) + return "purposeMap: object expected"; + var key = Object.keys(message.purposeMap); + for (var i = 0; i < key.length; ++i) { + if (!$util.key32Re.test(key[i])) + return "purposeMap: integer key{k:uint32} expected"; + { + var error = $root.org.dash.platform.dapi.v0.SecurityLevelMap.verify(message.purposeMap[key[i]]); + if (error) + return "purposeMap." + error; + } + } + } + return null; + }; + + /** + * Creates a SearchKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.SearchKey + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.SearchKey} SearchKey + */ + SearchKey.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.SearchKey) + return object; + var message = new $root.org.dash.platform.dapi.v0.SearchKey(); + if (object.purposeMap) { + if (typeof object.purposeMap !== "object") + throw TypeError(".org.dash.platform.dapi.v0.SearchKey.purposeMap: object expected"); + message.purposeMap = {}; + for (var keys = Object.keys(object.purposeMap), i = 0; i < keys.length; ++i) { + if (typeof object.purposeMap[keys[i]] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.SearchKey.purposeMap: object expected"); + message.purposeMap[keys[i]] = $root.org.dash.platform.dapi.v0.SecurityLevelMap.fromObject(object.purposeMap[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a SearchKey message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.SearchKey + * @static + * @param {org.dash.platform.dapi.v0.SearchKey} message SearchKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.purposeMap = {}; + var keys2; + if (message.purposeMap && (keys2 = Object.keys(message.purposeMap)).length) { + object.purposeMap = {}; + for (var j = 0; j < keys2.length; ++j) + object.purposeMap[keys2[j]] = $root.org.dash.platform.dapi.v0.SecurityLevelMap.toObject(message.purposeMap[keys2[j]], options); + } + return object; + }; + + /** + * Converts this SearchKey to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.SearchKey + * @instance + * @returns {Object.} JSON object + */ + SearchKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SearchKey; + })(); + + v0.SecurityLevelMap = (function() { + + /** + * Properties of a SecurityLevelMap. + * @memberof org.dash.platform.dapi.v0 + * @interface ISecurityLevelMap + * @property {Object.|null} [securityLevelMap] SecurityLevelMap securityLevelMap + */ + + /** + * Constructs a new SecurityLevelMap. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a SecurityLevelMap. + * @implements ISecurityLevelMap + * @constructor + * @param {org.dash.platform.dapi.v0.ISecurityLevelMap=} [properties] Properties to set + */ + function SecurityLevelMap(properties) { + this.securityLevelMap = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SecurityLevelMap securityLevelMap. + * @member {Object.} securityLevelMap + * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @instance + */ + SecurityLevelMap.prototype.securityLevelMap = $util.emptyObject; + + /** + * Creates a new SecurityLevelMap instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @static + * @param {org.dash.platform.dapi.v0.ISecurityLevelMap=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.SecurityLevelMap} SecurityLevelMap instance + */ + SecurityLevelMap.create = function create(properties) { + return new SecurityLevelMap(properties); + }; + + /** + * Encodes the specified SecurityLevelMap message. Does not implicitly {@link org.dash.platform.dapi.v0.SecurityLevelMap.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @static + * @param {org.dash.platform.dapi.v0.ISecurityLevelMap} message SecurityLevelMap message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecurityLevelMap.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.securityLevelMap != null && Object.hasOwnProperty.call(message, "securityLevelMap")) + for (var keys = Object.keys(message.securityLevelMap), i = 0; i < keys.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 0 =*/8).uint32(keys[i]).uint32(/* id 2, wireType 0 =*/16).int32(message.securityLevelMap[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified SecurityLevelMap message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.SecurityLevelMap.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @static + * @param {org.dash.platform.dapi.v0.ISecurityLevelMap} message SecurityLevelMap message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecurityLevelMap.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SecurityLevelMap message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.SecurityLevelMap} SecurityLevelMap + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecurityLevelMap.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.SecurityLevelMap(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (message.securityLevelMap === $util.emptyObject) + message.securityLevelMap = {}; + var end2 = reader.uint32() + reader.pos; + key = 0; + value = 0; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.uint32(); + break; + case 2: + value = reader.int32(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.securityLevelMap[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SecurityLevelMap message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.SecurityLevelMap} SecurityLevelMap + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecurityLevelMap.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SecurityLevelMap message. + * @function verify + * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SecurityLevelMap.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.securityLevelMap != null && message.hasOwnProperty("securityLevelMap")) { + if (!$util.isObject(message.securityLevelMap)) + return "securityLevelMap: object expected"; + var key = Object.keys(message.securityLevelMap); + for (var i = 0; i < key.length; ++i) { + if (!$util.key32Re.test(key[i])) + return "securityLevelMap: integer key{k:uint32} expected"; + switch (message.securityLevelMap[key[i]]) { + default: + return "securityLevelMap: enum value{k:uint32} expected"; + case 0: + case 1: + break; + } + } + } + return null; + }; + + /** + * Creates a SecurityLevelMap message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.SecurityLevelMap} SecurityLevelMap + */ + SecurityLevelMap.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.SecurityLevelMap) + return object; + var message = new $root.org.dash.platform.dapi.v0.SecurityLevelMap(); + if (object.securityLevelMap) { + if (typeof object.securityLevelMap !== "object") + throw TypeError(".org.dash.platform.dapi.v0.SecurityLevelMap.securityLevelMap: object expected"); + message.securityLevelMap = {}; + for (var keys = Object.keys(object.securityLevelMap), i = 0; i < keys.length; ++i) + switch (object.securityLevelMap[keys[i]]) { + case "CURRENT_KEY_OF_KIND_REQUEST": + case 0: + message.securityLevelMap[keys[i]] = 0; + break; + case "ALL_KEYS_OF_KIND_REQUEST": + case 1: + message.securityLevelMap[keys[i]] = 1; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a SecurityLevelMap message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @static + * @param {org.dash.platform.dapi.v0.SecurityLevelMap} message SecurityLevelMap + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SecurityLevelMap.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.securityLevelMap = {}; + var keys2; + if (message.securityLevelMap && (keys2 = Object.keys(message.securityLevelMap)).length) { + object.securityLevelMap = {}; + for (var j = 0; j < keys2.length; ++j) + object.securityLevelMap[keys2[j]] = options.enums === String ? $root.org.dash.platform.dapi.v0.SecurityLevelMap.KeyKindRequestType[message.securityLevelMap[keys2[j]]] : message.securityLevelMap[keys2[j]]; + } + return object; + }; + + /** + * Converts this SecurityLevelMap to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @instance + * @returns {Object.} JSON object + */ + SecurityLevelMap.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * KeyKindRequestType enum. + * @name org.dash.platform.dapi.v0.SecurityLevelMap.KeyKindRequestType + * @enum {number} + * @property {number} CURRENT_KEY_OF_KIND_REQUEST=0 CURRENT_KEY_OF_KIND_REQUEST value + * @property {number} ALL_KEYS_OF_KIND_REQUEST=1 ALL_KEYS_OF_KIND_REQUEST value + */ + SecurityLevelMap.KeyKindRequestType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CURRENT_KEY_OF_KIND_REQUEST"] = 0; + values[valuesById[1] = "ALL_KEYS_OF_KIND_REQUEST"] = 1; + return values; + })(); + + return SecurityLevelMap; + })(); + + v0.GetIdentityKeysRequest = (function() { + + /** + * Properties of a GetIdentityKeysRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetIdentityKeysRequest + * @property {org.dash.platform.dapi.v0.GetIdentityKeysRequest.IGetIdentityKeysRequestV0|null} [v0] GetIdentityKeysRequest v0 + */ + + /** + * Constructs a new GetIdentityKeysRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetIdentityKeysRequest. + * @implements IGetIdentityKeysRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IGetIdentityKeysRequest=} [properties] Properties to set + */ + function GetIdentityKeysRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetIdentityKeysRequest v0. + * @member {org.dash.platform.dapi.v0.GetIdentityKeysRequest.IGetIdentityKeysRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @instance + */ + GetIdentityKeysRequest.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetIdentityKeysRequest version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @instance + */ + Object.defineProperty(GetIdentityKeysRequest.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetIdentityKeysRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityKeysRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysRequest} GetIdentityKeysRequest instance + */ + GetIdentityKeysRequest.create = function create(properties) { + return new GetIdentityKeysRequest(properties); + }; + + /** + * Encodes the specified GetIdentityKeysRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityKeysRequest} message GetIdentityKeysRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityKeysRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetIdentityKeysRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityKeysRequest} message GetIdentityKeysRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityKeysRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetIdentityKeysRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysRequest} GetIdentityKeysRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityKeysRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetIdentityKeysRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysRequest} GetIdentityKeysRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityKeysRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIdentityKeysRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIdentityKeysRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a GetIdentityKeysRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysRequest} GetIdentityKeysRequest + */ + GetIdentityKeysRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityKeysRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a GetIdentityKeysRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityKeysRequest} message GetIdentityKeysRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIdentityKeysRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this GetIdentityKeysRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @instance + * @returns {Object.} JSON object + */ + GetIdentityKeysRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetIdentityKeysRequest.GetIdentityKeysRequestV0 = (function() { + + /** + * Properties of a GetIdentityKeysRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @interface IGetIdentityKeysRequestV0 + * @property {Uint8Array|null} [identityId] GetIdentityKeysRequestV0 identityId + * @property {org.dash.platform.dapi.v0.IKeyRequestType|null} [requestType] GetIdentityKeysRequestV0 requestType + * @property {google.protobuf.IUInt32Value|null} [limit] GetIdentityKeysRequestV0 limit + * @property {google.protobuf.IUInt32Value|null} [offset] GetIdentityKeysRequestV0 offset + * @property {boolean|null} [prove] GetIdentityKeysRequestV0 prove + */ + + /** + * Constructs a new GetIdentityKeysRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @classdesc Represents a GetIdentityKeysRequestV0. + * @implements IGetIdentityKeysRequestV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetIdentityKeysRequest.IGetIdentityKeysRequestV0=} [properties] Properties to set + */ + function GetIdentityKeysRequestV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetIdentityKeysRequestV0 identityId. + * @member {Uint8Array} identityId + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @instance + */ + GetIdentityKeysRequestV0.prototype.identityId = $util.newBuffer([]); + + /** + * GetIdentityKeysRequestV0 requestType. + * @member {org.dash.platform.dapi.v0.IKeyRequestType|null|undefined} requestType + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @instance + */ + GetIdentityKeysRequestV0.prototype.requestType = null; + + /** + * GetIdentityKeysRequestV0 limit. + * @member {google.protobuf.IUInt32Value|null|undefined} limit + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @instance + */ + GetIdentityKeysRequestV0.prototype.limit = null; + + /** + * GetIdentityKeysRequestV0 offset. + * @member {google.protobuf.IUInt32Value|null|undefined} offset + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @instance + */ + GetIdentityKeysRequestV0.prototype.offset = null; + + /** + * GetIdentityKeysRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @instance + */ + GetIdentityKeysRequestV0.prototype.prove = false; + + /** + * Creates a new GetIdentityKeysRequestV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityKeysRequest.IGetIdentityKeysRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} GetIdentityKeysRequestV0 instance + */ + GetIdentityKeysRequestV0.create = function create(properties) { + return new GetIdentityKeysRequestV0(properties); + }; + + /** + * Encodes the specified GetIdentityKeysRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityKeysRequest.IGetIdentityKeysRequestV0} message GetIdentityKeysRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityKeysRequestV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.identityId != null && Object.hasOwnProperty.call(message, "identityId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identityId); + if (message.requestType != null && Object.hasOwnProperty.call(message, "requestType")) + $root.org.dash.platform.dapi.v0.KeyRequestType.encode(message.requestType, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + $root.google.protobuf.UInt32Value.encode(message.limit, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + $root.google.protobuf.UInt32Value.encode(message.offset, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.prove); + return writer; + }; + + /** + * Encodes the specified GetIdentityKeysRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityKeysRequest.IGetIdentityKeysRequestV0} message GetIdentityKeysRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityKeysRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetIdentityKeysRequestV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} GetIdentityKeysRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityKeysRequestV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identityId = reader.bytes(); + break; + case 2: + message.requestType = $root.org.dash.platform.dapi.v0.KeyRequestType.decode(reader, reader.uint32()); + break; + case 3: + message.limit = $root.google.protobuf.UInt32Value.decode(reader, reader.uint32()); + break; + case 4: + message.offset = $root.google.protobuf.UInt32Value.decode(reader, reader.uint32()); + break; + case 5: + message.prove = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetIdentityKeysRequestV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} GetIdentityKeysRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityKeysRequestV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIdentityKeysRequestV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIdentityKeysRequestV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.identityId != null && message.hasOwnProperty("identityId")) + if (!(message.identityId && typeof message.identityId.length === "number" || $util.isString(message.identityId))) + return "identityId: buffer expected"; + if (message.requestType != null && message.hasOwnProperty("requestType")) { + var error = $root.org.dash.platform.dapi.v0.KeyRequestType.verify(message.requestType); + if (error) + return "requestType." + error; + } + if (message.limit != null && message.hasOwnProperty("limit")) { + var error = $root.google.protobuf.UInt32Value.verify(message.limit); + if (error) + return "limit." + error; + } + if (message.offset != null && message.hasOwnProperty("offset")) { + var error = $root.google.protobuf.UInt32Value.verify(message.offset); + if (error) + return "offset." + error; + } + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; + return null; + }; + + /** + * Creates a GetIdentityKeysRequestV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} GetIdentityKeysRequestV0 + */ + GetIdentityKeysRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0(); + if (object.identityId != null) + if (typeof object.identityId === "string") + $util.base64.decode(object.identityId, message.identityId = $util.newBuffer($util.base64.length(object.identityId)), 0); + else if (object.identityId.length >= 0) + message.identityId = object.identityId; + if (object.requestType != null) { + if (typeof object.requestType !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.requestType: object expected"); + message.requestType = $root.org.dash.platform.dapi.v0.KeyRequestType.fromObject(object.requestType); + } + if (object.limit != null) { + if (typeof object.limit !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.limit: object expected"); + message.limit = $root.google.protobuf.UInt32Value.fromObject(object.limit); + } + if (object.offset != null) { + if (typeof object.offset !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.offset: object expected"); + message.offset = $root.google.protobuf.UInt32Value.fromObject(object.offset); + } + if (object.prove != null) + message.prove = Boolean(object.prove); + return message; + }; + + /** + * Creates a plain object from a GetIdentityKeysRequestV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} message GetIdentityKeysRequestV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIdentityKeysRequestV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.identityId = ""; + else { + object.identityId = []; + if (options.bytes !== Array) + object.identityId = $util.newBuffer(object.identityId); + } + object.requestType = null; + object.limit = null; + object.offset = null; + object.prove = false; + } + if (message.identityId != null && message.hasOwnProperty("identityId")) + object.identityId = options.bytes === String ? $util.base64.encode(message.identityId, 0, message.identityId.length) : options.bytes === Array ? Array.prototype.slice.call(message.identityId) : message.identityId; + if (message.requestType != null && message.hasOwnProperty("requestType")) + object.requestType = $root.org.dash.platform.dapi.v0.KeyRequestType.toObject(message.requestType, options); + if (message.limit != null && message.hasOwnProperty("limit")) + object.limit = $root.google.protobuf.UInt32Value.toObject(message.limit, options); + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = $root.google.protobuf.UInt32Value.toObject(message.offset, options); + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; + return object; + }; + + /** + * Converts this GetIdentityKeysRequestV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @instance + * @returns {Object.} JSON object + */ + GetIdentityKeysRequestV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetIdentityKeysRequestV0; + })(); + + return GetIdentityKeysRequest; + })(); + + v0.GetIdentityKeysResponse = (function() { + + /** + * Properties of a GetIdentityKeysResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetIdentityKeysResponse + * @property {org.dash.platform.dapi.v0.GetIdentityKeysResponse.IGetIdentityKeysResponseV0|null} [v0] GetIdentityKeysResponse v0 + */ + + /** + * Constructs a new GetIdentityKeysResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetIdentityKeysResponse. + * @implements IGetIdentityKeysResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetIdentityKeysResponse=} [properties] Properties to set + */ + function GetIdentityKeysResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetIdentityKeysResponse v0. + * @member {org.dash.platform.dapi.v0.GetIdentityKeysResponse.IGetIdentityKeysResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse + * @instance + */ + GetIdentityKeysResponse.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetIdentityKeysResponse version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse + * @instance + */ + Object.defineProperty(GetIdentityKeysResponse.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetIdentityKeysResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityKeysResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse} GetIdentityKeysResponse instance + */ + GetIdentityKeysResponse.create = function create(properties) { + return new GetIdentityKeysResponse(properties); + }; + + /** + * Encodes the specified GetIdentityKeysResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityKeysResponse} message GetIdentityKeysResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityKeysResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetIdentityKeysResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetIdentityKeysResponse} message GetIdentityKeysResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityKeysResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetIdentityKeysResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse} GetIdentityKeysResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityKeysResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetIdentityKeysResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse} GetIdentityKeysResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityKeysResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIdentityKeysResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIdentityKeysResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a GetIdentityKeysResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse} GetIdentityKeysResponse + */ + GetIdentityKeysResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityKeysResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a GetIdentityKeysResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse} message GetIdentityKeysResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIdentityKeysResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this GetIdentityKeysResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse + * @instance + * @returns {Object.} JSON object + */ + GetIdentityKeysResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetIdentityKeysResponse.GetIdentityKeysResponseV0 = (function() { + + /** + * Properties of a GetIdentityKeysResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse + * @interface IGetIdentityKeysResponseV0 + * @property {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.IKeys|null} [keys] GetIdentityKeysResponseV0 keys + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityKeysResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityKeysResponseV0 metadata + */ + + /** + * Constructs a new GetIdentityKeysResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse + * @classdesc Represents a GetIdentityKeysResponseV0. + * @implements IGetIdentityKeysResponseV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.IGetIdentityKeysResponseV0=} [properties] Properties to set + */ + function GetIdentityKeysResponseV0(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetIdentityKeysResponseV0 keys. + * @member {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.IKeys|null|undefined} keys + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 + * @instance + */ + GetIdentityKeysResponseV0.prototype.keys = null; + + /** + * GetIdentityKeysResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 + * @instance + */ + GetIdentityKeysResponseV0.prototype.proof = null; + + /** + * GetIdentityKeysResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 + * @instance + */ + GetIdentityKeysResponseV0.prototype.metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetIdentityKeysResponseV0 result. + * @member {"keys"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 + * @instance + */ + Object.defineProperty(GetIdentityKeysResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["keys", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetIdentityKeysResponseV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.IGetIdentityKeysResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} GetIdentityKeysResponseV0 instance + */ + GetIdentityKeysResponseV0.create = function create(properties) { + return new GetIdentityKeysResponseV0(properties); + }; + + /** + * Encodes the specified GetIdentityKeysResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.IGetIdentityKeysResponseV0} message GetIdentityKeysResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityKeysResponseV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.keys != null && Object.hasOwnProperty.call(message, "keys")) + $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.encode(message.keys, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetIdentityKeysResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.IGetIdentityKeysResponseV0} message GetIdentityKeysResponseV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentityKeysResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetIdentityKeysResponseV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} GetIdentityKeysResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityKeysResponseV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.keys = $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.decode(reader, reader.uint32()); + break; + case 2: + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetIdentityKeysResponseV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} GetIdentityKeysResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentityKeysResponseV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIdentityKeysResponseV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIdentityKeysResponseV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.keys != null && message.hasOwnProperty("keys")) { + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.verify(message.keys); + if (error) + return "keys." + error; + } + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a GetIdentityKeysResponseV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} GetIdentityKeysResponseV0 + */ + GetIdentityKeysResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0(); + if (object.keys != null) { + if (typeof object.keys !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.keys: object expected"); + message.keys = $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.fromObject(object.keys); + } + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a GetIdentityKeysResponseV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} message GetIdentityKeysResponseV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIdentityKeysResponseV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.keys != null && message.hasOwnProperty("keys")) { + object.keys = $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject(message.keys, options); + if (options.oneofs) + object.result = "keys"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this GetIdentityKeysResponseV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 + * @instance + * @returns {Object.} JSON object + */ + GetIdentityKeysResponseV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Creates a new SearchKey instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.SearchKey - * @static - * @param {org.dash.platform.dapi.v0.ISearchKey=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.SearchKey} SearchKey instance - */ - SearchKey.create = function create(properties) { - return new SearchKey(properties); - }; + GetIdentityKeysResponseV0.Keys = (function() { - /** - * Encodes the specified SearchKey message. Does not implicitly {@link org.dash.platform.dapi.v0.SearchKey.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.SearchKey - * @static - * @param {org.dash.platform.dapi.v0.ISearchKey} message SearchKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SearchKey.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.purposeMap != null && Object.hasOwnProperty.call(message, "purposeMap")) - for (var keys = Object.keys(message.purposeMap), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 0 =*/8).uint32(keys[i]); - $root.org.dash.platform.dapi.v0.SecurityLevelMap.encode(message.purposeMap[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + /** + * Properties of a Keys. + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 + * @interface IKeys + * @property {Array.|null} [keysBytes] Keys keysBytes + */ + + /** + * Constructs a new Keys. + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 + * @classdesc Represents a Keys. + * @implements IKeys + * @constructor + * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.IKeys=} [properties] Properties to set + */ + function Keys(properties) { + this.keysBytes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - return writer; - }; - /** - * Encodes the specified SearchKey message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.SearchKey.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.SearchKey - * @static - * @param {org.dash.platform.dapi.v0.ISearchKey} message SearchKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SearchKey.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Keys keysBytes. + * @member {Array.} keysBytes + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @instance + */ + Keys.prototype.keysBytes = $util.emptyArray; - /** - * Decodes a SearchKey message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.SearchKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.SearchKey} SearchKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SearchKey.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.SearchKey(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (message.purposeMap === $util.emptyObject) - message.purposeMap = {}; - var end2 = reader.uint32() + reader.pos; - key = 0; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { + /** + * Creates a new Keys instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.IKeys=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} Keys instance + */ + Keys.create = function create(properties) { + return new Keys(properties); + }; + + /** + * Encodes the specified Keys message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.IKeys} message Keys message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Keys.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.keysBytes != null && message.keysBytes.length) + for (var i = 0; i < message.keysBytes.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.keysBytes[i]); + return writer; + }; + + /** + * Encodes the specified Keys message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.IKeys} message Keys message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Keys.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Keys message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} Keys + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Keys.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { case 1: - key = reader.uint32(); - break; - case 2: - value = $root.org.dash.platform.dapi.v0.SecurityLevelMap.decode(reader, reader.uint32()); + if (!(message.keysBytes && message.keysBytes.length)) + message.keysBytes = []; + message.keysBytes.push(reader.bytes()); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag & 7); break; } } - message.purposeMap[key] = value; - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + return message; + }; - /** - * Decodes a SearchKey message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.SearchKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.SearchKey} SearchKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SearchKey.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a Keys message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} Keys + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Keys.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Keys message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Keys.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.keysBytes != null && message.hasOwnProperty("keysBytes")) { + if (!Array.isArray(message.keysBytes)) + return "keysBytes: array expected"; + for (var i = 0; i < message.keysBytes.length; ++i) + if (!(message.keysBytes[i] && typeof message.keysBytes[i].length === "number" || $util.isString(message.keysBytes[i]))) + return "keysBytes: buffer[] expected"; + } + return null; + }; + + /** + * Creates a Keys message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} Keys + */ + Keys.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys(); + if (object.keysBytes) { + if (!Array.isArray(object.keysBytes)) + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.keysBytes: array expected"); + message.keysBytes = []; + for (var i = 0; i < object.keysBytes.length; ++i) + if (typeof object.keysBytes[i] === "string") + $util.base64.decode(object.keysBytes[i], message.keysBytes[i] = $util.newBuffer($util.base64.length(object.keysBytes[i])), 0); + else if (object.keysBytes[i].length >= 0) + message.keysBytes[i] = object.keysBytes[i]; + } + return message; + }; - /** - * Verifies a SearchKey message. - * @function verify - * @memberof org.dash.platform.dapi.v0.SearchKey - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SearchKey.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.purposeMap != null && message.hasOwnProperty("purposeMap")) { - if (!$util.isObject(message.purposeMap)) - return "purposeMap: object expected"; - var key = Object.keys(message.purposeMap); - for (var i = 0; i < key.length; ++i) { - if (!$util.key32Re.test(key[i])) - return "purposeMap: integer key{k:uint32} expected"; - { - var error = $root.org.dash.platform.dapi.v0.SecurityLevelMap.verify(message.purposeMap[key[i]]); - if (error) - return "purposeMap." + error; + /** + * Creates a plain object from a Keys message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} message Keys + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Keys.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.keysBytes = []; + if (message.keysBytes && message.keysBytes.length) { + object.keysBytes = []; + for (var j = 0; j < message.keysBytes.length; ++j) + object.keysBytes[j] = options.bytes === String ? $util.base64.encode(message.keysBytes[j], 0, message.keysBytes[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.keysBytes[j]) : message.keysBytes[j]; } - } - } - return null; - }; + return object; + }; - /** - * Creates a SearchKey message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.SearchKey - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.SearchKey} SearchKey - */ - SearchKey.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.SearchKey) - return object; - var message = new $root.org.dash.platform.dapi.v0.SearchKey(); - if (object.purposeMap) { - if (typeof object.purposeMap !== "object") - throw TypeError(".org.dash.platform.dapi.v0.SearchKey.purposeMap: object expected"); - message.purposeMap = {}; - for (var keys = Object.keys(object.purposeMap), i = 0; i < keys.length; ++i) { - if (typeof object.purposeMap[keys[i]] !== "object") - throw TypeError(".org.dash.platform.dapi.v0.SearchKey.purposeMap: object expected"); - message.purposeMap[keys[i]] = $root.org.dash.platform.dapi.v0.SecurityLevelMap.fromObject(object.purposeMap[keys[i]]); - } - } - return message; - }; + /** + * Converts this Keys to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @instance + * @returns {Object.} JSON object + */ + Keys.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Creates a plain object from a SearchKey message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.SearchKey - * @static - * @param {org.dash.platform.dapi.v0.SearchKey} message SearchKey - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SearchKey.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) - object.purposeMap = {}; - var keys2; - if (message.purposeMap && (keys2 = Object.keys(message.purposeMap)).length) { - object.purposeMap = {}; - for (var j = 0; j < keys2.length; ++j) - object.purposeMap[keys2[j]] = $root.org.dash.platform.dapi.v0.SecurityLevelMap.toObject(message.purposeMap[keys2[j]], options); - } - return object; - }; + return Keys; + })(); - /** - * Converts this SearchKey to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.SearchKey - * @instance - * @returns {Object.} JSON object - */ - SearchKey.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return GetIdentityKeysResponseV0; + })(); - return SearchKey; + return GetIdentityKeysResponse; })(); - v0.SecurityLevelMap = (function() { + v0.GetIdentitiesContractKeysRequest = (function() { /** - * Properties of a SecurityLevelMap. + * Properties of a GetIdentitiesContractKeysRequest. * @memberof org.dash.platform.dapi.v0 - * @interface ISecurityLevelMap - * @property {Object.|null} [securityLevelMap] SecurityLevelMap securityLevelMap + * @interface IGetIdentitiesContractKeysRequest + * @property {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.IGetIdentitiesContractKeysRequestV0|null} [v0] GetIdentitiesContractKeysRequest v0 */ /** - * Constructs a new SecurityLevelMap. + * Constructs a new GetIdentitiesContractKeysRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a SecurityLevelMap. - * @implements ISecurityLevelMap + * @classdesc Represents a GetIdentitiesContractKeysRequest. + * @implements IGetIdentitiesContractKeysRequest * @constructor - * @param {org.dash.platform.dapi.v0.ISecurityLevelMap=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysRequest=} [properties] Properties to set */ - function SecurityLevelMap(properties) { - this.securityLevelMap = {}; + function GetIdentitiesContractKeysRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -7382,95 +9236,89 @@ $root.org = (function() { } /** - * SecurityLevelMap securityLevelMap. - * @member {Object.} securityLevelMap - * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * GetIdentitiesContractKeysRequest v0. + * @member {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.IGetIdentitiesContractKeysRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @instance */ - SecurityLevelMap.prototype.securityLevelMap = $util.emptyObject; + GetIdentitiesContractKeysRequest.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * Creates a new SecurityLevelMap instance using the specified properties. + * GetIdentitiesContractKeysRequest version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest + * @instance + */ + Object.defineProperty(GetIdentitiesContractKeysRequest.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetIdentitiesContractKeysRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @static - * @param {org.dash.platform.dapi.v0.ISecurityLevelMap=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.SecurityLevelMap} SecurityLevelMap instance + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} GetIdentitiesContractKeysRequest instance */ - SecurityLevelMap.create = function create(properties) { - return new SecurityLevelMap(properties); + GetIdentitiesContractKeysRequest.create = function create(properties) { + return new GetIdentitiesContractKeysRequest(properties); }; /** - * Encodes the specified SecurityLevelMap message. Does not implicitly {@link org.dash.platform.dapi.v0.SecurityLevelMap.verify|verify} messages. + * Encodes the specified GetIdentitiesContractKeysRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @static - * @param {org.dash.platform.dapi.v0.ISecurityLevelMap} message SecurityLevelMap message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysRequest} message GetIdentitiesContractKeysRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SecurityLevelMap.encode = function encode(message, writer) { + GetIdentitiesContractKeysRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.securityLevelMap != null && Object.hasOwnProperty.call(message, "securityLevelMap")) - for (var keys = Object.keys(message.securityLevelMap), i = 0; i < keys.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 0 =*/8).uint32(keys[i]).uint32(/* id 2, wireType 0 =*/16).int32(message.securityLevelMap[keys[i]]).ldelim(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified SecurityLevelMap message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.SecurityLevelMap.verify|verify} messages. + * Encodes the specified GetIdentitiesContractKeysRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @static - * @param {org.dash.platform.dapi.v0.ISecurityLevelMap} message SecurityLevelMap message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysRequest} message GetIdentitiesContractKeysRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SecurityLevelMap.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentitiesContractKeysRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SecurityLevelMap message from the specified reader or buffer. + * Decodes a GetIdentitiesContractKeysRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.SecurityLevelMap} SecurityLevelMap + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} GetIdentitiesContractKeysRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SecurityLevelMap.decode = function decode(reader, length) { + GetIdentitiesContractKeysRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.SecurityLevelMap(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (message.securityLevelMap === $util.emptyObject) - message.securityLevelMap = {}; - var end2 = reader.uint32() + reader.pos; - key = 0; - value = 0; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.uint32(); - break; - case 2: - value = reader.int32(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.securityLevelMap[key] = value; + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -7481,152 +9329,477 @@ $root.org = (function() { }; /** - * Decodes a SecurityLevelMap message from the specified reader or buffer, length delimited. + * Decodes a GetIdentitiesContractKeysRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.SecurityLevelMap} SecurityLevelMap + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} GetIdentitiesContractKeysRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SecurityLevelMap.decodeDelimited = function decodeDelimited(reader) { + GetIdentitiesContractKeysRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SecurityLevelMap message. + * Verifies a GetIdentitiesContractKeysRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SecurityLevelMap.verify = function verify(message) { + GetIdentitiesContractKeysRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.securityLevelMap != null && message.hasOwnProperty("securityLevelMap")) { - if (!$util.isObject(message.securityLevelMap)) - return "securityLevelMap: object expected"; - var key = Object.keys(message.securityLevelMap); - for (var i = 0; i < key.length; ++i) { - if (!$util.key32Re.test(key[i])) - return "securityLevelMap: integer key{k:uint32} expected"; - switch (message.securityLevelMap[key[i]]) { - default: - return "securityLevelMap: enum value{k:uint32} expected"; - case 0: - case 1: - break; - } + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.verify(message.v0); + if (error) + return "v0." + error; } } return null; }; /** - * Creates a SecurityLevelMap message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentitiesContractKeysRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.SecurityLevelMap} SecurityLevelMap + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} GetIdentitiesContractKeysRequest */ - SecurityLevelMap.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.SecurityLevelMap) - return object; - var message = new $root.org.dash.platform.dapi.v0.SecurityLevelMap(); - if (object.securityLevelMap) { - if (typeof object.securityLevelMap !== "object") - throw TypeError(".org.dash.platform.dapi.v0.SecurityLevelMap.securityLevelMap: object expected"); - message.securityLevelMap = {}; - for (var keys = Object.keys(object.securityLevelMap), i = 0; i < keys.length; ++i) - switch (object.securityLevelMap[keys[i]]) { - case "CURRENT_KEY_OF_KIND_REQUEST": - case 0: - message.securityLevelMap[keys[i]] = 0; - break; - case "ALL_KEYS_OF_KIND_REQUEST": - case 1: - message.securityLevelMap[keys[i]] = 1; - break; - } + GetIdentitiesContractKeysRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a SecurityLevelMap message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentitiesContractKeysRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @static - * @param {org.dash.platform.dapi.v0.SecurityLevelMap} message SecurityLevelMap + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} message GetIdentitiesContractKeysRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SecurityLevelMap.toObject = function toObject(message, options) { + GetIdentitiesContractKeysRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.objects || options.defaults) - object.securityLevelMap = {}; - var keys2; - if (message.securityLevelMap && (keys2 = Object.keys(message.securityLevelMap)).length) { - object.securityLevelMap = {}; - for (var j = 0; j < keys2.length; ++j) - object.securityLevelMap[keys2[j]] = options.enums === String ? $root.org.dash.platform.dapi.v0.SecurityLevelMap.KeyKindRequestType[message.securityLevelMap[keys2[j]]] : message.securityLevelMap[keys2[j]]; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; } return object; }; /** - * Converts this SecurityLevelMap to JSON. + * Converts this GetIdentitiesContractKeysRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.SecurityLevelMap + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest * @instance * @returns {Object.} JSON object */ - SecurityLevelMap.prototype.toJSON = function toJSON() { + GetIdentitiesContractKeysRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * KeyKindRequestType enum. - * @name org.dash.platform.dapi.v0.SecurityLevelMap.KeyKindRequestType - * @enum {number} - * @property {number} CURRENT_KEY_OF_KIND_REQUEST=0 CURRENT_KEY_OF_KIND_REQUEST value - * @property {number} ALL_KEYS_OF_KIND_REQUEST=1 ALL_KEYS_OF_KIND_REQUEST value - */ - SecurityLevelMap.KeyKindRequestType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CURRENT_KEY_OF_KIND_REQUEST"] = 0; - values[valuesById[1] = "ALL_KEYS_OF_KIND_REQUEST"] = 1; - return values; + GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 = (function() { + + /** + * Properties of a GetIdentitiesContractKeysRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest + * @interface IGetIdentitiesContractKeysRequestV0 + * @property {Array.|null} [identitiesIds] GetIdentitiesContractKeysRequestV0 identitiesIds + * @property {Uint8Array|null} [contractId] GetIdentitiesContractKeysRequestV0 contractId + * @property {string|null} [documentTypeName] GetIdentitiesContractKeysRequestV0 documentTypeName + * @property {Array.|null} [purposes] GetIdentitiesContractKeysRequestV0 purposes + * @property {boolean|null} [prove] GetIdentitiesContractKeysRequestV0 prove + */ + + /** + * Constructs a new GetIdentitiesContractKeysRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest + * @classdesc Represents a GetIdentitiesContractKeysRequestV0. + * @implements IGetIdentitiesContractKeysRequestV0 + * @constructor + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.IGetIdentitiesContractKeysRequestV0=} [properties] Properties to set + */ + function GetIdentitiesContractKeysRequestV0(properties) { + this.identitiesIds = []; + this.purposes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetIdentitiesContractKeysRequestV0 identitiesIds. + * @member {Array.} identitiesIds + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 + * @instance + */ + GetIdentitiesContractKeysRequestV0.prototype.identitiesIds = $util.emptyArray; + + /** + * GetIdentitiesContractKeysRequestV0 contractId. + * @member {Uint8Array} contractId + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 + * @instance + */ + GetIdentitiesContractKeysRequestV0.prototype.contractId = $util.newBuffer([]); + + /** + * GetIdentitiesContractKeysRequestV0 documentTypeName. + * @member {string} documentTypeName + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 + * @instance + */ + GetIdentitiesContractKeysRequestV0.prototype.documentTypeName = ""; + + /** + * GetIdentitiesContractKeysRequestV0 purposes. + * @member {Array.} purposes + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 + * @instance + */ + GetIdentitiesContractKeysRequestV0.prototype.purposes = $util.emptyArray; + + /** + * GetIdentitiesContractKeysRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 + * @instance + */ + GetIdentitiesContractKeysRequestV0.prototype.prove = false; + + /** + * Creates a new GetIdentitiesContractKeysRequestV0 instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.IGetIdentitiesContractKeysRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} GetIdentitiesContractKeysRequestV0 instance + */ + GetIdentitiesContractKeysRequestV0.create = function create(properties) { + return new GetIdentitiesContractKeysRequestV0(properties); + }; + + /** + * Encodes the specified GetIdentitiesContractKeysRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.IGetIdentitiesContractKeysRequestV0} message GetIdentitiesContractKeysRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentitiesContractKeysRequestV0.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.identitiesIds != null && message.identitiesIds.length) + for (var i = 0; i < message.identitiesIds.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identitiesIds[i]); + if (message.contractId != null && Object.hasOwnProperty.call(message, "contractId")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.contractId); + if (message.documentTypeName != null && Object.hasOwnProperty.call(message, "documentTypeName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.documentTypeName); + if (message.purposes != null && message.purposes.length) { + writer.uint32(/* id 4, wireType 2 =*/34).fork(); + for (var i = 0; i < message.purposes.length; ++i) + writer.int32(message.purposes[i]); + writer.ldelim(); + } + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.prove); + return writer; + }; + + /** + * Encodes the specified GetIdentitiesContractKeysRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.IGetIdentitiesContractKeysRequestV0} message GetIdentitiesContractKeysRequestV0 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIdentitiesContractKeysRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetIdentitiesContractKeysRequestV0 message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} GetIdentitiesContractKeysRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentitiesContractKeysRequestV0.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.identitiesIds && message.identitiesIds.length)) + message.identitiesIds = []; + message.identitiesIds.push(reader.bytes()); + break; + case 2: + message.contractId = reader.bytes(); + break; + case 3: + message.documentTypeName = reader.string(); + break; + case 4: + if (!(message.purposes && message.purposes.length)) + message.purposes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.purposes.push(reader.int32()); + } else + message.purposes.push(reader.int32()); + break; + case 5: + message.prove = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetIdentitiesContractKeysRequestV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} GetIdentitiesContractKeysRequestV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIdentitiesContractKeysRequestV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIdentitiesContractKeysRequestV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIdentitiesContractKeysRequestV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.identitiesIds != null && message.hasOwnProperty("identitiesIds")) { + if (!Array.isArray(message.identitiesIds)) + return "identitiesIds: array expected"; + for (var i = 0; i < message.identitiesIds.length; ++i) + if (!(message.identitiesIds[i] && typeof message.identitiesIds[i].length === "number" || $util.isString(message.identitiesIds[i]))) + return "identitiesIds: buffer[] expected"; + } + if (message.contractId != null && message.hasOwnProperty("contractId")) + if (!(message.contractId && typeof message.contractId.length === "number" || $util.isString(message.contractId))) + return "contractId: buffer expected"; + if (message.documentTypeName != null && message.hasOwnProperty("documentTypeName")) + if (!$util.isString(message.documentTypeName)) + return "documentTypeName: string expected"; + if (message.purposes != null && message.hasOwnProperty("purposes")) { + if (!Array.isArray(message.purposes)) + return "purposes: array expected"; + for (var i = 0; i < message.purposes.length; ++i) + switch (message.purposes[i]) { + default: + return "purposes: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 5: + break; + } + } + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; + return null; + }; + + /** + * Creates a GetIdentitiesContractKeysRequestV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} GetIdentitiesContractKeysRequestV0 + */ + GetIdentitiesContractKeysRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0(); + if (object.identitiesIds) { + if (!Array.isArray(object.identitiesIds)) + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.identitiesIds: array expected"); + message.identitiesIds = []; + for (var i = 0; i < object.identitiesIds.length; ++i) + if (typeof object.identitiesIds[i] === "string") + $util.base64.decode(object.identitiesIds[i], message.identitiesIds[i] = $util.newBuffer($util.base64.length(object.identitiesIds[i])), 0); + else if (object.identitiesIds[i].length >= 0) + message.identitiesIds[i] = object.identitiesIds[i]; + } + if (object.contractId != null) + if (typeof object.contractId === "string") + $util.base64.decode(object.contractId, message.contractId = $util.newBuffer($util.base64.length(object.contractId)), 0); + else if (object.contractId.length >= 0) + message.contractId = object.contractId; + if (object.documentTypeName != null) + message.documentTypeName = String(object.documentTypeName); + if (object.purposes) { + if (!Array.isArray(object.purposes)) + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.purposes: array expected"); + message.purposes = []; + for (var i = 0; i < object.purposes.length; ++i) + switch (object.purposes[i]) { + default: + case "AUTHENTICATION": + case 0: + message.purposes[i] = 0; + break; + case "ENCRYPTION": + case 1: + message.purposes[i] = 1; + break; + case "DECRYPTION": + case 2: + message.purposes[i] = 2; + break; + case "TRANSFER": + case 3: + message.purposes[i] = 3; + break; + case "VOTING": + case 5: + message.purposes[i] = 5; + break; + } + } + if (object.prove != null) + message.prove = Boolean(object.prove); + return message; + }; + + /** + * Creates a plain object from a GetIdentitiesContractKeysRequestV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} message GetIdentitiesContractKeysRequestV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIdentitiesContractKeysRequestV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.identitiesIds = []; + object.purposes = []; + } + if (options.defaults) { + if (options.bytes === String) + object.contractId = ""; + else { + object.contractId = []; + if (options.bytes !== Array) + object.contractId = $util.newBuffer(object.contractId); + } + object.documentTypeName = ""; + object.prove = false; + } + if (message.identitiesIds && message.identitiesIds.length) { + object.identitiesIds = []; + for (var j = 0; j < message.identitiesIds.length; ++j) + object.identitiesIds[j] = options.bytes === String ? $util.base64.encode(message.identitiesIds[j], 0, message.identitiesIds[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.identitiesIds[j]) : message.identitiesIds[j]; + } + if (message.contractId != null && message.hasOwnProperty("contractId")) + object.contractId = options.bytes === String ? $util.base64.encode(message.contractId, 0, message.contractId.length) : options.bytes === Array ? Array.prototype.slice.call(message.contractId) : message.contractId; + if (message.documentTypeName != null && message.hasOwnProperty("documentTypeName")) + object.documentTypeName = message.documentTypeName; + if (message.purposes && message.purposes.length) { + object.purposes = []; + for (var j = 0; j < message.purposes.length; ++j) + object.purposes[j] = options.enums === String ? $root.org.dash.platform.dapi.v0.KeyPurpose[message.purposes[j]] : message.purposes[j]; + } + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; + return object; + }; + + /** + * Converts this GetIdentitiesContractKeysRequestV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 + * @instance + * @returns {Object.} JSON object + */ + GetIdentitiesContractKeysRequestV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetIdentitiesContractKeysRequestV0; })(); - return SecurityLevelMap; + return GetIdentitiesContractKeysRequest; })(); - v0.GetIdentityKeysRequest = (function() { + v0.GetIdentitiesContractKeysResponse = (function() { /** - * Properties of a GetIdentityKeysRequest. + * Properties of a GetIdentitiesContractKeysResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentityKeysRequest - * @property {org.dash.platform.dapi.v0.GetIdentityKeysRequest.IGetIdentityKeysRequestV0|null} [v0] GetIdentityKeysRequest v0 + * @interface IGetIdentitiesContractKeysResponse + * @property {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.IGetIdentitiesContractKeysResponseV0|null} [v0] GetIdentitiesContractKeysResponse v0 */ /** - * Constructs a new GetIdentityKeysRequest. + * Constructs a new GetIdentitiesContractKeysResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentityKeysRequest. - * @implements IGetIdentityKeysRequest + * @classdesc Represents a GetIdentitiesContractKeysResponse. + * @implements IGetIdentitiesContractKeysResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentityKeysRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysResponse=} [properties] Properties to set */ - function GetIdentityKeysRequest(properties) { + function GetIdentitiesContractKeysResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -7634,89 +9807,89 @@ $root.org = (function() { } /** - * GetIdentityKeysRequest v0. - * @member {org.dash.platform.dapi.v0.GetIdentityKeysRequest.IGetIdentityKeysRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * GetIdentitiesContractKeysResponse v0. + * @member {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.IGetIdentitiesContractKeysResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse * @instance */ - GetIdentityKeysRequest.prototype.v0 = null; + GetIdentitiesContractKeysResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentityKeysRequest version. + * GetIdentitiesContractKeysResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse * @instance */ - Object.defineProperty(GetIdentityKeysRequest.prototype, "version", { + Object.defineProperty(GetIdentitiesContractKeysResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentityKeysRequest instance using the specified properties. + * Creates a new GetIdentitiesContractKeysResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityKeysRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysRequest} GetIdentityKeysRequest instance + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} GetIdentitiesContractKeysResponse instance */ - GetIdentityKeysRequest.create = function create(properties) { - return new GetIdentityKeysRequest(properties); + GetIdentitiesContractKeysResponse.create = function create(properties) { + return new GetIdentitiesContractKeysResponse(properties); }; /** - * Encodes the specified GetIdentityKeysRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysRequest.verify|verify} messages. + * Encodes the specified GetIdentitiesContractKeysResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityKeysRequest} message GetIdentityKeysRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysResponse} message GetIdentitiesContractKeysResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityKeysRequest.encode = function encode(message, writer) { + GetIdentitiesContractKeysResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentityKeysRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysRequest.verify|verify} messages. + * Encodes the specified GetIdentitiesContractKeysResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityKeysRequest} message GetIdentityKeysRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentitiesContractKeysResponse} message GetIdentitiesContractKeysResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityKeysRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentitiesContractKeysResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityKeysRequest message from the specified reader or buffer. + * Decodes a GetIdentitiesContractKeysResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysRequest} GetIdentityKeysRequest + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} GetIdentitiesContractKeysResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityKeysRequest.decode = function decode(reader, length) { + GetIdentitiesContractKeysResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -7727,37 +9900,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityKeysRequest message from the specified reader or buffer, length delimited. + * Decodes a GetIdentitiesContractKeysResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysRequest} GetIdentityKeysRequest + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} GetIdentitiesContractKeysResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityKeysRequest.decodeDelimited = function decodeDelimited(reader) { + GetIdentitiesContractKeysResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityKeysRequest message. + * Verifies a GetIdentitiesContractKeysResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityKeysRequest.verify = function verify(message) { + GetIdentitiesContractKeysResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -7766,40 +9939,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentityKeysRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentitiesContractKeysResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysRequest} GetIdentityKeysRequest + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} GetIdentitiesContractKeysResponse */ - GetIdentityKeysRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest) + GetIdentitiesContractKeysResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityKeysRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentityKeysRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentitiesContractKeysResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse * @static - * @param {org.dash.platform.dapi.v0.GetIdentityKeysRequest} message GetIdentityKeysRequest + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} message GetIdentitiesContractKeysResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityKeysRequest.toObject = function toObject(message, options) { + GetIdentitiesContractKeysResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -7807,38 +9980,36 @@ $root.org = (function() { }; /** - * Converts this GetIdentityKeysRequest to JSON. + * Converts this GetIdentitiesContractKeysResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse * @instance * @returns {Object.} JSON object */ - GetIdentityKeysRequest.prototype.toJSON = function toJSON() { + GetIdentitiesContractKeysResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentityKeysRequest.GetIdentityKeysRequestV0 = (function() { + GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 = (function() { /** - * Properties of a GetIdentityKeysRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest - * @interface IGetIdentityKeysRequestV0 - * @property {Uint8Array|null} [identityId] GetIdentityKeysRequestV0 identityId - * @property {org.dash.platform.dapi.v0.IKeyRequestType|null} [requestType] GetIdentityKeysRequestV0 requestType - * @property {google.protobuf.IUInt32Value|null} [limit] GetIdentityKeysRequestV0 limit - * @property {google.protobuf.IUInt32Value|null} [offset] GetIdentityKeysRequestV0 offset - * @property {boolean|null} [prove] GetIdentityKeysRequestV0 prove + * Properties of a GetIdentitiesContractKeysResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse + * @interface IGetIdentitiesContractKeysResponseV0 + * @property {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentitiesKeys|null} [identitiesKeys] GetIdentitiesContractKeysResponseV0 identitiesKeys + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentitiesContractKeysResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentitiesContractKeysResponseV0 metadata */ /** - * Constructs a new GetIdentityKeysRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest - * @classdesc Represents a GetIdentityKeysRequestV0. - * @implements IGetIdentityKeysRequestV0 + * Constructs a new GetIdentitiesContractKeysResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse + * @classdesc Represents a GetIdentitiesContractKeysResponseV0. + * @implements IGetIdentitiesContractKeysResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentityKeysRequest.IGetIdentityKeysRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.IGetIdentitiesContractKeysResponseV0=} [properties] Properties to set */ - function GetIdentityKeysRequestV0(properties) { + function GetIdentitiesContractKeysResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -7846,127 +10017,115 @@ $root.org = (function() { } /** - * GetIdentityKeysRequestV0 identityId. - * @member {Uint8Array} identityId - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * GetIdentitiesContractKeysResponseV0 identitiesKeys. + * @member {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentitiesKeys|null|undefined} identitiesKeys + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 * @instance */ - GetIdentityKeysRequestV0.prototype.identityId = $util.newBuffer([]); + GetIdentitiesContractKeysResponseV0.prototype.identitiesKeys = null; /** - * GetIdentityKeysRequestV0 requestType. - * @member {org.dash.platform.dapi.v0.IKeyRequestType|null|undefined} requestType - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * GetIdentitiesContractKeysResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 * @instance */ - GetIdentityKeysRequestV0.prototype.requestType = null; + GetIdentitiesContractKeysResponseV0.prototype.proof = null; /** - * GetIdentityKeysRequestV0 limit. - * @member {google.protobuf.IUInt32Value|null|undefined} limit - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * GetIdentitiesContractKeysResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 * @instance */ - GetIdentityKeysRequestV0.prototype.limit = null; + GetIdentitiesContractKeysResponseV0.prototype.metadata = null; - /** - * GetIdentityKeysRequestV0 offset. - * @member {google.protobuf.IUInt32Value|null|undefined} offset - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 - * @instance - */ - GetIdentityKeysRequestV0.prototype.offset = null; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * GetIdentityKeysRequestV0 prove. - * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * GetIdentitiesContractKeysResponseV0 result. + * @member {"identitiesKeys"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 * @instance */ - GetIdentityKeysRequestV0.prototype.prove = false; + Object.defineProperty(GetIdentitiesContractKeysResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["identitiesKeys", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new GetIdentityKeysRequestV0 instance using the specified properties. + * Creates a new GetIdentitiesContractKeysResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityKeysRequest.IGetIdentityKeysRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} GetIdentityKeysRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.IGetIdentitiesContractKeysResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} GetIdentitiesContractKeysResponseV0 instance */ - GetIdentityKeysRequestV0.create = function create(properties) { - return new GetIdentityKeysRequestV0(properties); + GetIdentitiesContractKeysResponseV0.create = function create(properties) { + return new GetIdentitiesContractKeysResponseV0(properties); }; /** - * Encodes the specified GetIdentityKeysRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.verify|verify} messages. + * Encodes the specified GetIdentitiesContractKeysResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityKeysRequest.IGetIdentityKeysRequestV0} message GetIdentityKeysRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.IGetIdentitiesContractKeysResponseV0} message GetIdentitiesContractKeysResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityKeysRequestV0.encode = function encode(message, writer) { + GetIdentitiesContractKeysResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.identityId != null && Object.hasOwnProperty.call(message, "identityId")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identityId); - if (message.requestType != null && Object.hasOwnProperty.call(message, "requestType")) - $root.org.dash.platform.dapi.v0.KeyRequestType.encode(message.requestType, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) - $root.google.protobuf.UInt32Value.encode(message.limit, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) - $root.google.protobuf.UInt32Value.encode(message.offset, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.prove); + if (message.identitiesKeys != null && Object.hasOwnProperty.call(message, "identitiesKeys")) + $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.encode(message.identitiesKeys, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentityKeysRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.verify|verify} messages. + * Encodes the specified GetIdentitiesContractKeysResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityKeysRequest.IGetIdentityKeysRequestV0} message GetIdentityKeysRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.IGetIdentitiesContractKeysResponseV0} message GetIdentitiesContractKeysResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityKeysRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentitiesContractKeysResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityKeysRequestV0 message from the specified reader or buffer. + * Decodes a GetIdentitiesContractKeysResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} GetIdentityKeysRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} GetIdentitiesContractKeysResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityKeysRequestV0.decode = function decode(reader, length) { + GetIdentitiesContractKeysResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.identityId = reader.bytes(); + message.identitiesKeys = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.decode(reader, reader.uint32()); break; case 2: - message.requestType = $root.org.dash.platform.dapi.v0.KeyRequestType.decode(reader, reader.uint32()); + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); break; case 3: - message.limit = $root.google.protobuf.UInt32Value.decode(reader, reader.uint32()); - break; - case 4: - message.offset = $root.google.protobuf.UInt32Value.decode(reader, reader.uint32()); - break; - case 5: - message.prove = reader.bool(); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -7977,646 +10136,646 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityKeysRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetIdentitiesContractKeysResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} GetIdentityKeysRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} GetIdentitiesContractKeysResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityKeysRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetIdentitiesContractKeysResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityKeysRequestV0 message. + * Verifies a GetIdentitiesContractKeysResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityKeysRequestV0.verify = function verify(message) { + GetIdentitiesContractKeysResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.identityId != null && message.hasOwnProperty("identityId")) - if (!(message.identityId && typeof message.identityId.length === "number" || $util.isString(message.identityId))) - return "identityId: buffer expected"; - if (message.requestType != null && message.hasOwnProperty("requestType")) { - var error = $root.org.dash.platform.dapi.v0.KeyRequestType.verify(message.requestType); - if (error) - return "requestType." + error; + var properties = {}; + if (message.identitiesKeys != null && message.hasOwnProperty("identitiesKeys")) { + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.verify(message.identitiesKeys); + if (error) + return "identitiesKeys." + error; + } } - if (message.limit != null && message.hasOwnProperty("limit")) { - var error = $root.google.protobuf.UInt32Value.verify(message.limit); - if (error) - return "limit." + error; + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } } - if (message.offset != null && message.hasOwnProperty("offset")) { - var error = $root.google.protobuf.UInt32Value.verify(message.offset); + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); if (error) - return "offset." + error; + return "metadata." + error; } - if (message.prove != null && message.hasOwnProperty("prove")) - if (typeof message.prove !== "boolean") - return "prove: boolean expected"; return null; }; /** - * Creates a GetIdentityKeysRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentitiesContractKeysResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} GetIdentityKeysRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} GetIdentitiesContractKeysResponseV0 */ - GetIdentityKeysRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0) + GetIdentitiesContractKeysResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0(); - if (object.identityId != null) - if (typeof object.identityId === "string") - $util.base64.decode(object.identityId, message.identityId = $util.newBuffer($util.base64.length(object.identityId)), 0); - else if (object.identityId.length >= 0) - message.identityId = object.identityId; - if (object.requestType != null) { - if (typeof object.requestType !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.requestType: object expected"); - message.requestType = $root.org.dash.platform.dapi.v0.KeyRequestType.fromObject(object.requestType); + var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0(); + if (object.identitiesKeys != null) { + if (typeof object.identitiesKeys !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.identitiesKeys: object expected"); + message.identitiesKeys = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.fromObject(object.identitiesKeys); } - if (object.limit != null) { - if (typeof object.limit !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.limit: object expected"); - message.limit = $root.google.protobuf.UInt32Value.fromObject(object.limit); + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); } - if (object.offset != null) { - if (typeof object.offset !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.offset: object expected"); - message.offset = $root.google.protobuf.UInt32Value.fromObject(object.offset); + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); } - if (object.prove != null) - message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetIdentityKeysRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentitiesContractKeysResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} message GetIdentityKeysRequestV0 + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} message GetIdentitiesContractKeysResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityKeysRequestV0.toObject = function toObject(message, options) { + GetIdentitiesContractKeysResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - if (options.bytes === String) - object.identityId = ""; - else { - object.identityId = []; - if (options.bytes !== Array) - object.identityId = $util.newBuffer(object.identityId); - } - object.requestType = null; - object.limit = null; - object.offset = null; - object.prove = false; + if (options.defaults) + object.metadata = null; + if (message.identitiesKeys != null && message.hasOwnProperty("identitiesKeys")) { + object.identitiesKeys = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.toObject(message.identitiesKeys, options); + if (options.oneofs) + object.result = "identitiesKeys"; } - if (message.identityId != null && message.hasOwnProperty("identityId")) - object.identityId = options.bytes === String ? $util.base64.encode(message.identityId, 0, message.identityId.length) : options.bytes === Array ? Array.prototype.slice.call(message.identityId) : message.identityId; - if (message.requestType != null && message.hasOwnProperty("requestType")) - object.requestType = $root.org.dash.platform.dapi.v0.KeyRequestType.toObject(message.requestType, options); - if (message.limit != null && message.hasOwnProperty("limit")) - object.limit = $root.google.protobuf.UInt32Value.toObject(message.limit, options); - if (message.offset != null && message.hasOwnProperty("offset")) - object.offset = $root.google.protobuf.UInt32Value.toObject(message.offset, options); - if (message.prove != null && message.hasOwnProperty("prove")) - object.prove = message.prove; + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); return object; }; /** - * Converts this GetIdentityKeysRequestV0 to JSON. + * Converts this GetIdentitiesContractKeysResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 * @instance * @returns {Object.} JSON object */ - GetIdentityKeysRequestV0.prototype.toJSON = function toJSON() { + GetIdentitiesContractKeysResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetIdentityKeysRequestV0; - })(); - - return GetIdentityKeysRequest; - })(); - - v0.GetIdentityKeysResponse = (function() { - - /** - * Properties of a GetIdentityKeysResponse. - * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentityKeysResponse - * @property {org.dash.platform.dapi.v0.GetIdentityKeysResponse.IGetIdentityKeysResponseV0|null} [v0] GetIdentityKeysResponse v0 - */ - - /** - * Constructs a new GetIdentityKeysResponse. - * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentityKeysResponse. - * @implements IGetIdentityKeysResponse - * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentityKeysResponse=} [properties] Properties to set - */ - function GetIdentityKeysResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + }; - /** - * GetIdentityKeysResponse v0. - * @member {org.dash.platform.dapi.v0.GetIdentityKeysResponse.IGetIdentityKeysResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse - * @instance - */ - GetIdentityKeysResponse.prototype.v0 = null; + GetIdentitiesContractKeysResponseV0.PurposeKeys = (function() { - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Properties of a PurposeKeys. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @interface IPurposeKeys + * @property {org.dash.platform.dapi.v0.KeyPurpose|null} [purpose] PurposeKeys purpose + * @property {Array.|null} [keysBytes] PurposeKeys keysBytes + */ - /** - * GetIdentityKeysResponse version. - * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse - * @instance - */ - Object.defineProperty(GetIdentityKeysResponse.prototype, "version", { - get: $util.oneOfGetter($oneOfFields = ["v0"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * Constructs a new PurposeKeys. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @classdesc Represents a PurposeKeys. + * @implements IPurposeKeys + * @constructor + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IPurposeKeys=} [properties] Properties to set + */ + function PurposeKeys(properties) { + this.keysBytes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new GetIdentityKeysResponse instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse - * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityKeysResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse} GetIdentityKeysResponse instance - */ - GetIdentityKeysResponse.create = function create(properties) { - return new GetIdentityKeysResponse(properties); - }; + /** + * PurposeKeys purpose. + * @member {org.dash.platform.dapi.v0.KeyPurpose} purpose + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys + * @instance + */ + PurposeKeys.prototype.purpose = 0; - /** - * Encodes the specified GetIdentityKeysResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysResponse.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse - * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityKeysResponse} message GetIdentityKeysResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetIdentityKeysResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + /** + * PurposeKeys keysBytes. + * @member {Array.} keysBytes + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys + * @instance + */ + PurposeKeys.prototype.keysBytes = $util.emptyArray; - /** - * Encodes the specified GetIdentityKeysResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse - * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityKeysResponse} message GetIdentityKeysResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetIdentityKeysResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a new PurposeKeys instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IPurposeKeys=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} PurposeKeys instance + */ + PurposeKeys.create = function create(properties) { + return new PurposeKeys(properties); + }; - /** - * Decodes a GetIdentityKeysResponse message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse} GetIdentityKeysResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetIdentityKeysResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Encodes the specified PurposeKeys message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IPurposeKeys} message PurposeKeys message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurposeKeys.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.purpose != null && Object.hasOwnProperty.call(message, "purpose")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.purpose); + if (message.keysBytes != null && message.keysBytes.length) + for (var i = 0; i < message.keysBytes.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.keysBytes[i]); + return writer; + }; - /** - * Decodes a GetIdentityKeysResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse} GetIdentityKeysResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetIdentityKeysResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified PurposeKeys message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IPurposeKeys} message PurposeKeys message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurposeKeys.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Verifies a GetIdentityKeysResponse message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetIdentityKeysResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.v0 != null && message.hasOwnProperty("v0")) { - properties.version = 1; - { - var error = $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.verify(message.v0); - if (error) - return "v0." + error; - } - } - return null; - }; + /** + * Decodes a PurposeKeys message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} PurposeKeys + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurposeKeys.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.purpose = reader.int32(); + break; + case 2: + if (!(message.keysBytes && message.keysBytes.length)) + message.keysBytes = []; + message.keysBytes.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Creates a GetIdentityKeysResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse} GetIdentityKeysResponse - */ - GetIdentityKeysResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse(); - if (object.v0 != null) { - if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityKeysResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.fromObject(object.v0); - } - return message; - }; + /** + * Decodes a PurposeKeys message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} PurposeKeys + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurposeKeys.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a plain object from a GetIdentityKeysResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse - * @static - * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse} message GetIdentityKeysResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetIdentityKeysResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject(message.v0, options); - if (options.oneofs) - object.version = "v0"; - } - return object; - }; + /** + * Verifies a PurposeKeys message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurposeKeys.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.purpose != null && message.hasOwnProperty("purpose")) + switch (message.purpose) { + default: + return "purpose: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 5: + break; + } + if (message.keysBytes != null && message.hasOwnProperty("keysBytes")) { + if (!Array.isArray(message.keysBytes)) + return "keysBytes: array expected"; + for (var i = 0; i < message.keysBytes.length; ++i) + if (!(message.keysBytes[i] && typeof message.keysBytes[i].length === "number" || $util.isString(message.keysBytes[i]))) + return "keysBytes: buffer[] expected"; + } + return null; + }; - /** - * Converts this GetIdentityKeysResponse to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse - * @instance - * @returns {Object.} JSON object - */ - GetIdentityKeysResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a PurposeKeys message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} PurposeKeys + */ + PurposeKeys.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys(); + switch (object.purpose) { + case "AUTHENTICATION": + case 0: + message.purpose = 0; + break; + case "ENCRYPTION": + case 1: + message.purpose = 1; + break; + case "DECRYPTION": + case 2: + message.purpose = 2; + break; + case "TRANSFER": + case 3: + message.purpose = 3; + break; + case "VOTING": + case 5: + message.purpose = 5; + break; + } + if (object.keysBytes) { + if (!Array.isArray(object.keysBytes)) + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.keysBytes: array expected"); + message.keysBytes = []; + for (var i = 0; i < object.keysBytes.length; ++i) + if (typeof object.keysBytes[i] === "string") + $util.base64.decode(object.keysBytes[i], message.keysBytes[i] = $util.newBuffer($util.base64.length(object.keysBytes[i])), 0); + else if (object.keysBytes[i].length >= 0) + message.keysBytes[i] = object.keysBytes[i]; + } + return message; + }; - GetIdentityKeysResponse.GetIdentityKeysResponseV0 = (function() { + /** + * Creates a plain object from a PurposeKeys message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} message PurposeKeys + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurposeKeys.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.keysBytes = []; + if (options.defaults) + object.purpose = options.enums === String ? "AUTHENTICATION" : 0; + if (message.purpose != null && message.hasOwnProperty("purpose")) + object.purpose = options.enums === String ? $root.org.dash.platform.dapi.v0.KeyPurpose[message.purpose] : message.purpose; + if (message.keysBytes && message.keysBytes.length) { + object.keysBytes = []; + for (var j = 0; j < message.keysBytes.length; ++j) + object.keysBytes[j] = options.bytes === String ? $util.base64.encode(message.keysBytes[j], 0, message.keysBytes[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.keysBytes[j]) : message.keysBytes[j]; + } + return object; + }; - /** - * Properties of a GetIdentityKeysResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse - * @interface IGetIdentityKeysResponseV0 - * @property {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.IKeys|null} [keys] GetIdentityKeysResponseV0 keys - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityKeysResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityKeysResponseV0 metadata - */ + /** + * Converts this PurposeKeys to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys + * @instance + * @returns {Object.} JSON object + */ + PurposeKeys.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Constructs a new GetIdentityKeysResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse - * @classdesc Represents a GetIdentityKeysResponseV0. - * @implements IGetIdentityKeysResponseV0 - * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.IGetIdentityKeysResponseV0=} [properties] Properties to set - */ - function GetIdentityKeysResponseV0(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + return PurposeKeys; + })(); - /** - * GetIdentityKeysResponseV0 keys. - * @member {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.IKeys|null|undefined} keys - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 - * @instance - */ - GetIdentityKeysResponseV0.prototype.keys = null; + GetIdentitiesContractKeysResponseV0.IdentityKeys = (function() { - /** - * GetIdentityKeysResponseV0 proof. - * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 - * @instance - */ - GetIdentityKeysResponseV0.prototype.proof = null; + /** + * Properties of an IdentityKeys. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @interface IIdentityKeys + * @property {Uint8Array|null} [identityId] IdentityKeys identityId + * @property {Array.|null} [keys] IdentityKeys keys + */ - /** - * GetIdentityKeysResponseV0 metadata. - * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 - * @instance - */ - GetIdentityKeysResponseV0.prototype.metadata = null; + /** + * Constructs a new IdentityKeys. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @classdesc Represents an IdentityKeys. + * @implements IIdentityKeys + * @constructor + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentityKeys=} [properties] Properties to set + */ + function IdentityKeys(properties) { + this.keys = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * IdentityKeys identityId. + * @member {Uint8Array} identityId + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys + * @instance + */ + IdentityKeys.prototype.identityId = $util.newBuffer([]); - /** - * GetIdentityKeysResponseV0 result. - * @member {"keys"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 - * @instance - */ - Object.defineProperty(GetIdentityKeysResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["keys", "proof"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * IdentityKeys keys. + * @member {Array.} keys + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys + * @instance + */ + IdentityKeys.prototype.keys = $util.emptyArray; - /** - * Creates a new GetIdentityKeysResponseV0 instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.IGetIdentityKeysResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} GetIdentityKeysResponseV0 instance - */ - GetIdentityKeysResponseV0.create = function create(properties) { - return new GetIdentityKeysResponseV0(properties); - }; + /** + * Creates a new IdentityKeys instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentityKeys=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} IdentityKeys instance + */ + IdentityKeys.create = function create(properties) { + return new IdentityKeys(properties); + }; - /** - * Encodes the specified GetIdentityKeysResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.IGetIdentityKeysResponseV0} message GetIdentityKeysResponseV0 message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetIdentityKeysResponseV0.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.keys != null && Object.hasOwnProperty.call(message, "keys")) - $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.encode(message.keys, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; + /** + * Encodes the specified IdentityKeys message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentityKeys} message IdentityKeys message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IdentityKeys.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.identityId != null && Object.hasOwnProperty.call(message, "identityId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identityId); + if (message.keys != null && message.keys.length) + for (var i = 0; i < message.keys.length; ++i) + $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.encode(message.keys[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; - /** - * Encodes the specified GetIdentityKeysResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.IGetIdentityKeysResponseV0} message GetIdentityKeysResponseV0 message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetIdentityKeysResponseV0.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified IdentityKeys message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentityKeys} message IdentityKeys message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IdentityKeys.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a GetIdentityKeysResponseV0 message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} GetIdentityKeysResponseV0 - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetIdentityKeysResponseV0.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.keys = $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.decode(reader, reader.uint32()); - break; - case 2: - message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); - break; - case 3: - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Decodes an IdentityKeys message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} IdentityKeys + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IdentityKeys.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identityId = reader.bytes(); + break; + case 2: + if (!(message.keys && message.keys.length)) + message.keys = []; + message.keys.push($root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes a GetIdentityKeysResponseV0 message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} GetIdentityKeysResponseV0 - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetIdentityKeysResponseV0.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes an IdentityKeys message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} IdentityKeys + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IdentityKeys.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a GetIdentityKeysResponseV0 message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetIdentityKeysResponseV0.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.keys != null && message.hasOwnProperty("keys")) { - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.verify(message.keys); - if (error) - return "keys." + error; + /** + * Verifies an IdentityKeys message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IdentityKeys.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.identityId != null && message.hasOwnProperty("identityId")) + if (!(message.identityId && typeof message.identityId.length === "number" || $util.isString(message.identityId))) + return "identityId: buffer expected"; + if (message.keys != null && message.hasOwnProperty("keys")) { + if (!Array.isArray(message.keys)) + return "keys: array expected"; + for (var i = 0; i < message.keys.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.verify(message.keys[i]); + if (error) + return "keys." + error; + } } - } - if (message.proof != null && message.hasOwnProperty("proof")) { - if (properties.result === 1) - return "result: multiple values"; - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); - if (error) - return "proof." + error; + return null; + }; + + /** + * Creates an IdentityKeys message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} IdentityKeys + */ + IdentityKeys.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys(); + if (object.identityId != null) + if (typeof object.identityId === "string") + $util.base64.decode(object.identityId, message.identityId = $util.newBuffer($util.base64.length(object.identityId)), 0); + else if (object.identityId.length >= 0) + message.identityId = object.identityId; + if (object.keys) { + if (!Array.isArray(object.keys)) + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.keys: array expected"); + message.keys = []; + for (var i = 0; i < object.keys.length; ++i) { + if (typeof object.keys[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.keys: object expected"); + message.keys[i] = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.fromObject(object.keys[i]); + } } - } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); - if (error) - return "metadata." + error; - } - return null; - }; + return message; + }; - /** - * Creates a GetIdentityKeysResponseV0 message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} GetIdentityKeysResponseV0 - */ - GetIdentityKeysResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0) + /** + * Creates a plain object from an IdentityKeys message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys + * @static + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} message IdentityKeys + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IdentityKeys.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.keys = []; + if (options.defaults) + if (options.bytes === String) + object.identityId = ""; + else { + object.identityId = []; + if (options.bytes !== Array) + object.identityId = $util.newBuffer(object.identityId); + } + if (message.identityId != null && message.hasOwnProperty("identityId")) + object.identityId = options.bytes === String ? $util.base64.encode(message.identityId, 0, message.identityId.length) : options.bytes === Array ? Array.prototype.slice.call(message.identityId) : message.identityId; + if (message.keys && message.keys.length) { + object.keys = []; + for (var j = 0; j < message.keys.length; ++j) + object.keys[j] = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.toObject(message.keys[j], options); + } return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0(); - if (object.keys != null) { - if (typeof object.keys !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.keys: object expected"); - message.keys = $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.fromObject(object.keys); - } - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.proof: object expected"); - message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); - } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.metadata: object expected"); - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); - } - return message; - }; + }; - /** - * Creates a plain object from a GetIdentityKeysResponseV0 message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} message GetIdentityKeysResponseV0 - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetIdentityKeysResponseV0.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.metadata = null; - if (message.keys != null && message.hasOwnProperty("keys")) { - object.keys = $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject(message.keys, options); - if (options.oneofs) - object.result = "keys"; - } - if (message.proof != null && message.hasOwnProperty("proof")) { - object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); - if (options.oneofs) - object.result = "proof"; - } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); - return object; - }; + /** + * Converts this IdentityKeys to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys + * @instance + * @returns {Object.} JSON object + */ + IdentityKeys.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this GetIdentityKeysResponseV0 to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 - * @instance - * @returns {Object.} JSON object - */ - GetIdentityKeysResponseV0.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return IdentityKeys; + })(); - GetIdentityKeysResponseV0.Keys = (function() { + GetIdentitiesContractKeysResponseV0.IdentitiesKeys = (function() { /** - * Properties of a Keys. - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 - * @interface IKeys - * @property {Array.|null} [keysBytes] Keys keysBytes + * Properties of an IdentitiesKeys. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @interface IIdentitiesKeys + * @property {Array.|null} [entries] IdentitiesKeys entries */ /** - * Constructs a new Keys. - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0 - * @classdesc Represents a Keys. - * @implements IKeys + * Constructs a new IdentitiesKeys. + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 + * @classdesc Represents an IdentitiesKeys. + * @implements IIdentitiesKeys * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.IKeys=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentitiesKeys=} [properties] Properties to set */ - function Keys(properties) { - this.keysBytes = []; + function IdentitiesKeys(properties) { + this.entries = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -8624,78 +10783,78 @@ $root.org = (function() { } /** - * Keys keysBytes. - * @member {Array.} keysBytes - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * IdentitiesKeys entries. + * @member {Array.} entries + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys * @instance */ - Keys.prototype.keysBytes = $util.emptyArray; + IdentitiesKeys.prototype.entries = $util.emptyArray; /** - * Creates a new Keys instance using the specified properties. + * Creates a new IdentitiesKeys instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys * @static - * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.IKeys=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} Keys instance + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentitiesKeys=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} IdentitiesKeys instance */ - Keys.create = function create(properties) { - return new Keys(properties); + IdentitiesKeys.create = function create(properties) { + return new IdentitiesKeys(properties); }; /** - * Encodes the specified Keys message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.verify|verify} messages. + * Encodes the specified IdentitiesKeys message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys * @static - * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.IKeys} message Keys message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentitiesKeys} message IdentitiesKeys message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Keys.encode = function encode(message, writer) { + IdentitiesKeys.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.keysBytes != null && message.keysBytes.length) - for (var i = 0; i < message.keysBytes.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.keysBytes[i]); + if (message.entries != null && message.entries.length) + for (var i = 0; i < message.entries.length; ++i) + $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.encode(message.entries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified Keys message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.verify|verify} messages. + * Encodes the specified IdentitiesKeys message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys * @static - * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.IKeys} message Keys message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IIdentitiesKeys} message IdentitiesKeys message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Keys.encodeDelimited = function encodeDelimited(message, writer) { + IdentitiesKeys.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Keys message from the specified reader or buffer. + * Decodes an IdentitiesKeys message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} Keys + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} IdentitiesKeys * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Keys.decode = function decode(reader, length) { + IdentitiesKeys.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.keysBytes && message.keysBytes.length)) - message.keysBytes = []; - message.keysBytes.push(reader.bytes()); + if (!(message.entries && message.entries.length)) + message.entries = []; + message.entries.push($root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -8706,108 +10865,110 @@ $root.org = (function() { }; /** - * Decodes a Keys message from the specified reader or buffer, length delimited. + * Decodes an IdentitiesKeys message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} Keys + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} IdentitiesKeys * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Keys.decodeDelimited = function decodeDelimited(reader) { + IdentitiesKeys.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Keys message. + * Verifies an IdentitiesKeys message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Keys.verify = function verify(message) { + IdentitiesKeys.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.keysBytes != null && message.hasOwnProperty("keysBytes")) { - if (!Array.isArray(message.keysBytes)) - return "keysBytes: array expected"; - for (var i = 0; i < message.keysBytes.length; ++i) - if (!(message.keysBytes[i] && typeof message.keysBytes[i].length === "number" || $util.isString(message.keysBytes[i]))) - return "keysBytes: buffer[] expected"; + if (message.entries != null && message.hasOwnProperty("entries")) { + if (!Array.isArray(message.entries)) + return "entries: array expected"; + for (var i = 0; i < message.entries.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.verify(message.entries[i]); + if (error) + return "entries." + error; + } } return null; }; /** - * Creates a Keys message from a plain object. Also converts values to their respective internal types. + * Creates an IdentitiesKeys message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} Keys + * @returns {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} IdentitiesKeys */ - Keys.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys) + IdentitiesKeys.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys(); - if (object.keysBytes) { - if (!Array.isArray(object.keysBytes)) - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.keysBytes: array expected"); - message.keysBytes = []; - for (var i = 0; i < object.keysBytes.length; ++i) - if (typeof object.keysBytes[i] === "string") - $util.base64.decode(object.keysBytes[i], message.keysBytes[i] = $util.newBuffer($util.base64.length(object.keysBytes[i])), 0); - else if (object.keysBytes[i].length >= 0) - message.keysBytes[i] = object.keysBytes[i]; + var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys(); + if (object.entries) { + if (!Array.isArray(object.entries)) + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.entries: array expected"); + message.entries = []; + for (var i = 0; i < object.entries.length; ++i) { + if (typeof object.entries[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.entries: object expected"); + message.entries[i] = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.fromObject(object.entries[i]); + } } return message; }; /** - * Creates a plain object from a Keys message. Also converts values to other types if specified. + * Creates a plain object from an IdentitiesKeys message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys * @static - * @param {org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} message Keys + * @param {org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} message IdentitiesKeys * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Keys.toObject = function toObject(message, options) { + IdentitiesKeys.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.keysBytes = []; - if (message.keysBytes && message.keysBytes.length) { - object.keysBytes = []; - for (var j = 0; j < message.keysBytes.length; ++j) - object.keysBytes[j] = options.bytes === String ? $util.base64.encode(message.keysBytes[j], 0, message.keysBytes[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.keysBytes[j]) : message.keysBytes[j]; + object.entries = []; + if (message.entries && message.entries.length) { + object.entries = []; + for (var j = 0; j < message.entries.length; ++j) + object.entries[j] = $root.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.toObject(message.entries[j], options); } return object; }; /** - * Converts this Keys to JSON. + * Converts this IdentitiesKeys to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys + * @memberof org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys * @instance * @returns {Object.} JSON object */ - Keys.prototype.toJSON = function toJSON() { + IdentitiesKeys.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Keys; + return IdentitiesKeys; })(); - return GetIdentityKeysResponseV0; + return GetIdentitiesContractKeysResponseV0; })(); - return GetIdentityKeysResponse; + return GetIdentitiesContractKeysResponse; })(); v0.GetProofsRequest = (function() { @@ -9736,6 +11897,7 @@ $root.org = (function() { case 0: case 1: case 2: + case 3: break; } return null; @@ -9771,6 +11933,10 @@ $root.org = (function() { case 2: message.requestType = 2; break; + case "REVISION": + case 3: + message.requestType = 3; + break; } return message; }; @@ -9823,12 +11989,14 @@ $root.org = (function() { * @property {number} FULL_IDENTITY=0 FULL_IDENTITY value * @property {number} BALANCE=1 BALANCE value * @property {number} KEYS=2 KEYS value + * @property {number} REVISION=3 REVISION value */ IdentityRequest.Type = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "FULL_IDENTITY"] = 0; values[valuesById[1] = "BALANCE"] = 1; values[valuesById[2] = "KEYS"] = 2; + values[valuesById[3] = "REVISION"] = 3; return values; })(); @@ -15500,24 +17668,24 @@ $root.org = (function() { return GetDocumentsResponse; })(); - v0.GetIdentitiesByPublicKeyHashesRequest = (function() { + v0.GetIdentityByPublicKeyHashRequest = (function() { /** - * Properties of a GetIdentitiesByPublicKeyHashesRequest. + * Properties of a GetIdentityByPublicKeyHashRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentitiesByPublicKeyHashesRequest - * @property {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.IGetIdentitiesByPublicKeyHashesRequestV0|null} [v0] GetIdentitiesByPublicKeyHashesRequest v0 + * @interface IGetIdentityByPublicKeyHashRequest + * @property {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0|null} [v0] GetIdentityByPublicKeyHashRequest v0 */ /** - * Constructs a new GetIdentitiesByPublicKeyHashesRequest. + * Constructs a new GetIdentityByPublicKeyHashRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentitiesByPublicKeyHashesRequest. - * @implements IGetIdentitiesByPublicKeyHashesRequest + * @classdesc Represents a GetIdentityByPublicKeyHashRequest. + * @implements IGetIdentityByPublicKeyHashRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashRequest=} [properties] Properties to set */ - function GetIdentitiesByPublicKeyHashesRequest(properties) { + function GetIdentityByPublicKeyHashRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15525,89 +17693,89 @@ $root.org = (function() { } /** - * GetIdentitiesByPublicKeyHashesRequest v0. - * @member {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.IGetIdentitiesByPublicKeyHashesRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * GetIdentityByPublicKeyHashRequest v0. + * @member {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest * @instance */ - GetIdentitiesByPublicKeyHashesRequest.prototype.v0 = null; + GetIdentityByPublicKeyHashRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentitiesByPublicKeyHashesRequest version. + * GetIdentityByPublicKeyHashRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest * @instance */ - Object.defineProperty(GetIdentitiesByPublicKeyHashesRequest.prototype, "version", { + Object.defineProperty(GetIdentityByPublicKeyHashRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentitiesByPublicKeyHashesRequest instance using the specified properties. + * Creates a new GetIdentityByPublicKeyHashRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} GetIdentitiesByPublicKeyHashesRequest instance + * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} GetIdentityByPublicKeyHashRequest instance */ - GetIdentitiesByPublicKeyHashesRequest.create = function create(properties) { - return new GetIdentitiesByPublicKeyHashesRequest(properties); + GetIdentityByPublicKeyHashRequest.create = function create(properties) { + return new GetIdentityByPublicKeyHashRequest(properties); }; /** - * Encodes the specified GetIdentitiesByPublicKeyHashesRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.verify|verify} messages. + * Encodes the specified GetIdentityByPublicKeyHashRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesRequest} message GetIdentitiesByPublicKeyHashesRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashRequest} message GetIdentityByPublicKeyHashRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesByPublicKeyHashesRequest.encode = function encode(message, writer) { + GetIdentityByPublicKeyHashRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentitiesByPublicKeyHashesRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.verify|verify} messages. + * Encodes the specified GetIdentityByPublicKeyHashRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesRequest} message GetIdentitiesByPublicKeyHashesRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashRequest} message GetIdentityByPublicKeyHashRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesByPublicKeyHashesRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityByPublicKeyHashRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentitiesByPublicKeyHashesRequest message from the specified reader or buffer. + * Decodes a GetIdentityByPublicKeyHashRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} GetIdentitiesByPublicKeyHashesRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} GetIdentityByPublicKeyHashRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesByPublicKeyHashesRequest.decode = function decode(reader, length) { + GetIdentityByPublicKeyHashRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -15618,37 +17786,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentitiesByPublicKeyHashesRequest message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityByPublicKeyHashRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} GetIdentitiesByPublicKeyHashesRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} GetIdentityByPublicKeyHashRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesByPublicKeyHashesRequest.decodeDelimited = function decodeDelimited(reader) { + GetIdentityByPublicKeyHashRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentitiesByPublicKeyHashesRequest message. + * Verifies a GetIdentityByPublicKeyHashRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentitiesByPublicKeyHashesRequest.verify = function verify(message) { + GetIdentityByPublicKeyHashRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -15657,40 +17825,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentitiesByPublicKeyHashesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityByPublicKeyHashRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} GetIdentitiesByPublicKeyHashesRequest + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} GetIdentityByPublicKeyHashRequest */ - GetIdentitiesByPublicKeyHashesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest) + GetIdentityByPublicKeyHashRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentitiesByPublicKeyHashesRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityByPublicKeyHashRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} message GetIdentitiesByPublicKeyHashesRequest + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} message GetIdentityByPublicKeyHashRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentitiesByPublicKeyHashesRequest.toObject = function toObject(message, options) { + GetIdentityByPublicKeyHashRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -15698,36 +17866,35 @@ $root.org = (function() { }; /** - * Converts this GetIdentitiesByPublicKeyHashesRequest to JSON. + * Converts this GetIdentityByPublicKeyHashRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest * @instance * @returns {Object.} JSON object */ - GetIdentitiesByPublicKeyHashesRequest.prototype.toJSON = function toJSON() { + GetIdentityByPublicKeyHashRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 = (function() { + GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 = (function() { /** - * Properties of a GetIdentitiesByPublicKeyHashesRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest - * @interface IGetIdentitiesByPublicKeyHashesRequestV0 - * @property {Array.|null} [publicKeyHashes] GetIdentitiesByPublicKeyHashesRequestV0 publicKeyHashes - * @property {boolean|null} [prove] GetIdentitiesByPublicKeyHashesRequestV0 prove + * Properties of a GetIdentityByPublicKeyHashRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @interface IGetIdentityByPublicKeyHashRequestV0 + * @property {Uint8Array|null} [publicKeyHash] GetIdentityByPublicKeyHashRequestV0 publicKeyHash + * @property {boolean|null} [prove] GetIdentityByPublicKeyHashRequestV0 prove */ /** - * Constructs a new GetIdentitiesByPublicKeyHashesRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest - * @classdesc Represents a GetIdentitiesByPublicKeyHashesRequestV0. - * @implements IGetIdentitiesByPublicKeyHashesRequestV0 + * Constructs a new GetIdentityByPublicKeyHashRequestV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @classdesc Represents a GetIdentityByPublicKeyHashRequestV0. + * @implements IGetIdentityByPublicKeyHashRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.IGetIdentitiesByPublicKeyHashesRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0=} [properties] Properties to set */ - function GetIdentitiesByPublicKeyHashesRequestV0(properties) { - this.publicKeyHashes = []; + function GetIdentityByPublicKeyHashRequestV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15735,88 +17902,85 @@ $root.org = (function() { } /** - * GetIdentitiesByPublicKeyHashesRequestV0 publicKeyHashes. - * @member {Array.} publicKeyHashes - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 + * GetIdentityByPublicKeyHashRequestV0 publicKeyHash. + * @member {Uint8Array} publicKeyHash + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 * @instance */ - GetIdentitiesByPublicKeyHashesRequestV0.prototype.publicKeyHashes = $util.emptyArray; + GetIdentityByPublicKeyHashRequestV0.prototype.publicKeyHash = $util.newBuffer([]); /** - * GetIdentitiesByPublicKeyHashesRequestV0 prove. + * GetIdentityByPublicKeyHashRequestV0 prove. * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 * @instance */ - GetIdentitiesByPublicKeyHashesRequestV0.prototype.prove = false; + GetIdentityByPublicKeyHashRequestV0.prototype.prove = false; /** - * Creates a new GetIdentitiesByPublicKeyHashesRequestV0 instance using the specified properties. + * Creates a new GetIdentityByPublicKeyHashRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.IGetIdentitiesByPublicKeyHashesRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} GetIdentitiesByPublicKeyHashesRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} GetIdentityByPublicKeyHashRequestV0 instance */ - GetIdentitiesByPublicKeyHashesRequestV0.create = function create(properties) { - return new GetIdentitiesByPublicKeyHashesRequestV0(properties); + GetIdentityByPublicKeyHashRequestV0.create = function create(properties) { + return new GetIdentityByPublicKeyHashRequestV0(properties); }; /** - * Encodes the specified GetIdentitiesByPublicKeyHashesRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.verify|verify} messages. + * Encodes the specified GetIdentityByPublicKeyHashRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.IGetIdentitiesByPublicKeyHashesRequestV0} message GetIdentitiesByPublicKeyHashesRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0} message GetIdentityByPublicKeyHashRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesByPublicKeyHashesRequestV0.encode = function encode(message, writer) { + GetIdentityByPublicKeyHashRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.publicKeyHashes != null && message.publicKeyHashes.length) - for (var i = 0; i < message.publicKeyHashes.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.publicKeyHashes[i]); + if (message.publicKeyHash != null && Object.hasOwnProperty.call(message, "publicKeyHash")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.publicKeyHash); if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); return writer; }; /** - * Encodes the specified GetIdentitiesByPublicKeyHashesRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.verify|verify} messages. + * Encodes the specified GetIdentityByPublicKeyHashRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.IGetIdentitiesByPublicKeyHashesRequestV0} message GetIdentitiesByPublicKeyHashesRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0} message GetIdentityByPublicKeyHashRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesByPublicKeyHashesRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityByPublicKeyHashRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentitiesByPublicKeyHashesRequestV0 message from the specified reader or buffer. + * Decodes a GetIdentityByPublicKeyHashRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} GetIdentitiesByPublicKeyHashesRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} GetIdentityByPublicKeyHashRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesByPublicKeyHashesRequestV0.decode = function decode(reader, length) { + GetIdentityByPublicKeyHashRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.publicKeyHashes && message.publicKeyHashes.length)) - message.publicKeyHashes = []; - message.publicKeyHashes.push(reader.bytes()); + message.publicKeyHash = reader.bytes(); break; case 2: message.prove = reader.bool(); @@ -15830,39 +17994,35 @@ $root.org = (function() { }; /** - * Decodes a GetIdentitiesByPublicKeyHashesRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityByPublicKeyHashRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} GetIdentitiesByPublicKeyHashesRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} GetIdentityByPublicKeyHashRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesByPublicKeyHashesRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetIdentityByPublicKeyHashRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentitiesByPublicKeyHashesRequestV0 message. + * Verifies a GetIdentityByPublicKeyHashRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentitiesByPublicKeyHashesRequestV0.verify = function verify(message) { + GetIdentityByPublicKeyHashRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.publicKeyHashes != null && message.hasOwnProperty("publicKeyHashes")) { - if (!Array.isArray(message.publicKeyHashes)) - return "publicKeyHashes: array expected"; - for (var i = 0; i < message.publicKeyHashes.length; ++i) - if (!(message.publicKeyHashes[i] && typeof message.publicKeyHashes[i].length === "number" || $util.isString(message.publicKeyHashes[i]))) - return "publicKeyHashes: buffer[] expected"; - } + if (message.publicKeyHash != null && message.hasOwnProperty("publicKeyHash")) + if (!(message.publicKeyHash && typeof message.publicKeyHash.length === "number" || $util.isString(message.publicKeyHash))) + return "publicKeyHash: buffer expected"; if (message.prove != null && message.hasOwnProperty("prove")) if (typeof message.prove !== "boolean") return "prove: boolean expected"; @@ -15870,94 +18030,92 @@ $root.org = (function() { }; /** - * Creates a GetIdentitiesByPublicKeyHashesRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityByPublicKeyHashRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} GetIdentitiesByPublicKeyHashesRequestV0 + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} GetIdentityByPublicKeyHashRequestV0 */ - GetIdentitiesByPublicKeyHashesRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0) + GetIdentityByPublicKeyHashRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0(); - if (object.publicKeyHashes) { - if (!Array.isArray(object.publicKeyHashes)) - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.publicKeyHashes: array expected"); - message.publicKeyHashes = []; - for (var i = 0; i < object.publicKeyHashes.length; ++i) - if (typeof object.publicKeyHashes[i] === "string") - $util.base64.decode(object.publicKeyHashes[i], message.publicKeyHashes[i] = $util.newBuffer($util.base64.length(object.publicKeyHashes[i])), 0); - else if (object.publicKeyHashes[i].length >= 0) - message.publicKeyHashes[i] = object.publicKeyHashes[i]; - } + var message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0(); + if (object.publicKeyHash != null) + if (typeof object.publicKeyHash === "string") + $util.base64.decode(object.publicKeyHash, message.publicKeyHash = $util.newBuffer($util.base64.length(object.publicKeyHash)), 0); + else if (object.publicKeyHash.length >= 0) + message.publicKeyHash = object.publicKeyHash; if (object.prove != null) message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetIdentitiesByPublicKeyHashesRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityByPublicKeyHashRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} message GetIdentitiesByPublicKeyHashesRequestV0 + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} message GetIdentityByPublicKeyHashRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentitiesByPublicKeyHashesRequestV0.toObject = function toObject(message, options) { + GetIdentityByPublicKeyHashRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.publicKeyHashes = []; - if (options.defaults) + if (options.defaults) { + if (options.bytes === String) + object.publicKeyHash = ""; + else { + object.publicKeyHash = []; + if (options.bytes !== Array) + object.publicKeyHash = $util.newBuffer(object.publicKeyHash); + } object.prove = false; - if (message.publicKeyHashes && message.publicKeyHashes.length) { - object.publicKeyHashes = []; - for (var j = 0; j < message.publicKeyHashes.length; ++j) - object.publicKeyHashes[j] = options.bytes === String ? $util.base64.encode(message.publicKeyHashes[j], 0, message.publicKeyHashes[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.publicKeyHashes[j]) : message.publicKeyHashes[j]; } + if (message.publicKeyHash != null && message.hasOwnProperty("publicKeyHash")) + object.publicKeyHash = options.bytes === String ? $util.base64.encode(message.publicKeyHash, 0, message.publicKeyHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.publicKeyHash) : message.publicKeyHash; if (message.prove != null && message.hasOwnProperty("prove")) object.prove = message.prove; return object; }; /** - * Converts this GetIdentitiesByPublicKeyHashesRequestV0 to JSON. + * Converts this GetIdentityByPublicKeyHashRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 * @instance * @returns {Object.} JSON object */ - GetIdentitiesByPublicKeyHashesRequestV0.prototype.toJSON = function toJSON() { + GetIdentityByPublicKeyHashRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetIdentitiesByPublicKeyHashesRequestV0; + return GetIdentityByPublicKeyHashRequestV0; })(); - return GetIdentitiesByPublicKeyHashesRequest; + return GetIdentityByPublicKeyHashRequest; })(); - v0.GetIdentitiesByPublicKeyHashesResponse = (function() { + v0.GetIdentityByPublicKeyHashResponse = (function() { /** - * Properties of a GetIdentitiesByPublicKeyHashesResponse. + * Properties of a GetIdentityByPublicKeyHashResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentitiesByPublicKeyHashesResponse - * @property {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IGetIdentitiesByPublicKeyHashesResponseV0|null} [v0] GetIdentitiesByPublicKeyHashesResponse v0 + * @interface IGetIdentityByPublicKeyHashResponse + * @property {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0|null} [v0] GetIdentityByPublicKeyHashResponse v0 */ /** - * Constructs a new GetIdentitiesByPublicKeyHashesResponse. + * Constructs a new GetIdentityByPublicKeyHashResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentitiesByPublicKeyHashesResponse. - * @implements IGetIdentitiesByPublicKeyHashesResponse + * @classdesc Represents a GetIdentityByPublicKeyHashResponse. + * @implements IGetIdentityByPublicKeyHashResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashResponse=} [properties] Properties to set */ - function GetIdentitiesByPublicKeyHashesResponse(properties) { + function GetIdentityByPublicKeyHashResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15965,89 +18123,89 @@ $root.org = (function() { } /** - * GetIdentitiesByPublicKeyHashesResponse v0. - * @member {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IGetIdentitiesByPublicKeyHashesResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * GetIdentityByPublicKeyHashResponse v0. + * @member {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse * @instance */ - GetIdentitiesByPublicKeyHashesResponse.prototype.v0 = null; + GetIdentityByPublicKeyHashResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentitiesByPublicKeyHashesResponse version. + * GetIdentityByPublicKeyHashResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse * @instance */ - Object.defineProperty(GetIdentitiesByPublicKeyHashesResponse.prototype, "version", { + Object.defineProperty(GetIdentityByPublicKeyHashResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentitiesByPublicKeyHashesResponse instance using the specified properties. + * Creates a new GetIdentityByPublicKeyHashResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} GetIdentitiesByPublicKeyHashesResponse instance + * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} GetIdentityByPublicKeyHashResponse instance */ - GetIdentitiesByPublicKeyHashesResponse.create = function create(properties) { - return new GetIdentitiesByPublicKeyHashesResponse(properties); + GetIdentityByPublicKeyHashResponse.create = function create(properties) { + return new GetIdentityByPublicKeyHashResponse(properties); }; /** - * Encodes the specified GetIdentitiesByPublicKeyHashesResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.verify|verify} messages. + * Encodes the specified GetIdentityByPublicKeyHashResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesResponse} message GetIdentitiesByPublicKeyHashesResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashResponse} message GetIdentityByPublicKeyHashResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesByPublicKeyHashesResponse.encode = function encode(message, writer) { + GetIdentityByPublicKeyHashResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentitiesByPublicKeyHashesResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.verify|verify} messages. + * Encodes the specified GetIdentityByPublicKeyHashResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentitiesByPublicKeyHashesResponse} message GetIdentitiesByPublicKeyHashesResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashResponse} message GetIdentityByPublicKeyHashResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesByPublicKeyHashesResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityByPublicKeyHashResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentitiesByPublicKeyHashesResponse message from the specified reader or buffer. + * Decodes a GetIdentityByPublicKeyHashResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} GetIdentitiesByPublicKeyHashesResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} GetIdentityByPublicKeyHashResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesByPublicKeyHashesResponse.decode = function decode(reader, length) { + GetIdentityByPublicKeyHashResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -16058,37 +18216,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentitiesByPublicKeyHashesResponse message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityByPublicKeyHashResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} GetIdentitiesByPublicKeyHashesResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} GetIdentityByPublicKeyHashResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesByPublicKeyHashesResponse.decodeDelimited = function decodeDelimited(reader) { + GetIdentityByPublicKeyHashResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentitiesByPublicKeyHashesResponse message. + * Verifies a GetIdentityByPublicKeyHashResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentitiesByPublicKeyHashesResponse.verify = function verify(message) { + GetIdentityByPublicKeyHashResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -16097,40 +18255,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentitiesByPublicKeyHashesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityByPublicKeyHashResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} GetIdentitiesByPublicKeyHashesResponse + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} GetIdentityByPublicKeyHashResponse */ - GetIdentitiesByPublicKeyHashesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse) + GetIdentityByPublicKeyHashResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentitiesByPublicKeyHashesResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityByPublicKeyHashResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} message GetIdentitiesByPublicKeyHashesResponse + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} message GetIdentityByPublicKeyHashResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentitiesByPublicKeyHashesResponse.toObject = function toObject(message, options) { + GetIdentityByPublicKeyHashResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -16138,35 +18296,36 @@ $root.org = (function() { }; /** - * Converts this GetIdentitiesByPublicKeyHashesResponse to JSON. + * Converts this GetIdentityByPublicKeyHashResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse * @instance * @returns {Object.} JSON object */ - GetIdentitiesByPublicKeyHashesResponse.prototype.toJSON = function toJSON() { + GetIdentityByPublicKeyHashResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry = (function() { + GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 = (function() { /** - * Properties of a PublicKeyHashIdentityEntry. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse - * @interface IPublicKeyHashIdentityEntry - * @property {Uint8Array|null} [publicKeyHash] PublicKeyHashIdentityEntry publicKeyHash - * @property {google.protobuf.IBytesValue|null} [value] PublicKeyHashIdentityEntry value + * Properties of a GetIdentityByPublicKeyHashResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @interface IGetIdentityByPublicKeyHashResponseV0 + * @property {Uint8Array|null} [identity] GetIdentityByPublicKeyHashResponseV0 identity + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityByPublicKeyHashResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityByPublicKeyHashResponseV0 metadata */ /** - * Constructs a new PublicKeyHashIdentityEntry. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse - * @classdesc Represents a PublicKeyHashIdentityEntry. - * @implements IPublicKeyHashIdentityEntry + * Constructs a new GetIdentityByPublicKeyHashResponseV0. + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @classdesc Represents a GetIdentityByPublicKeyHashResponseV0. + * @implements IGetIdentityByPublicKeyHashResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IPublicKeyHashIdentityEntry=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0=} [properties] Properties to set */ - function PublicKeyHashIdentityEntry(properties) { + function GetIdentityByPublicKeyHashResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16174,302 +18333,115 @@ $root.org = (function() { } /** - * PublicKeyHashIdentityEntry publicKeyHash. - * @member {Uint8Array} publicKeyHash - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry + * GetIdentityByPublicKeyHashResponseV0 identity. + * @member {Uint8Array} identity + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 * @instance */ - PublicKeyHashIdentityEntry.prototype.publicKeyHash = $util.newBuffer([]); + GetIdentityByPublicKeyHashResponseV0.prototype.identity = $util.newBuffer([]); /** - * PublicKeyHashIdentityEntry value. - * @member {google.protobuf.IBytesValue|null|undefined} value - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry + * GetIdentityByPublicKeyHashResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 * @instance */ - PublicKeyHashIdentityEntry.prototype.value = null; - - /** - * Creates a new PublicKeyHashIdentityEntry instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IPublicKeyHashIdentityEntry=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} PublicKeyHashIdentityEntry instance - */ - PublicKeyHashIdentityEntry.create = function create(properties) { - return new PublicKeyHashIdentityEntry(properties); - }; - - /** - * Encodes the specified PublicKeyHashIdentityEntry message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IPublicKeyHashIdentityEntry} message PublicKeyHashIdentityEntry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PublicKeyHashIdentityEntry.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.publicKeyHash != null && Object.hasOwnProperty.call(message, "publicKeyHash")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.publicKeyHash); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - $root.google.protobuf.BytesValue.encode(message.value, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PublicKeyHashIdentityEntry message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IPublicKeyHashIdentityEntry} message PublicKeyHashIdentityEntry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PublicKeyHashIdentityEntry.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PublicKeyHashIdentityEntry message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} PublicKeyHashIdentityEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PublicKeyHashIdentityEntry.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.publicKeyHash = reader.bytes(); - break; - case 2: - message.value = $root.google.protobuf.BytesValue.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PublicKeyHashIdentityEntry message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} PublicKeyHashIdentityEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PublicKeyHashIdentityEntry.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PublicKeyHashIdentityEntry message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PublicKeyHashIdentityEntry.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.publicKeyHash != null && message.hasOwnProperty("publicKeyHash")) - if (!(message.publicKeyHash && typeof message.publicKeyHash.length === "number" || $util.isString(message.publicKeyHash))) - return "publicKeyHash: buffer expected"; - if (message.value != null && message.hasOwnProperty("value")) { - var error = $root.google.protobuf.BytesValue.verify(message.value); - if (error) - return "value." + error; - } - return null; - }; - - /** - * Creates a PublicKeyHashIdentityEntry message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} PublicKeyHashIdentityEntry - */ - PublicKeyHashIdentityEntry.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry(); - if (object.publicKeyHash != null) - if (typeof object.publicKeyHash === "string") - $util.base64.decode(object.publicKeyHash, message.publicKeyHash = $util.newBuffer($util.base64.length(object.publicKeyHash)), 0); - else if (object.publicKeyHash.length >= 0) - message.publicKeyHash = object.publicKeyHash; - if (object.value != null) { - if (typeof object.value !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.value: object expected"); - message.value = $root.google.protobuf.BytesValue.fromObject(object.value); - } - return message; - }; - - /** - * Creates a plain object from a PublicKeyHashIdentityEntry message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry - * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} message PublicKeyHashIdentityEntry - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PublicKeyHashIdentityEntry.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if (options.bytes === String) - object.publicKeyHash = ""; - else { - object.publicKeyHash = []; - if (options.bytes !== Array) - object.publicKeyHash = $util.newBuffer(object.publicKeyHash); - } - object.value = null; - } - if (message.publicKeyHash != null && message.hasOwnProperty("publicKeyHash")) - object.publicKeyHash = options.bytes === String ? $util.base64.encode(message.publicKeyHash, 0, message.publicKeyHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.publicKeyHash) : message.publicKeyHash; - if (message.value != null && message.hasOwnProperty("value")) - object.value = $root.google.protobuf.BytesValue.toObject(message.value, options); - return object; - }; + GetIdentityByPublicKeyHashResponseV0.prototype.proof = null; /** - * Converts this PublicKeyHashIdentityEntry to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry + * GetIdentityByPublicKeyHashResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 * @instance - * @returns {Object.} JSON object - */ - PublicKeyHashIdentityEntry.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PublicKeyHashIdentityEntry; - })(); - - GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes = (function() { - - /** - * Properties of an IdentitiesByPublicKeyHashes. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse - * @interface IIdentitiesByPublicKeyHashes - * @property {Array.|null} [identityEntries] IdentitiesByPublicKeyHashes identityEntries */ + GetIdentityByPublicKeyHashResponseV0.prototype.metadata = null; - /** - * Constructs a new IdentitiesByPublicKeyHashes. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse - * @classdesc Represents an IdentitiesByPublicKeyHashes. - * @implements IIdentitiesByPublicKeyHashes - * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IIdentitiesByPublicKeyHashes=} [properties] Properties to set - */ - function IdentitiesByPublicKeyHashes(properties) { - this.identityEntries = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * IdentitiesByPublicKeyHashes identityEntries. - * @member {Array.} identityEntries - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * GetIdentityByPublicKeyHashResponseV0 result. + * @member {"identity"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 * @instance */ - IdentitiesByPublicKeyHashes.prototype.identityEntries = $util.emptyArray; + Object.defineProperty(GetIdentityByPublicKeyHashResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["identity", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new IdentitiesByPublicKeyHashes instance using the specified properties. + * Creates a new GetIdentityByPublicKeyHashResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IIdentitiesByPublicKeyHashes=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} IdentitiesByPublicKeyHashes instance + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} GetIdentityByPublicKeyHashResponseV0 instance */ - IdentitiesByPublicKeyHashes.create = function create(properties) { - return new IdentitiesByPublicKeyHashes(properties); + GetIdentityByPublicKeyHashResponseV0.create = function create(properties) { + return new GetIdentityByPublicKeyHashResponseV0(properties); }; /** - * Encodes the specified IdentitiesByPublicKeyHashes message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.verify|verify} messages. + * Encodes the specified GetIdentityByPublicKeyHashResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IIdentitiesByPublicKeyHashes} message IdentitiesByPublicKeyHashes message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0} message GetIdentityByPublicKeyHashResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - IdentitiesByPublicKeyHashes.encode = function encode(message, writer) { + GetIdentityByPublicKeyHashResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.identityEntries != null && message.identityEntries.length) - for (var i = 0; i < message.identityEntries.length; ++i) - $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.encode(message.identityEntries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.identity != null && Object.hasOwnProperty.call(message, "identity")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identity); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified IdentitiesByPublicKeyHashes message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.verify|verify} messages. + * Encodes the specified GetIdentityByPublicKeyHashResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IIdentitiesByPublicKeyHashes} message IdentitiesByPublicKeyHashes message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0} message GetIdentityByPublicKeyHashResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - IdentitiesByPublicKeyHashes.encodeDelimited = function encodeDelimited(message, writer) { + GetIdentityByPublicKeyHashResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an IdentitiesByPublicKeyHashes message from the specified reader or buffer. + * Decodes a GetIdentityByPublicKeyHashResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} IdentitiesByPublicKeyHashes + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} GetIdentityByPublicKeyHashResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - IdentitiesByPublicKeyHashes.decode = function decode(reader, length) { + GetIdentityByPublicKeyHashResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.identityEntries && message.identityEntries.length)) - message.identityEntries = []; - message.identityEntries.push($root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.decode(reader, reader.uint32())); + message.identity = reader.bytes(); + break; + case 2: + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -16480,126 +18452,360 @@ $root.org = (function() { }; /** - * Decodes an IdentitiesByPublicKeyHashes message from the specified reader or buffer, length delimited. + * Decodes a GetIdentityByPublicKeyHashResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} IdentitiesByPublicKeyHashes + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} GetIdentityByPublicKeyHashResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - IdentitiesByPublicKeyHashes.decodeDelimited = function decodeDelimited(reader) { + GetIdentityByPublicKeyHashResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an IdentitiesByPublicKeyHashes message. + * Verifies a GetIdentityByPublicKeyHashResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - IdentitiesByPublicKeyHashes.verify = function verify(message) { + GetIdentityByPublicKeyHashResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.identityEntries != null && message.hasOwnProperty("identityEntries")) { - if (!Array.isArray(message.identityEntries)) - return "identityEntries: array expected"; - for (var i = 0; i < message.identityEntries.length; ++i) { - var error = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.verify(message.identityEntries[i]); + var properties = {}; + if (message.identity != null && message.hasOwnProperty("identity")) { + properties.result = 1; + if (!(message.identity && typeof message.identity.length === "number" || $util.isString(message.identity))) + return "identity: buffer expected"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); if (error) - return "identityEntries." + error; + return "proof." + error; } } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } return null; }; /** - * Creates an IdentitiesByPublicKeyHashes message from a plain object. Also converts values to their respective internal types. + * Creates a GetIdentityByPublicKeyHashResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} IdentitiesByPublicKeyHashes + * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} GetIdentityByPublicKeyHashResponseV0 */ - IdentitiesByPublicKeyHashes.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes) + GetIdentityByPublicKeyHashResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes(); - if (object.identityEntries) { - if (!Array.isArray(object.identityEntries)) - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.identityEntries: array expected"); - message.identityEntries = []; - for (var i = 0; i < object.identityEntries.length; ++i) { - if (typeof object.identityEntries[i] !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.identityEntries: object expected"); - message.identityEntries[i] = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.fromObject(object.identityEntries[i]); - } + var message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0(); + if (object.identity != null) + if (typeof object.identity === "string") + $util.base64.decode(object.identity, message.identity = $util.newBuffer($util.base64.length(object.identity)), 0); + else if (object.identity.length >= 0) + message.identity = object.identity; + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); } return message; }; /** - * Creates a plain object from an IdentitiesByPublicKeyHashes message. Also converts values to other types if specified. + * Creates a plain object from a GetIdentityByPublicKeyHashResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} message IdentitiesByPublicKeyHashes + * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} message GetIdentityByPublicKeyHashResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - IdentitiesByPublicKeyHashes.toObject = function toObject(message, options) { + GetIdentityByPublicKeyHashResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.identityEntries = []; - if (message.identityEntries && message.identityEntries.length) { - object.identityEntries = []; - for (var j = 0; j < message.identityEntries.length; ++j) - object.identityEntries[j] = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.toObject(message.identityEntries[j], options); + if (options.defaults) + object.metadata = null; + if (message.identity != null && message.hasOwnProperty("identity")) { + object.identity = options.bytes === String ? $util.base64.encode(message.identity, 0, message.identity.length) : options.bytes === Array ? Array.prototype.slice.call(message.identity) : message.identity; + if (options.oneofs) + object.result = "identity"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); return object; }; /** - * Converts this IdentitiesByPublicKeyHashes to JSON. + * Converts this GetIdentityByPublicKeyHashResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes + * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 * @instance * @returns {Object.} JSON object */ - IdentitiesByPublicKeyHashes.prototype.toJSON = function toJSON() { + GetIdentityByPublicKeyHashResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return IdentitiesByPublicKeyHashes; + return GetIdentityByPublicKeyHashResponseV0; })(); - GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 = (function() { + return GetIdentityByPublicKeyHashResponse; + })(); + + v0.WaitForStateTransitionResultRequest = (function() { + + /** + * Properties of a WaitForStateTransitionResultRequest. + * @memberof org.dash.platform.dapi.v0 + * @interface IWaitForStateTransitionResultRequest + * @property {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0|null} [v0] WaitForStateTransitionResultRequest v0 + */ + + /** + * Constructs a new WaitForStateTransitionResultRequest. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a WaitForStateTransitionResultRequest. + * @implements IWaitForStateTransitionResultRequest + * @constructor + * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultRequest=} [properties] Properties to set + */ + function WaitForStateTransitionResultRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WaitForStateTransitionResultRequest v0. + * @member {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @instance + */ + WaitForStateTransitionResultRequest.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * WaitForStateTransitionResultRequest version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @instance + */ + Object.defineProperty(WaitForStateTransitionResultRequest.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new WaitForStateTransitionResultRequest instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @static + * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} WaitForStateTransitionResultRequest instance + */ + WaitForStateTransitionResultRequest.create = function create(properties) { + return new WaitForStateTransitionResultRequest(properties); + }; + + /** + * Encodes the specified WaitForStateTransitionResultRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @static + * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultRequest} message WaitForStateTransitionResultRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitForStateTransitionResultRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WaitForStateTransitionResultRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @static + * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultRequest} message WaitForStateTransitionResultRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitForStateTransitionResultRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WaitForStateTransitionResultRequest message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} WaitForStateTransitionResultRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitForStateTransitionResultRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WaitForStateTransitionResultRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} WaitForStateTransitionResultRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitForStateTransitionResultRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WaitForStateTransitionResultRequest message. + * @function verify + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WaitForStateTransitionResultRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.verify(message.v0); + if (error) + return "v0." + error; + } + } + return null; + }; + + /** + * Creates a WaitForStateTransitionResultRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} WaitForStateTransitionResultRequest + */ + WaitForStateTransitionResultRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest) + return object; + var message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.fromObject(object.v0); + } + return message; + }; + + /** + * Creates a plain object from a WaitForStateTransitionResultRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @static + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} message WaitForStateTransitionResultRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WaitForStateTransitionResultRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; + + /** + * Converts this WaitForStateTransitionResultRequest to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @instance + * @returns {Object.} JSON object + */ + WaitForStateTransitionResultRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 = (function() { /** - * Properties of a GetIdentitiesByPublicKeyHashesResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse - * @interface IGetIdentitiesByPublicKeyHashesResponseV0 - * @property {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IIdentitiesByPublicKeyHashes|null} [identities] GetIdentitiesByPublicKeyHashesResponseV0 identities - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentitiesByPublicKeyHashesResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentitiesByPublicKeyHashesResponseV0 metadata + * Properties of a WaitForStateTransitionResultRequestV0. + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @interface IWaitForStateTransitionResultRequestV0 + * @property {Uint8Array|null} [stateTransitionHash] WaitForStateTransitionResultRequestV0 stateTransitionHash + * @property {boolean|null} [prove] WaitForStateTransitionResultRequestV0 prove */ /** - * Constructs a new GetIdentitiesByPublicKeyHashesResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse - * @classdesc Represents a GetIdentitiesByPublicKeyHashesResponseV0. - * @implements IGetIdentitiesByPublicKeyHashesResponseV0 + * Constructs a new WaitForStateTransitionResultRequestV0. + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @classdesc Represents a WaitForStateTransitionResultRequestV0. + * @implements IWaitForStateTransitionResultRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IGetIdentitiesByPublicKeyHashesResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0=} [properties] Properties to set */ - function GetIdentitiesByPublicKeyHashesResponseV0(properties) { + function WaitForStateTransitionResultRequestV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16607,115 +18813,88 @@ $root.org = (function() { } /** - * GetIdentitiesByPublicKeyHashesResponseV0 identities. - * @member {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IIdentitiesByPublicKeyHashes|null|undefined} identities - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 - * @instance - */ - GetIdentitiesByPublicKeyHashesResponseV0.prototype.identities = null; - - /** - * GetIdentitiesByPublicKeyHashesResponseV0 proof. - * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 - * @instance - */ - GetIdentitiesByPublicKeyHashesResponseV0.prototype.proof = null; - - /** - * GetIdentitiesByPublicKeyHashesResponseV0 metadata. - * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 + * WaitForStateTransitionResultRequestV0 stateTransitionHash. + * @member {Uint8Array} stateTransitionHash + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 * @instance */ - GetIdentitiesByPublicKeyHashesResponseV0.prototype.metadata = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + WaitForStateTransitionResultRequestV0.prototype.stateTransitionHash = $util.newBuffer([]); /** - * GetIdentitiesByPublicKeyHashesResponseV0 result. - * @member {"identities"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 + * WaitForStateTransitionResultRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 * @instance - */ - Object.defineProperty(GetIdentitiesByPublicKeyHashesResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["identities", "proof"]), - set: $util.oneOfSetter($oneOfFields) - }); + */ + WaitForStateTransitionResultRequestV0.prototype.prove = false; /** - * Creates a new GetIdentitiesByPublicKeyHashesResponseV0 instance using the specified properties. + * Creates a new WaitForStateTransitionResultRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IGetIdentitiesByPublicKeyHashesResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} GetIdentitiesByPublicKeyHashesResponseV0 instance + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} WaitForStateTransitionResultRequestV0 instance */ - GetIdentitiesByPublicKeyHashesResponseV0.create = function create(properties) { - return new GetIdentitiesByPublicKeyHashesResponseV0(properties); + WaitForStateTransitionResultRequestV0.create = function create(properties) { + return new WaitForStateTransitionResultRequestV0(properties); }; /** - * Encodes the specified GetIdentitiesByPublicKeyHashesResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.verify|verify} messages. + * Encodes the specified WaitForStateTransitionResultRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IGetIdentitiesByPublicKeyHashesResponseV0} message GetIdentitiesByPublicKeyHashesResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0} message WaitForStateTransitionResultRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesByPublicKeyHashesResponseV0.encode = function encode(message, writer) { + WaitForStateTransitionResultRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.identities != null && Object.hasOwnProperty.call(message, "identities")) - $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.encode(message.identities, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.stateTransitionHash != null && Object.hasOwnProperty.call(message, "stateTransitionHash")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.stateTransitionHash); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); return writer; }; /** - * Encodes the specified GetIdentitiesByPublicKeyHashesResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.verify|verify} messages. + * Encodes the specified WaitForStateTransitionResultRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IGetIdentitiesByPublicKeyHashesResponseV0} message GetIdentitiesByPublicKeyHashesResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0} message WaitForStateTransitionResultRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentitiesByPublicKeyHashesResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + WaitForStateTransitionResultRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentitiesByPublicKeyHashesResponseV0 message from the specified reader or buffer. + * Decodes a WaitForStateTransitionResultRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} GetIdentitiesByPublicKeyHashesResponseV0 + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} WaitForStateTransitionResultRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesByPublicKeyHashesResponseV0.decode = function decode(reader, length) { + WaitForStateTransitionResultRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.identities = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.decode(reader, reader.uint32()); + message.stateTransitionHash = reader.bytes(); break; case 2: - message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); - break; - case 3: - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + message.prove = reader.bool(); break; default: reader.skipType(tag & 7); @@ -16726,154 +18905,128 @@ $root.org = (function() { }; /** - * Decodes a GetIdentitiesByPublicKeyHashesResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a WaitForStateTransitionResultRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} GetIdentitiesByPublicKeyHashesResponseV0 + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} WaitForStateTransitionResultRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentitiesByPublicKeyHashesResponseV0.decodeDelimited = function decodeDelimited(reader) { + WaitForStateTransitionResultRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentitiesByPublicKeyHashesResponseV0 message. + * Verifies a WaitForStateTransitionResultRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentitiesByPublicKeyHashesResponseV0.verify = function verify(message) { + WaitForStateTransitionResultRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.identities != null && message.hasOwnProperty("identities")) { - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.verify(message.identities); - if (error) - return "identities." + error; - } - } - if (message.proof != null && message.hasOwnProperty("proof")) { - if (properties.result === 1) - return "result: multiple values"; - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); - if (error) - return "proof." + error; - } - } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); - if (error) - return "metadata." + error; - } + if (message.stateTransitionHash != null && message.hasOwnProperty("stateTransitionHash")) + if (!(message.stateTransitionHash && typeof message.stateTransitionHash.length === "number" || $util.isString(message.stateTransitionHash))) + return "stateTransitionHash: buffer expected"; + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; return null; }; /** - * Creates a GetIdentitiesByPublicKeyHashesResponseV0 message from a plain object. Also converts values to their respective internal types. + * Creates a WaitForStateTransitionResultRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} GetIdentitiesByPublicKeyHashesResponseV0 + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} WaitForStateTransitionResultRequestV0 */ - GetIdentitiesByPublicKeyHashesResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0) + WaitForStateTransitionResultRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0(); - if (object.identities != null) { - if (typeof object.identities !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.identities: object expected"); - message.identities = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.fromObject(object.identities); - } - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.proof: object expected"); - message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); - } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.metadata: object expected"); - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); - } + var message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0(); + if (object.stateTransitionHash != null) + if (typeof object.stateTransitionHash === "string") + $util.base64.decode(object.stateTransitionHash, message.stateTransitionHash = $util.newBuffer($util.base64.length(object.stateTransitionHash)), 0); + else if (object.stateTransitionHash.length >= 0) + message.stateTransitionHash = object.stateTransitionHash; + if (object.prove != null) + message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetIdentitiesByPublicKeyHashesResponseV0 message. Also converts values to other types if specified. + * Creates a plain object from a WaitForStateTransitionResultRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} message GetIdentitiesByPublicKeyHashesResponseV0 + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} message WaitForStateTransitionResultRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentitiesByPublicKeyHashesResponseV0.toObject = function toObject(message, options) { + WaitForStateTransitionResultRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.metadata = null; - if (message.identities != null && message.hasOwnProperty("identities")) { - object.identities = $root.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.toObject(message.identities, options); - if (options.oneofs) - object.result = "identities"; - } - if (message.proof != null && message.hasOwnProperty("proof")) { - object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); - if (options.oneofs) - object.result = "proof"; + if (options.defaults) { + if (options.bytes === String) + object.stateTransitionHash = ""; + else { + object.stateTransitionHash = []; + if (options.bytes !== Array) + object.stateTransitionHash = $util.newBuffer(object.stateTransitionHash); + } + object.prove = false; } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + if (message.stateTransitionHash != null && message.hasOwnProperty("stateTransitionHash")) + object.stateTransitionHash = options.bytes === String ? $util.base64.encode(message.stateTransitionHash, 0, message.stateTransitionHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.stateTransitionHash) : message.stateTransitionHash; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; return object; }; /** - * Converts this GetIdentitiesByPublicKeyHashesResponseV0 to JSON. + * Converts this WaitForStateTransitionResultRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 * @instance * @returns {Object.} JSON object */ - GetIdentitiesByPublicKeyHashesResponseV0.prototype.toJSON = function toJSON() { + WaitForStateTransitionResultRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetIdentitiesByPublicKeyHashesResponseV0; + return WaitForStateTransitionResultRequestV0; })(); - return GetIdentitiesByPublicKeyHashesResponse; + return WaitForStateTransitionResultRequest; })(); - v0.GetIdentityByPublicKeyHashRequest = (function() { + v0.WaitForStateTransitionResultResponse = (function() { /** - * Properties of a GetIdentityByPublicKeyHashRequest. + * Properties of a WaitForStateTransitionResultResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentityByPublicKeyHashRequest - * @property {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0|null} [v0] GetIdentityByPublicKeyHashRequest v0 + * @interface IWaitForStateTransitionResultResponse + * @property {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0|null} [v0] WaitForStateTransitionResultResponse v0 */ /** - * Constructs a new GetIdentityByPublicKeyHashRequest. + * Constructs a new WaitForStateTransitionResultResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentityByPublicKeyHashRequest. - * @implements IGetIdentityByPublicKeyHashRequest + * @classdesc Represents a WaitForStateTransitionResultResponse. + * @implements IWaitForStateTransitionResultResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultResponse=} [properties] Properties to set */ - function GetIdentityByPublicKeyHashRequest(properties) { + function WaitForStateTransitionResultResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16881,89 +19034,89 @@ $root.org = (function() { } /** - * GetIdentityByPublicKeyHashRequest v0. - * @member {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * WaitForStateTransitionResultResponse v0. + * @member {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse * @instance */ - GetIdentityByPublicKeyHashRequest.prototype.v0 = null; + WaitForStateTransitionResultResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentityByPublicKeyHashRequest version. + * WaitForStateTransitionResultResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse * @instance */ - Object.defineProperty(GetIdentityByPublicKeyHashRequest.prototype, "version", { + Object.defineProperty(WaitForStateTransitionResultResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentityByPublicKeyHashRequest instance using the specified properties. + * Creates a new WaitForStateTransitionResultResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} GetIdentityByPublicKeyHashRequest instance + * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} WaitForStateTransitionResultResponse instance */ - GetIdentityByPublicKeyHashRequest.create = function create(properties) { - return new GetIdentityByPublicKeyHashRequest(properties); + WaitForStateTransitionResultResponse.create = function create(properties) { + return new WaitForStateTransitionResultResponse(properties); }; /** - * Encodes the specified GetIdentityByPublicKeyHashRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.verify|verify} messages. + * Encodes the specified WaitForStateTransitionResultResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashRequest} message GetIdentityByPublicKeyHashRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultResponse} message WaitForStateTransitionResultResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityByPublicKeyHashRequest.encode = function encode(message, writer) { + WaitForStateTransitionResultResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentityByPublicKeyHashRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.verify|verify} messages. + * Encodes the specified WaitForStateTransitionResultResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashRequest} message GetIdentityByPublicKeyHashRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultResponse} message WaitForStateTransitionResultResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityByPublicKeyHashRequest.encodeDelimited = function encodeDelimited(message, writer) { + WaitForStateTransitionResultResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityByPublicKeyHashRequest message from the specified reader or buffer. + * Decodes a WaitForStateTransitionResultResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} GetIdentityByPublicKeyHashRequest + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} WaitForStateTransitionResultResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityByPublicKeyHashRequest.decode = function decode(reader, length) { + WaitForStateTransitionResultResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -16974,37 +19127,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityByPublicKeyHashRequest message from the specified reader or buffer, length delimited. + * Decodes a WaitForStateTransitionResultResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} GetIdentityByPublicKeyHashRequest + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} WaitForStateTransitionResultResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityByPublicKeyHashRequest.decodeDelimited = function decodeDelimited(reader) { + WaitForStateTransitionResultResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityByPublicKeyHashRequest message. + * Verifies a WaitForStateTransitionResultResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityByPublicKeyHashRequest.verify = function verify(message) { + WaitForStateTransitionResultResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -17013,40 +19166,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentityByPublicKeyHashRequest message from a plain object. Also converts values to their respective internal types. + * Creates a WaitForStateTransitionResultResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} GetIdentityByPublicKeyHashRequest + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} WaitForStateTransitionResultResponse */ - GetIdentityByPublicKeyHashRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest) + WaitForStateTransitionResultResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest(); + var message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentityByPublicKeyHashRequest message. Also converts values to other types if specified. + * Creates a plain object from a WaitForStateTransitionResultResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} message GetIdentityByPublicKeyHashRequest + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} message WaitForStateTransitionResultResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityByPublicKeyHashRequest.toObject = function toObject(message, options) { + WaitForStateTransitionResultResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -17054,35 +19207,36 @@ $root.org = (function() { }; /** - * Converts this GetIdentityByPublicKeyHashRequest to JSON. + * Converts this WaitForStateTransitionResultResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse * @instance * @returns {Object.} JSON object */ - GetIdentityByPublicKeyHashRequest.prototype.toJSON = function toJSON() { + WaitForStateTransitionResultResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 = (function() { + WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 = (function() { - /** - * Properties of a GetIdentityByPublicKeyHashRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest - * @interface IGetIdentityByPublicKeyHashRequestV0 - * @property {Uint8Array|null} [publicKeyHash] GetIdentityByPublicKeyHashRequestV0 publicKeyHash - * @property {boolean|null} [prove] GetIdentityByPublicKeyHashRequestV0 prove + /** + * Properties of a WaitForStateTransitionResultResponseV0. + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @interface IWaitForStateTransitionResultResponseV0 + * @property {org.dash.platform.dapi.v0.IStateTransitionBroadcastError|null} [error] WaitForStateTransitionResultResponseV0 error + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] WaitForStateTransitionResultResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] WaitForStateTransitionResultResponseV0 metadata */ /** - * Constructs a new GetIdentityByPublicKeyHashRequestV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest - * @classdesc Represents a GetIdentityByPublicKeyHashRequestV0. - * @implements IGetIdentityByPublicKeyHashRequestV0 + * Constructs a new WaitForStateTransitionResultResponseV0. + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse + * @classdesc Represents a WaitForStateTransitionResultResponseV0. + * @implements IWaitForStateTransitionResultResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0=} [properties] Properties to set */ - function GetIdentityByPublicKeyHashRequestV0(properties) { + function WaitForStateTransitionResultResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17090,88 +19244,115 @@ $root.org = (function() { } /** - * GetIdentityByPublicKeyHashRequestV0 publicKeyHash. - * @member {Uint8Array} publicKeyHash - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * WaitForStateTransitionResultResponseV0 error. + * @member {org.dash.platform.dapi.v0.IStateTransitionBroadcastError|null|undefined} error + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 * @instance */ - GetIdentityByPublicKeyHashRequestV0.prototype.publicKeyHash = $util.newBuffer([]); + WaitForStateTransitionResultResponseV0.prototype.error = null; /** - * GetIdentityByPublicKeyHashRequestV0 prove. - * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * WaitForStateTransitionResultResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 * @instance */ - GetIdentityByPublicKeyHashRequestV0.prototype.prove = false; + WaitForStateTransitionResultResponseV0.prototype.proof = null; /** - * Creates a new GetIdentityByPublicKeyHashRequestV0 instance using the specified properties. + * WaitForStateTransitionResultResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @instance + */ + WaitForStateTransitionResultResponseV0.prototype.metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * WaitForStateTransitionResultResponseV0 result. + * @member {"error"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @instance + */ + Object.defineProperty(WaitForStateTransitionResultResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["error", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new WaitForStateTransitionResultResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} GetIdentityByPublicKeyHashRequestV0 instance + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} WaitForStateTransitionResultResponseV0 instance */ - GetIdentityByPublicKeyHashRequestV0.create = function create(properties) { - return new GetIdentityByPublicKeyHashRequestV0(properties); + WaitForStateTransitionResultResponseV0.create = function create(properties) { + return new WaitForStateTransitionResultResponseV0(properties); }; /** - * Encodes the specified GetIdentityByPublicKeyHashRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.verify|verify} messages. + * Encodes the specified WaitForStateTransitionResultResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0} message GetIdentityByPublicKeyHashRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0} message WaitForStateTransitionResultResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityByPublicKeyHashRequestV0.encode = function encode(message, writer) { + WaitForStateTransitionResultResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.publicKeyHash != null && Object.hasOwnProperty.call(message, "publicKeyHash")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.publicKeyHash); - if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.encode(message.error, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentityByPublicKeyHashRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.verify|verify} messages. + * Encodes the specified WaitForStateTransitionResultResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.IGetIdentityByPublicKeyHashRequestV0} message GetIdentityByPublicKeyHashRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0} message WaitForStateTransitionResultResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityByPublicKeyHashRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + WaitForStateTransitionResultResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityByPublicKeyHashRequestV0 message from the specified reader or buffer. + * Decodes a WaitForStateTransitionResultResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} GetIdentityByPublicKeyHashRequestV0 + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} WaitForStateTransitionResultResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityByPublicKeyHashRequestV0.decode = function decode(reader, length) { + WaitForStateTransitionResultResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.publicKeyHash = reader.bytes(); + message.error = $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.decode(reader, reader.uint32()); break; case 2: - message.prove = reader.bool(); + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -17182,218 +19363,244 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityByPublicKeyHashRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a WaitForStateTransitionResultResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} GetIdentityByPublicKeyHashRequestV0 + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} WaitForStateTransitionResultResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityByPublicKeyHashRequestV0.decodeDelimited = function decodeDelimited(reader) { + WaitForStateTransitionResultResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityByPublicKeyHashRequestV0 message. + * Verifies a WaitForStateTransitionResultResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityByPublicKeyHashRequestV0.verify = function verify(message) { + WaitForStateTransitionResultResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.publicKeyHash != null && message.hasOwnProperty("publicKeyHash")) - if (!(message.publicKeyHash && typeof message.publicKeyHash.length === "number" || $util.isString(message.publicKeyHash))) - return "publicKeyHash: buffer expected"; - if (message.prove != null && message.hasOwnProperty("prove")) - if (typeof message.prove !== "boolean") - return "prove: boolean expected"; + var properties = {}; + if (message.error != null && message.hasOwnProperty("error")) { + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.verify(message.error); + if (error) + return "error." + error; + } + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } return null; }; /** - * Creates a GetIdentityByPublicKeyHashRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a WaitForStateTransitionResultResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} GetIdentityByPublicKeyHashRequestV0 + * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} WaitForStateTransitionResultResponseV0 */ - GetIdentityByPublicKeyHashRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0) + WaitForStateTransitionResultResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0(); - if (object.publicKeyHash != null) - if (typeof object.publicKeyHash === "string") - $util.base64.decode(object.publicKeyHash, message.publicKeyHash = $util.newBuffer($util.base64.length(object.publicKeyHash)), 0); - else if (object.publicKeyHash.length >= 0) - message.publicKeyHash = object.publicKeyHash; - if (object.prove != null) - message.prove = Boolean(object.prove); + var message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0(); + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.error: object expected"); + message.error = $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.fromObject(object.error); + } + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } return message; }; /** - * Creates a plain object from a GetIdentityByPublicKeyHashRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a WaitForStateTransitionResultResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} message GetIdentityByPublicKeyHashRequestV0 + * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} message WaitForStateTransitionResultResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityByPublicKeyHashRequestV0.toObject = function toObject(message, options) { + WaitForStateTransitionResultResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - if (options.bytes === String) - object.publicKeyHash = ""; - else { - object.publicKeyHash = []; - if (options.bytes !== Array) - object.publicKeyHash = $util.newBuffer(object.publicKeyHash); - } - object.prove = false; + if (options.defaults) + object.metadata = null; + if (message.error != null && message.hasOwnProperty("error")) { + object.error = $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject(message.error, options); + if (options.oneofs) + object.result = "error"; } - if (message.publicKeyHash != null && message.hasOwnProperty("publicKeyHash")) - object.publicKeyHash = options.bytes === String ? $util.base64.encode(message.publicKeyHash, 0, message.publicKeyHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.publicKeyHash) : message.publicKeyHash; - if (message.prove != null && message.hasOwnProperty("prove")) - object.prove = message.prove; + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); return object; }; /** - * Converts this GetIdentityByPublicKeyHashRequestV0 to JSON. + * Converts this WaitForStateTransitionResultResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 + * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 * @instance * @returns {Object.} JSON object */ - GetIdentityByPublicKeyHashRequestV0.prototype.toJSON = function toJSON() { + WaitForStateTransitionResultResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetIdentityByPublicKeyHashRequestV0; + return WaitForStateTransitionResultResponseV0; })(); - return GetIdentityByPublicKeyHashRequest; + return WaitForStateTransitionResultResponse; })(); - v0.GetIdentityByPublicKeyHashResponse = (function() { + v0.GetConsensusParamsRequest = (function() { /** - * Properties of a GetIdentityByPublicKeyHashResponse. + * Properties of a GetConsensusParamsRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetIdentityByPublicKeyHashResponse - * @property {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0|null} [v0] GetIdentityByPublicKeyHashResponse v0 + * @interface IGetConsensusParamsRequest + * @property {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0|null} [v0] GetConsensusParamsRequest v0 */ /** - * Constructs a new GetIdentityByPublicKeyHashResponse. + * Constructs a new GetConsensusParamsRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetIdentityByPublicKeyHashResponse. - * @implements IGetIdentityByPublicKeyHashResponse + * @classdesc Represents a GetConsensusParamsRequest. + * @implements IGetConsensusParamsRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetConsensusParamsRequest=} [properties] Properties to set */ - function GetIdentityByPublicKeyHashResponse(properties) { + function GetConsensusParamsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } - /** - * GetIdentityByPublicKeyHashResponse v0. - * @member {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + /** + * GetConsensusParamsRequest v0. + * @member {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest * @instance */ - GetIdentityByPublicKeyHashResponse.prototype.v0 = null; + GetConsensusParamsRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetIdentityByPublicKeyHashResponse version. + * GetConsensusParamsRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest * @instance */ - Object.defineProperty(GetIdentityByPublicKeyHashResponse.prototype, "version", { + Object.defineProperty(GetConsensusParamsRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetIdentityByPublicKeyHashResponse instance using the specified properties. + * Creates a new GetConsensusParamsRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} GetIdentityByPublicKeyHashResponse instance + * @param {org.dash.platform.dapi.v0.IGetConsensusParamsRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest} GetConsensusParamsRequest instance */ - GetIdentityByPublicKeyHashResponse.create = function create(properties) { - return new GetIdentityByPublicKeyHashResponse(properties); + GetConsensusParamsRequest.create = function create(properties) { + return new GetConsensusParamsRequest(properties); }; /** - * Encodes the specified GetIdentityByPublicKeyHashResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.verify|verify} messages. + * Encodes the specified GetConsensusParamsRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashResponse} message GetIdentityByPublicKeyHashResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetConsensusParamsRequest} message GetConsensusParamsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityByPublicKeyHashResponse.encode = function encode(message, writer) { + GetConsensusParamsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIdentityByPublicKeyHashResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.verify|verify} messages. + * Encodes the specified GetConsensusParamsRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest * @static - * @param {org.dash.platform.dapi.v0.IGetIdentityByPublicKeyHashResponse} message GetIdentityByPublicKeyHashResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetConsensusParamsRequest} message GetConsensusParamsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityByPublicKeyHashResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetConsensusParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityByPublicKeyHashResponse message from the specified reader or buffer. + * Decodes a GetConsensusParamsRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} GetIdentityByPublicKeyHashResponse + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest} GetConsensusParamsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityByPublicKeyHashResponse.decode = function decode(reader, length) { + GetConsensusParamsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -17404,37 +19611,37 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityByPublicKeyHashResponse message from the specified reader or buffer, length delimited. + * Decodes a GetConsensusParamsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} GetIdentityByPublicKeyHashResponse + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest} GetConsensusParamsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityByPublicKeyHashResponse.decodeDelimited = function decodeDelimited(reader) { + GetConsensusParamsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityByPublicKeyHashResponse message. + * Verifies a GetConsensusParamsRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityByPublicKeyHashResponse.verify = function verify(message) { + GetConsensusParamsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -17443,40 +19650,40 @@ $root.org = (function() { }; /** - * Creates a GetIdentityByPublicKeyHashResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetConsensusParamsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} GetIdentityByPublicKeyHashResponse + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest} GetConsensusParamsRequest */ - GetIdentityByPublicKeyHashResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse) + GetConsensusParamsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetConsensusParamsRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetIdentityByPublicKeyHashResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetConsensusParamsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} message GetIdentityByPublicKeyHashResponse + * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest} message GetConsensusParamsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityByPublicKeyHashResponse.toObject = function toObject(message, options) { + GetConsensusParamsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -17484,36 +19691,35 @@ $root.org = (function() { }; /** - * Converts this GetIdentityByPublicKeyHashResponse to JSON. + * Converts this GetConsensusParamsRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest * @instance * @returns {Object.} JSON object */ - GetIdentityByPublicKeyHashResponse.prototype.toJSON = function toJSON() { + GetConsensusParamsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 = (function() { + GetConsensusParamsRequest.GetConsensusParamsRequestV0 = (function() { /** - * Properties of a GetIdentityByPublicKeyHashResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse - * @interface IGetIdentityByPublicKeyHashResponseV0 - * @property {Uint8Array|null} [identity] GetIdentityByPublicKeyHashResponseV0 identity - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityByPublicKeyHashResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityByPublicKeyHashResponseV0 metadata + * Properties of a GetConsensusParamsRequestV0. + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest + * @interface IGetConsensusParamsRequestV0 + * @property {number|null} [height] GetConsensusParamsRequestV0 height + * @property {boolean|null} [prove] GetConsensusParamsRequestV0 prove */ /** - * Constructs a new GetIdentityByPublicKeyHashResponseV0. - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse - * @classdesc Represents a GetIdentityByPublicKeyHashResponseV0. - * @implements IGetIdentityByPublicKeyHashResponseV0 + * Constructs a new GetConsensusParamsRequestV0. + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest + * @classdesc Represents a GetConsensusParamsRequestV0. + * @implements IGetConsensusParamsRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0=} [properties] Properties to set */ - function GetIdentityByPublicKeyHashResponseV0(properties) { + function GetConsensusParamsRequestV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17521,115 +19727,88 @@ $root.org = (function() { } /** - * GetIdentityByPublicKeyHashResponseV0 identity. - * @member {Uint8Array} identity - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 - * @instance - */ - GetIdentityByPublicKeyHashResponseV0.prototype.identity = $util.newBuffer([]); - - /** - * GetIdentityByPublicKeyHashResponseV0 proof. - * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 - * @instance - */ - GetIdentityByPublicKeyHashResponseV0.prototype.proof = null; - - /** - * GetIdentityByPublicKeyHashResponseV0 metadata. - * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * GetConsensusParamsRequestV0 height. + * @member {number} height + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 * @instance */ - GetIdentityByPublicKeyHashResponseV0.prototype.metadata = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + GetConsensusParamsRequestV0.prototype.height = 0; /** - * GetIdentityByPublicKeyHashResponseV0 result. - * @member {"identity"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * GetConsensusParamsRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 * @instance */ - Object.defineProperty(GetIdentityByPublicKeyHashResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["identity", "proof"]), - set: $util.oneOfSetter($oneOfFields) - }); + GetConsensusParamsRequestV0.prototype.prove = false; /** - * Creates a new GetIdentityByPublicKeyHashResponseV0 instance using the specified properties. + * Creates a new GetConsensusParamsRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} GetIdentityByPublicKeyHashResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} GetConsensusParamsRequestV0 instance */ - GetIdentityByPublicKeyHashResponseV0.create = function create(properties) { - return new GetIdentityByPublicKeyHashResponseV0(properties); + GetConsensusParamsRequestV0.create = function create(properties) { + return new GetConsensusParamsRequestV0(properties); }; /** - * Encodes the specified GetIdentityByPublicKeyHashResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.verify|verify} messages. + * Encodes the specified GetConsensusParamsRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0} message GetIdentityByPublicKeyHashResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0} message GetConsensusParamsRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityByPublicKeyHashResponseV0.encode = function encode(message, writer) { + GetConsensusParamsRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.identity != null && Object.hasOwnProperty.call(message, "identity")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.identity); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.height); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); return writer; }; /** - * Encodes the specified GetIdentityByPublicKeyHashResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.verify|verify} messages. + * Encodes the specified GetConsensusParamsRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.IGetIdentityByPublicKeyHashResponseV0} message GetIdentityByPublicKeyHashResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0} message GetConsensusParamsRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIdentityByPublicKeyHashResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetConsensusParamsRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIdentityByPublicKeyHashResponseV0 message from the specified reader or buffer. + * Decodes a GetConsensusParamsRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} GetIdentityByPublicKeyHashResponseV0 + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} GetConsensusParamsRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityByPublicKeyHashResponseV0.decode = function decode(reader, length) { + GetConsensusParamsRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.identity = reader.bytes(); + message.height = reader.int32(); break; case 2: - message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); - break; - case 3: - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + message.prove = reader.bool(); break; default: reader.skipType(tag & 7); @@ -17640,151 +19819,119 @@ $root.org = (function() { }; /** - * Decodes a GetIdentityByPublicKeyHashResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a GetConsensusParamsRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} GetIdentityByPublicKeyHashResponseV0 + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} GetConsensusParamsRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIdentityByPublicKeyHashResponseV0.decodeDelimited = function decodeDelimited(reader) { + GetConsensusParamsRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetIdentityByPublicKeyHashResponseV0 message. + * Verifies a GetConsensusParamsRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetIdentityByPublicKeyHashResponseV0.verify = function verify(message) { + GetConsensusParamsRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.identity != null && message.hasOwnProperty("identity")) { - properties.result = 1; - if (!(message.identity && typeof message.identity.length === "number" || $util.isString(message.identity))) - return "identity: buffer expected"; - } - if (message.proof != null && message.hasOwnProperty("proof")) { - if (properties.result === 1) - return "result: multiple values"; - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); - if (error) - return "proof." + error; - } - } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); - if (error) - return "metadata." + error; - } + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; return null; }; /** - * Creates a GetIdentityByPublicKeyHashResponseV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetConsensusParamsRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} GetIdentityByPublicKeyHashResponseV0 + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} GetConsensusParamsRequestV0 */ - GetIdentityByPublicKeyHashResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0) + GetConsensusParamsRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0(); - if (object.identity != null) - if (typeof object.identity === "string") - $util.base64.decode(object.identity, message.identity = $util.newBuffer($util.base64.length(object.identity)), 0); - else if (object.identity.length >= 0) - message.identity = object.identity; - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.proof: object expected"); - message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); - } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.metadata: object expected"); - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); - } + var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0(); + if (object.height != null) + message.height = object.height | 0; + if (object.prove != null) + message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetIdentityByPublicKeyHashResponseV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetConsensusParamsRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} message GetIdentityByPublicKeyHashResponseV0 + * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} message GetConsensusParamsRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetIdentityByPublicKeyHashResponseV0.toObject = function toObject(message, options) { + GetConsensusParamsRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.metadata = null; - if (message.identity != null && message.hasOwnProperty("identity")) { - object.identity = options.bytes === String ? $util.base64.encode(message.identity, 0, message.identity.length) : options.bytes === Array ? Array.prototype.slice.call(message.identity) : message.identity; - if (options.oneofs) - object.result = "identity"; - } - if (message.proof != null && message.hasOwnProperty("proof")) { - object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); - if (options.oneofs) - object.result = "proof"; + if (options.defaults) { + object.height = 0; + object.prove = false; } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; return object; }; /** - * Converts this GetIdentityByPublicKeyHashResponseV0 to JSON. + * Converts this GetConsensusParamsRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 * @instance * @returns {Object.} JSON object */ - GetIdentityByPublicKeyHashResponseV0.prototype.toJSON = function toJSON() { + GetConsensusParamsRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetIdentityByPublicKeyHashResponseV0; + return GetConsensusParamsRequestV0; })(); - return GetIdentityByPublicKeyHashResponse; + return GetConsensusParamsRequest; })(); - v0.WaitForStateTransitionResultRequest = (function() { + v0.GetConsensusParamsResponse = (function() { /** - * Properties of a WaitForStateTransitionResultRequest. + * Properties of a GetConsensusParamsResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IWaitForStateTransitionResultRequest - * @property {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0|null} [v0] WaitForStateTransitionResultRequest v0 + * @interface IGetConsensusParamsResponse + * @property {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0|null} [v0] GetConsensusParamsResponse v0 */ /** - * Constructs a new WaitForStateTransitionResultRequest. + * Constructs a new GetConsensusParamsResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a WaitForStateTransitionResultRequest. - * @implements IWaitForStateTransitionResultRequest + * @classdesc Represents a GetConsensusParamsResponse. + * @implements IGetConsensusParamsResponse * @constructor - * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetConsensusParamsResponse=} [properties] Properties to set */ - function WaitForStateTransitionResultRequest(properties) { + function GetConsensusParamsResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17792,89 +19939,89 @@ $root.org = (function() { } /** - * WaitForStateTransitionResultRequest v0. - * @member {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * GetConsensusParamsResponse v0. + * @member {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse * @instance */ - WaitForStateTransitionResultRequest.prototype.v0 = null; + GetConsensusParamsResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * WaitForStateTransitionResultRequest version. + * GetConsensusParamsResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse * @instance */ - Object.defineProperty(WaitForStateTransitionResultRequest.prototype, "version", { + Object.defineProperty(GetConsensusParamsResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new WaitForStateTransitionResultRequest instance using the specified properties. + * Creates a new GetConsensusParamsResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse * @static - * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} WaitForStateTransitionResultRequest instance + * @param {org.dash.platform.dapi.v0.IGetConsensusParamsResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse} GetConsensusParamsResponse instance */ - WaitForStateTransitionResultRequest.create = function create(properties) { - return new WaitForStateTransitionResultRequest(properties); + GetConsensusParamsResponse.create = function create(properties) { + return new GetConsensusParamsResponse(properties); }; /** - * Encodes the specified WaitForStateTransitionResultRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.verify|verify} messages. + * Encodes the specified GetConsensusParamsResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse * @static - * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultRequest} message WaitForStateTransitionResultRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetConsensusParamsResponse} message GetConsensusParamsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WaitForStateTransitionResultRequest.encode = function encode(message, writer) { + GetConsensusParamsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified WaitForStateTransitionResultRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.verify|verify} messages. + * Encodes the specified GetConsensusParamsResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse * @static - * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultRequest} message WaitForStateTransitionResultRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetConsensusParamsResponse} message GetConsensusParamsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WaitForStateTransitionResultRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetConsensusParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a WaitForStateTransitionResultRequest message from the specified reader or buffer. + * Decodes a GetConsensusParamsResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} WaitForStateTransitionResultRequest + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse} GetConsensusParamsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WaitForStateTransitionResultRequest.decode = function decode(reader, length) { + GetConsensusParamsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -17885,37 +20032,37 @@ $root.org = (function() { }; /** - * Decodes a WaitForStateTransitionResultRequest message from the specified reader or buffer, length delimited. + * Decodes a GetConsensusParamsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} WaitForStateTransitionResultRequest + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse} GetConsensusParamsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WaitForStateTransitionResultRequest.decodeDelimited = function decodeDelimited(reader) { + GetConsensusParamsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a WaitForStateTransitionResultRequest message. + * Verifies a GetConsensusParamsResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - WaitForStateTransitionResultRequest.verify = function verify(message) { + GetConsensusParamsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -17924,40 +20071,40 @@ $root.org = (function() { }; /** - * Creates a WaitForStateTransitionResultRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetConsensusParamsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} WaitForStateTransitionResultRequest + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse} GetConsensusParamsResponse */ - WaitForStateTransitionResultRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest) + GetConsensusParamsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetConsensusParamsResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a WaitForStateTransitionResultRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetConsensusParamsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} message WaitForStateTransitionResultRequest + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse} message GetConsensusParamsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - WaitForStateTransitionResultRequest.toObject = function toObject(message, options) { + GetConsensusParamsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -17965,35 +20112,36 @@ $root.org = (function() { }; /** - * Converts this WaitForStateTransitionResultRequest to JSON. + * Converts this GetConsensusParamsResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse * @instance * @returns {Object.} JSON object */ - WaitForStateTransitionResultRequest.prototype.toJSON = function toJSON() { + GetConsensusParamsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 = (function() { + GetConsensusParamsResponse.ConsensusParamsBlock = (function() { /** - * Properties of a WaitForStateTransitionResultRequestV0. - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest - * @interface IWaitForStateTransitionResultRequestV0 - * @property {Uint8Array|null} [stateTransitionHash] WaitForStateTransitionResultRequestV0 stateTransitionHash - * @property {boolean|null} [prove] WaitForStateTransitionResultRequestV0 prove + * Properties of a ConsensusParamsBlock. + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @interface IConsensusParamsBlock + * @property {string|null} [maxBytes] ConsensusParamsBlock maxBytes + * @property {string|null} [maxGas] ConsensusParamsBlock maxGas + * @property {string|null} [timeIotaMs] ConsensusParamsBlock timeIotaMs */ /** - * Constructs a new WaitForStateTransitionResultRequestV0. - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest - * @classdesc Represents a WaitForStateTransitionResultRequestV0. - * @implements IWaitForStateTransitionResultRequestV0 + * Constructs a new ConsensusParamsBlock. + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @classdesc Represents a ConsensusParamsBlock. + * @implements IConsensusParamsBlock * @constructor - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock=} [properties] Properties to set */ - function WaitForStateTransitionResultRequestV0(properties) { + function ConsensusParamsBlock(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -18001,88 +20149,101 @@ $root.org = (function() { } /** - * WaitForStateTransitionResultRequestV0 stateTransitionHash. - * @member {Uint8Array} stateTransitionHash - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * ConsensusParamsBlock maxBytes. + * @member {string} maxBytes + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock * @instance */ - WaitForStateTransitionResultRequestV0.prototype.stateTransitionHash = $util.newBuffer([]); + ConsensusParamsBlock.prototype.maxBytes = ""; /** - * WaitForStateTransitionResultRequestV0 prove. - * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * ConsensusParamsBlock maxGas. + * @member {string} maxGas + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock * @instance */ - WaitForStateTransitionResultRequestV0.prototype.prove = false; + ConsensusParamsBlock.prototype.maxGas = ""; /** - * Creates a new WaitForStateTransitionResultRequestV0 instance using the specified properties. + * ConsensusParamsBlock timeIotaMs. + * @member {string} timeIotaMs + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @instance + */ + ConsensusParamsBlock.prototype.timeIotaMs = ""; + + /** + * Creates a new ConsensusParamsBlock instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} WaitForStateTransitionResultRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} ConsensusParamsBlock instance */ - WaitForStateTransitionResultRequestV0.create = function create(properties) { - return new WaitForStateTransitionResultRequestV0(properties); + ConsensusParamsBlock.create = function create(properties) { + return new ConsensusParamsBlock(properties); }; /** - * Encodes the specified WaitForStateTransitionResultRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.verify|verify} messages. + * Encodes the specified ConsensusParamsBlock message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0} message WaitForStateTransitionResultRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock} message ConsensusParamsBlock message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WaitForStateTransitionResultRequestV0.encode = function encode(message, writer) { + ConsensusParamsBlock.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.stateTransitionHash != null && Object.hasOwnProperty.call(message, "stateTransitionHash")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.stateTransitionHash); - if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); + if (message.maxBytes != null && Object.hasOwnProperty.call(message, "maxBytes")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.maxBytes); + if (message.maxGas != null && Object.hasOwnProperty.call(message, "maxGas")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.maxGas); + if (message.timeIotaMs != null && Object.hasOwnProperty.call(message, "timeIotaMs")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.timeIotaMs); return writer; }; /** - * Encodes the specified WaitForStateTransitionResultRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.verify|verify} messages. + * Encodes the specified ConsensusParamsBlock message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.IWaitForStateTransitionResultRequestV0} message WaitForStateTransitionResultRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock} message ConsensusParamsBlock message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WaitForStateTransitionResultRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + ConsensusParamsBlock.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a WaitForStateTransitionResultRequestV0 message from the specified reader or buffer. + * Decodes a ConsensusParamsBlock message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} WaitForStateTransitionResultRequestV0 + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} ConsensusParamsBlock * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WaitForStateTransitionResultRequestV0.decode = function decode(reader, length) { + ConsensusParamsBlock.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.stateTransitionHash = reader.bytes(); + message.maxBytes = reader.string(); break; case 2: - message.prove = reader.bool(); + message.maxGas = reader.string(); + break; + case 3: + message.timeIotaMs = reader.string(); break; default: reader.skipType(tag & 7); @@ -18093,338 +20254,126 @@ $root.org = (function() { }; /** - * Decodes a WaitForStateTransitionResultRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a ConsensusParamsBlock message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} WaitForStateTransitionResultRequestV0 + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} ConsensusParamsBlock * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WaitForStateTransitionResultRequestV0.decodeDelimited = function decodeDelimited(reader) { + ConsensusParamsBlock.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a WaitForStateTransitionResultRequestV0 message. + * Verifies a ConsensusParamsBlock message. * @function verify - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - WaitForStateTransitionResultRequestV0.verify = function verify(message) { + ConsensusParamsBlock.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.stateTransitionHash != null && message.hasOwnProperty("stateTransitionHash")) - if (!(message.stateTransitionHash && typeof message.stateTransitionHash.length === "number" || $util.isString(message.stateTransitionHash))) - return "stateTransitionHash: buffer expected"; - if (message.prove != null && message.hasOwnProperty("prove")) - if (typeof message.prove !== "boolean") - return "prove: boolean expected"; - return null; - }; - - /** - * Creates a WaitForStateTransitionResultRequestV0 message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} WaitForStateTransitionResultRequestV0 - */ - WaitForStateTransitionResultRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0) - return object; - var message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0(); - if (object.stateTransitionHash != null) - if (typeof object.stateTransitionHash === "string") - $util.base64.decode(object.stateTransitionHash, message.stateTransitionHash = $util.newBuffer($util.base64.length(object.stateTransitionHash)), 0); - else if (object.stateTransitionHash.length >= 0) - message.stateTransitionHash = object.stateTransitionHash; - if (object.prove != null) - message.prove = Boolean(object.prove); - return message; - }; - - /** - * Creates a plain object from a WaitForStateTransitionResultRequestV0 message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 - * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} message WaitForStateTransitionResultRequestV0 - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WaitForStateTransitionResultRequestV0.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if (options.bytes === String) - object.stateTransitionHash = ""; - else { - object.stateTransitionHash = []; - if (options.bytes !== Array) - object.stateTransitionHash = $util.newBuffer(object.stateTransitionHash); - } - object.prove = false; - } - if (message.stateTransitionHash != null && message.hasOwnProperty("stateTransitionHash")) - object.stateTransitionHash = options.bytes === String ? $util.base64.encode(message.stateTransitionHash, 0, message.stateTransitionHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.stateTransitionHash) : message.stateTransitionHash; - if (message.prove != null && message.hasOwnProperty("prove")) - object.prove = message.prove; - return object; - }; - - /** - * Converts this WaitForStateTransitionResultRequestV0 to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 - * @instance - * @returns {Object.} JSON object - */ - WaitForStateTransitionResultRequestV0.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return WaitForStateTransitionResultRequestV0; - })(); - - return WaitForStateTransitionResultRequest; - })(); - - v0.WaitForStateTransitionResultResponse = (function() { - - /** - * Properties of a WaitForStateTransitionResultResponse. - * @memberof org.dash.platform.dapi.v0 - * @interface IWaitForStateTransitionResultResponse - * @property {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0|null} [v0] WaitForStateTransitionResultResponse v0 - */ - - /** - * Constructs a new WaitForStateTransitionResultResponse. - * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a WaitForStateTransitionResultResponse. - * @implements IWaitForStateTransitionResultResponse - * @constructor - * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultResponse=} [properties] Properties to set - */ - function WaitForStateTransitionResultResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * WaitForStateTransitionResultResponse v0. - * @member {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse - * @instance - */ - WaitForStateTransitionResultResponse.prototype.v0 = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * WaitForStateTransitionResultResponse version. - * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse - * @instance - */ - Object.defineProperty(WaitForStateTransitionResultResponse.prototype, "version", { - get: $util.oneOfGetter($oneOfFields = ["v0"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new WaitForStateTransitionResultResponse instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse - * @static - * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} WaitForStateTransitionResultResponse instance - */ - WaitForStateTransitionResultResponse.create = function create(properties) { - return new WaitForStateTransitionResultResponse(properties); - }; - - /** - * Encodes the specified WaitForStateTransitionResultResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse - * @static - * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultResponse} message WaitForStateTransitionResultResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WaitForStateTransitionResultResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified WaitForStateTransitionResultResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse - * @static - * @param {org.dash.platform.dapi.v0.IWaitForStateTransitionResultResponse} message WaitForStateTransitionResultResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WaitForStateTransitionResultResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WaitForStateTransitionResultResponse message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} WaitForStateTransitionResultResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WaitForStateTransitionResultResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + if (message.maxBytes != null && message.hasOwnProperty("maxBytes")) + if (!$util.isString(message.maxBytes)) + return "maxBytes: string expected"; + if (message.maxGas != null && message.hasOwnProperty("maxGas")) + if (!$util.isString(message.maxGas)) + return "maxGas: string expected"; + if (message.timeIotaMs != null && message.hasOwnProperty("timeIotaMs")) + if (!$util.isString(message.timeIotaMs)) + return "timeIotaMs: string expected"; + return null; + }; - /** - * Decodes a WaitForStateTransitionResultResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} WaitForStateTransitionResultResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WaitForStateTransitionResultResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Creates a ConsensusParamsBlock message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} ConsensusParamsBlock + */ + ConsensusParamsBlock.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock(); + if (object.maxBytes != null) + message.maxBytes = String(object.maxBytes); + if (object.maxGas != null) + message.maxGas = String(object.maxGas); + if (object.timeIotaMs != null) + message.timeIotaMs = String(object.timeIotaMs); + return message; + }; - /** - * Verifies a WaitForStateTransitionResultResponse message. - * @function verify - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WaitForStateTransitionResultResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.v0 != null && message.hasOwnProperty("v0")) { - properties.version = 1; - { - var error = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.verify(message.v0); - if (error) - return "v0." + error; + /** + * Creates a plain object from a ConsensusParamsBlock message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} message ConsensusParamsBlock + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConsensusParamsBlock.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.maxBytes = ""; + object.maxGas = ""; + object.timeIotaMs = ""; } - } - return null; - }; - - /** - * Creates a WaitForStateTransitionResultResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} WaitForStateTransitionResultResponse - */ - WaitForStateTransitionResultResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse) + if (message.maxBytes != null && message.hasOwnProperty("maxBytes")) + object.maxBytes = message.maxBytes; + if (message.maxGas != null && message.hasOwnProperty("maxGas")) + object.maxGas = message.maxGas; + if (message.timeIotaMs != null && message.hasOwnProperty("timeIotaMs")) + object.timeIotaMs = message.timeIotaMs; return object; - var message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse(); - if (object.v0 != null) { - if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.fromObject(object.v0); - } - return message; - }; + }; - /** - * Creates a plain object from a WaitForStateTransitionResultResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse - * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} message WaitForStateTransitionResultResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WaitForStateTransitionResultResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(message.v0, options); - if (options.oneofs) - object.version = "v0"; - } - return object; - }; + /** + * Converts this ConsensusParamsBlock to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @instance + * @returns {Object.} JSON object + */ + ConsensusParamsBlock.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this WaitForStateTransitionResultResponse to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse - * @instance - * @returns {Object.} JSON object - */ - WaitForStateTransitionResultResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return ConsensusParamsBlock; + })(); - WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 = (function() { + GetConsensusParamsResponse.ConsensusParamsEvidence = (function() { /** - * Properties of a WaitForStateTransitionResultResponseV0. - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse - * @interface IWaitForStateTransitionResultResponseV0 - * @property {org.dash.platform.dapi.v0.IStateTransitionBroadcastError|null} [error] WaitForStateTransitionResultResponseV0 error - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] WaitForStateTransitionResultResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] WaitForStateTransitionResultResponseV0 metadata + * Properties of a ConsensusParamsEvidence. + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @interface IConsensusParamsEvidence + * @property {string|null} [maxAgeNumBlocks] ConsensusParamsEvidence maxAgeNumBlocks + * @property {string|null} [maxAgeDuration] ConsensusParamsEvidence maxAgeDuration + * @property {string|null} [maxBytes] ConsensusParamsEvidence maxBytes */ /** - * Constructs a new WaitForStateTransitionResultResponseV0. - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse - * @classdesc Represents a WaitForStateTransitionResultResponseV0. - * @implements IWaitForStateTransitionResultResponseV0 + * Constructs a new ConsensusParamsEvidence. + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @classdesc Represents a ConsensusParamsEvidence. + * @implements IConsensusParamsEvidence * @constructor - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence=} [properties] Properties to set */ - function WaitForStateTransitionResultResponseV0(properties) { + function ConsensusParamsEvidence(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -18432,115 +20381,101 @@ $root.org = (function() { } /** - * WaitForStateTransitionResultResponseV0 error. - * @member {org.dash.platform.dapi.v0.IStateTransitionBroadcastError|null|undefined} error - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 - * @instance - */ - WaitForStateTransitionResultResponseV0.prototype.error = null; - - /** - * WaitForStateTransitionResultResponseV0 proof. - * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * ConsensusParamsEvidence maxAgeNumBlocks. + * @member {string} maxAgeNumBlocks + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence * @instance */ - WaitForStateTransitionResultResponseV0.prototype.proof = null; + ConsensusParamsEvidence.prototype.maxAgeNumBlocks = ""; /** - * WaitForStateTransitionResultResponseV0 metadata. - * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * ConsensusParamsEvidence maxAgeDuration. + * @member {string} maxAgeDuration + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence * @instance */ - WaitForStateTransitionResultResponseV0.prototype.metadata = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + ConsensusParamsEvidence.prototype.maxAgeDuration = ""; /** - * WaitForStateTransitionResultResponseV0 result. - * @member {"error"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * ConsensusParamsEvidence maxBytes. + * @member {string} maxBytes + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence * @instance */ - Object.defineProperty(WaitForStateTransitionResultResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["error", "proof"]), - set: $util.oneOfSetter($oneOfFields) - }); + ConsensusParamsEvidence.prototype.maxBytes = ""; /** - * Creates a new WaitForStateTransitionResultResponseV0 instance using the specified properties. + * Creates a new ConsensusParamsEvidence instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} WaitForStateTransitionResultResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} ConsensusParamsEvidence instance */ - WaitForStateTransitionResultResponseV0.create = function create(properties) { - return new WaitForStateTransitionResultResponseV0(properties); + ConsensusParamsEvidence.create = function create(properties) { + return new ConsensusParamsEvidence(properties); }; /** - * Encodes the specified WaitForStateTransitionResultResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.verify|verify} messages. + * Encodes the specified ConsensusParamsEvidence message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0} message WaitForStateTransitionResultResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence} message ConsensusParamsEvidence message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WaitForStateTransitionResultResponseV0.encode = function encode(message, writer) { + ConsensusParamsEvidence.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.encode(message.error, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.maxAgeNumBlocks != null && Object.hasOwnProperty.call(message, "maxAgeNumBlocks")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.maxAgeNumBlocks); + if (message.maxAgeDuration != null && Object.hasOwnProperty.call(message, "maxAgeDuration")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.maxAgeDuration); + if (message.maxBytes != null && Object.hasOwnProperty.call(message, "maxBytes")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.maxBytes); return writer; }; /** - * Encodes the specified WaitForStateTransitionResultResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.verify|verify} messages. + * Encodes the specified ConsensusParamsEvidence message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.IWaitForStateTransitionResultResponseV0} message WaitForStateTransitionResultResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence} message ConsensusParamsEvidence message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WaitForStateTransitionResultResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + ConsensusParamsEvidence.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a WaitForStateTransitionResultResponseV0 message from the specified reader or buffer. + * Decodes a ConsensusParamsEvidence message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} WaitForStateTransitionResultResponseV0 + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} ConsensusParamsEvidence * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WaitForStateTransitionResultResponseV0.decode = function decode(reader, length) { + ConsensusParamsEvidence.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.error = $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.decode(reader, reader.uint32()); + message.maxAgeNumBlocks = reader.string(); break; case 2: - message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); + message.maxAgeDuration = reader.string(); break; case 3: - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + message.maxBytes = reader.string(); break; default: reader.skipType(tag & 7); @@ -18551,363 +20486,125 @@ $root.org = (function() { }; /** - * Decodes a WaitForStateTransitionResultResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a ConsensusParamsEvidence message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} WaitForStateTransitionResultResponseV0 + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} ConsensusParamsEvidence * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WaitForStateTransitionResultResponseV0.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WaitForStateTransitionResultResponseV0 message. - * @function verify - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WaitForStateTransitionResultResponseV0.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.error != null && message.hasOwnProperty("error")) { - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.verify(message.error); - if (error) - return "error." + error; - } - } - if (message.proof != null && message.hasOwnProperty("proof")) { - if (properties.result === 1) - return "result: multiple values"; - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); - if (error) - return "proof." + error; - } - } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); - if (error) - return "metadata." + error; - } - return null; - }; - - /** - * Creates a WaitForStateTransitionResultResponseV0 message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} WaitForStateTransitionResultResponseV0 - */ - WaitForStateTransitionResultResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0) - return object; - var message = new $root.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0(); - if (object.error != null) { - if (typeof object.error !== "object") - throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.error: object expected"); - message.error = $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.fromObject(object.error); - } - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.proof: object expected"); - message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); - } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.metadata: object expected"); - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); - } - return message; - }; - - /** - * Creates a plain object from a WaitForStateTransitionResultResponseV0 message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} message WaitForStateTransitionResultResponseV0 - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WaitForStateTransitionResultResponseV0.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.metadata = null; - if (message.error != null && message.hasOwnProperty("error")) { - object.error = $root.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject(message.error, options); - if (options.oneofs) - object.result = "error"; - } - if (message.proof != null && message.hasOwnProperty("proof")) { - object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); - if (options.oneofs) - object.result = "proof"; - } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); - return object; - }; - - /** - * Converts this WaitForStateTransitionResultResponseV0 to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 - * @instance - * @returns {Object.} JSON object - */ - WaitForStateTransitionResultResponseV0.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return WaitForStateTransitionResultResponseV0; - })(); - - return WaitForStateTransitionResultResponse; - })(); - - v0.GetConsensusParamsRequest = (function() { - - /** - * Properties of a GetConsensusParamsRequest. - * @memberof org.dash.platform.dapi.v0 - * @interface IGetConsensusParamsRequest - * @property {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0|null} [v0] GetConsensusParamsRequest v0 - */ - - /** - * Constructs a new GetConsensusParamsRequest. - * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetConsensusParamsRequest. - * @implements IGetConsensusParamsRequest - * @constructor - * @param {org.dash.platform.dapi.v0.IGetConsensusParamsRequest=} [properties] Properties to set - */ - function GetConsensusParamsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetConsensusParamsRequest v0. - * @member {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @instance - */ - GetConsensusParamsRequest.prototype.v0 = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * GetConsensusParamsRequest version. - * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @instance - */ - Object.defineProperty(GetConsensusParamsRequest.prototype, "version", { - get: $util.oneOfGetter($oneOfFields = ["v0"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new GetConsensusParamsRequest instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @static - * @param {org.dash.platform.dapi.v0.IGetConsensusParamsRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest} GetConsensusParamsRequest instance - */ - GetConsensusParamsRequest.create = function create(properties) { - return new GetConsensusParamsRequest(properties); - }; - - /** - * Encodes the specified GetConsensusParamsRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsRequest.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @static - * @param {org.dash.platform.dapi.v0.IGetConsensusParamsRequest} message GetConsensusParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetConsensusParamsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GetConsensusParamsRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @static - * @param {org.dash.platform.dapi.v0.IGetConsensusParamsRequest} message GetConsensusParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetConsensusParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetConsensusParamsRequest message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest} GetConsensusParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetConsensusParamsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + */ + ConsensusParamsEvidence.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Decodes a GetConsensusParamsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest} GetConsensusParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetConsensusParamsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Verifies a ConsensusParamsEvidence message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConsensusParamsEvidence.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.maxAgeNumBlocks != null && message.hasOwnProperty("maxAgeNumBlocks")) + if (!$util.isString(message.maxAgeNumBlocks)) + return "maxAgeNumBlocks: string expected"; + if (message.maxAgeDuration != null && message.hasOwnProperty("maxAgeDuration")) + if (!$util.isString(message.maxAgeDuration)) + return "maxAgeDuration: string expected"; + if (message.maxBytes != null && message.hasOwnProperty("maxBytes")) + if (!$util.isString(message.maxBytes)) + return "maxBytes: string expected"; + return null; + }; - /** - * Verifies a GetConsensusParamsRequest message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetConsensusParamsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.v0 != null && message.hasOwnProperty("v0")) { - properties.version = 1; - { - var error = $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.verify(message.v0); - if (error) - return "v0." + error; - } - } - return null; - }; + /** + * Creates a ConsensusParamsEvidence message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} ConsensusParamsEvidence + */ + ConsensusParamsEvidence.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence(); + if (object.maxAgeNumBlocks != null) + message.maxAgeNumBlocks = String(object.maxAgeNumBlocks); + if (object.maxAgeDuration != null) + message.maxAgeDuration = String(object.maxAgeDuration); + if (object.maxBytes != null) + message.maxBytes = String(object.maxBytes); + return message; + }; - /** - * Creates a GetConsensusParamsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest} GetConsensusParamsRequest - */ - GetConsensusParamsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest) + /** + * Creates a plain object from a ConsensusParamsEvidence message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @static + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} message ConsensusParamsEvidence + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConsensusParamsEvidence.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.maxAgeNumBlocks = ""; + object.maxAgeDuration = ""; + object.maxBytes = ""; + } + if (message.maxAgeNumBlocks != null && message.hasOwnProperty("maxAgeNumBlocks")) + object.maxAgeNumBlocks = message.maxAgeNumBlocks; + if (message.maxAgeDuration != null && message.hasOwnProperty("maxAgeDuration")) + object.maxAgeDuration = message.maxAgeDuration; + if (message.maxBytes != null && message.hasOwnProperty("maxBytes")) + object.maxBytes = message.maxBytes; return object; - var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest(); - if (object.v0 != null) { - if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetConsensusParamsRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.fromObject(object.v0); - } - return message; - }; + }; - /** - * Creates a plain object from a GetConsensusParamsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest} message GetConsensusParamsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetConsensusParamsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(message.v0, options); - if (options.oneofs) - object.version = "v0"; - } - return object; - }; + /** + * Converts this ConsensusParamsEvidence to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @instance + * @returns {Object.} JSON object + */ + ConsensusParamsEvidence.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this GetConsensusParamsRequest to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @instance - * @returns {Object.} JSON object - */ - GetConsensusParamsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return ConsensusParamsEvidence; + })(); - GetConsensusParamsRequest.GetConsensusParamsRequestV0 = (function() { + GetConsensusParamsResponse.GetConsensusParamsResponseV0 = (function() { /** - * Properties of a GetConsensusParamsRequestV0. - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @interface IGetConsensusParamsRequestV0 - * @property {number|null} [height] GetConsensusParamsRequestV0 height - * @property {boolean|null} [prove] GetConsensusParamsRequestV0 prove + * Properties of a GetConsensusParamsResponseV0. + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @interface IGetConsensusParamsResponseV0 + * @property {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock|null} [block] GetConsensusParamsResponseV0 block + * @property {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence|null} [evidence] GetConsensusParamsResponseV0 evidence */ /** - * Constructs a new GetConsensusParamsRequestV0. - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest - * @classdesc Represents a GetConsensusParamsRequestV0. - * @implements IGetConsensusParamsRequestV0 + * Constructs a new GetConsensusParamsResponseV0. + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @classdesc Represents a GetConsensusParamsResponseV0. + * @implements IGetConsensusParamsResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0=} [properties] Properties to set */ - function GetConsensusParamsRequestV0(properties) { + function GetConsensusParamsResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -18915,88 +20612,88 @@ $root.org = (function() { } /** - * GetConsensusParamsRequestV0 height. - * @member {number} height - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * GetConsensusParamsResponseV0 block. + * @member {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock|null|undefined} block + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 * @instance */ - GetConsensusParamsRequestV0.prototype.height = 0; + GetConsensusParamsResponseV0.prototype.block = null; /** - * GetConsensusParamsRequestV0 prove. - * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * GetConsensusParamsResponseV0 evidence. + * @member {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence|null|undefined} evidence + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 * @instance */ - GetConsensusParamsRequestV0.prototype.prove = false; + GetConsensusParamsResponseV0.prototype.evidence = null; /** - * Creates a new GetConsensusParamsRequestV0 instance using the specified properties. + * Creates a new GetConsensusParamsResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} GetConsensusParamsRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} GetConsensusParamsResponseV0 instance */ - GetConsensusParamsRequestV0.create = function create(properties) { - return new GetConsensusParamsRequestV0(properties); + GetConsensusParamsResponseV0.create = function create(properties) { + return new GetConsensusParamsResponseV0(properties); }; /** - * Encodes the specified GetConsensusParamsRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.verify|verify} messages. + * Encodes the specified GetConsensusParamsResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0} message GetConsensusParamsRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0} message GetConsensusParamsResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetConsensusParamsRequestV0.encode = function encode(message, writer) { + GetConsensusParamsResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.height); - if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.prove); + if (message.block != null && Object.hasOwnProperty.call(message, "block")) + $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.encode(message.block, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.evidence != null && Object.hasOwnProperty.call(message, "evidence")) + $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.encode(message.evidence, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetConsensusParamsRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.verify|verify} messages. + * Encodes the specified GetConsensusParamsResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.IGetConsensusParamsRequestV0} message GetConsensusParamsRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0} message GetConsensusParamsResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetConsensusParamsRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetConsensusParamsResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetConsensusParamsRequestV0 message from the specified reader or buffer. + * Decodes a GetConsensusParamsResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} GetConsensusParamsRequestV0 + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} GetConsensusParamsResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetConsensusParamsRequestV0.decode = function decode(reader, length) { + GetConsensusParamsResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.height = reader.int32(); + message.block = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.decode(reader, reader.uint32()); break; case 2: - message.prove = reader.bool(); + message.evidence = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -19007,119 +20704,129 @@ $root.org = (function() { }; /** - * Decodes a GetConsensusParamsRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetConsensusParamsResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} GetConsensusParamsRequestV0 + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} GetConsensusParamsResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetConsensusParamsRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetConsensusParamsResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetConsensusParamsRequestV0 message. + * Verifies a GetConsensusParamsResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetConsensusParamsRequestV0.verify = function verify(message) { + GetConsensusParamsResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height)) - return "height: integer expected"; - if (message.prove != null && message.hasOwnProperty("prove")) - if (typeof message.prove !== "boolean") - return "prove: boolean expected"; + if (message.block != null && message.hasOwnProperty("block")) { + var error = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.verify(message.block); + if (error) + return "block." + error; + } + if (message.evidence != null && message.hasOwnProperty("evidence")) { + var error = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.verify(message.evidence); + if (error) + return "evidence." + error; + } return null; }; /** - * Creates a GetConsensusParamsRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetConsensusParamsResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} GetConsensusParamsRequestV0 + * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} GetConsensusParamsResponseV0 */ - GetConsensusParamsRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0) + GetConsensusParamsResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0(); - if (object.height != null) - message.height = object.height | 0; - if (object.prove != null) - message.prove = Boolean(object.prove); + var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0(); + if (object.block != null) { + if (typeof object.block !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.block: object expected"); + message.block = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.fromObject(object.block); + } + if (object.evidence != null) { + if (typeof object.evidence !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.evidence: object expected"); + message.evidence = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.fromObject(object.evidence); + } return message; }; /** - * Creates a plain object from a GetConsensusParamsRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetConsensusParamsResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} message GetConsensusParamsRequestV0 + * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} message GetConsensusParamsResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetConsensusParamsRequestV0.toObject = function toObject(message, options) { + GetConsensusParamsResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.height = 0; - object.prove = false; + object.block = null; + object.evidence = null; } - if (message.height != null && message.hasOwnProperty("height")) - object.height = message.height; - if (message.prove != null && message.hasOwnProperty("prove")) - object.prove = message.prove; + if (message.block != null && message.hasOwnProperty("block")) + object.block = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(message.block, options); + if (message.evidence != null && message.hasOwnProperty("evidence")) + object.evidence = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(message.evidence, options); return object; }; /** - * Converts this GetConsensusParamsRequestV0 to JSON. + * Converts this GetConsensusParamsResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 + * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 * @instance * @returns {Object.} JSON object */ - GetConsensusParamsRequestV0.prototype.toJSON = function toJSON() { + GetConsensusParamsResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetConsensusParamsRequestV0; + return GetConsensusParamsResponseV0; })(); - return GetConsensusParamsRequest; + return GetConsensusParamsResponse; })(); - v0.GetConsensusParamsResponse = (function() { + v0.GetProtocolVersionUpgradeStateRequest = (function() { /** - * Properties of a GetConsensusParamsResponse. + * Properties of a GetProtocolVersionUpgradeStateRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetConsensusParamsResponse - * @property {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0|null} [v0] GetConsensusParamsResponse v0 + * @interface IGetProtocolVersionUpgradeStateRequest + * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0|null} [v0] GetProtocolVersionUpgradeStateRequest v0 */ /** - * Constructs a new GetConsensusParamsResponse. + * Constructs a new GetProtocolVersionUpgradeStateRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetConsensusParamsResponse. - * @implements IGetConsensusParamsResponse + * @classdesc Represents a GetProtocolVersionUpgradeStateRequest. + * @implements IGetProtocolVersionUpgradeStateRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetConsensusParamsResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateRequest=} [properties] Properties to set */ - function GetConsensusParamsResponse(properties) { + function GetProtocolVersionUpgradeStateRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -19127,89 +20834,89 @@ $root.org = (function() { } /** - * GetConsensusParamsResponse v0. - * @member {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * GetProtocolVersionUpgradeStateRequest v0. + * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest * @instance */ - GetConsensusParamsResponse.prototype.v0 = null; + GetProtocolVersionUpgradeStateRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetConsensusParamsResponse version. + * GetProtocolVersionUpgradeStateRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest * @instance */ - Object.defineProperty(GetConsensusParamsResponse.prototype, "version", { + Object.defineProperty(GetProtocolVersionUpgradeStateRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetConsensusParamsResponse instance using the specified properties. + * Creates a new GetProtocolVersionUpgradeStateRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest * @static - * @param {org.dash.platform.dapi.v0.IGetConsensusParamsResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse} GetConsensusParamsResponse instance + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} GetProtocolVersionUpgradeStateRequest instance */ - GetConsensusParamsResponse.create = function create(properties) { - return new GetConsensusParamsResponse(properties); + GetProtocolVersionUpgradeStateRequest.create = function create(properties) { + return new GetProtocolVersionUpgradeStateRequest(properties); }; /** - * Encodes the specified GetConsensusParamsResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.verify|verify} messages. + * Encodes the specified GetProtocolVersionUpgradeStateRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest * @static - * @param {org.dash.platform.dapi.v0.IGetConsensusParamsResponse} message GetConsensusParamsResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateRequest} message GetProtocolVersionUpgradeStateRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetConsensusParamsResponse.encode = function encode(message, writer) { + GetProtocolVersionUpgradeStateRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetConsensusParamsResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.verify|verify} messages. + * Encodes the specified GetProtocolVersionUpgradeStateRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest * @static - * @param {org.dash.platform.dapi.v0.IGetConsensusParamsResponse} message GetConsensusParamsResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateRequest} message GetProtocolVersionUpgradeStateRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetConsensusParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetProtocolVersionUpgradeStateRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetConsensusParamsResponse message from the specified reader or buffer. + * Decodes a GetProtocolVersionUpgradeStateRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse} GetConsensusParamsResponse + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} GetProtocolVersionUpgradeStateRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetConsensusParamsResponse.decode = function decode(reader, length) { + GetProtocolVersionUpgradeStateRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -19220,37 +20927,37 @@ $root.org = (function() { }; /** - * Decodes a GetConsensusParamsResponse message from the specified reader or buffer, length delimited. + * Decodes a GetProtocolVersionUpgradeStateRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse} GetConsensusParamsResponse + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} GetProtocolVersionUpgradeStateRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetConsensusParamsResponse.decodeDelimited = function decodeDelimited(reader) { + GetProtocolVersionUpgradeStateRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetConsensusParamsResponse message. + * Verifies a GetProtocolVersionUpgradeStateRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetConsensusParamsResponse.verify = function verify(message) { + GetProtocolVersionUpgradeStateRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -19259,40 +20966,40 @@ $root.org = (function() { }; /** - * Creates a GetConsensusParamsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetProtocolVersionUpgradeStateRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse} GetConsensusParamsResponse + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} GetProtocolVersionUpgradeStateRequest */ - GetConsensusParamsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse) + GetProtocolVersionUpgradeStateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetConsensusParamsResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetConsensusParamsResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetProtocolVersionUpgradeStateRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse} message GetConsensusParamsResponse + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} message GetProtocolVersionUpgradeStateRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetConsensusParamsResponse.toObject = function toObject(message, options) { + GetProtocolVersionUpgradeStateRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -19300,138 +21007,110 @@ $root.org = (function() { }; /** - * Converts this GetConsensusParamsResponse to JSON. + * Converts this GetProtocolVersionUpgradeStateRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest * @instance * @returns {Object.} JSON object */ - GetConsensusParamsResponse.prototype.toJSON = function toJSON() { + GetProtocolVersionUpgradeStateRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetConsensusParamsResponse.ConsensusParamsBlock = (function() { + GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 = (function() { /** - * Properties of a ConsensusParamsBlock. - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse - * @interface IConsensusParamsBlock - * @property {string|null} [maxBytes] ConsensusParamsBlock maxBytes - * @property {string|null} [maxGas] ConsensusParamsBlock maxGas - * @property {string|null} [timeIotaMs] ConsensusParamsBlock timeIotaMs + * Properties of a GetProtocolVersionUpgradeStateRequestV0. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @interface IGetProtocolVersionUpgradeStateRequestV0 + * @property {boolean|null} [prove] GetProtocolVersionUpgradeStateRequestV0 prove */ /** - * Constructs a new ConsensusParamsBlock. - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse - * @classdesc Represents a ConsensusParamsBlock. - * @implements IConsensusParamsBlock + * Constructs a new GetProtocolVersionUpgradeStateRequestV0. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @classdesc Represents a GetProtocolVersionUpgradeStateRequestV0. + * @implements IGetProtocolVersionUpgradeStateRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0=} [properties] Properties to set */ - function ConsensusParamsBlock(properties) { + function GetProtocolVersionUpgradeStateRequestV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } - /** - * ConsensusParamsBlock maxBytes. - * @member {string} maxBytes - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock - * @instance - */ - ConsensusParamsBlock.prototype.maxBytes = ""; - - /** - * ConsensusParamsBlock maxGas. - * @member {string} maxGas - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock - * @instance - */ - ConsensusParamsBlock.prototype.maxGas = ""; - - /** - * ConsensusParamsBlock timeIotaMs. - * @member {string} timeIotaMs - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + /** + * GetProtocolVersionUpgradeStateRequestV0 prove. + * @member {boolean} prove + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 * @instance */ - ConsensusParamsBlock.prototype.timeIotaMs = ""; + GetProtocolVersionUpgradeStateRequestV0.prototype.prove = false; /** - * Creates a new ConsensusParamsBlock instance using the specified properties. + * Creates a new GetProtocolVersionUpgradeStateRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} ConsensusParamsBlock instance + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} GetProtocolVersionUpgradeStateRequestV0 instance */ - ConsensusParamsBlock.create = function create(properties) { - return new ConsensusParamsBlock(properties); + GetProtocolVersionUpgradeStateRequestV0.create = function create(properties) { + return new GetProtocolVersionUpgradeStateRequestV0(properties); }; /** - * Encodes the specified ConsensusParamsBlock message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.verify|verify} messages. + * Encodes the specified GetProtocolVersionUpgradeStateRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock} message ConsensusParamsBlock message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0} message GetProtocolVersionUpgradeStateRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ConsensusParamsBlock.encode = function encode(message, writer) { + GetProtocolVersionUpgradeStateRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.maxBytes != null && Object.hasOwnProperty.call(message, "maxBytes")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.maxBytes); - if (message.maxGas != null && Object.hasOwnProperty.call(message, "maxGas")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.maxGas); - if (message.timeIotaMs != null && Object.hasOwnProperty.call(message, "timeIotaMs")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.timeIotaMs); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.prove); return writer; }; /** - * Encodes the specified ConsensusParamsBlock message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.verify|verify} messages. + * Encodes the specified GetProtocolVersionUpgradeStateRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock} message ConsensusParamsBlock message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0} message GetProtocolVersionUpgradeStateRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ConsensusParamsBlock.encodeDelimited = function encodeDelimited(message, writer) { + GetProtocolVersionUpgradeStateRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ConsensusParamsBlock message from the specified reader or buffer. + * Decodes a GetProtocolVersionUpgradeStateRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} ConsensusParamsBlock + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} GetProtocolVersionUpgradeStateRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ConsensusParamsBlock.decode = function decode(reader, length) { + GetProtocolVersionUpgradeStateRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.maxBytes = reader.string(); - break; - case 2: - message.maxGas = reader.string(); - break; - case 3: - message.timeIotaMs = reader.string(); + message.prove = reader.bool(); break; default: reader.skipType(tag & 7); @@ -19442,126 +21121,320 @@ $root.org = (function() { }; /** - * Decodes a ConsensusParamsBlock message from the specified reader or buffer, length delimited. + * Decodes a GetProtocolVersionUpgradeStateRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} ConsensusParamsBlock + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} GetProtocolVersionUpgradeStateRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ConsensusParamsBlock.decodeDelimited = function decodeDelimited(reader) { + GetProtocolVersionUpgradeStateRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ConsensusParamsBlock message. + * Verifies a GetProtocolVersionUpgradeStateRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ConsensusParamsBlock.verify = function verify(message) { + GetProtocolVersionUpgradeStateRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.maxBytes != null && message.hasOwnProperty("maxBytes")) - if (!$util.isString(message.maxBytes)) - return "maxBytes: string expected"; - if (message.maxGas != null && message.hasOwnProperty("maxGas")) - if (!$util.isString(message.maxGas)) - return "maxGas: string expected"; - if (message.timeIotaMs != null && message.hasOwnProperty("timeIotaMs")) - if (!$util.isString(message.timeIotaMs)) - return "timeIotaMs: string expected"; + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; return null; }; - /** - * Creates a ConsensusParamsBlock message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} ConsensusParamsBlock - */ - ConsensusParamsBlock.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock(); - if (object.maxBytes != null) - message.maxBytes = String(object.maxBytes); - if (object.maxGas != null) - message.maxGas = String(object.maxGas); - if (object.timeIotaMs != null) - message.timeIotaMs = String(object.timeIotaMs); - return message; - }; + /** + * Creates a GetProtocolVersionUpgradeStateRequestV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} GetProtocolVersionUpgradeStateRequestV0 + */ + GetProtocolVersionUpgradeStateRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0(); + if (object.prove != null) + message.prove = Boolean(object.prove); + return message; + }; + + /** + * Creates a plain object from a GetProtocolVersionUpgradeStateRequestV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} message GetProtocolVersionUpgradeStateRequestV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProtocolVersionUpgradeStateRequestV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.prove = false; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; + return object; + }; + + /** + * Converts this GetProtocolVersionUpgradeStateRequestV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @instance + * @returns {Object.} JSON object + */ + GetProtocolVersionUpgradeStateRequestV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetProtocolVersionUpgradeStateRequestV0; + })(); + + return GetProtocolVersionUpgradeStateRequest; + })(); + + v0.GetProtocolVersionUpgradeStateResponse = (function() { + + /** + * Properties of a GetProtocolVersionUpgradeStateResponse. + * @memberof org.dash.platform.dapi.v0 + * @interface IGetProtocolVersionUpgradeStateResponse + * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0|null} [v0] GetProtocolVersionUpgradeStateResponse v0 + */ + + /** + * Constructs a new GetProtocolVersionUpgradeStateResponse. + * @memberof org.dash.platform.dapi.v0 + * @classdesc Represents a GetProtocolVersionUpgradeStateResponse. + * @implements IGetProtocolVersionUpgradeStateResponse + * @constructor + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateResponse=} [properties] Properties to set + */ + function GetProtocolVersionUpgradeStateResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetProtocolVersionUpgradeStateResponse v0. + * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @instance + */ + GetProtocolVersionUpgradeStateResponse.prototype.v0 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetProtocolVersionUpgradeStateResponse version. + * @member {"v0"|undefined} version + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @instance + */ + Object.defineProperty(GetProtocolVersionUpgradeStateResponse.prototype, "version", { + get: $util.oneOfGetter($oneOfFields = ["v0"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetProtocolVersionUpgradeStateResponse instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} GetProtocolVersionUpgradeStateResponse instance + */ + GetProtocolVersionUpgradeStateResponse.create = function create(properties) { + return new GetProtocolVersionUpgradeStateResponse(properties); + }; + + /** + * Encodes the specified GetProtocolVersionUpgradeStateResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateResponse} message GetProtocolVersionUpgradeStateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProtocolVersionUpgradeStateResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) + $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetProtocolVersionUpgradeStateResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @static + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateResponse} message GetProtocolVersionUpgradeStateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProtocolVersionUpgradeStateResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProtocolVersionUpgradeStateResponse message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} GetProtocolVersionUpgradeStateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProtocolVersionUpgradeStateResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetProtocolVersionUpgradeStateResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} GetProtocolVersionUpgradeStateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProtocolVersionUpgradeStateResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a plain object from a ConsensusParamsBlock message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock - * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} message ConsensusParamsBlock - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConsensusParamsBlock.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.maxBytes = ""; - object.maxGas = ""; - object.timeIotaMs = ""; + /** + * Verifies a GetProtocolVersionUpgradeStateResponse message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProtocolVersionUpgradeStateResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + properties.version = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.verify(message.v0); + if (error) + return "v0." + error; } - if (message.maxBytes != null && message.hasOwnProperty("maxBytes")) - object.maxBytes = message.maxBytes; - if (message.maxGas != null && message.hasOwnProperty("maxGas")) - object.maxGas = message.maxGas; - if (message.timeIotaMs != null && message.hasOwnProperty("timeIotaMs")) - object.timeIotaMs = message.timeIotaMs; + } + return null; + }; + + /** + * Creates a GetProtocolVersionUpgradeStateResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} GetProtocolVersionUpgradeStateResponse + */ + GetProtocolVersionUpgradeStateResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse) return object; - }; + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse(); + if (object.v0 != null) { + if (typeof object.v0 !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.fromObject(object.v0); + } + return message; + }; - /** - * Converts this ConsensusParamsBlock to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock - * @instance - * @returns {Object.} JSON object - */ - ConsensusParamsBlock.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a GetProtocolVersionUpgradeStateResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} message GetProtocolVersionUpgradeStateResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProtocolVersionUpgradeStateResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.v0 != null && message.hasOwnProperty("v0")) { + object.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(message.v0, options); + if (options.oneofs) + object.version = "v0"; + } + return object; + }; - return ConsensusParamsBlock; - })(); + /** + * Converts this GetProtocolVersionUpgradeStateResponse to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @instance + * @returns {Object.} JSON object + */ + GetProtocolVersionUpgradeStateResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - GetConsensusParamsResponse.ConsensusParamsEvidence = (function() { + GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 = (function() { /** - * Properties of a ConsensusParamsEvidence. - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse - * @interface IConsensusParamsEvidence - * @property {string|null} [maxAgeNumBlocks] ConsensusParamsEvidence maxAgeNumBlocks - * @property {string|null} [maxAgeDuration] ConsensusParamsEvidence maxAgeDuration - * @property {string|null} [maxBytes] ConsensusParamsEvidence maxBytes + * Properties of a GetProtocolVersionUpgradeStateResponseV0. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @interface IGetProtocolVersionUpgradeStateResponseV0 + * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions|null} [versions] GetProtocolVersionUpgradeStateResponseV0 versions + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetProtocolVersionUpgradeStateResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetProtocolVersionUpgradeStateResponseV0 metadata */ /** - * Constructs a new ConsensusParamsEvidence. - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse - * @classdesc Represents a ConsensusParamsEvidence. - * @implements IConsensusParamsEvidence + * Constructs a new GetProtocolVersionUpgradeStateResponseV0. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @classdesc Represents a GetProtocolVersionUpgradeStateResponseV0. + * @implements IGetProtocolVersionUpgradeStateResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0=} [properties] Properties to set */ - function ConsensusParamsEvidence(properties) { + function GetProtocolVersionUpgradeStateResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -19569,101 +21442,115 @@ $root.org = (function() { } /** - * ConsensusParamsEvidence maxAgeNumBlocks. - * @member {string} maxAgeNumBlocks - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * GetProtocolVersionUpgradeStateResponseV0 versions. + * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions|null|undefined} versions + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 * @instance */ - ConsensusParamsEvidence.prototype.maxAgeNumBlocks = ""; + GetProtocolVersionUpgradeStateResponseV0.prototype.versions = null; /** - * ConsensusParamsEvidence maxAgeDuration. - * @member {string} maxAgeDuration - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * GetProtocolVersionUpgradeStateResponseV0 proof. + * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 * @instance */ - ConsensusParamsEvidence.prototype.maxAgeDuration = ""; + GetProtocolVersionUpgradeStateResponseV0.prototype.proof = null; /** - * ConsensusParamsEvidence maxBytes. - * @member {string} maxBytes - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * GetProtocolVersionUpgradeStateResponseV0 metadata. + * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 * @instance */ - ConsensusParamsEvidence.prototype.maxBytes = ""; + GetProtocolVersionUpgradeStateResponseV0.prototype.metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * Creates a new ConsensusParamsEvidence instance using the specified properties. + * GetProtocolVersionUpgradeStateResponseV0 result. + * @member {"versions"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @instance + */ + Object.defineProperty(GetProtocolVersionUpgradeStateResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["versions", "proof"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetProtocolVersionUpgradeStateResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} ConsensusParamsEvidence instance + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} GetProtocolVersionUpgradeStateResponseV0 instance */ - ConsensusParamsEvidence.create = function create(properties) { - return new ConsensusParamsEvidence(properties); + GetProtocolVersionUpgradeStateResponseV0.create = function create(properties) { + return new GetProtocolVersionUpgradeStateResponseV0(properties); }; /** - * Encodes the specified ConsensusParamsEvidence message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.verify|verify} messages. + * Encodes the specified GetProtocolVersionUpgradeStateResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence} message ConsensusParamsEvidence message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0} message GetProtocolVersionUpgradeStateResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ConsensusParamsEvidence.encode = function encode(message, writer) { + GetProtocolVersionUpgradeStateResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.maxAgeNumBlocks != null && Object.hasOwnProperty.call(message, "maxAgeNumBlocks")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.maxAgeNumBlocks); - if (message.maxAgeDuration != null && Object.hasOwnProperty.call(message, "maxAgeDuration")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.maxAgeDuration); - if (message.maxBytes != null && Object.hasOwnProperty.call(message, "maxBytes")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.maxBytes); + if (message.versions != null && Object.hasOwnProperty.call(message, "versions")) + $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.encode(message.versions, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified ConsensusParamsEvidence message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.verify|verify} messages. + * Encodes the specified GetProtocolVersionUpgradeStateResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence} message ConsensusParamsEvidence message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0} message GetProtocolVersionUpgradeStateResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ConsensusParamsEvidence.encodeDelimited = function encodeDelimited(message, writer) { + GetProtocolVersionUpgradeStateResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ConsensusParamsEvidence message from the specified reader or buffer. + * Decodes a GetProtocolVersionUpgradeStateResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} ConsensusParamsEvidence + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} GetProtocolVersionUpgradeStateResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ConsensusParamsEvidence.decode = function decode(reader, length) { + GetProtocolVersionUpgradeStateResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.maxAgeNumBlocks = reader.string(); + message.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.decode(reader, reader.uint32()); break; case 2: - message.maxAgeDuration = reader.string(); + message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); break; case 3: - message.maxBytes = reader.string(); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -19674,437 +21561,662 @@ $root.org = (function() { }; /** - * Decodes a ConsensusParamsEvidence message from the specified reader or buffer, length delimited. + * Decodes a GetProtocolVersionUpgradeStateResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} ConsensusParamsEvidence + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} GetProtocolVersionUpgradeStateResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ConsensusParamsEvidence.decodeDelimited = function decodeDelimited(reader) { + GetProtocolVersionUpgradeStateResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ConsensusParamsEvidence message. + * Verifies a GetProtocolVersionUpgradeStateResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ConsensusParamsEvidence.verify = function verify(message) { + GetProtocolVersionUpgradeStateResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.maxAgeNumBlocks != null && message.hasOwnProperty("maxAgeNumBlocks")) - if (!$util.isString(message.maxAgeNumBlocks)) - return "maxAgeNumBlocks: string expected"; - if (message.maxAgeDuration != null && message.hasOwnProperty("maxAgeDuration")) - if (!$util.isString(message.maxAgeDuration)) - return "maxAgeDuration: string expected"; - if (message.maxBytes != null && message.hasOwnProperty("maxBytes")) - if (!$util.isString(message.maxBytes)) - return "maxBytes: string expected"; + var properties = {}; + if (message.versions != null && message.hasOwnProperty("versions")) { + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.verify(message.versions); + if (error) + return "versions." + error; + } + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } return null; }; /** - * Creates a ConsensusParamsEvidence message from a plain object. Also converts values to their respective internal types. + * Creates a GetProtocolVersionUpgradeStateResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} ConsensusParamsEvidence + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} GetProtocolVersionUpgradeStateResponseV0 */ - ConsensusParamsEvidence.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence) + GetProtocolVersionUpgradeStateResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence(); - if (object.maxAgeNumBlocks != null) - message.maxAgeNumBlocks = String(object.maxAgeNumBlocks); - if (object.maxAgeDuration != null) - message.maxAgeDuration = String(object.maxAgeDuration); - if (object.maxBytes != null) - message.maxBytes = String(object.maxBytes); + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0(); + if (object.versions != null) { + if (typeof object.versions !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.versions: object expected"); + message.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.fromObject(object.versions); + } + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } return message; }; /** - * Creates a plain object from a ConsensusParamsEvidence message. Also converts values to other types if specified. + * Creates a plain object from a GetProtocolVersionUpgradeStateResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} message ConsensusParamsEvidence + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} message GetProtocolVersionUpgradeStateResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ConsensusParamsEvidence.toObject = function toObject(message, options) { + GetProtocolVersionUpgradeStateResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.maxAgeNumBlocks = ""; - object.maxAgeDuration = ""; - object.maxBytes = ""; + if (options.defaults) + object.metadata = null; + if (message.versions != null && message.hasOwnProperty("versions")) { + object.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(message.versions, options); + if (options.oneofs) + object.result = "versions"; } - if (message.maxAgeNumBlocks != null && message.hasOwnProperty("maxAgeNumBlocks")) - object.maxAgeNumBlocks = message.maxAgeNumBlocks; - if (message.maxAgeDuration != null && message.hasOwnProperty("maxAgeDuration")) - object.maxAgeDuration = message.maxAgeDuration; - if (message.maxBytes != null && message.hasOwnProperty("maxBytes")) - object.maxBytes = message.maxBytes; + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); return object; }; - /** - * Converts this ConsensusParamsEvidence to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence - * @instance - * @returns {Object.} JSON object - */ - ConsensusParamsEvidence.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Converts this GetProtocolVersionUpgradeStateResponseV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @instance + * @returns {Object.} JSON object + */ + GetProtocolVersionUpgradeStateResponseV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GetProtocolVersionUpgradeStateResponseV0.Versions = (function() { + + /** + * Properties of a Versions. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @interface IVersions + * @property {Array.|null} [versions] Versions versions + */ + + /** + * Constructs a new Versions. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @classdesc Represents a Versions. + * @implements IVersions + * @constructor + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions=} [properties] Properties to set + */ + function Versions(properties) { + this.versions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Versions versions. + * @member {Array.} versions + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @instance + */ + Versions.prototype.versions = $util.emptyArray; + + /** + * Creates a new Versions instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} Versions instance + */ + Versions.create = function create(properties) { + return new Versions(properties); + }; + + /** + * Encodes the specified Versions message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions} message Versions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Versions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.versions != null && message.versions.length) + for (var i = 0; i < message.versions.length; ++i) + $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.encode(message.versions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Versions message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions} message Versions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Versions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Versions message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} Versions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Versions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.versions && message.versions.length)) + message.versions = []; + message.versions.push($root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Versions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} Versions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Versions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Versions message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Versions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.versions != null && message.hasOwnProperty("versions")) { + if (!Array.isArray(message.versions)) + return "versions: array expected"; + for (var i = 0; i < message.versions.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.verify(message.versions[i]); + if (error) + return "versions." + error; + } + } + return null; + }; + + /** + * Creates a Versions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} Versions + */ + Versions.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions(); + if (object.versions) { + if (!Array.isArray(object.versions)) + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.versions: array expected"); + message.versions = []; + for (var i = 0; i < object.versions.length; ++i) { + if (typeof object.versions[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.versions: object expected"); + message.versions[i] = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.fromObject(object.versions[i]); + } + } + return message; + }; - return ConsensusParamsEvidence; - })(); + /** + * Creates a plain object from a Versions message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} message Versions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Versions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.versions = []; + if (message.versions && message.versions.length) { + object.versions = []; + for (var j = 0; j < message.versions.length; ++j) + object.versions[j] = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject(message.versions[j], options); + } + return object; + }; - GetConsensusParamsResponse.GetConsensusParamsResponseV0 = (function() { + /** + * Converts this Versions to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @instance + * @returns {Object.} JSON object + */ + Versions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Properties of a GetConsensusParamsResponseV0. - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse - * @interface IGetConsensusParamsResponseV0 - * @property {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock|null} [block] GetConsensusParamsResponseV0 block - * @property {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence|null} [evidence] GetConsensusParamsResponseV0 evidence - */ + return Versions; + })(); - /** - * Constructs a new GetConsensusParamsResponseV0. - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse - * @classdesc Represents a GetConsensusParamsResponseV0. - * @implements IGetConsensusParamsResponseV0 - * @constructor - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0=} [properties] Properties to set - */ - function GetConsensusParamsResponseV0(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + GetProtocolVersionUpgradeStateResponseV0.VersionEntry = (function() { - /** - * GetConsensusParamsResponseV0 block. - * @member {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsBlock|null|undefined} block - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 - * @instance - */ - GetConsensusParamsResponseV0.prototype.block = null; + /** + * Properties of a VersionEntry. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @interface IVersionEntry + * @property {number|null} [versionNumber] VersionEntry versionNumber + * @property {number|null} [voteCount] VersionEntry voteCount + */ - /** - * GetConsensusParamsResponseV0 evidence. - * @member {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IConsensusParamsEvidence|null|undefined} evidence - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 - * @instance - */ - GetConsensusParamsResponseV0.prototype.evidence = null; + /** + * Constructs a new VersionEntry. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @classdesc Represents a VersionEntry. + * @implements IVersionEntry + * @constructor + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersionEntry=} [properties] Properties to set + */ + function VersionEntry(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new GetConsensusParamsResponseV0 instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} GetConsensusParamsResponseV0 instance - */ - GetConsensusParamsResponseV0.create = function create(properties) { - return new GetConsensusParamsResponseV0(properties); - }; + /** + * VersionEntry versionNumber. + * @member {number} versionNumber + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @instance + */ + VersionEntry.prototype.versionNumber = 0; - /** - * Encodes the specified GetConsensusParamsResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0} message GetConsensusParamsResponseV0 message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetConsensusParamsResponseV0.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.block != null && Object.hasOwnProperty.call(message, "block")) - $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.encode(message.block, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.evidence != null && Object.hasOwnProperty.call(message, "evidence")) - $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.encode(message.evidence, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; + /** + * VersionEntry voteCount. + * @member {number} voteCount + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @instance + */ + VersionEntry.prototype.voteCount = 0; - /** - * Encodes the specified GetConsensusParamsResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.IGetConsensusParamsResponseV0} message GetConsensusParamsResponseV0 message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetConsensusParamsResponseV0.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a new VersionEntry instance using the specified properties. + * @function create + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersionEntry=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} VersionEntry instance + */ + VersionEntry.create = function create(properties) { + return new VersionEntry(properties); + }; - /** - * Decodes a GetConsensusParamsResponseV0 message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} GetConsensusParamsResponseV0 - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetConsensusParamsResponseV0.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.block = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.decode(reader, reader.uint32()); - break; - case 2: - message.evidence = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Encodes the specified VersionEntry message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.verify|verify} messages. + * @function encode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersionEntry} message VersionEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VersionEntry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.versionNumber != null && Object.hasOwnProperty.call(message, "versionNumber")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.versionNumber); + if (message.voteCount != null && Object.hasOwnProperty.call(message, "voteCount")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.voteCount); + return writer; + }; + + /** + * Encodes the specified VersionEntry message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.verify|verify} messages. + * @function encodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersionEntry} message VersionEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VersionEntry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VersionEntry message from the specified reader or buffer. + * @function decode + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} VersionEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VersionEntry.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.versionNumber = reader.uint32(); + break; + case 2: + message.voteCount = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes a GetConsensusParamsResponseV0 message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} GetConsensusParamsResponseV0 - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetConsensusParamsResponseV0.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a VersionEntry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} VersionEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VersionEntry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a GetConsensusParamsResponseV0 message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetConsensusParamsResponseV0.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.block != null && message.hasOwnProperty("block")) { - var error = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.verify(message.block); - if (error) - return "block." + error; - } - if (message.evidence != null && message.hasOwnProperty("evidence")) { - var error = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.verify(message.evidence); - if (error) - return "evidence." + error; - } - return null; - }; + /** + * Verifies a VersionEntry message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VersionEntry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.versionNumber != null && message.hasOwnProperty("versionNumber")) + if (!$util.isInteger(message.versionNumber)) + return "versionNumber: integer expected"; + if (message.voteCount != null && message.hasOwnProperty("voteCount")) + if (!$util.isInteger(message.voteCount)) + return "voteCount: integer expected"; + return null; + }; - /** - * Creates a GetConsensusParamsResponseV0 message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} GetConsensusParamsResponseV0 - */ - GetConsensusParamsResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0) + /** + * Creates a VersionEntry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} VersionEntry + */ + VersionEntry.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry) + return object; + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry(); + if (object.versionNumber != null) + message.versionNumber = object.versionNumber >>> 0; + if (object.voteCount != null) + message.voteCount = object.voteCount >>> 0; + return message; + }; + + /** + * Creates a plain object from a VersionEntry message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @static + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} message VersionEntry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VersionEntry.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.versionNumber = 0; + object.voteCount = 0; + } + if (message.versionNumber != null && message.hasOwnProperty("versionNumber")) + object.versionNumber = message.versionNumber; + if (message.voteCount != null && message.hasOwnProperty("voteCount")) + object.voteCount = message.voteCount; return object; - var message = new $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0(); - if (object.block != null) { - if (typeof object.block !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.block: object expected"); - message.block = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.fromObject(object.block); - } - if (object.evidence != null) { - if (typeof object.evidence !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.evidence: object expected"); - message.evidence = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.fromObject(object.evidence); - } - return message; - }; + }; - /** - * Creates a plain object from a GetConsensusParamsResponseV0 message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 - * @static - * @param {org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} message GetConsensusParamsResponseV0 - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetConsensusParamsResponseV0.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.block = null; - object.evidence = null; - } - if (message.block != null && message.hasOwnProperty("block")) - object.block = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(message.block, options); - if (message.evidence != null && message.hasOwnProperty("evidence")) - object.evidence = $root.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(message.evidence, options); - return object; - }; + /** + * Converts this VersionEntry to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @instance + * @returns {Object.} JSON object + */ + VersionEntry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this GetConsensusParamsResponseV0 to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 - * @instance - * @returns {Object.} JSON object - */ - GetConsensusParamsResponseV0.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return VersionEntry; + })(); - return GetConsensusParamsResponseV0; + return GetProtocolVersionUpgradeStateResponseV0; })(); - return GetConsensusParamsResponse; + return GetProtocolVersionUpgradeStateResponse; })(); - v0.GetProtocolVersionUpgradeStateRequest = (function() { + v0.GetProtocolVersionUpgradeVoteStatusRequest = (function() { /** - * Properties of a GetProtocolVersionUpgradeStateRequest. + * Properties of a GetProtocolVersionUpgradeVoteStatusRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetProtocolVersionUpgradeStateRequest - * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0|null} [v0] GetProtocolVersionUpgradeStateRequest v0 + * @interface IGetProtocolVersionUpgradeVoteStatusRequest + * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0|null} [v0] GetProtocolVersionUpgradeVoteStatusRequest v0 */ /** - * Constructs a new GetProtocolVersionUpgradeStateRequest. + * Constructs a new GetProtocolVersionUpgradeVoteStatusRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetProtocolVersionUpgradeStateRequest. - * @implements IGetProtocolVersionUpgradeStateRequest + * @classdesc Represents a GetProtocolVersionUpgradeVoteStatusRequest. + * @implements IGetProtocolVersionUpgradeVoteStatusRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusRequest=} [properties] Properties to set */ - function GetProtocolVersionUpgradeStateRequest(properties) { + function GetProtocolVersionUpgradeVoteStatusRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } - - /** - * GetProtocolVersionUpgradeStateRequest v0. - * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + + /** + * GetProtocolVersionUpgradeVoteStatusRequest v0. + * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest * @instance */ - GetProtocolVersionUpgradeStateRequest.prototype.v0 = null; + GetProtocolVersionUpgradeVoteStatusRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetProtocolVersionUpgradeStateRequest version. + * GetProtocolVersionUpgradeVoteStatusRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest * @instance */ - Object.defineProperty(GetProtocolVersionUpgradeStateRequest.prototype, "version", { + Object.defineProperty(GetProtocolVersionUpgradeVoteStatusRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetProtocolVersionUpgradeStateRequest instance using the specified properties. + * Creates a new GetProtocolVersionUpgradeVoteStatusRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} GetProtocolVersionUpgradeStateRequest instance + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} GetProtocolVersionUpgradeVoteStatusRequest instance */ - GetProtocolVersionUpgradeStateRequest.create = function create(properties) { - return new GetProtocolVersionUpgradeStateRequest(properties); + GetProtocolVersionUpgradeVoteStatusRequest.create = function create(properties) { + return new GetProtocolVersionUpgradeVoteStatusRequest(properties); }; /** - * Encodes the specified GetProtocolVersionUpgradeStateRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.verify|verify} messages. + * Encodes the specified GetProtocolVersionUpgradeVoteStatusRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateRequest} message GetProtocolVersionUpgradeStateRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusRequest} message GetProtocolVersionUpgradeVoteStatusRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeStateRequest.encode = function encode(message, writer) { + GetProtocolVersionUpgradeVoteStatusRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetProtocolVersionUpgradeStateRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.verify|verify} messages. + * Encodes the specified GetProtocolVersionUpgradeVoteStatusRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateRequest} message GetProtocolVersionUpgradeStateRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusRequest} message GetProtocolVersionUpgradeVoteStatusRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeStateRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetProtocolVersionUpgradeVoteStatusRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProtocolVersionUpgradeStateRequest message from the specified reader or buffer. + * Decodes a GetProtocolVersionUpgradeVoteStatusRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} GetProtocolVersionUpgradeStateRequest + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} GetProtocolVersionUpgradeVoteStatusRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeStateRequest.decode = function decode(reader, length) { + GetProtocolVersionUpgradeVoteStatusRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -20115,37 +22227,37 @@ $root.org = (function() { }; /** - * Decodes a GetProtocolVersionUpgradeStateRequest message from the specified reader or buffer, length delimited. + * Decodes a GetProtocolVersionUpgradeVoteStatusRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} GetProtocolVersionUpgradeStateRequest + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} GetProtocolVersionUpgradeVoteStatusRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeStateRequest.decodeDelimited = function decodeDelimited(reader) { + GetProtocolVersionUpgradeVoteStatusRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProtocolVersionUpgradeStateRequest message. + * Verifies a GetProtocolVersionUpgradeVoteStatusRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProtocolVersionUpgradeStateRequest.verify = function verify(message) { + GetProtocolVersionUpgradeVoteStatusRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -20154,40 +22266,40 @@ $root.org = (function() { }; /** - * Creates a GetProtocolVersionUpgradeStateRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetProtocolVersionUpgradeVoteStatusRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} GetProtocolVersionUpgradeStateRequest + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} GetProtocolVersionUpgradeVoteStatusRequest */ - GetProtocolVersionUpgradeStateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest) + GetProtocolVersionUpgradeVoteStatusRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetProtocolVersionUpgradeStateRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetProtocolVersionUpgradeVoteStatusRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} message GetProtocolVersionUpgradeStateRequest + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} message GetProtocolVersionUpgradeVoteStatusRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProtocolVersionUpgradeStateRequest.toObject = function toObject(message, options) { + GetProtocolVersionUpgradeVoteStatusRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -20195,34 +22307,36 @@ $root.org = (function() { }; /** - * Converts this GetProtocolVersionUpgradeStateRequest to JSON. + * Converts this GetProtocolVersionUpgradeVoteStatusRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest * @instance * @returns {Object.} JSON object */ - GetProtocolVersionUpgradeStateRequest.prototype.toJSON = function toJSON() { + GetProtocolVersionUpgradeVoteStatusRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 = (function() { + GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 = (function() { /** - * Properties of a GetProtocolVersionUpgradeStateRequestV0. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest - * @interface IGetProtocolVersionUpgradeStateRequestV0 - * @property {boolean|null} [prove] GetProtocolVersionUpgradeStateRequestV0 prove + * Properties of a GetProtocolVersionUpgradeVoteStatusRequestV0. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @interface IGetProtocolVersionUpgradeVoteStatusRequestV0 + * @property {Uint8Array|null} [startProTxHash] GetProtocolVersionUpgradeVoteStatusRequestV0 startProTxHash + * @property {number|null} [count] GetProtocolVersionUpgradeVoteStatusRequestV0 count + * @property {boolean|null} [prove] GetProtocolVersionUpgradeVoteStatusRequestV0 prove */ /** - * Constructs a new GetProtocolVersionUpgradeStateRequestV0. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest - * @classdesc Represents a GetProtocolVersionUpgradeStateRequestV0. - * @implements IGetProtocolVersionUpgradeStateRequestV0 + * Constructs a new GetProtocolVersionUpgradeVoteStatusRequestV0. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @classdesc Represents a GetProtocolVersionUpgradeVoteStatusRequestV0. + * @implements IGetProtocolVersionUpgradeVoteStatusRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0=} [properties] Properties to set */ - function GetProtocolVersionUpgradeStateRequestV0(properties) { + function GetProtocolVersionUpgradeVoteStatusRequestV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20230,74 +22344,100 @@ $root.org = (function() { } /** - * GetProtocolVersionUpgradeStateRequestV0 prove. + * GetProtocolVersionUpgradeVoteStatusRequestV0 startProTxHash. + * @member {Uint8Array} startProTxHash + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @instance + */ + GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.startProTxHash = $util.newBuffer([]); + + /** + * GetProtocolVersionUpgradeVoteStatusRequestV0 count. + * @member {number} count + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @instance + */ + GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.count = 0; + + /** + * GetProtocolVersionUpgradeVoteStatusRequestV0 prove. * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 * @instance */ - GetProtocolVersionUpgradeStateRequestV0.prototype.prove = false; + GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.prove = false; /** - * Creates a new GetProtocolVersionUpgradeStateRequestV0 instance using the specified properties. + * Creates a new GetProtocolVersionUpgradeVoteStatusRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} GetProtocolVersionUpgradeStateRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} GetProtocolVersionUpgradeVoteStatusRequestV0 instance */ - GetProtocolVersionUpgradeStateRequestV0.create = function create(properties) { - return new GetProtocolVersionUpgradeStateRequestV0(properties); + GetProtocolVersionUpgradeVoteStatusRequestV0.create = function create(properties) { + return new GetProtocolVersionUpgradeVoteStatusRequestV0(properties); }; /** - * Encodes the specified GetProtocolVersionUpgradeStateRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.verify|verify} messages. + * Encodes the specified GetProtocolVersionUpgradeVoteStatusRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0} message GetProtocolVersionUpgradeStateRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0} message GetProtocolVersionUpgradeVoteStatusRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeStateRequestV0.encode = function encode(message, writer) { + GetProtocolVersionUpgradeVoteStatusRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.startProTxHash != null && Object.hasOwnProperty.call(message, "startProTxHash")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.startProTxHash); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.count); if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.prove); + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.prove); return writer; }; /** - * Encodes the specified GetProtocolVersionUpgradeStateRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.verify|verify} messages. + * Encodes the specified GetProtocolVersionUpgradeVoteStatusRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.IGetProtocolVersionUpgradeStateRequestV0} message GetProtocolVersionUpgradeStateRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0} message GetProtocolVersionUpgradeVoteStatusRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeStateRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetProtocolVersionUpgradeVoteStatusRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProtocolVersionUpgradeStateRequestV0 message from the specified reader or buffer. + * Decodes a GetProtocolVersionUpgradeVoteStatusRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} GetProtocolVersionUpgradeStateRequestV0 + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} GetProtocolVersionUpgradeVoteStatusRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeStateRequestV0.decode = function decode(reader, length) { + GetProtocolVersionUpgradeVoteStatusRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: + message.startProTxHash = reader.bytes(); + break; + case 2: + message.count = reader.uint32(); + break; + case 3: message.prove = reader.bool(); break; default: @@ -20309,32 +22449,38 @@ $root.org = (function() { }; /** - * Decodes a GetProtocolVersionUpgradeStateRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetProtocolVersionUpgradeVoteStatusRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} GetProtocolVersionUpgradeStateRequestV0 + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} GetProtocolVersionUpgradeVoteStatusRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeStateRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetProtocolVersionUpgradeVoteStatusRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProtocolVersionUpgradeStateRequestV0 message. + * Verifies a GetProtocolVersionUpgradeVoteStatusRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProtocolVersionUpgradeStateRequestV0.verify = function verify(message) { + GetProtocolVersionUpgradeVoteStatusRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.startProTxHash != null && message.hasOwnProperty("startProTxHash")) + if (!(message.startProTxHash && typeof message.startProTxHash.length === "number" || $util.isString(message.startProTxHash))) + return "startProTxHash: buffer expected"; + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count)) + return "count: integer expected"; if (message.prove != null && message.hasOwnProperty("prove")) if (typeof message.prove !== "boolean") return "prove: boolean expected"; @@ -20342,77 +22488,97 @@ $root.org = (function() { }; /** - * Creates a GetProtocolVersionUpgradeStateRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetProtocolVersionUpgradeVoteStatusRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} GetProtocolVersionUpgradeStateRequestV0 + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} GetProtocolVersionUpgradeVoteStatusRequestV0 */ - GetProtocolVersionUpgradeStateRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0) + GetProtocolVersionUpgradeVoteStatusRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0(); + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0(); + if (object.startProTxHash != null) + if (typeof object.startProTxHash === "string") + $util.base64.decode(object.startProTxHash, message.startProTxHash = $util.newBuffer($util.base64.length(object.startProTxHash)), 0); + else if (object.startProTxHash.length >= 0) + message.startProTxHash = object.startProTxHash; + if (object.count != null) + message.count = object.count >>> 0; if (object.prove != null) message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetProtocolVersionUpgradeStateRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetProtocolVersionUpgradeVoteStatusRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} message GetProtocolVersionUpgradeStateRequestV0 + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} message GetProtocolVersionUpgradeVoteStatusRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProtocolVersionUpgradeStateRequestV0.toObject = function toObject(message, options) { + GetProtocolVersionUpgradeVoteStatusRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { + if (options.bytes === String) + object.startProTxHash = ""; + else { + object.startProTxHash = []; + if (options.bytes !== Array) + object.startProTxHash = $util.newBuffer(object.startProTxHash); + } + object.count = 0; object.prove = false; + } + if (message.startProTxHash != null && message.hasOwnProperty("startProTxHash")) + object.startProTxHash = options.bytes === String ? $util.base64.encode(message.startProTxHash, 0, message.startProTxHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.startProTxHash) : message.startProTxHash; + if (message.count != null && message.hasOwnProperty("count")) + object.count = message.count; if (message.prove != null && message.hasOwnProperty("prove")) object.prove = message.prove; return object; }; /** - * Converts this GetProtocolVersionUpgradeStateRequestV0 to JSON. + * Converts this GetProtocolVersionUpgradeVoteStatusRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 * @instance * @returns {Object.} JSON object */ - GetProtocolVersionUpgradeStateRequestV0.prototype.toJSON = function toJSON() { + GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetProtocolVersionUpgradeStateRequestV0; + return GetProtocolVersionUpgradeVoteStatusRequestV0; })(); - return GetProtocolVersionUpgradeStateRequest; + return GetProtocolVersionUpgradeVoteStatusRequest; })(); - v0.GetProtocolVersionUpgradeStateResponse = (function() { + v0.GetProtocolVersionUpgradeVoteStatusResponse = (function() { /** - * Properties of a GetProtocolVersionUpgradeStateResponse. + * Properties of a GetProtocolVersionUpgradeVoteStatusResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetProtocolVersionUpgradeStateResponse - * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0|null} [v0] GetProtocolVersionUpgradeStateResponse v0 + * @interface IGetProtocolVersionUpgradeVoteStatusResponse + * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0|null} [v0] GetProtocolVersionUpgradeVoteStatusResponse v0 */ /** - * Constructs a new GetProtocolVersionUpgradeStateResponse. + * Constructs a new GetProtocolVersionUpgradeVoteStatusResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetProtocolVersionUpgradeStateResponse. - * @implements IGetProtocolVersionUpgradeStateResponse + * @classdesc Represents a GetProtocolVersionUpgradeVoteStatusResponse. + * @implements IGetProtocolVersionUpgradeVoteStatusResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusResponse=} [properties] Properties to set */ - function GetProtocolVersionUpgradeStateResponse(properties) { + function GetProtocolVersionUpgradeVoteStatusResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20420,89 +22586,89 @@ $root.org = (function() { } /** - * GetProtocolVersionUpgradeStateResponse v0. - * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * GetProtocolVersionUpgradeVoteStatusResponse v0. + * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse * @instance */ - GetProtocolVersionUpgradeStateResponse.prototype.v0 = null; + GetProtocolVersionUpgradeVoteStatusResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetProtocolVersionUpgradeStateResponse version. + * GetProtocolVersionUpgradeVoteStatusResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse * @instance */ - Object.defineProperty(GetProtocolVersionUpgradeStateResponse.prototype, "version", { + Object.defineProperty(GetProtocolVersionUpgradeVoteStatusResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetProtocolVersionUpgradeStateResponse instance using the specified properties. + * Creates a new GetProtocolVersionUpgradeVoteStatusResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} GetProtocolVersionUpgradeStateResponse instance + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} GetProtocolVersionUpgradeVoteStatusResponse instance */ - GetProtocolVersionUpgradeStateResponse.create = function create(properties) { - return new GetProtocolVersionUpgradeStateResponse(properties); + GetProtocolVersionUpgradeVoteStatusResponse.create = function create(properties) { + return new GetProtocolVersionUpgradeVoteStatusResponse(properties); }; /** - * Encodes the specified GetProtocolVersionUpgradeStateResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.verify|verify} messages. + * Encodes the specified GetProtocolVersionUpgradeVoteStatusResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateResponse} message GetProtocolVersionUpgradeStateResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusResponse} message GetProtocolVersionUpgradeVoteStatusResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeStateResponse.encode = function encode(message, writer) { + GetProtocolVersionUpgradeVoteStatusResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetProtocolVersionUpgradeStateResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.verify|verify} messages. + * Encodes the specified GetProtocolVersionUpgradeVoteStatusResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeStateResponse} message GetProtocolVersionUpgradeStateResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusResponse} message GetProtocolVersionUpgradeVoteStatusResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeStateResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetProtocolVersionUpgradeVoteStatusResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProtocolVersionUpgradeStateResponse message from the specified reader or buffer. + * Decodes a GetProtocolVersionUpgradeVoteStatusResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} GetProtocolVersionUpgradeStateResponse + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} GetProtocolVersionUpgradeVoteStatusResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeStateResponse.decode = function decode(reader, length) { + GetProtocolVersionUpgradeVoteStatusResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -20513,37 +22679,37 @@ $root.org = (function() { }; /** - * Decodes a GetProtocolVersionUpgradeStateResponse message from the specified reader or buffer, length delimited. + * Decodes a GetProtocolVersionUpgradeVoteStatusResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} GetProtocolVersionUpgradeStateResponse + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} GetProtocolVersionUpgradeVoteStatusResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeStateResponse.decodeDelimited = function decodeDelimited(reader) { + GetProtocolVersionUpgradeVoteStatusResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProtocolVersionUpgradeStateResponse message. + * Verifies a GetProtocolVersionUpgradeVoteStatusResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProtocolVersionUpgradeStateResponse.verify = function verify(message) { + GetProtocolVersionUpgradeVoteStatusResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -20552,40 +22718,40 @@ $root.org = (function() { }; /** - * Creates a GetProtocolVersionUpgradeStateResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetProtocolVersionUpgradeVoteStatusResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} GetProtocolVersionUpgradeStateResponse + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} GetProtocolVersionUpgradeVoteStatusResponse */ - GetProtocolVersionUpgradeStateResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse) + GetProtocolVersionUpgradeVoteStatusResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetProtocolVersionUpgradeStateResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetProtocolVersionUpgradeVoteStatusResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} message GetProtocolVersionUpgradeStateResponse + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} message GetProtocolVersionUpgradeVoteStatusResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProtocolVersionUpgradeStateResponse.toObject = function toObject(message, options) { + GetProtocolVersionUpgradeVoteStatusResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -20593,36 +22759,36 @@ $root.org = (function() { }; /** - * Converts this GetProtocolVersionUpgradeStateResponse to JSON. + * Converts this GetProtocolVersionUpgradeVoteStatusResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse * @instance * @returns {Object.} JSON object */ - GetProtocolVersionUpgradeStateResponse.prototype.toJSON = function toJSON() { + GetProtocolVersionUpgradeVoteStatusResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 = (function() { + GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 = (function() { /** - * Properties of a GetProtocolVersionUpgradeStateResponseV0. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse - * @interface IGetProtocolVersionUpgradeStateResponseV0 - * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions|null} [versions] GetProtocolVersionUpgradeStateResponseV0 versions - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetProtocolVersionUpgradeStateResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetProtocolVersionUpgradeStateResponseV0 metadata + * Properties of a GetProtocolVersionUpgradeVoteStatusResponseV0. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @interface IGetProtocolVersionUpgradeVoteStatusResponseV0 + * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals|null} [versions] GetProtocolVersionUpgradeVoteStatusResponseV0 versions + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetProtocolVersionUpgradeVoteStatusResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetProtocolVersionUpgradeVoteStatusResponseV0 metadata */ /** - * Constructs a new GetProtocolVersionUpgradeStateResponseV0. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse - * @classdesc Represents a GetProtocolVersionUpgradeStateResponseV0. - * @implements IGetProtocolVersionUpgradeStateResponseV0 + * Constructs a new GetProtocolVersionUpgradeVoteStatusResponseV0. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @classdesc Represents a GetProtocolVersionUpgradeVoteStatusResponseV0. + * @implements IGetProtocolVersionUpgradeVoteStatusResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0=} [properties] Properties to set */ - function GetProtocolVersionUpgradeStateResponseV0(properties) { + function GetProtocolVersionUpgradeVoteStatusResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20630,69 +22796,69 @@ $root.org = (function() { } /** - * GetProtocolVersionUpgradeStateResponseV0 versions. - * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions|null|undefined} versions - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * GetProtocolVersionUpgradeVoteStatusResponseV0 versions. + * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals|null|undefined} versions + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 * @instance */ - GetProtocolVersionUpgradeStateResponseV0.prototype.versions = null; + GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.versions = null; /** - * GetProtocolVersionUpgradeStateResponseV0 proof. + * GetProtocolVersionUpgradeVoteStatusResponseV0 proof. * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 * @instance */ - GetProtocolVersionUpgradeStateResponseV0.prototype.proof = null; + GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.proof = null; /** - * GetProtocolVersionUpgradeStateResponseV0 metadata. + * GetProtocolVersionUpgradeVoteStatusResponseV0 metadata. * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 * @instance */ - GetProtocolVersionUpgradeStateResponseV0.prototype.metadata = null; + GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.metadata = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetProtocolVersionUpgradeStateResponseV0 result. + * GetProtocolVersionUpgradeVoteStatusResponseV0 result. * @member {"versions"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 * @instance */ - Object.defineProperty(GetProtocolVersionUpgradeStateResponseV0.prototype, "result", { + Object.defineProperty(GetProtocolVersionUpgradeVoteStatusResponseV0.prototype, "result", { get: $util.oneOfGetter($oneOfFields = ["versions", "proof"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetProtocolVersionUpgradeStateResponseV0 instance using the specified properties. + * Creates a new GetProtocolVersionUpgradeVoteStatusResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} GetProtocolVersionUpgradeStateResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} GetProtocolVersionUpgradeVoteStatusResponseV0 instance */ - GetProtocolVersionUpgradeStateResponseV0.create = function create(properties) { - return new GetProtocolVersionUpgradeStateResponseV0(properties); + GetProtocolVersionUpgradeVoteStatusResponseV0.create = function create(properties) { + return new GetProtocolVersionUpgradeVoteStatusResponseV0(properties); }; /** - * Encodes the specified GetProtocolVersionUpgradeStateResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.verify|verify} messages. + * Encodes the specified GetProtocolVersionUpgradeVoteStatusResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0} message GetProtocolVersionUpgradeStateResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0} message GetProtocolVersionUpgradeVoteStatusResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeStateResponseV0.encode = function encode(message, writer) { + GetProtocolVersionUpgradeVoteStatusResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.versions != null && Object.hasOwnProperty.call(message, "versions")) - $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.encode(message.versions, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.encode(message.versions, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) @@ -20701,38 +22867,38 @@ $root.org = (function() { }; /** - * Encodes the specified GetProtocolVersionUpgradeStateResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.verify|verify} messages. + * Encodes the specified GetProtocolVersionUpgradeVoteStatusResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.IGetProtocolVersionUpgradeStateResponseV0} message GetProtocolVersionUpgradeStateResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0} message GetProtocolVersionUpgradeVoteStatusResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeStateResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetProtocolVersionUpgradeVoteStatusResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProtocolVersionUpgradeStateResponseV0 message from the specified reader or buffer. + * Decodes a GetProtocolVersionUpgradeVoteStatusResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} GetProtocolVersionUpgradeStateResponseV0 + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} GetProtocolVersionUpgradeVoteStatusResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeStateResponseV0.decode = function decode(reader, length) { + GetProtocolVersionUpgradeVoteStatusResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.decode(reader, reader.uint32()); + message.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.decode(reader, reader.uint32()); break; case 2: message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); @@ -20749,37 +22915,37 @@ $root.org = (function() { }; /** - * Decodes a GetProtocolVersionUpgradeStateResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a GetProtocolVersionUpgradeVoteStatusResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} GetProtocolVersionUpgradeStateResponseV0 + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} GetProtocolVersionUpgradeVoteStatusResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeStateResponseV0.decodeDelimited = function decodeDelimited(reader) { + GetProtocolVersionUpgradeVoteStatusResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProtocolVersionUpgradeStateResponseV0 message. + * Verifies a GetProtocolVersionUpgradeVoteStatusResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProtocolVersionUpgradeStateResponseV0.verify = function verify(message) { + GetProtocolVersionUpgradeVoteStatusResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.versions != null && message.hasOwnProperty("versions")) { properties.result = 1; { - var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.verify(message.versions); + var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.verify(message.versions); if (error) return "versions." + error; } @@ -20803,52 +22969,52 @@ $root.org = (function() { }; /** - * Creates a GetProtocolVersionUpgradeStateResponseV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetProtocolVersionUpgradeVoteStatusResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} GetProtocolVersionUpgradeStateResponseV0 - */ - GetProtocolVersionUpgradeStateResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0) + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} GetProtocolVersionUpgradeVoteStatusResponseV0 + */ + GetProtocolVersionUpgradeVoteStatusResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0(); + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0(); if (object.versions != null) { if (typeof object.versions !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.versions: object expected"); - message.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.fromObject(object.versions); + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.versions: object expected"); + message.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.fromObject(object.versions); } if (object.proof != null) { if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.proof: object expected"); + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.proof: object expected"); message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); } if (object.metadata != null) { if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.metadata: object expected"); + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.metadata: object expected"); message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); } return message; }; /** - * Creates a plain object from a GetProtocolVersionUpgradeStateResponseV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetProtocolVersionUpgradeVoteStatusResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} message GetProtocolVersionUpgradeStateResponseV0 + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} message GetProtocolVersionUpgradeVoteStatusResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProtocolVersionUpgradeStateResponseV0.toObject = function toObject(message, options) { + GetProtocolVersionUpgradeVoteStatusResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) object.metadata = null; if (message.versions != null && message.hasOwnProperty("versions")) { - object.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(message.versions, options); + object.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(message.versions, options); if (options.oneofs) object.result = "versions"; } @@ -20863,35 +23029,35 @@ $root.org = (function() { }; /** - * Converts this GetProtocolVersionUpgradeStateResponseV0 to JSON. + * Converts this GetProtocolVersionUpgradeVoteStatusResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 * @instance * @returns {Object.} JSON object */ - GetProtocolVersionUpgradeStateResponseV0.prototype.toJSON = function toJSON() { + GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetProtocolVersionUpgradeStateResponseV0.Versions = (function() { + GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals = (function() { /** - * Properties of a Versions. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 - * @interface IVersions - * @property {Array.|null} [versions] Versions versions + * Properties of a VersionSignals. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @interface IVersionSignals + * @property {Array.|null} [versionSignals] VersionSignals versionSignals */ /** - * Constructs a new Versions. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 - * @classdesc Represents a Versions. - * @implements IVersions + * Constructs a new VersionSignals. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @classdesc Represents a VersionSignals. + * @implements IVersionSignals * @constructor - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals=} [properties] Properties to set */ - function Versions(properties) { - this.versions = []; + function VersionSignals(properties) { + this.versionSignals = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20899,78 +23065,78 @@ $root.org = (function() { } /** - * Versions versions. - * @member {Array.} versions - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * VersionSignals versionSignals. + * @member {Array.} versionSignals + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals * @instance */ - Versions.prototype.versions = $util.emptyArray; + VersionSignals.prototype.versionSignals = $util.emptyArray; /** - * Creates a new Versions instance using the specified properties. + * Creates a new VersionSignals instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} Versions instance + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} VersionSignals instance */ - Versions.create = function create(properties) { - return new Versions(properties); + VersionSignals.create = function create(properties) { + return new VersionSignals(properties); }; /** - * Encodes the specified Versions message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.verify|verify} messages. + * Encodes the specified VersionSignals message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions} message Versions message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals} message VersionSignals message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Versions.encode = function encode(message, writer) { + VersionSignals.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.versions != null && message.versions.length) - for (var i = 0; i < message.versions.length; ++i) - $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.encode(message.versions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.versionSignals != null && message.versionSignals.length) + for (var i = 0; i < message.versionSignals.length; ++i) + $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.encode(message.versionSignals[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified Versions message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.verify|verify} messages. + * Encodes the specified VersionSignals message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersions} message Versions message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals} message VersionSignals message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Versions.encodeDelimited = function encodeDelimited(message, writer) { + VersionSignals.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Versions message from the specified reader or buffer. + * Decodes a VersionSignals message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} Versions + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} VersionSignals * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Versions.decode = function decode(reader, length) { + VersionSignals.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.versions && message.versions.length)) - message.versions = []; - message.versions.push($root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.decode(reader, reader.uint32())); + if (!(message.versionSignals && message.versionSignals.length)) + message.versionSignals = []; + message.versionSignals.push($root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -20981,125 +23147,125 @@ $root.org = (function() { }; /** - * Decodes a Versions message from the specified reader or buffer, length delimited. + * Decodes a VersionSignals message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} Versions + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} VersionSignals * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Versions.decodeDelimited = function decodeDelimited(reader) { + VersionSignals.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Versions message. + * Verifies a VersionSignals message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Versions.verify = function verify(message) { + VersionSignals.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.versions != null && message.hasOwnProperty("versions")) { - if (!Array.isArray(message.versions)) - return "versions: array expected"; - for (var i = 0; i < message.versions.length; ++i) { - var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.verify(message.versions[i]); + if (message.versionSignals != null && message.hasOwnProperty("versionSignals")) { + if (!Array.isArray(message.versionSignals)) + return "versionSignals: array expected"; + for (var i = 0; i < message.versionSignals.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.verify(message.versionSignals[i]); if (error) - return "versions." + error; + return "versionSignals." + error; } } return null; }; /** - * Creates a Versions message from a plain object. Also converts values to their respective internal types. + * Creates a VersionSignals message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} Versions + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} VersionSignals */ - Versions.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions) + VersionSignals.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions(); - if (object.versions) { - if (!Array.isArray(object.versions)) - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.versions: array expected"); - message.versions = []; - for (var i = 0; i < object.versions.length; ++i) { - if (typeof object.versions[i] !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.versions: object expected"); - message.versions[i] = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.fromObject(object.versions[i]); + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals(); + if (object.versionSignals) { + if (!Array.isArray(object.versionSignals)) + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.versionSignals: array expected"); + message.versionSignals = []; + for (var i = 0; i < object.versionSignals.length; ++i) { + if (typeof object.versionSignals[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.versionSignals: object expected"); + message.versionSignals[i] = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.fromObject(object.versionSignals[i]); } } return message; }; /** - * Creates a plain object from a Versions message. Also converts values to other types if specified. + * Creates a plain object from a VersionSignals message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} message Versions + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} message VersionSignals * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Versions.toObject = function toObject(message, options) { + VersionSignals.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.versions = []; - if (message.versions && message.versions.length) { - object.versions = []; - for (var j = 0; j < message.versions.length; ++j) - object.versions[j] = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject(message.versions[j], options); + object.versionSignals = []; + if (message.versionSignals && message.versionSignals.length) { + object.versionSignals = []; + for (var j = 0; j < message.versionSignals.length; ++j) + object.versionSignals[j] = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject(message.versionSignals[j], options); } return object; }; /** - * Converts this Versions to JSON. + * Converts this VersionSignals to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals * @instance * @returns {Object.} JSON object */ - Versions.prototype.toJSON = function toJSON() { + VersionSignals.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Versions; + return VersionSignals; })(); - GetProtocolVersionUpgradeStateResponseV0.VersionEntry = (function() { + GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal = (function() { /** - * Properties of a VersionEntry. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 - * @interface IVersionEntry - * @property {number|null} [versionNumber] VersionEntry versionNumber - * @property {number|null} [voteCount] VersionEntry voteCount + * Properties of a VersionSignal. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @interface IVersionSignal + * @property {Uint8Array|null} [proTxHash] VersionSignal proTxHash + * @property {number|null} [version] VersionSignal version */ /** - * Constructs a new VersionEntry. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 - * @classdesc Represents a VersionEntry. - * @implements IVersionEntry + * Constructs a new VersionSignal. + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @classdesc Represents a VersionSignal. + * @implements IVersionSignal * @constructor - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersionEntry=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignal=} [properties] Properties to set */ - function VersionEntry(properties) { + function VersionSignal(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21107,88 +23273,88 @@ $root.org = (function() { } /** - * VersionEntry versionNumber. - * @member {number} versionNumber - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * VersionSignal proTxHash. + * @member {Uint8Array} proTxHash + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal * @instance */ - VersionEntry.prototype.versionNumber = 0; + VersionSignal.prototype.proTxHash = $util.newBuffer([]); /** - * VersionEntry voteCount. - * @member {number} voteCount - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * VersionSignal version. + * @member {number} version + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal * @instance */ - VersionEntry.prototype.voteCount = 0; + VersionSignal.prototype.version = 0; /** - * Creates a new VersionEntry instance using the specified properties. + * Creates a new VersionSignal instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersionEntry=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} VersionEntry instance + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignal=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} VersionSignal instance */ - VersionEntry.create = function create(properties) { - return new VersionEntry(properties); + VersionSignal.create = function create(properties) { + return new VersionSignal(properties); }; /** - * Encodes the specified VersionEntry message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.verify|verify} messages. + * Encodes the specified VersionSignal message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersionEntry} message VersionEntry message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignal} message VersionSignal message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - VersionEntry.encode = function encode(message, writer) { + VersionSignal.encode = function encode(message, writer) { if (!writer) - writer = $Writer.create(); - if (message.versionNumber != null && Object.hasOwnProperty.call(message, "versionNumber")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.versionNumber); - if (message.voteCount != null && Object.hasOwnProperty.call(message, "voteCount")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.voteCount); + writer = $Writer.create(); + if (message.proTxHash != null && Object.hasOwnProperty.call(message, "proTxHash")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.proTxHash); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.version); return writer; }; /** - * Encodes the specified VersionEntry message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.verify|verify} messages. + * Encodes the specified VersionSignal message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.IVersionEntry} message VersionEntry message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignal} message VersionSignal message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - VersionEntry.encodeDelimited = function encodeDelimited(message, writer) { + VersionSignal.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a VersionEntry message from the specified reader or buffer. + * Decodes a VersionSignal message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} VersionEntry + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} VersionSignal * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - VersionEntry.decode = function decode(reader, length) { + VersionSignal.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.versionNumber = reader.uint32(); + message.proTxHash = reader.bytes(); break; case 2: - message.voteCount = reader.uint32(); + message.version = reader.uint32(); break; default: reader.skipType(tag & 7); @@ -21199,122 +23365,131 @@ $root.org = (function() { }; /** - * Decodes a VersionEntry message from the specified reader or buffer, length delimited. + * Decodes a VersionSignal message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} VersionEntry + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} VersionSignal * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - VersionEntry.decodeDelimited = function decodeDelimited(reader) { + VersionSignal.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a VersionEntry message. + * Verifies a VersionSignal message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - VersionEntry.verify = function verify(message) { + VersionSignal.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.versionNumber != null && message.hasOwnProperty("versionNumber")) - if (!$util.isInteger(message.versionNumber)) - return "versionNumber: integer expected"; - if (message.voteCount != null && message.hasOwnProperty("voteCount")) - if (!$util.isInteger(message.voteCount)) - return "voteCount: integer expected"; + if (message.proTxHash != null && message.hasOwnProperty("proTxHash")) + if (!(message.proTxHash && typeof message.proTxHash.length === "number" || $util.isString(message.proTxHash))) + return "proTxHash: buffer expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isInteger(message.version)) + return "version: integer expected"; return null; }; /** - * Creates a VersionEntry message from a plain object. Also converts values to their respective internal types. + * Creates a VersionSignal message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} VersionEntry + * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} VersionSignal */ - VersionEntry.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry) + VersionSignal.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry(); - if (object.versionNumber != null) - message.versionNumber = object.versionNumber >>> 0; - if (object.voteCount != null) - message.voteCount = object.voteCount >>> 0; + var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal(); + if (object.proTxHash != null) + if (typeof object.proTxHash === "string") + $util.base64.decode(object.proTxHash, message.proTxHash = $util.newBuffer($util.base64.length(object.proTxHash)), 0); + else if (object.proTxHash.length >= 0) + message.proTxHash = object.proTxHash; + if (object.version != null) + message.version = object.version >>> 0; return message; }; /** - * Creates a plain object from a VersionEntry message. Also converts values to other types if specified. + * Creates a plain object from a VersionSignal message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} message VersionEntry + * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} message VersionSignal * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - VersionEntry.toObject = function toObject(message, options) { + VersionSignal.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.versionNumber = 0; - object.voteCount = 0; + if (options.bytes === String) + object.proTxHash = ""; + else { + object.proTxHash = []; + if (options.bytes !== Array) + object.proTxHash = $util.newBuffer(object.proTxHash); + } + object.version = 0; } - if (message.versionNumber != null && message.hasOwnProperty("versionNumber")) - object.versionNumber = message.versionNumber; - if (message.voteCount != null && message.hasOwnProperty("voteCount")) - object.voteCount = message.voteCount; + if (message.proTxHash != null && message.hasOwnProperty("proTxHash")) + object.proTxHash = options.bytes === String ? $util.base64.encode(message.proTxHash, 0, message.proTxHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.proTxHash) : message.proTxHash; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; return object; }; /** - * Converts this VersionEntry to JSON. + * Converts this VersionSignal to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry + * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal * @instance * @returns {Object.} JSON object */ - VersionEntry.prototype.toJSON = function toJSON() { + VersionSignal.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return VersionEntry; + return VersionSignal; })(); - return GetProtocolVersionUpgradeStateResponseV0; + return GetProtocolVersionUpgradeVoteStatusResponseV0; })(); - return GetProtocolVersionUpgradeStateResponse; + return GetProtocolVersionUpgradeVoteStatusResponse; })(); - v0.GetProtocolVersionUpgradeVoteStatusRequest = (function() { + v0.GetEpochsInfoRequest = (function() { /** - * Properties of a GetProtocolVersionUpgradeVoteStatusRequest. + * Properties of a GetEpochsInfoRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetProtocolVersionUpgradeVoteStatusRequest - * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0|null} [v0] GetProtocolVersionUpgradeVoteStatusRequest v0 + * @interface IGetEpochsInfoRequest + * @property {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0|null} [v0] GetEpochsInfoRequest v0 */ /** - * Constructs a new GetProtocolVersionUpgradeVoteStatusRequest. + * Constructs a new GetEpochsInfoRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetProtocolVersionUpgradeVoteStatusRequest. - * @implements IGetProtocolVersionUpgradeVoteStatusRequest + * @classdesc Represents a GetEpochsInfoRequest. + * @implements IGetEpochsInfoRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetEpochsInfoRequest=} [properties] Properties to set */ - function GetProtocolVersionUpgradeVoteStatusRequest(properties) { + function GetEpochsInfoRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21322,89 +23497,89 @@ $root.org = (function() { } /** - * GetProtocolVersionUpgradeVoteStatusRequest v0. - * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * GetEpochsInfoRequest v0. + * @member {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest * @instance */ - GetProtocolVersionUpgradeVoteStatusRequest.prototype.v0 = null; + GetEpochsInfoRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetProtocolVersionUpgradeVoteStatusRequest version. + * GetEpochsInfoRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest * @instance */ - Object.defineProperty(GetProtocolVersionUpgradeVoteStatusRequest.prototype, "version", { + Object.defineProperty(GetEpochsInfoRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetProtocolVersionUpgradeVoteStatusRequest instance using the specified properties. + * Creates a new GetEpochsInfoRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} GetProtocolVersionUpgradeVoteStatusRequest instance + * @param {org.dash.platform.dapi.v0.IGetEpochsInfoRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest} GetEpochsInfoRequest instance */ - GetProtocolVersionUpgradeVoteStatusRequest.create = function create(properties) { - return new GetProtocolVersionUpgradeVoteStatusRequest(properties); + GetEpochsInfoRequest.create = function create(properties) { + return new GetEpochsInfoRequest(properties); }; /** - * Encodes the specified GetProtocolVersionUpgradeVoteStatusRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.verify|verify} messages. + * Encodes the specified GetEpochsInfoRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusRequest} message GetProtocolVersionUpgradeVoteStatusRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetEpochsInfoRequest} message GetEpochsInfoRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeVoteStatusRequest.encode = function encode(message, writer) { + GetEpochsInfoRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetProtocolVersionUpgradeVoteStatusRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.verify|verify} messages. + * Encodes the specified GetEpochsInfoRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusRequest} message GetProtocolVersionUpgradeVoteStatusRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetEpochsInfoRequest} message GetEpochsInfoRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeVoteStatusRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetEpochsInfoRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProtocolVersionUpgradeVoteStatusRequest message from the specified reader or buffer. + * Decodes a GetEpochsInfoRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} GetProtocolVersionUpgradeVoteStatusRequest + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest} GetEpochsInfoRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeVoteStatusRequest.decode = function decode(reader, length) { + GetEpochsInfoRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -21415,37 +23590,37 @@ $root.org = (function() { }; /** - * Decodes a GetProtocolVersionUpgradeVoteStatusRequest message from the specified reader or buffer, length delimited. + * Decodes a GetEpochsInfoRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} GetProtocolVersionUpgradeVoteStatusRequest + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest} GetEpochsInfoRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeVoteStatusRequest.decodeDelimited = function decodeDelimited(reader) { + GetEpochsInfoRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProtocolVersionUpgradeVoteStatusRequest message. + * Verifies a GetEpochsInfoRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProtocolVersionUpgradeVoteStatusRequest.verify = function verify(message) { + GetEpochsInfoRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -21454,40 +23629,40 @@ $root.org = (function() { }; /** - * Creates a GetProtocolVersionUpgradeVoteStatusRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetEpochsInfoRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} GetProtocolVersionUpgradeVoteStatusRequest + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest} GetEpochsInfoRequest */ - GetProtocolVersionUpgradeVoteStatusRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest) + GetEpochsInfoRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetProtocolVersionUpgradeVoteStatusRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetEpochsInfoRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} message GetProtocolVersionUpgradeVoteStatusRequest + * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest} message GetEpochsInfoRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProtocolVersionUpgradeVoteStatusRequest.toObject = function toObject(message, options) { + GetEpochsInfoRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -21495,36 +23670,37 @@ $root.org = (function() { }; /** - * Converts this GetProtocolVersionUpgradeVoteStatusRequest to JSON. + * Converts this GetEpochsInfoRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest * @instance * @returns {Object.} JSON object */ - GetProtocolVersionUpgradeVoteStatusRequest.prototype.toJSON = function toJSON() { + GetEpochsInfoRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 = (function() { + GetEpochsInfoRequest.GetEpochsInfoRequestV0 = (function() { /** - * Properties of a GetProtocolVersionUpgradeVoteStatusRequestV0. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest - * @interface IGetProtocolVersionUpgradeVoteStatusRequestV0 - * @property {Uint8Array|null} [startProTxHash] GetProtocolVersionUpgradeVoteStatusRequestV0 startProTxHash - * @property {number|null} [count] GetProtocolVersionUpgradeVoteStatusRequestV0 count - * @property {boolean|null} [prove] GetProtocolVersionUpgradeVoteStatusRequestV0 prove + * Properties of a GetEpochsInfoRequestV0. + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @interface IGetEpochsInfoRequestV0 + * @property {google.protobuf.IUInt32Value|null} [startEpoch] GetEpochsInfoRequestV0 startEpoch + * @property {number|null} [count] GetEpochsInfoRequestV0 count + * @property {boolean|null} [ascending] GetEpochsInfoRequestV0 ascending + * @property {boolean|null} [prove] GetEpochsInfoRequestV0 prove */ - /** - * Constructs a new GetProtocolVersionUpgradeVoteStatusRequestV0. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest - * @classdesc Represents a GetProtocolVersionUpgradeVoteStatusRequestV0. - * @implements IGetProtocolVersionUpgradeVoteStatusRequestV0 + /** + * Constructs a new GetEpochsInfoRequestV0. + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @classdesc Represents a GetEpochsInfoRequestV0. + * @implements IGetEpochsInfoRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0=} [properties] Properties to set */ - function GetProtocolVersionUpgradeVoteStatusRequestV0(properties) { + function GetEpochsInfoRequestV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21532,100 +23708,113 @@ $root.org = (function() { } /** - * GetProtocolVersionUpgradeVoteStatusRequestV0 startProTxHash. - * @member {Uint8Array} startProTxHash - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * GetEpochsInfoRequestV0 startEpoch. + * @member {google.protobuf.IUInt32Value|null|undefined} startEpoch + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 * @instance */ - GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.startProTxHash = $util.newBuffer([]); + GetEpochsInfoRequestV0.prototype.startEpoch = null; /** - * GetProtocolVersionUpgradeVoteStatusRequestV0 count. + * GetEpochsInfoRequestV0 count. * @member {number} count - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 * @instance */ - GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.count = 0; + GetEpochsInfoRequestV0.prototype.count = 0; /** - * GetProtocolVersionUpgradeVoteStatusRequestV0 prove. + * GetEpochsInfoRequestV0 ascending. + * @member {boolean} ascending + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @instance + */ + GetEpochsInfoRequestV0.prototype.ascending = false; + + /** + * GetEpochsInfoRequestV0 prove. * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 * @instance */ - GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.prove = false; + GetEpochsInfoRequestV0.prototype.prove = false; /** - * Creates a new GetProtocolVersionUpgradeVoteStatusRequestV0 instance using the specified properties. + * Creates a new GetEpochsInfoRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} GetProtocolVersionUpgradeVoteStatusRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} GetEpochsInfoRequestV0 instance */ - GetProtocolVersionUpgradeVoteStatusRequestV0.create = function create(properties) { - return new GetProtocolVersionUpgradeVoteStatusRequestV0(properties); + GetEpochsInfoRequestV0.create = function create(properties) { + return new GetEpochsInfoRequestV0(properties); }; /** - * Encodes the specified GetProtocolVersionUpgradeVoteStatusRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.verify|verify} messages. + * Encodes the specified GetEpochsInfoRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0} message GetProtocolVersionUpgradeVoteStatusRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0} message GetEpochsInfoRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeVoteStatusRequestV0.encode = function encode(message, writer) { + GetEpochsInfoRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.startProTxHash != null && Object.hasOwnProperty.call(message, "startProTxHash")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.startProTxHash); + if (message.startEpoch != null && Object.hasOwnProperty.call(message, "startEpoch")) + $root.google.protobuf.UInt32Value.encode(message.startEpoch, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.count != null && Object.hasOwnProperty.call(message, "count")) writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.count); + if (message.ascending != null && Object.hasOwnProperty.call(message, "ascending")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.ascending); if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.prove); + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.prove); return writer; }; /** - * Encodes the specified GetProtocolVersionUpgradeVoteStatusRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.verify|verify} messages. + * Encodes the specified GetEpochsInfoRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.IGetProtocolVersionUpgradeVoteStatusRequestV0} message GetProtocolVersionUpgradeVoteStatusRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0} message GetEpochsInfoRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeVoteStatusRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetEpochsInfoRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProtocolVersionUpgradeVoteStatusRequestV0 message from the specified reader or buffer. + * Decodes a GetEpochsInfoRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} GetProtocolVersionUpgradeVoteStatusRequestV0 + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} GetEpochsInfoRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeVoteStatusRequestV0.decode = function decode(reader, length) { + GetEpochsInfoRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.startProTxHash = reader.bytes(); + message.startEpoch = $root.google.protobuf.UInt32Value.decode(reader, reader.uint32()); break; case 2: message.count = reader.uint32(); break; case 3: + message.ascending = reader.bool(); + break; + case 4: message.prove = reader.bool(); break; default: @@ -21637,38 +23826,43 @@ $root.org = (function() { }; /** - * Decodes a GetProtocolVersionUpgradeVoteStatusRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetEpochsInfoRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} GetProtocolVersionUpgradeVoteStatusRequestV0 + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} GetEpochsInfoRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeVoteStatusRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetEpochsInfoRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProtocolVersionUpgradeVoteStatusRequestV0 message. + * Verifies a GetEpochsInfoRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProtocolVersionUpgradeVoteStatusRequestV0.verify = function verify(message) { + GetEpochsInfoRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.startProTxHash != null && message.hasOwnProperty("startProTxHash")) - if (!(message.startProTxHash && typeof message.startProTxHash.length === "number" || $util.isString(message.startProTxHash))) - return "startProTxHash: buffer expected"; + if (message.startEpoch != null && message.hasOwnProperty("startEpoch")) { + var error = $root.google.protobuf.UInt32Value.verify(message.startEpoch); + if (error) + return "startEpoch." + error; + } if (message.count != null && message.hasOwnProperty("count")) if (!$util.isInteger(message.count)) return "count: integer expected"; + if (message.ascending != null && message.hasOwnProperty("ascending")) + if (typeof message.ascending !== "boolean") + return "ascending: boolean expected"; if (message.prove != null && message.hasOwnProperty("prove")) if (typeof message.prove !== "boolean") return "prove: boolean expected"; @@ -21676,97 +23870,96 @@ $root.org = (function() { }; /** - * Creates a GetProtocolVersionUpgradeVoteStatusRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetEpochsInfoRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} GetProtocolVersionUpgradeVoteStatusRequestV0 + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} GetEpochsInfoRequestV0 */ - GetProtocolVersionUpgradeVoteStatusRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0) + GetEpochsInfoRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0(); - if (object.startProTxHash != null) - if (typeof object.startProTxHash === "string") - $util.base64.decode(object.startProTxHash, message.startProTxHash = $util.newBuffer($util.base64.length(object.startProTxHash)), 0); - else if (object.startProTxHash.length >= 0) - message.startProTxHash = object.startProTxHash; + var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0(); + if (object.startEpoch != null) { + if (typeof object.startEpoch !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.startEpoch: object expected"); + message.startEpoch = $root.google.protobuf.UInt32Value.fromObject(object.startEpoch); + } if (object.count != null) message.count = object.count >>> 0; + if (object.ascending != null) + message.ascending = Boolean(object.ascending); if (object.prove != null) message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetProtocolVersionUpgradeVoteStatusRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetEpochsInfoRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} message GetProtocolVersionUpgradeVoteStatusRequestV0 + * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} message GetEpochsInfoRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProtocolVersionUpgradeVoteStatusRequestV0.toObject = function toObject(message, options) { + GetEpochsInfoRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - if (options.bytes === String) - object.startProTxHash = ""; - else { - object.startProTxHash = []; - if (options.bytes !== Array) - object.startProTxHash = $util.newBuffer(object.startProTxHash); - } + object.startEpoch = null; object.count = 0; + object.ascending = false; object.prove = false; } - if (message.startProTxHash != null && message.hasOwnProperty("startProTxHash")) - object.startProTxHash = options.bytes === String ? $util.base64.encode(message.startProTxHash, 0, message.startProTxHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.startProTxHash) : message.startProTxHash; + if (message.startEpoch != null && message.hasOwnProperty("startEpoch")) + object.startEpoch = $root.google.protobuf.UInt32Value.toObject(message.startEpoch, options); if (message.count != null && message.hasOwnProperty("count")) object.count = message.count; + if (message.ascending != null && message.hasOwnProperty("ascending")) + object.ascending = message.ascending; if (message.prove != null && message.hasOwnProperty("prove")) object.prove = message.prove; return object; }; /** - * Converts this GetProtocolVersionUpgradeVoteStatusRequestV0 to JSON. + * Converts this GetEpochsInfoRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 * @instance * @returns {Object.} JSON object */ - GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.toJSON = function toJSON() { + GetEpochsInfoRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetProtocolVersionUpgradeVoteStatusRequestV0; + return GetEpochsInfoRequestV0; })(); - return GetProtocolVersionUpgradeVoteStatusRequest; + return GetEpochsInfoRequest; })(); - v0.GetProtocolVersionUpgradeVoteStatusResponse = (function() { + v0.GetEpochsInfoResponse = (function() { /** - * Properties of a GetProtocolVersionUpgradeVoteStatusResponse. + * Properties of a GetEpochsInfoResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetProtocolVersionUpgradeVoteStatusResponse - * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0|null} [v0] GetProtocolVersionUpgradeVoteStatusResponse v0 + * @interface IGetEpochsInfoResponse + * @property {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0|null} [v0] GetEpochsInfoResponse v0 */ /** - * Constructs a new GetProtocolVersionUpgradeVoteStatusResponse. + * Constructs a new GetEpochsInfoResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetProtocolVersionUpgradeVoteStatusResponse. - * @implements IGetProtocolVersionUpgradeVoteStatusResponse + * @classdesc Represents a GetEpochsInfoResponse. + * @implements IGetEpochsInfoResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetEpochsInfoResponse=} [properties] Properties to set */ - function GetProtocolVersionUpgradeVoteStatusResponse(properties) { + function GetEpochsInfoResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21774,89 +23967,89 @@ $root.org = (function() { } /** - * GetProtocolVersionUpgradeVoteStatusResponse v0. - * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * GetEpochsInfoResponse v0. + * @member {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse * @instance */ - GetProtocolVersionUpgradeVoteStatusResponse.prototype.v0 = null; + GetEpochsInfoResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetProtocolVersionUpgradeVoteStatusResponse version. + * GetEpochsInfoResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse * @instance */ - Object.defineProperty(GetProtocolVersionUpgradeVoteStatusResponse.prototype, "version", { + Object.defineProperty(GetEpochsInfoResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetProtocolVersionUpgradeVoteStatusResponse instance using the specified properties. + * Creates a new GetEpochsInfoResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} GetProtocolVersionUpgradeVoteStatusResponse instance + * @param {org.dash.platform.dapi.v0.IGetEpochsInfoResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse} GetEpochsInfoResponse instance */ - GetProtocolVersionUpgradeVoteStatusResponse.create = function create(properties) { - return new GetProtocolVersionUpgradeVoteStatusResponse(properties); + GetEpochsInfoResponse.create = function create(properties) { + return new GetEpochsInfoResponse(properties); }; /** - * Encodes the specified GetProtocolVersionUpgradeVoteStatusResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.verify|verify} messages. + * Encodes the specified GetEpochsInfoResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusResponse} message GetProtocolVersionUpgradeVoteStatusResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetEpochsInfoResponse} message GetEpochsInfoResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeVoteStatusResponse.encode = function encode(message, writer) { + GetEpochsInfoResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetProtocolVersionUpgradeVoteStatusResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.verify|verify} messages. + * Encodes the specified GetEpochsInfoResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse * @static - * @param {org.dash.platform.dapi.v0.IGetProtocolVersionUpgradeVoteStatusResponse} message GetProtocolVersionUpgradeVoteStatusResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetEpochsInfoResponse} message GetEpochsInfoResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeVoteStatusResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetEpochsInfoResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProtocolVersionUpgradeVoteStatusResponse message from the specified reader or buffer. + * Decodes a GetEpochsInfoResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} GetProtocolVersionUpgradeVoteStatusResponse + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse} GetEpochsInfoResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeVoteStatusResponse.decode = function decode(reader, length) { + GetEpochsInfoResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -21867,37 +24060,37 @@ $root.org = (function() { }; /** - * Decodes a GetProtocolVersionUpgradeVoteStatusResponse message from the specified reader or buffer, length delimited. + * Decodes a GetEpochsInfoResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} GetProtocolVersionUpgradeVoteStatusResponse + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse} GetEpochsInfoResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeVoteStatusResponse.decodeDelimited = function decodeDelimited(reader) { + GetEpochsInfoResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProtocolVersionUpgradeVoteStatusResponse message. + * Verifies a GetEpochsInfoResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProtocolVersionUpgradeVoteStatusResponse.verify = function verify(message) { + GetEpochsInfoResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -21906,40 +24099,40 @@ $root.org = (function() { }; /** - * Creates a GetProtocolVersionUpgradeVoteStatusResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetEpochsInfoResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} GetProtocolVersionUpgradeVoteStatusResponse + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse} GetEpochsInfoResponse */ - GetProtocolVersionUpgradeVoteStatusResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse) + GetEpochsInfoResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetProtocolVersionUpgradeVoteStatusResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetEpochsInfoResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} message GetProtocolVersionUpgradeVoteStatusResponse + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse} message GetEpochsInfoResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProtocolVersionUpgradeVoteStatusResponse.toObject = function toObject(message, options) { + GetEpochsInfoResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -21947,36 +24140,36 @@ $root.org = (function() { }; /** - * Converts this GetProtocolVersionUpgradeVoteStatusResponse to JSON. + * Converts this GetEpochsInfoResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse * @instance * @returns {Object.} JSON object */ - GetProtocolVersionUpgradeVoteStatusResponse.prototype.toJSON = function toJSON() { + GetEpochsInfoResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 = (function() { + GetEpochsInfoResponse.GetEpochsInfoResponseV0 = (function() { /** - * Properties of a GetProtocolVersionUpgradeVoteStatusResponseV0. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse - * @interface IGetProtocolVersionUpgradeVoteStatusResponseV0 - * @property {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals|null} [versions] GetProtocolVersionUpgradeVoteStatusResponseV0 versions - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetProtocolVersionUpgradeVoteStatusResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetProtocolVersionUpgradeVoteStatusResponseV0 metadata + * Properties of a GetEpochsInfoResponseV0. + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @interface IGetEpochsInfoResponseV0 + * @property {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos|null} [epochs] GetEpochsInfoResponseV0 epochs + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetEpochsInfoResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetEpochsInfoResponseV0 metadata */ /** - * Constructs a new GetProtocolVersionUpgradeVoteStatusResponseV0. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse - * @classdesc Represents a GetProtocolVersionUpgradeVoteStatusResponseV0. - * @implements IGetProtocolVersionUpgradeVoteStatusResponseV0 + * Constructs a new GetEpochsInfoResponseV0. + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @classdesc Represents a GetEpochsInfoResponseV0. + * @implements IGetEpochsInfoResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0=} [properties] Properties to set */ - function GetProtocolVersionUpgradeVoteStatusResponseV0(properties) { + function GetEpochsInfoResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21984,69 +24177,69 @@ $root.org = (function() { } /** - * GetProtocolVersionUpgradeVoteStatusResponseV0 versions. - * @member {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals|null|undefined} versions - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * GetEpochsInfoResponseV0 epochs. + * @member {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos|null|undefined} epochs + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 * @instance */ - GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.versions = null; + GetEpochsInfoResponseV0.prototype.epochs = null; /** - * GetProtocolVersionUpgradeVoteStatusResponseV0 proof. + * GetEpochsInfoResponseV0 proof. * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 * @instance */ - GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.proof = null; + GetEpochsInfoResponseV0.prototype.proof = null; /** - * GetProtocolVersionUpgradeVoteStatusResponseV0 metadata. + * GetEpochsInfoResponseV0 metadata. * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 * @instance */ - GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.metadata = null; + GetEpochsInfoResponseV0.prototype.metadata = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetProtocolVersionUpgradeVoteStatusResponseV0 result. - * @member {"versions"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * GetEpochsInfoResponseV0 result. + * @member {"epochs"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 * @instance */ - Object.defineProperty(GetProtocolVersionUpgradeVoteStatusResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["versions", "proof"]), + Object.defineProperty(GetEpochsInfoResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["epochs", "proof"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetProtocolVersionUpgradeVoteStatusResponseV0 instance using the specified properties. + * Creates a new GetEpochsInfoResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} GetProtocolVersionUpgradeVoteStatusResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} GetEpochsInfoResponseV0 instance */ - GetProtocolVersionUpgradeVoteStatusResponseV0.create = function create(properties) { - return new GetProtocolVersionUpgradeVoteStatusResponseV0(properties); + GetEpochsInfoResponseV0.create = function create(properties) { + return new GetEpochsInfoResponseV0(properties); }; /** - * Encodes the specified GetProtocolVersionUpgradeVoteStatusResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.verify|verify} messages. + * Encodes the specified GetEpochsInfoResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0} message GetProtocolVersionUpgradeVoteStatusResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0} message GetEpochsInfoResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeVoteStatusResponseV0.encode = function encode(message, writer) { + GetEpochsInfoResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.versions != null && Object.hasOwnProperty.call(message, "versions")) - $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.encode(message.versions, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.epochs != null && Object.hasOwnProperty.call(message, "epochs")) + $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.encode(message.epochs, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) @@ -22055,38 +24248,38 @@ $root.org = (function() { }; /** - * Encodes the specified GetProtocolVersionUpgradeVoteStatusResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.verify|verify} messages. + * Encodes the specified GetEpochsInfoResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.IGetProtocolVersionUpgradeVoteStatusResponseV0} message GetProtocolVersionUpgradeVoteStatusResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0} message GetEpochsInfoResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProtocolVersionUpgradeVoteStatusResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetEpochsInfoResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProtocolVersionUpgradeVoteStatusResponseV0 message from the specified reader or buffer. + * Decodes a GetEpochsInfoResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} GetProtocolVersionUpgradeVoteStatusResponseV0 + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} GetEpochsInfoResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeVoteStatusResponseV0.decode = function decode(reader, length) { + GetEpochsInfoResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.decode(reader, reader.uint32()); + message.epochs = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.decode(reader, reader.uint32()); break; case 2: message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); @@ -22103,39 +24296,39 @@ $root.org = (function() { }; /** - * Decodes a GetProtocolVersionUpgradeVoteStatusResponseV0 message from the specified reader or buffer, length delimited. + * Decodes a GetEpochsInfoResponseV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} GetProtocolVersionUpgradeVoteStatusResponseV0 + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} GetEpochsInfoResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProtocolVersionUpgradeVoteStatusResponseV0.decodeDelimited = function decodeDelimited(reader) { + GetEpochsInfoResponseV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProtocolVersionUpgradeVoteStatusResponseV0 message. + * Verifies a GetEpochsInfoResponseV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProtocolVersionUpgradeVoteStatusResponseV0.verify = function verify(message) { + GetEpochsInfoResponseV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.versions != null && message.hasOwnProperty("versions")) { + if (message.epochs != null && message.hasOwnProperty("epochs")) { properties.result = 1; { - var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.verify(message.versions); + var error = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.verify(message.epochs); if (error) - return "versions." + error; + return "epochs." + error; } } if (message.proof != null && message.hasOwnProperty("proof")) { @@ -22157,54 +24350,54 @@ $root.org = (function() { }; /** - * Creates a GetProtocolVersionUpgradeVoteStatusResponseV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetEpochsInfoResponseV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} GetProtocolVersionUpgradeVoteStatusResponseV0 + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} GetEpochsInfoResponseV0 */ - GetProtocolVersionUpgradeVoteStatusResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0) + GetEpochsInfoResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0(); - if (object.versions != null) { - if (typeof object.versions !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.versions: object expected"); - message.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.fromObject(object.versions); + var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0(); + if (object.epochs != null) { + if (typeof object.epochs !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.epochs: object expected"); + message.epochs = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.fromObject(object.epochs); } if (object.proof != null) { if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.proof: object expected"); + throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.proof: object expected"); message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); } if (object.metadata != null) { if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.metadata: object expected"); + throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.metadata: object expected"); message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); } return message; }; /** - * Creates a plain object from a GetProtocolVersionUpgradeVoteStatusResponseV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetEpochsInfoResponseV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} message GetProtocolVersionUpgradeVoteStatusResponseV0 + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} message GetEpochsInfoResponseV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProtocolVersionUpgradeVoteStatusResponseV0.toObject = function toObject(message, options) { + GetEpochsInfoResponseV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) object.metadata = null; - if (message.versions != null && message.hasOwnProperty("versions")) { - object.versions = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(message.versions, options); + if (message.epochs != null && message.hasOwnProperty("epochs")) { + object.epochs = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(message.epochs, options); if (options.oneofs) - object.result = "versions"; + object.result = "epochs"; } if (message.proof != null && message.hasOwnProperty("proof")) { object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); @@ -22217,35 +24410,35 @@ $root.org = (function() { }; /** - * Converts this GetProtocolVersionUpgradeVoteStatusResponseV0 to JSON. + * Converts this GetEpochsInfoResponseV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 * @instance * @returns {Object.} JSON object */ - GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.toJSON = function toJSON() { + GetEpochsInfoResponseV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals = (function() { + GetEpochsInfoResponseV0.EpochInfos = (function() { /** - * Properties of a VersionSignals. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 - * @interface IVersionSignals - * @property {Array.|null} [versionSignals] VersionSignals versionSignals + * Properties of an EpochInfos. + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @interface IEpochInfos + * @property {Array.|null} [epochInfos] EpochInfos epochInfos */ /** - * Constructs a new VersionSignals. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 - * @classdesc Represents a VersionSignals. - * @implements IVersionSignals + * Constructs a new EpochInfos. + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @classdesc Represents an EpochInfos. + * @implements IEpochInfos * @constructor - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos=} [properties] Properties to set */ - function VersionSignals(properties) { - this.versionSignals = []; + function EpochInfos(properties) { + this.epochInfos = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22253,78 +24446,78 @@ $root.org = (function() { } /** - * VersionSignals versionSignals. - * @member {Array.} versionSignals - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * EpochInfos epochInfos. + * @member {Array.} epochInfos + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos * @instance */ - VersionSignals.prototype.versionSignals = $util.emptyArray; + EpochInfos.prototype.epochInfos = $util.emptyArray; /** - * Creates a new VersionSignals instance using the specified properties. + * Creates a new EpochInfos instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} VersionSignals instance + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} EpochInfos instance */ - VersionSignals.create = function create(properties) { - return new VersionSignals(properties); + EpochInfos.create = function create(properties) { + return new EpochInfos(properties); }; /** - * Encodes the specified VersionSignals message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.verify|verify} messages. + * Encodes the specified EpochInfos message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals} message VersionSignals message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos} message EpochInfos message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - VersionSignals.encode = function encode(message, writer) { + EpochInfos.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.versionSignals != null && message.versionSignals.length) - for (var i = 0; i < message.versionSignals.length; ++i) - $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.encode(message.versionSignals[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.epochInfos != null && message.epochInfos.length) + for (var i = 0; i < message.epochInfos.length; ++i) + $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.encode(message.epochInfos[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified VersionSignals message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.verify|verify} messages. + * Encodes the specified EpochInfos message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignals} message VersionSignals message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos} message EpochInfos message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - VersionSignals.encodeDelimited = function encodeDelimited(message, writer) { + EpochInfos.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a VersionSignals message from the specified reader or buffer. + * Decodes an EpochInfos message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} VersionSignals + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} EpochInfos * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - VersionSignals.decode = function decode(reader, length) { + EpochInfos.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.versionSignals && message.versionSignals.length)) - message.versionSignals = []; - message.versionSignals.push($root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.decode(reader, reader.uint32())); + if (!(message.epochInfos && message.epochInfos.length)) + message.epochInfos = []; + message.epochInfos.push($root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -22335,125 +24528,129 @@ $root.org = (function() { }; /** - * Decodes a VersionSignals message from the specified reader or buffer, length delimited. + * Decodes an EpochInfos message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} VersionSignals + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} EpochInfos * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - VersionSignals.decodeDelimited = function decodeDelimited(reader) { + EpochInfos.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a VersionSignals message. + * Verifies an EpochInfos message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - VersionSignals.verify = function verify(message) { + EpochInfos.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.versionSignals != null && message.hasOwnProperty("versionSignals")) { - if (!Array.isArray(message.versionSignals)) - return "versionSignals: array expected"; - for (var i = 0; i < message.versionSignals.length; ++i) { - var error = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.verify(message.versionSignals[i]); + if (message.epochInfos != null && message.hasOwnProperty("epochInfos")) { + if (!Array.isArray(message.epochInfos)) + return "epochInfos: array expected"; + for (var i = 0; i < message.epochInfos.length; ++i) { + var error = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.verify(message.epochInfos[i]); if (error) - return "versionSignals." + error; + return "epochInfos." + error; } } return null; }; /** - * Creates a VersionSignals message from a plain object. Also converts values to their respective internal types. + * Creates an EpochInfos message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} VersionSignals + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} EpochInfos */ - VersionSignals.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals) + EpochInfos.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals(); - if (object.versionSignals) { - if (!Array.isArray(object.versionSignals)) - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.versionSignals: array expected"); - message.versionSignals = []; - for (var i = 0; i < object.versionSignals.length; ++i) { - if (typeof object.versionSignals[i] !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.versionSignals: object expected"); - message.versionSignals[i] = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.fromObject(object.versionSignals[i]); + var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos(); + if (object.epochInfos) { + if (!Array.isArray(object.epochInfos)) + throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.epochInfos: array expected"); + message.epochInfos = []; + for (var i = 0; i < object.epochInfos.length; ++i) { + if (typeof object.epochInfos[i] !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.epochInfos: object expected"); + message.epochInfos[i] = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.fromObject(object.epochInfos[i]); } } return message; }; /** - * Creates a plain object from a VersionSignals message. Also converts values to other types if specified. + * Creates a plain object from an EpochInfos message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} message VersionSignals + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} message EpochInfos * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - VersionSignals.toObject = function toObject(message, options) { + EpochInfos.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.versionSignals = []; - if (message.versionSignals && message.versionSignals.length) { - object.versionSignals = []; - for (var j = 0; j < message.versionSignals.length; ++j) - object.versionSignals[j] = $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject(message.versionSignals[j], options); + object.epochInfos = []; + if (message.epochInfos && message.epochInfos.length) { + object.epochInfos = []; + for (var j = 0; j < message.epochInfos.length; ++j) + object.epochInfos[j] = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject(message.epochInfos[j], options); } return object; }; /** - * Converts this VersionSignals to JSON. + * Converts this EpochInfos to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos * @instance * @returns {Object.} JSON object */ - VersionSignals.prototype.toJSON = function toJSON() { + EpochInfos.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return VersionSignals; + return EpochInfos; })(); - GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal = (function() { + GetEpochsInfoResponseV0.EpochInfo = (function() { /** - * Properties of a VersionSignal. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 - * @interface IVersionSignal - * @property {Uint8Array|null} [proTxHash] VersionSignal proTxHash - * @property {number|null} [version] VersionSignal version + * Properties of an EpochInfo. + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @interface IEpochInfo + * @property {number|null} [number] EpochInfo number + * @property {number|Long|null} [firstBlockHeight] EpochInfo firstBlockHeight + * @property {number|null} [firstCoreBlockHeight] EpochInfo firstCoreBlockHeight + * @property {number|Long|null} [startTime] EpochInfo startTime + * @property {number|null} [feeMultiplier] EpochInfo feeMultiplier + * @property {number|null} [protocolVersion] EpochInfo protocolVersion */ /** - * Constructs a new VersionSignal. - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 - * @classdesc Represents a VersionSignal. - * @implements IVersionSignal + * Constructs a new EpochInfo. + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @classdesc Represents an EpochInfo. + * @implements IEpochInfo * @constructor - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignal=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfo=} [properties] Properties to set */ - function VersionSignal(properties) { + function EpochInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22461,88 +24658,140 @@ $root.org = (function() { } /** - * VersionSignal proTxHash. - * @member {Uint8Array} proTxHash - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * EpochInfo number. + * @member {number} number + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo * @instance */ - VersionSignal.prototype.proTxHash = $util.newBuffer([]); + EpochInfo.prototype.number = 0; /** - * VersionSignal version. - * @member {number} version - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * EpochInfo firstBlockHeight. + * @member {number|Long} firstBlockHeight + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo * @instance */ - VersionSignal.prototype.version = 0; + EpochInfo.prototype.firstBlockHeight = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** - * Creates a new VersionSignal instance using the specified properties. + * EpochInfo firstCoreBlockHeight. + * @member {number} firstCoreBlockHeight + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @instance + */ + EpochInfo.prototype.firstCoreBlockHeight = 0; + + /** + * EpochInfo startTime. + * @member {number|Long} startTime + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @instance + */ + EpochInfo.prototype.startTime = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * EpochInfo feeMultiplier. + * @member {number} feeMultiplier + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @instance + */ + EpochInfo.prototype.feeMultiplier = 0; + + /** + * EpochInfo protocolVersion. + * @member {number} protocolVersion + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @instance + */ + EpochInfo.prototype.protocolVersion = 0; + + /** + * Creates a new EpochInfo instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignal=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} VersionSignal instance + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfo=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} EpochInfo instance */ - VersionSignal.create = function create(properties) { - return new VersionSignal(properties); + EpochInfo.create = function create(properties) { + return new EpochInfo(properties); }; /** - * Encodes the specified VersionSignal message. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.verify|verify} messages. + * Encodes the specified EpochInfo message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignal} message VersionSignal message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfo} message EpochInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - VersionSignal.encode = function encode(message, writer) { + EpochInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.proTxHash != null && Object.hasOwnProperty.call(message, "proTxHash")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.proTxHash); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.version); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.number); + if (message.firstBlockHeight != null && Object.hasOwnProperty.call(message, "firstBlockHeight")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.firstBlockHeight); + if (message.firstCoreBlockHeight != null && Object.hasOwnProperty.call(message, "firstCoreBlockHeight")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.firstCoreBlockHeight); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.startTime); + if (message.feeMultiplier != null && Object.hasOwnProperty.call(message, "feeMultiplier")) + writer.uint32(/* id 5, wireType 1 =*/41).double(message.feeMultiplier); + if (message.protocolVersion != null && Object.hasOwnProperty.call(message, "protocolVersion")) + writer.uint32(/* id 6, wireType 0 =*/48).uint32(message.protocolVersion); return writer; }; /** - * Encodes the specified VersionSignal message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.verify|verify} messages. + * Encodes the specified EpochInfo message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.IVersionSignal} message VersionSignal message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfo} message EpochInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - VersionSignal.encodeDelimited = function encodeDelimited(message, writer) { + EpochInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a VersionSignal message from the specified reader or buffer. + * Decodes an EpochInfo message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} VersionSignal + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} EpochInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - VersionSignal.decode = function decode(reader, length) { + EpochInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.proTxHash = reader.bytes(); + message.number = reader.uint32(); break; case 2: - message.version = reader.uint32(); + message.firstBlockHeight = reader.uint64(); + break; + case 3: + message.firstCoreBlockHeight = reader.uint32(); + break; + case 4: + message.startTime = reader.uint64(); + break; + case 5: + message.feeMultiplier = reader.double(); + break; + case 6: + message.protocolVersion = reader.uint32(); break; default: reader.skipType(tag & 7); @@ -22553,131 +24802,182 @@ $root.org = (function() { }; /** - * Decodes a VersionSignal message from the specified reader or buffer, length delimited. + * Decodes an EpochInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} VersionSignal + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} EpochInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - VersionSignal.decodeDelimited = function decodeDelimited(reader) { + EpochInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a VersionSignal message. + * Verifies an EpochInfo message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - VersionSignal.verify = function verify(message) { + EpochInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.proTxHash != null && message.hasOwnProperty("proTxHash")) - if (!(message.proTxHash && typeof message.proTxHash.length === "number" || $util.isString(message.proTxHash))) - return "proTxHash: buffer expected"; - if (message.version != null && message.hasOwnProperty("version")) - if (!$util.isInteger(message.version)) - return "version: integer expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.firstBlockHeight != null && message.hasOwnProperty("firstBlockHeight")) + if (!$util.isInteger(message.firstBlockHeight) && !(message.firstBlockHeight && $util.isInteger(message.firstBlockHeight.low) && $util.isInteger(message.firstBlockHeight.high))) + return "firstBlockHeight: integer|Long expected"; + if (message.firstCoreBlockHeight != null && message.hasOwnProperty("firstCoreBlockHeight")) + if (!$util.isInteger(message.firstCoreBlockHeight)) + return "firstCoreBlockHeight: integer expected"; + if (message.startTime != null && message.hasOwnProperty("startTime")) + if (!$util.isInteger(message.startTime) && !(message.startTime && $util.isInteger(message.startTime.low) && $util.isInteger(message.startTime.high))) + return "startTime: integer|Long expected"; + if (message.feeMultiplier != null && message.hasOwnProperty("feeMultiplier")) + if (typeof message.feeMultiplier !== "number") + return "feeMultiplier: number expected"; + if (message.protocolVersion != null && message.hasOwnProperty("protocolVersion")) + if (!$util.isInteger(message.protocolVersion)) + return "protocolVersion: integer expected"; return null; }; /** - * Creates a VersionSignal message from a plain object. Also converts values to their respective internal types. + * Creates an EpochInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} VersionSignal + * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} EpochInfo */ - VersionSignal.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal) + EpochInfo.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo) return object; - var message = new $root.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal(); - if (object.proTxHash != null) - if (typeof object.proTxHash === "string") - $util.base64.decode(object.proTxHash, message.proTxHash = $util.newBuffer($util.base64.length(object.proTxHash)), 0); - else if (object.proTxHash.length >= 0) - message.proTxHash = object.proTxHash; - if (object.version != null) - message.version = object.version >>> 0; + var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo(); + if (object.number != null) + message.number = object.number >>> 0; + if (object.firstBlockHeight != null) + if ($util.Long) + (message.firstBlockHeight = $util.Long.fromValue(object.firstBlockHeight)).unsigned = true; + else if (typeof object.firstBlockHeight === "string") + message.firstBlockHeight = parseInt(object.firstBlockHeight, 10); + else if (typeof object.firstBlockHeight === "number") + message.firstBlockHeight = object.firstBlockHeight; + else if (typeof object.firstBlockHeight === "object") + message.firstBlockHeight = new $util.LongBits(object.firstBlockHeight.low >>> 0, object.firstBlockHeight.high >>> 0).toNumber(true); + if (object.firstCoreBlockHeight != null) + message.firstCoreBlockHeight = object.firstCoreBlockHeight >>> 0; + if (object.startTime != null) + if ($util.Long) + (message.startTime = $util.Long.fromValue(object.startTime)).unsigned = true; + else if (typeof object.startTime === "string") + message.startTime = parseInt(object.startTime, 10); + else if (typeof object.startTime === "number") + message.startTime = object.startTime; + else if (typeof object.startTime === "object") + message.startTime = new $util.LongBits(object.startTime.low >>> 0, object.startTime.high >>> 0).toNumber(true); + if (object.feeMultiplier != null) + message.feeMultiplier = Number(object.feeMultiplier); + if (object.protocolVersion != null) + message.protocolVersion = object.protocolVersion >>> 0; return message; }; /** - * Creates a plain object from a VersionSignal message. Also converts values to other types if specified. + * Creates a plain object from an EpochInfo message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo * @static - * @param {org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} message VersionSignal + * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} message EpochInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - VersionSignal.toObject = function toObject(message, options) { + EpochInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - if (options.bytes === String) - object.proTxHash = ""; - else { - object.proTxHash = []; - if (options.bytes !== Array) - object.proTxHash = $util.newBuffer(object.proTxHash); - } - object.version = 0; + object.number = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.firstBlockHeight = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.firstBlockHeight = options.longs === String ? "0" : 0; + object.firstCoreBlockHeight = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.startTime = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.startTime = options.longs === String ? "0" : 0; + object.feeMultiplier = 0; + object.protocolVersion = 0; } - if (message.proTxHash != null && message.hasOwnProperty("proTxHash")) - object.proTxHash = options.bytes === String ? $util.base64.encode(message.proTxHash, 0, message.proTxHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.proTxHash) : message.proTxHash; - if (message.version != null && message.hasOwnProperty("version")) - object.version = message.version; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.firstBlockHeight != null && message.hasOwnProperty("firstBlockHeight")) + if (typeof message.firstBlockHeight === "number") + object.firstBlockHeight = options.longs === String ? String(message.firstBlockHeight) : message.firstBlockHeight; + else + object.firstBlockHeight = options.longs === String ? $util.Long.prototype.toString.call(message.firstBlockHeight) : options.longs === Number ? new $util.LongBits(message.firstBlockHeight.low >>> 0, message.firstBlockHeight.high >>> 0).toNumber(true) : message.firstBlockHeight; + if (message.firstCoreBlockHeight != null && message.hasOwnProperty("firstCoreBlockHeight")) + object.firstCoreBlockHeight = message.firstCoreBlockHeight; + if (message.startTime != null && message.hasOwnProperty("startTime")) + if (typeof message.startTime === "number") + object.startTime = options.longs === String ? String(message.startTime) : message.startTime; + else + object.startTime = options.longs === String ? $util.Long.prototype.toString.call(message.startTime) : options.longs === Number ? new $util.LongBits(message.startTime.low >>> 0, message.startTime.high >>> 0).toNumber(true) : message.startTime; + if (message.feeMultiplier != null && message.hasOwnProperty("feeMultiplier")) + object.feeMultiplier = options.json && !isFinite(message.feeMultiplier) ? String(message.feeMultiplier) : message.feeMultiplier; + if (message.protocolVersion != null && message.hasOwnProperty("protocolVersion")) + object.protocolVersion = message.protocolVersion; return object; }; /** - * Converts this VersionSignal to JSON. + * Converts this EpochInfo to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal + * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo * @instance * @returns {Object.} JSON object */ - VersionSignal.prototype.toJSON = function toJSON() { + EpochInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return VersionSignal; + return EpochInfo; })(); - return GetProtocolVersionUpgradeVoteStatusResponseV0; + return GetEpochsInfoResponseV0; })(); - return GetProtocolVersionUpgradeVoteStatusResponse; + return GetEpochsInfoResponse; })(); - v0.GetEpochsInfoRequest = (function() { + v0.GetPathElementsRequest = (function() { /** - * Properties of a GetEpochsInfoRequest. + * Properties of a GetPathElementsRequest. * @memberof org.dash.platform.dapi.v0 - * @interface IGetEpochsInfoRequest - * @property {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0|null} [v0] GetEpochsInfoRequest v0 + * @interface IGetPathElementsRequest + * @property {org.dash.platform.dapi.v0.GetPathElementsRequest.IGetPathElementsRequestV0|null} [v0] GetPathElementsRequest v0 */ /** - * Constructs a new GetEpochsInfoRequest. + * Constructs a new GetPathElementsRequest. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetEpochsInfoRequest. - * @implements IGetEpochsInfoRequest + * @classdesc Represents a GetPathElementsRequest. + * @implements IGetPathElementsRequest * @constructor - * @param {org.dash.platform.dapi.v0.IGetEpochsInfoRequest=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetPathElementsRequest=} [properties] Properties to set */ - function GetEpochsInfoRequest(properties) { + function GetPathElementsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22685,89 +24985,89 @@ $root.org = (function() { } /** - * GetEpochsInfoRequest v0. - * @member {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * GetPathElementsRequest v0. + * @member {org.dash.platform.dapi.v0.GetPathElementsRequest.IGetPathElementsRequestV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @instance */ - GetEpochsInfoRequest.prototype.v0 = null; + GetPathElementsRequest.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetEpochsInfoRequest version. + * GetPathElementsRequest version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @instance */ - Object.defineProperty(GetEpochsInfoRequest.prototype, "version", { + Object.defineProperty(GetPathElementsRequest.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetEpochsInfoRequest instance using the specified properties. + * Creates a new GetPathElementsRequest instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @static - * @param {org.dash.platform.dapi.v0.IGetEpochsInfoRequest=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest} GetEpochsInfoRequest instance + * @param {org.dash.platform.dapi.v0.IGetPathElementsRequest=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetPathElementsRequest} GetPathElementsRequest instance */ - GetEpochsInfoRequest.create = function create(properties) { - return new GetEpochsInfoRequest(properties); + GetPathElementsRequest.create = function create(properties) { + return new GetPathElementsRequest(properties); }; /** - * Encodes the specified GetEpochsInfoRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoRequest.verify|verify} messages. + * Encodes the specified GetPathElementsRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsRequest.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @static - * @param {org.dash.platform.dapi.v0.IGetEpochsInfoRequest} message GetEpochsInfoRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetPathElementsRequest} message GetPathElementsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetEpochsInfoRequest.encode = function encode(message, writer) { + GetPathElementsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetEpochsInfoRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoRequest.verify|verify} messages. + * Encodes the specified GetPathElementsRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @static - * @param {org.dash.platform.dapi.v0.IGetEpochsInfoRequest} message GetEpochsInfoRequest message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetPathElementsRequest} message GetPathElementsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetEpochsInfoRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetPathElementsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetEpochsInfoRequest message from the specified reader or buffer. + * Decodes a GetPathElementsRequest message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest} GetEpochsInfoRequest + * @returns {org.dash.platform.dapi.v0.GetPathElementsRequest} GetPathElementsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetEpochsInfoRequest.decode = function decode(reader, length) { + GetPathElementsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetPathElementsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -22778,37 +25078,37 @@ $root.org = (function() { }; /** - * Decodes a GetEpochsInfoRequest message from the specified reader or buffer, length delimited. + * Decodes a GetPathElementsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest} GetEpochsInfoRequest + * @returns {org.dash.platform.dapi.v0.GetPathElementsRequest} GetPathElementsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetEpochsInfoRequest.decodeDelimited = function decodeDelimited(reader) { + GetPathElementsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetEpochsInfoRequest message. + * Verifies a GetPathElementsRequest message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetEpochsInfoRequest.verify = function verify(message) { + GetPathElementsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.verify(message.v0); if (error) return "v0." + error; } @@ -22817,40 +25117,40 @@ $root.org = (function() { }; /** - * Creates a GetEpochsInfoRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetPathElementsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest} GetEpochsInfoRequest + * @returns {org.dash.platform.dapi.v0.GetPathElementsRequest} GetPathElementsRequest */ - GetEpochsInfoRequest.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest) + GetPathElementsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetPathElementsRequest) return object; - var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest(); + var message = new $root.org.dash.platform.dapi.v0.GetPathElementsRequest(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoRequest.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetPathElementsRequest.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetEpochsInfoRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetPathElementsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest} message GetEpochsInfoRequest + * @param {org.dash.platform.dapi.v0.GetPathElementsRequest} message GetPathElementsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetEpochsInfoRequest.toObject = function toObject(message, options) { + GetPathElementsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -22858,37 +25158,38 @@ $root.org = (function() { }; /** - * Converts this GetEpochsInfoRequest to JSON. + * Converts this GetPathElementsRequest to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest * @instance * @returns {Object.} JSON object */ - GetEpochsInfoRequest.prototype.toJSON = function toJSON() { + GetPathElementsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetEpochsInfoRequest.GetEpochsInfoRequestV0 = (function() { + GetPathElementsRequest.GetPathElementsRequestV0 = (function() { /** - * Properties of a GetEpochsInfoRequestV0. - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest - * @interface IGetEpochsInfoRequestV0 - * @property {google.protobuf.IUInt32Value|null} [startEpoch] GetEpochsInfoRequestV0 startEpoch - * @property {number|null} [count] GetEpochsInfoRequestV0 count - * @property {boolean|null} [ascending] GetEpochsInfoRequestV0 ascending - * @property {boolean|null} [prove] GetEpochsInfoRequestV0 prove + * Properties of a GetPathElementsRequestV0. + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest + * @interface IGetPathElementsRequestV0 + * @property {Array.|null} [path] GetPathElementsRequestV0 path + * @property {Array.|null} [keys] GetPathElementsRequestV0 keys + * @property {boolean|null} [prove] GetPathElementsRequestV0 prove */ /** - * Constructs a new GetEpochsInfoRequestV0. - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest - * @classdesc Represents a GetEpochsInfoRequestV0. - * @implements IGetEpochsInfoRequestV0 + * Constructs a new GetPathElementsRequestV0. + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest + * @classdesc Represents a GetPathElementsRequestV0. + * @implements IGetPathElementsRequestV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetPathElementsRequest.IGetPathElementsRequestV0=} [properties] Properties to set */ - function GetEpochsInfoRequestV0(properties) { + function GetPathElementsRequestV0(properties) { + this.path = []; + this.keys = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22896,113 +25197,106 @@ $root.org = (function() { } /** - * GetEpochsInfoRequestV0 startEpoch. - * @member {google.protobuf.IUInt32Value|null|undefined} startEpoch - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 - * @instance - */ - GetEpochsInfoRequestV0.prototype.startEpoch = null; - - /** - * GetEpochsInfoRequestV0 count. - * @member {number} count - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * GetPathElementsRequestV0 path. + * @member {Array.} path + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @instance */ - GetEpochsInfoRequestV0.prototype.count = 0; + GetPathElementsRequestV0.prototype.path = $util.emptyArray; /** - * GetEpochsInfoRequestV0 ascending. - * @member {boolean} ascending - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * GetPathElementsRequestV0 keys. + * @member {Array.} keys + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @instance */ - GetEpochsInfoRequestV0.prototype.ascending = false; + GetPathElementsRequestV0.prototype.keys = $util.emptyArray; /** - * GetEpochsInfoRequestV0 prove. + * GetPathElementsRequestV0 prove. * @member {boolean} prove - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @instance */ - GetEpochsInfoRequestV0.prototype.prove = false; + GetPathElementsRequestV0.prototype.prove = false; /** - * Creates a new GetEpochsInfoRequestV0 instance using the specified properties. + * Creates a new GetPathElementsRequestV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} GetEpochsInfoRequestV0 instance + * @param {org.dash.platform.dapi.v0.GetPathElementsRequest.IGetPathElementsRequestV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} GetPathElementsRequestV0 instance */ - GetEpochsInfoRequestV0.create = function create(properties) { - return new GetEpochsInfoRequestV0(properties); + GetPathElementsRequestV0.create = function create(properties) { + return new GetPathElementsRequestV0(properties); }; /** - * Encodes the specified GetEpochsInfoRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.verify|verify} messages. + * Encodes the specified GetPathElementsRequestV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0} message GetEpochsInfoRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetPathElementsRequest.IGetPathElementsRequestV0} message GetPathElementsRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetEpochsInfoRequestV0.encode = function encode(message, writer) { + GetPathElementsRequestV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.startEpoch != null && Object.hasOwnProperty.call(message, "startEpoch")) - $root.google.protobuf.UInt32Value.encode(message.startEpoch, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.count != null && Object.hasOwnProperty.call(message, "count")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.count); - if (message.ascending != null && Object.hasOwnProperty.call(message, "ascending")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.ascending); + if (message.path != null && message.path.length) + for (var i = 0; i < message.path.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.path[i]); + if (message.keys != null && message.keys.length) + for (var i = 0; i < message.keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.keys[i]); if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.prove); + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.prove); return writer; }; /** - * Encodes the specified GetEpochsInfoRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.verify|verify} messages. + * Encodes the specified GetPathElementsRequestV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.IGetEpochsInfoRequestV0} message GetEpochsInfoRequestV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetPathElementsRequest.IGetPathElementsRequestV0} message GetPathElementsRequestV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetEpochsInfoRequestV0.encodeDelimited = function encodeDelimited(message, writer) { + GetPathElementsRequestV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetEpochsInfoRequestV0 message from the specified reader or buffer. + * Decodes a GetPathElementsRequestV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} GetEpochsInfoRequestV0 + * @returns {org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} GetPathElementsRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetEpochsInfoRequestV0.decode = function decode(reader, length) { + GetPathElementsRequestV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.startEpoch = $root.google.protobuf.UInt32Value.decode(reader, reader.uint32()); + if (!(message.path && message.path.length)) + message.path = []; + message.path.push(reader.bytes()); break; case 2: - message.count = reader.uint32(); + if (!(message.keys && message.keys.length)) + message.keys = []; + message.keys.push(reader.bytes()); break; case 3: - message.ascending = reader.bool(); - break; - case 4: message.prove = reader.bool(); break; default: @@ -23014,43 +25308,46 @@ $root.org = (function() { }; /** - * Decodes a GetEpochsInfoRequestV0 message from the specified reader or buffer, length delimited. + * Decodes a GetPathElementsRequestV0 message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} GetEpochsInfoRequestV0 + * @returns {org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} GetPathElementsRequestV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetEpochsInfoRequestV0.decodeDelimited = function decodeDelimited(reader) { + GetPathElementsRequestV0.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetEpochsInfoRequestV0 message. + * Verifies a GetPathElementsRequestV0 message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetEpochsInfoRequestV0.verify = function verify(message) { + GetPathElementsRequestV0.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.startEpoch != null && message.hasOwnProperty("startEpoch")) { - var error = $root.google.protobuf.UInt32Value.verify(message.startEpoch); - if (error) - return "startEpoch." + error; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!(message.path[i] && typeof message.path[i].length === "number" || $util.isString(message.path[i]))) + return "path: buffer[] expected"; + } + if (message.keys != null && message.hasOwnProperty("keys")) { + if (!Array.isArray(message.keys)) + return "keys: array expected"; + for (var i = 0; i < message.keys.length; ++i) + if (!(message.keys[i] && typeof message.keys[i].length === "number" || $util.isString(message.keys[i]))) + return "keys: buffer[] expected"; } - if (message.count != null && message.hasOwnProperty("count")) - if (!$util.isInteger(message.count)) - return "count: integer expected"; - if (message.ascending != null && message.hasOwnProperty("ascending")) - if (typeof message.ascending !== "boolean") - return "ascending: boolean expected"; if (message.prove != null && message.hasOwnProperty("prove")) if (typeof message.prove !== "boolean") return "prove: boolean expected"; @@ -23058,96 +25355,111 @@ $root.org = (function() { }; /** - * Creates a GetEpochsInfoRequestV0 message from a plain object. Also converts values to their respective internal types. + * Creates a GetPathElementsRequestV0 message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} GetEpochsInfoRequestV0 + * @returns {org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} GetPathElementsRequestV0 */ - GetEpochsInfoRequestV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0) + GetPathElementsRequestV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0) return object; - var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0(); - if (object.startEpoch != null) { - if (typeof object.startEpoch !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.startEpoch: object expected"); - message.startEpoch = $root.google.protobuf.UInt32Value.fromObject(object.startEpoch); + var message = new $root.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + if (typeof object.path[i] === "string") + $util.base64.decode(object.path[i], message.path[i] = $util.newBuffer($util.base64.length(object.path[i])), 0); + else if (object.path[i].length >= 0) + message.path[i] = object.path[i]; + } + if (object.keys) { + if (!Array.isArray(object.keys)) + throw TypeError(".org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.keys: array expected"); + message.keys = []; + for (var i = 0; i < object.keys.length; ++i) + if (typeof object.keys[i] === "string") + $util.base64.decode(object.keys[i], message.keys[i] = $util.newBuffer($util.base64.length(object.keys[i])), 0); + else if (object.keys[i].length >= 0) + message.keys[i] = object.keys[i]; } - if (object.count != null) - message.count = object.count >>> 0; - if (object.ascending != null) - message.ascending = Boolean(object.ascending); if (object.prove != null) message.prove = Boolean(object.prove); return message; }; /** - * Creates a plain object from a GetEpochsInfoRequestV0 message. Also converts values to other types if specified. + * Creates a plain object from a GetPathElementsRequestV0 message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} message GetEpochsInfoRequestV0 + * @param {org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} message GetPathElementsRequestV0 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetEpochsInfoRequestV0.toObject = function toObject(message, options) { + GetPathElementsRequestV0.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.startEpoch = null; - object.count = 0; - object.ascending = false; + if (options.arrays || options.defaults) { + object.path = []; + object.keys = []; + } + if (options.defaults) object.prove = false; + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = options.bytes === String ? $util.base64.encode(message.path[j], 0, message.path[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.path[j]) : message.path[j]; + } + if (message.keys && message.keys.length) { + object.keys = []; + for (var j = 0; j < message.keys.length; ++j) + object.keys[j] = options.bytes === String ? $util.base64.encode(message.keys[j], 0, message.keys[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.keys[j]) : message.keys[j]; } - if (message.startEpoch != null && message.hasOwnProperty("startEpoch")) - object.startEpoch = $root.google.protobuf.UInt32Value.toObject(message.startEpoch, options); - if (message.count != null && message.hasOwnProperty("count")) - object.count = message.count; - if (message.ascending != null && message.hasOwnProperty("ascending")) - object.ascending = message.ascending; if (message.prove != null && message.hasOwnProperty("prove")) object.prove = message.prove; return object; }; /** - * Converts this GetEpochsInfoRequestV0 to JSON. + * Converts this GetPathElementsRequestV0 to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 * @instance * @returns {Object.} JSON object */ - GetEpochsInfoRequestV0.prototype.toJSON = function toJSON() { + GetPathElementsRequestV0.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetEpochsInfoRequestV0; + return GetPathElementsRequestV0; })(); - return GetEpochsInfoRequest; + return GetPathElementsRequest; })(); - v0.GetEpochsInfoResponse = (function() { + v0.GetPathElementsResponse = (function() { /** - * Properties of a GetEpochsInfoResponse. + * Properties of a GetPathElementsResponse. * @memberof org.dash.platform.dapi.v0 - * @interface IGetEpochsInfoResponse - * @property {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0|null} [v0] GetEpochsInfoResponse v0 + * @interface IGetPathElementsResponse + * @property {org.dash.platform.dapi.v0.GetPathElementsResponse.IGetPathElementsResponseV0|null} [v0] GetPathElementsResponse v0 */ /** - * Constructs a new GetEpochsInfoResponse. + * Constructs a new GetPathElementsResponse. * @memberof org.dash.platform.dapi.v0 - * @classdesc Represents a GetEpochsInfoResponse. - * @implements IGetEpochsInfoResponse + * @classdesc Represents a GetPathElementsResponse. + * @implements IGetPathElementsResponse * @constructor - * @param {org.dash.platform.dapi.v0.IGetEpochsInfoResponse=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.IGetPathElementsResponse=} [properties] Properties to set */ - function GetEpochsInfoResponse(properties) { + function GetPathElementsResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -23155,89 +25467,89 @@ $root.org = (function() { } /** - * GetEpochsInfoResponse v0. - * @member {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0|null|undefined} v0 - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * GetPathElementsResponse v0. + * @member {org.dash.platform.dapi.v0.GetPathElementsResponse.IGetPathElementsResponseV0|null|undefined} v0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @instance */ - GetEpochsInfoResponse.prototype.v0 = null; + GetPathElementsResponse.prototype.v0 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetEpochsInfoResponse version. + * GetPathElementsResponse version. * @member {"v0"|undefined} version - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @instance */ - Object.defineProperty(GetEpochsInfoResponse.prototype, "version", { + Object.defineProperty(GetPathElementsResponse.prototype, "version", { get: $util.oneOfGetter($oneOfFields = ["v0"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetEpochsInfoResponse instance using the specified properties. + * Creates a new GetPathElementsResponse instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @static - * @param {org.dash.platform.dapi.v0.IGetEpochsInfoResponse=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse} GetEpochsInfoResponse instance + * @param {org.dash.platform.dapi.v0.IGetPathElementsResponse=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse} GetPathElementsResponse instance */ - GetEpochsInfoResponse.create = function create(properties) { - return new GetEpochsInfoResponse(properties); + GetPathElementsResponse.create = function create(properties) { + return new GetPathElementsResponse(properties); }; /** - * Encodes the specified GetEpochsInfoResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.verify|verify} messages. + * Encodes the specified GetPathElementsResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsResponse.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @static - * @param {org.dash.platform.dapi.v0.IGetEpochsInfoResponse} message GetEpochsInfoResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetPathElementsResponse} message GetPathElementsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetEpochsInfoResponse.encode = function encode(message, writer) { + GetPathElementsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.v0 != null && Object.hasOwnProperty.call(message, "v0")) - $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.encode(message.v0, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetEpochsInfoResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.verify|verify} messages. + * Encodes the specified GetPathElementsResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @static - * @param {org.dash.platform.dapi.v0.IGetEpochsInfoResponse} message GetEpochsInfoResponse message or plain object to encode + * @param {org.dash.platform.dapi.v0.IGetPathElementsResponse} message GetPathElementsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetEpochsInfoResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetPathElementsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetEpochsInfoResponse message from the specified reader or buffer. + * Decodes a GetPathElementsResponse message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse} GetEpochsInfoResponse + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse} GetPathElementsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetEpochsInfoResponse.decode = function decode(reader, length) { + GetPathElementsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetPathElementsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.decode(reader, reader.uint32()); + message.v0 = $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -23248,37 +25560,37 @@ $root.org = (function() { }; /** - * Decodes a GetEpochsInfoResponse message from the specified reader or buffer, length delimited. + * Decodes a GetPathElementsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse} GetEpochsInfoResponse + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse} GetPathElementsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetEpochsInfoResponse.decodeDelimited = function decodeDelimited(reader) { + GetPathElementsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetEpochsInfoResponse message. + * Verifies a GetPathElementsResponse message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetEpochsInfoResponse.verify = function verify(message) { + GetPathElementsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { properties.version = 1; { - var error = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.verify(message.v0); + var error = $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.verify(message.v0); if (error) return "v0." + error; } @@ -23287,40 +25599,40 @@ $root.org = (function() { }; /** - * Creates a GetEpochsInfoResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetPathElementsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse} GetEpochsInfoResponse + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse} GetPathElementsResponse */ - GetEpochsInfoResponse.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse) + GetPathElementsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetPathElementsResponse) return object; - var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse(); + var message = new $root.org.dash.platform.dapi.v0.GetPathElementsResponse(); if (object.v0 != null) { if (typeof object.v0 !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.v0: object expected"); - message.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.fromObject(object.v0); + throw TypeError(".org.dash.platform.dapi.v0.GetPathElementsResponse.v0: object expected"); + message.v0 = $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.fromObject(object.v0); } return message; }; /** - * Creates a plain object from a GetEpochsInfoResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetPathElementsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse} message GetEpochsInfoResponse + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse} message GetPathElementsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetEpochsInfoResponse.toObject = function toObject(message, options) { + GetPathElementsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.v0 != null && message.hasOwnProperty("v0")) { - object.v0 = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(message.v0, options); + object.v0 = $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.toObject(message.v0, options); if (options.oneofs) object.version = "v0"; } @@ -23328,36 +25640,36 @@ $root.org = (function() { }; /** - * Converts this GetEpochsInfoResponse to JSON. + * Converts this GetPathElementsResponse to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse * @instance * @returns {Object.} JSON object */ - GetEpochsInfoResponse.prototype.toJSON = function toJSON() { + GetPathElementsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - GetEpochsInfoResponse.GetEpochsInfoResponseV0 = (function() { + GetPathElementsResponse.GetPathElementsResponseV0 = (function() { /** - * Properties of a GetEpochsInfoResponseV0. - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse - * @interface IGetEpochsInfoResponseV0 - * @property {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos|null} [epochs] GetEpochsInfoResponseV0 epochs - * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetEpochsInfoResponseV0 proof - * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetEpochsInfoResponseV0 metadata + * Properties of a GetPathElementsResponseV0. + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse + * @interface IGetPathElementsResponseV0 + * @property {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.IElements|null} [elements] GetPathElementsResponseV0 elements + * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetPathElementsResponseV0 proof + * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetPathElementsResponseV0 metadata */ /** - * Constructs a new GetEpochsInfoResponseV0. - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse - * @classdesc Represents a GetEpochsInfoResponseV0. - * @implements IGetEpochsInfoResponseV0 + * Constructs a new GetPathElementsResponseV0. + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse + * @classdesc Represents a GetPathElementsResponseV0. + * @implements IGetPathElementsResponseV0 * @constructor - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.IGetPathElementsResponseV0=} [properties] Properties to set */ - function GetEpochsInfoResponseV0(properties) { + function GetPathElementsResponseV0(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -23365,69 +25677,69 @@ $root.org = (function() { } /** - * GetEpochsInfoResponseV0 epochs. - * @member {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos|null|undefined} epochs - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * GetPathElementsResponseV0 elements. + * @member {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.IElements|null|undefined} elements + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 * @instance */ - GetEpochsInfoResponseV0.prototype.epochs = null; + GetPathElementsResponseV0.prototype.elements = null; /** - * GetEpochsInfoResponseV0 proof. + * GetPathElementsResponseV0 proof. * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 * @instance */ - GetEpochsInfoResponseV0.prototype.proof = null; + GetPathElementsResponseV0.prototype.proof = null; /** - * GetEpochsInfoResponseV0 metadata. + * GetPathElementsResponseV0 metadata. * @member {org.dash.platform.dapi.v0.IResponseMetadata|null|undefined} metadata - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 * @instance */ - GetEpochsInfoResponseV0.prototype.metadata = null; + GetPathElementsResponseV0.prototype.metadata = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * GetEpochsInfoResponseV0 result. - * @member {"epochs"|"proof"|undefined} result - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * GetPathElementsResponseV0 result. + * @member {"elements"|"proof"|undefined} result + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 * @instance */ - Object.defineProperty(GetEpochsInfoResponseV0.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["epochs", "proof"]), + Object.defineProperty(GetPathElementsResponseV0.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["elements", "proof"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new GetEpochsInfoResponseV0 instance using the specified properties. + * Creates a new GetPathElementsResponseV0 instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} GetEpochsInfoResponseV0 instance + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.IGetPathElementsResponseV0=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} GetPathElementsResponseV0 instance */ - GetEpochsInfoResponseV0.create = function create(properties) { - return new GetEpochsInfoResponseV0(properties); + GetPathElementsResponseV0.create = function create(properties) { + return new GetPathElementsResponseV0(properties); }; /** - * Encodes the specified GetEpochsInfoResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.verify|verify} messages. + * Encodes the specified GetPathElementsResponseV0 message. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0} message GetEpochsInfoResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.IGetPathElementsResponseV0} message GetPathElementsResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetEpochsInfoResponseV0.encode = function encode(message, writer) { + GetPathElementsResponseV0.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.epochs != null && Object.hasOwnProperty.call(message, "epochs")) - $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.encode(message.epochs, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.elements != null && Object.hasOwnProperty.call(message, "elements")) + $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.encode(message.elements, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) @@ -23436,408 +25748,197 @@ $root.org = (function() { }; /** - * Encodes the specified GetEpochsInfoResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.verify|verify} messages. + * Encodes the specified GetPathElementsResponseV0 message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.IGetEpochsInfoResponseV0} message GetEpochsInfoResponseV0 message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.IGetPathElementsResponseV0} message GetPathElementsResponseV0 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetEpochsInfoResponseV0.encodeDelimited = function encodeDelimited(message, writer) { + GetPathElementsResponseV0.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetEpochsInfoResponseV0 message from the specified reader or buffer. + * Decodes a GetPathElementsResponseV0 message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} GetEpochsInfoResponseV0 + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} GetPathElementsResponseV0 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetEpochsInfoResponseV0.decode = function decode(reader, length) { + GetPathElementsResponseV0.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.epochs = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.decode(reader, reader.uint32()); + message.elements = $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.decode(reader, reader.uint32()); break; case 2: message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32()); - break; - case 3: - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetEpochsInfoResponseV0 message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} GetEpochsInfoResponseV0 - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetEpochsInfoResponseV0.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetEpochsInfoResponseV0 message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetEpochsInfoResponseV0.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.epochs != null && message.hasOwnProperty("epochs")) { - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.verify(message.epochs); - if (error) - return "epochs." + error; - } - } - if (message.proof != null && message.hasOwnProperty("proof")) { - if (properties.result === 1) - return "result: multiple values"; - properties.result = 1; - { - var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); - if (error) - return "proof." + error; - } - } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); - if (error) - return "metadata." + error; - } - return null; - }; - - /** - * Creates a GetEpochsInfoResponseV0 message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} GetEpochsInfoResponseV0 - */ - GetEpochsInfoResponseV0.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0(); - if (object.epochs != null) { - if (typeof object.epochs !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.epochs: object expected"); - message.epochs = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.fromObject(object.epochs); - } - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.proof: object expected"); - message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); - } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.metadata: object expected"); - message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + break; + case 3: + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } } return message; }; /** - * Creates a plain object from a GetEpochsInfoResponseV0 message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 + * Decodes a GetPathElementsResponseV0 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} message GetEpochsInfoResponseV0 - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} GetPathElementsResponseV0 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetEpochsInfoResponseV0.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.metadata = null; - if (message.epochs != null && message.hasOwnProperty("epochs")) { - object.epochs = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(message.epochs, options); - if (options.oneofs) - object.result = "epochs"; - } - if (message.proof != null && message.hasOwnProperty("proof")) { - object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); - if (options.oneofs) - object.result = "proof"; - } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); - return object; + GetPathElementsResponseV0.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); }; /** - * Converts this GetEpochsInfoResponseV0 to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 - * @instance - * @returns {Object.} JSON object + * Verifies a GetPathElementsResponseV0 message. + * @function verify + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetEpochsInfoResponseV0.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - GetEpochsInfoResponseV0.EpochInfos = (function() { - - /** - * Properties of an EpochInfos. - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 - * @interface IEpochInfos - * @property {Array.|null} [epochInfos] EpochInfos epochInfos - */ - - /** - * Constructs a new EpochInfos. - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 - * @classdesc Represents an EpochInfos. - * @implements IEpochInfos - * @constructor - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos=} [properties] Properties to set - */ - function EpochInfos(properties) { - this.epochInfos = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EpochInfos epochInfos. - * @member {Array.} epochInfos - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @instance - */ - EpochInfos.prototype.epochInfos = $util.emptyArray; - - /** - * Creates a new EpochInfos instance using the specified properties. - * @function create - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} EpochInfos instance - */ - EpochInfos.create = function create(properties) { - return new EpochInfos(properties); - }; - - /** - * Encodes the specified EpochInfos message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.verify|verify} messages. - * @function encode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos} message EpochInfos message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EpochInfos.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.epochInfos != null && message.epochInfos.length) - for (var i = 0; i < message.epochInfos.length; ++i) - $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.encode(message.epochInfos[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified EpochInfos message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.verify|verify} messages. - * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfos} message EpochInfos message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EpochInfos.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EpochInfos message from the specified reader or buffer. - * @function decode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} EpochInfos - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EpochInfos.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.epochInfos && message.epochInfos.length)) - message.epochInfos = []; - message.epochInfos.push($root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EpochInfos message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} EpochInfos - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EpochInfos.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EpochInfos message. - * @function verify - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EpochInfos.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.epochInfos != null && message.hasOwnProperty("epochInfos")) { - if (!Array.isArray(message.epochInfos)) - return "epochInfos: array expected"; - for (var i = 0; i < message.epochInfos.length; ++i) { - var error = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.verify(message.epochInfos[i]); - if (error) - return "epochInfos." + error; - } - } - return null; - }; - - /** - * Creates an EpochInfos message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @static - * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} EpochInfos - */ - EpochInfos.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos) - return object; - var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos(); - if (object.epochInfos) { - if (!Array.isArray(object.epochInfos)) - throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.epochInfos: array expected"); - message.epochInfos = []; - for (var i = 0; i < object.epochInfos.length; ++i) { - if (typeof object.epochInfos[i] !== "object") - throw TypeError(".org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.epochInfos: object expected"); - message.epochInfos[i] = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.fromObject(object.epochInfos[i]); - } + GetPathElementsResponseV0.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.elements != null && message.hasOwnProperty("elements")) { + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.verify(message.elements); + if (error) + return "elements." + error; } - return message; - }; - - /** - * Creates a plain object from an EpochInfos message. Also converts values to other types if specified. - * @function toObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} message EpochInfos - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EpochInfos.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.epochInfos = []; - if (message.epochInfos && message.epochInfos.length) { - object.epochInfos = []; - for (var j = 0; j < message.epochInfos.length; ++j) - object.epochInfos[j] = $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject(message.epochInfos[j], options); + } + if (message.proof != null && message.hasOwnProperty("proof")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof); + if (error) + return "proof." + error; } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.org.dash.platform.dapi.v0.ResponseMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a GetPathElementsResponseV0 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 + * @static + * @param {Object.} object Plain object + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} GetPathElementsResponseV0 + */ + GetPathElementsResponseV0.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0) return object; - }; + var message = new $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0(); + if (object.elements != null) { + if (typeof object.elements !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.elements: object expected"); + message.elements = $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.fromObject(object.elements); + } + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.proof: object expected"); + message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.metadata: object expected"); + message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.fromObject(object.metadata); + } + return message; + }; - /** - * Converts this EpochInfos to JSON. - * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos - * @instance - * @returns {Object.} JSON object - */ - EpochInfos.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a GetPathElementsResponseV0 message. Also converts values to other types if specified. + * @function toObject + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 + * @static + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} message GetPathElementsResponseV0 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetPathElementsResponseV0.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.elements != null && message.hasOwnProperty("elements")) { + object.elements = $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.toObject(message.elements, options); + if (options.oneofs) + object.result = "elements"; + } + if (message.proof != null && message.hasOwnProperty("proof")) { + object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options); + if (options.oneofs) + object.result = "proof"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options); + return object; + }; - return EpochInfos; - })(); + /** + * Converts this GetPathElementsResponseV0 to JSON. + * @function toJSON + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 + * @instance + * @returns {Object.} JSON object + */ + GetPathElementsResponseV0.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - GetEpochsInfoResponseV0.EpochInfo = (function() { + GetPathElementsResponseV0.Elements = (function() { /** - * Properties of an EpochInfo. - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 - * @interface IEpochInfo - * @property {number|null} [number] EpochInfo number - * @property {number|Long|null} [firstBlockHeight] EpochInfo firstBlockHeight - * @property {number|null} [firstCoreBlockHeight] EpochInfo firstCoreBlockHeight - * @property {number|Long|null} [startTime] EpochInfo startTime - * @property {number|null} [feeMultiplier] EpochInfo feeMultiplier + * Properties of an Elements. + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 + * @interface IElements + * @property {Array.|null} [elements] Elements elements */ /** - * Constructs a new EpochInfo. - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 - * @classdesc Represents an EpochInfo. - * @implements IEpochInfo + * Constructs a new Elements. + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 + * @classdesc Represents an Elements. + * @implements IElements * @constructor - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfo=} [properties] Properties to set + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.IElements=} [properties] Properties to set */ - function EpochInfo(properties) { + function Elements(properties) { + this.elements = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -23845,127 +25946,78 @@ $root.org = (function() { } /** - * EpochInfo number. - * @member {number} number - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo - * @instance - */ - EpochInfo.prototype.number = 0; - - /** - * EpochInfo firstBlockHeight. - * @member {number|Long} firstBlockHeight - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo - * @instance - */ - EpochInfo.prototype.firstBlockHeight = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * EpochInfo firstCoreBlockHeight. - * @member {number} firstCoreBlockHeight - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo - * @instance - */ - EpochInfo.prototype.firstCoreBlockHeight = 0; - - /** - * EpochInfo startTime. - * @member {number|Long} startTime - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo - * @instance - */ - EpochInfo.prototype.startTime = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * EpochInfo feeMultiplier. - * @member {number} feeMultiplier - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * Elements elements. + * @member {Array.} elements + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @instance */ - EpochInfo.prototype.feeMultiplier = 0; + Elements.prototype.elements = $util.emptyArray; /** - * Creates a new EpochInfo instance using the specified properties. + * Creates a new Elements instance using the specified properties. * @function create - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfo=} [properties] Properties to set - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} EpochInfo instance + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.IElements=} [properties] Properties to set + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} Elements instance */ - EpochInfo.create = function create(properties) { - return new EpochInfo(properties); + Elements.create = function create(properties) { + return new Elements(properties); }; /** - * Encodes the specified EpochInfo message. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.verify|verify} messages. + * Encodes the specified Elements message. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.verify|verify} messages. * @function encode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfo} message EpochInfo message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.IElements} message Elements message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EpochInfo.encode = function encode(message, writer) { + Elements.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.number != null && Object.hasOwnProperty.call(message, "number")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.number); - if (message.firstBlockHeight != null && Object.hasOwnProperty.call(message, "firstBlockHeight")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.firstBlockHeight); - if (message.firstCoreBlockHeight != null && Object.hasOwnProperty.call(message, "firstCoreBlockHeight")) - writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.firstCoreBlockHeight); - if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) - writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.startTime); - if (message.feeMultiplier != null && Object.hasOwnProperty.call(message, "feeMultiplier")) - writer.uint32(/* id 5, wireType 1 =*/41).double(message.feeMultiplier); + if (message.elements != null && message.elements.length) + for (var i = 0; i < message.elements.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.elements[i]); return writer; }; /** - * Encodes the specified EpochInfo message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.verify|verify} messages. + * Encodes the specified Elements message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.verify|verify} messages. * @function encodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.IEpochInfo} message EpochInfo message or plain object to encode + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.IElements} message Elements message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EpochInfo.encodeDelimited = function encodeDelimited(message, writer) { + Elements.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EpochInfo message from the specified reader or buffer. + * Decodes an Elements message from the specified reader or buffer. * @function decode - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} EpochInfo + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} Elements * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EpochInfo.decode = function decode(reader, length) { + Elements.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.number = reader.uint32(); - break; - case 2: - message.firstBlockHeight = reader.uint64(); - break; - case 3: - message.firstCoreBlockHeight = reader.uint32(); - break; - case 4: - message.startTime = reader.uint64(); - break; - case 5: - message.feeMultiplier = reader.double(); + if (!(message.elements && message.elements.length)) + message.elements = []; + message.elements.push(reader.bytes()); break; default: reader.skipType(tag & 7); @@ -23976,154 +26028,108 @@ $root.org = (function() { }; /** - * Decodes an EpochInfo message from the specified reader or buffer, length delimited. + * Decodes an Elements message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} EpochInfo + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} Elements * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EpochInfo.decodeDelimited = function decodeDelimited(reader) { + Elements.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EpochInfo message. + * Verifies an Elements message. * @function verify - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EpochInfo.verify = function verify(message) { + Elements.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.number != null && message.hasOwnProperty("number")) - if (!$util.isInteger(message.number)) - return "number: integer expected"; - if (message.firstBlockHeight != null && message.hasOwnProperty("firstBlockHeight")) - if (!$util.isInteger(message.firstBlockHeight) && !(message.firstBlockHeight && $util.isInteger(message.firstBlockHeight.low) && $util.isInteger(message.firstBlockHeight.high))) - return "firstBlockHeight: integer|Long expected"; - if (message.firstCoreBlockHeight != null && message.hasOwnProperty("firstCoreBlockHeight")) - if (!$util.isInteger(message.firstCoreBlockHeight)) - return "firstCoreBlockHeight: integer expected"; - if (message.startTime != null && message.hasOwnProperty("startTime")) - if (!$util.isInteger(message.startTime) && !(message.startTime && $util.isInteger(message.startTime.low) && $util.isInteger(message.startTime.high))) - return "startTime: integer|Long expected"; - if (message.feeMultiplier != null && message.hasOwnProperty("feeMultiplier")) - if (typeof message.feeMultiplier !== "number") - return "feeMultiplier: number expected"; + if (message.elements != null && message.hasOwnProperty("elements")) { + if (!Array.isArray(message.elements)) + return "elements: array expected"; + for (var i = 0; i < message.elements.length; ++i) + if (!(message.elements[i] && typeof message.elements[i].length === "number" || $util.isString(message.elements[i]))) + return "elements: buffer[] expected"; + } return null; }; /** - * Creates an EpochInfo message from a plain object. Also converts values to their respective internal types. + * Creates an Elements message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @static * @param {Object.} object Plain object - * @returns {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} EpochInfo + * @returns {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} Elements */ - EpochInfo.fromObject = function fromObject(object) { - if (object instanceof $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo) + Elements.fromObject = function fromObject(object) { + if (object instanceof $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements) return object; - var message = new $root.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo(); - if (object.number != null) - message.number = object.number >>> 0; - if (object.firstBlockHeight != null) - if ($util.Long) - (message.firstBlockHeight = $util.Long.fromValue(object.firstBlockHeight)).unsigned = true; - else if (typeof object.firstBlockHeight === "string") - message.firstBlockHeight = parseInt(object.firstBlockHeight, 10); - else if (typeof object.firstBlockHeight === "number") - message.firstBlockHeight = object.firstBlockHeight; - else if (typeof object.firstBlockHeight === "object") - message.firstBlockHeight = new $util.LongBits(object.firstBlockHeight.low >>> 0, object.firstBlockHeight.high >>> 0).toNumber(true); - if (object.firstCoreBlockHeight != null) - message.firstCoreBlockHeight = object.firstCoreBlockHeight >>> 0; - if (object.startTime != null) - if ($util.Long) - (message.startTime = $util.Long.fromValue(object.startTime)).unsigned = true; - else if (typeof object.startTime === "string") - message.startTime = parseInt(object.startTime, 10); - else if (typeof object.startTime === "number") - message.startTime = object.startTime; - else if (typeof object.startTime === "object") - message.startTime = new $util.LongBits(object.startTime.low >>> 0, object.startTime.high >>> 0).toNumber(true); - if (object.feeMultiplier != null) - message.feeMultiplier = Number(object.feeMultiplier); + var message = new $root.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements(); + if (object.elements) { + if (!Array.isArray(object.elements)) + throw TypeError(".org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.elements: array expected"); + message.elements = []; + for (var i = 0; i < object.elements.length; ++i) + if (typeof object.elements[i] === "string") + $util.base64.decode(object.elements[i], message.elements[i] = $util.newBuffer($util.base64.length(object.elements[i])), 0); + else if (object.elements[i].length >= 0) + message.elements[i] = object.elements[i]; + } return message; }; /** - * Creates a plain object from an EpochInfo message. Also converts values to other types if specified. + * Creates a plain object from an Elements message. Also converts values to other types if specified. * @function toObject - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @static - * @param {org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} message EpochInfo + * @param {org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} message Elements * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EpochInfo.toObject = function toObject(message, options) { + Elements.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.number = 0; - if ($util.Long) { - var long = new $util.Long(0, 0, true); - object.firstBlockHeight = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.firstBlockHeight = options.longs === String ? "0" : 0; - object.firstCoreBlockHeight = 0; - if ($util.Long) { - var long = new $util.Long(0, 0, true); - object.startTime = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.startTime = options.longs === String ? "0" : 0; - object.feeMultiplier = 0; + if (options.arrays || options.defaults) + object.elements = []; + if (message.elements && message.elements.length) { + object.elements = []; + for (var j = 0; j < message.elements.length; ++j) + object.elements[j] = options.bytes === String ? $util.base64.encode(message.elements[j], 0, message.elements[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.elements[j]) : message.elements[j]; } - if (message.number != null && message.hasOwnProperty("number")) - object.number = message.number; - if (message.firstBlockHeight != null && message.hasOwnProperty("firstBlockHeight")) - if (typeof message.firstBlockHeight === "number") - object.firstBlockHeight = options.longs === String ? String(message.firstBlockHeight) : message.firstBlockHeight; - else - object.firstBlockHeight = options.longs === String ? $util.Long.prototype.toString.call(message.firstBlockHeight) : options.longs === Number ? new $util.LongBits(message.firstBlockHeight.low >>> 0, message.firstBlockHeight.high >>> 0).toNumber(true) : message.firstBlockHeight; - if (message.firstCoreBlockHeight != null && message.hasOwnProperty("firstCoreBlockHeight")) - object.firstCoreBlockHeight = message.firstCoreBlockHeight; - if (message.startTime != null && message.hasOwnProperty("startTime")) - if (typeof message.startTime === "number") - object.startTime = options.longs === String ? String(message.startTime) : message.startTime; - else - object.startTime = options.longs === String ? $util.Long.prototype.toString.call(message.startTime) : options.longs === Number ? new $util.LongBits(message.startTime.low >>> 0, message.startTime.high >>> 0).toNumber(true) : message.startTime; - if (message.feeMultiplier != null && message.hasOwnProperty("feeMultiplier")) - object.feeMultiplier = options.json && !isFinite(message.feeMultiplier) ? String(message.feeMultiplier) : message.feeMultiplier; return object; }; /** - * Converts this EpochInfo to JSON. + * Converts this Elements to JSON. * @function toJSON - * @memberof org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo + * @memberof org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements * @instance * @returns {Object.} JSON object */ - EpochInfo.prototype.toJSON = function toJSON() { + Elements.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return EpochInfo; + return Elements; })(); - return GetEpochsInfoResponseV0; + return GetPathElementsResponseV0; })(); - return GetEpochsInfoResponse; + return GetPathElementsResponse; })(); return v0; diff --git a/packages/dapi-grpc/clients/platform/v0/nodejs/platform_protoc.js b/packages/dapi-grpc/clients/platform/v0/nodejs/platform_protoc.js index 9d6d3e76cfa..f8609dbd8ba 100644 --- a/packages/dapi-grpc/clients/platform/v0/nodejs/platform_protoc.js +++ b/packages/dapi-grpc/clients/platform/v0/nodejs/platform_protoc.js @@ -75,25 +75,16 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpoc goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.VersionCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.ResultCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.VersionCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesRequest', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.VersionCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.ResultCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase', null, { proto }); @@ -116,6 +107,13 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRes goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase', null, { proto }); @@ -124,6 +122,13 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetId goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityRequest.VersionCase', null, { proto }); @@ -131,6 +136,14 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityResponse', null, { goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest', null, { proto }); @@ -160,6 +173,7 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVote goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.KeyPurpose', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.KeyRequestType', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.Proof', null, { proto }); @@ -333,16 +347,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest'; + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest'; } /** * Generated by JsPbCodeGenerator. @@ -354,16 +368,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0'; + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -375,16 +389,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest'; + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest'; } /** * Generated by JsPbCodeGenerator. @@ -396,16 +410,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0'; + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -417,16 +431,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityResponse'; + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest'; } /** * Generated by JsPbCodeGenerator. @@ -438,16 +452,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0'; + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -459,16 +473,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesRequest'; + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest'; } /** * Generated by JsPbCodeGenerator. @@ -480,16 +494,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0'; + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -501,16 +515,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse'; + proto.org.dash.platform.dapi.v0.GetIdentityResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityResponse'; } /** * Generated by JsPbCodeGenerator. @@ -522,16 +536,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue'; + proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -543,16 +557,37 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry'; + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -564,16 +599,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities'; + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse'; } /** * Generated by JsPbCodeGenerator. @@ -585,16 +620,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0'; + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -911,6 +946,153 @@ if (goog.DEBUG && !COMPILED) { */ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -1509,16 +1691,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest'; + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1530,16 +1712,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0'; + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1551,16 +1733,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse'; + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1572,16 +1754,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry'; + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -1593,16 +1775,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes'; + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1614,16 +1796,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0'; + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1635,16 +1817,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest'; + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1656,16 +1838,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0'; + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -1677,16 +1859,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1698,16 +1880,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1719,16 +1901,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1740,16 +1922,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock'; } /** * Generated by JsPbCodeGenerator. @@ -1761,16 +1943,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence'; } /** * Generated by JsPbCodeGenerator. @@ -1782,16 +1964,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -1803,16 +1985,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1824,16 +2006,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1845,16 +2027,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1866,16 +2048,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -1887,16 +2069,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions'; } /** * Generated by JsPbCodeGenerator. @@ -1908,16 +2090,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry'; } /** * Generated by JsPbCodeGenerator. @@ -1929,16 +2111,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1950,16 +2132,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1971,16 +2153,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1992,16 +2174,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -2013,16 +2195,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals'; } /** * Generated by JsPbCodeGenerator. @@ -2034,16 +2216,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal'; } /** * Generated by JsPbCodeGenerator. @@ -2055,16 +2237,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest'; } /** * Generated by JsPbCodeGenerator. @@ -2076,16 +2258,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -2097,16 +2279,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse'; } /** * Generated by JsPbCodeGenerator. @@ -2118,16 +2300,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -2139,16 +2321,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos'; } /** * Generated by JsPbCodeGenerator. @@ -2160,37 +2342,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_); -}; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo'; } /** * Generated by JsPbCodeGenerator. @@ -2202,16 +2363,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0'; + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsRequest'; } /** * Generated by JsPbCodeGenerator. @@ -2223,16 +2384,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse'; + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -2244,16 +2405,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0'; + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsResponse'; } /** * Generated by JsPbCodeGenerator. @@ -2265,16 +2426,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos'; + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -2286,16 +2447,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo'; + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements'; } @@ -3791,21 +3952,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.hasV0 = function() * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.oneofGroups_[0])); }; @@ -3823,8 +3984,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.toObject(opt_includeInstance, this); }; @@ -3833,13 +3994,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.toObject = f * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -3853,23 +4014,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject = function(in /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3877,8 +4038,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromR var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -3894,9 +4055,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromR * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3904,18 +4065,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.serializeBin /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.serializeBinaryToWriter ); } }; @@ -3937,8 +4098,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.toObject(opt_includeInstance, this); }; @@ -3947,13 +4108,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - id: msg.getId_asB64(), + identityId: msg.getIdentityId_asB64(), prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; @@ -3968,23 +4129,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3993,7 +4154,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setId(value); + msg.setIdentityId(value); break; case 2: var value = /** @type {boolean} */ (reader.readBool()); @@ -4012,9 +4173,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4022,13 +4183,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getId_asU8(); + f = message.getIdentityId_asU8(); if (f.length > 0) { writer.writeBytes( 1, @@ -4046,43 +4207,43 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ /** - * optional bytes id = 1; + * optional bytes identity_id = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.getIdentityId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes id = 1; - * This is a type-conversion wrapper around `getId()` + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.getIdentityId_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getId())); + this.getIdentityId())); }; /** - * optional bytes id = 1; + * optional bytes identity_id = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getId()` + * This is a type-conversion wrapper around `getIdentityId()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.getIdentityId_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getId())); + this.getIdentityId())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.setId = function(value) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.setIdentityId = function(value) { return jspb.Message.setProto3BytesField(this, 1, value); }; @@ -4091,44 +4252,44 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ * optional bool prove = 2; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getProve = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.getProve = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.setProve = function(value) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.setProve = function(value) { return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional GetIdentityBalanceRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} + * optional GetIdentityNonceRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -4137,7 +4298,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.clearV0 = fu * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -4151,21 +4312,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.hasV0 = func * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.oneofGroups_[0])); }; @@ -4183,8 +4344,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.toObject(opt_includeInstance, this); }; @@ -4193,13 +4354,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.t * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -4213,23 +4374,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -4237,8 +4398,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserialize var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -4254,9 +4415,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserialize * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4264,18 +4425,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.s /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.serializeBinaryToWriter ); } }; @@ -4297,8 +4458,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.toObject(opt_includeInstance, this); }; @@ -4307,14 +4468,15 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - id: msg.getId_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + identityId: msg.getIdentityId_asB64(), + contractId: msg.getContractId_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) }; if (includeInstance) { @@ -4328,23 +4490,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -4353,9 +4515,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setId(value); + msg.setIdentityId(value); break; case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); + break; + case 3: var value = /** @type {boolean} */ (reader.readBool()); msg.setProve(value); break; @@ -4372,9 +4538,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4382,23 +4548,30 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getId_asU8(); + f = message.getIdentityId_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } f = message.getProve(); if (f) { writer.writeBool( - 2, + 3, f ); } @@ -4406,89 +4579,131 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity /** - * optional bytes id = 1; + * optional bytes identity_id = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getIdentityId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes id = 1; - * This is a type-conversion wrapper around `getId()` + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getIdentityId_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getId())); + this.getIdentityId())); }; /** - * optional bytes id = 1; + * optional bytes identity_id = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getId()` + * This is a type-conversion wrapper around `getIdentityId()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getIdentityId_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getId())); + this.getIdentityId())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.setId = function(value) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.setIdentityId = function(value) { return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional bool prove = 2; + * optional bytes contract_id = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes contract_id = 2; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); +}; + + +/** + * optional bytes contract_id = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional bool prove = 3; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); }; /** - * optional GetIdentityBalanceAndRevisionRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} + * optional GetIdentityContractNonceRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -4497,7 +4712,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.c * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -4511,21 +4726,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.h * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_[0])); }; @@ -4543,8 +4758,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject(opt_includeInstance, this); }; @@ -4553,13 +4768,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.toObject = functio * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -4573,23 +4788,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject = function(includeI /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -4597,8 +4812,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -4614,9 +4829,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4624,50 +4839,24 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.serializeBinary = /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter ); } }; -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - IDENTITY: 1, - PROOF: 2 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase} - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0])); -}; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -4683,8 +4872,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(opt_includeInstance, this); }; @@ -4693,15 +4882,14 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.protot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - identity: msg.getIdentity_asB64(), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + id: msg.getId_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -4715,23 +4903,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObje /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -4740,17 +4928,11 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deseri switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setIdentity(value); + msg.setId(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -4765,9 +4947,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deseri * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4775,196 +4957,113 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.protot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); - if (f != null) { + f = message.getId_asU8(); + if (f.length > 0) { writer.writeBytes( 1, f ); } - f = message.getProof(); - if (f != null) { - writer.writeMessage( + f = message.getProve(); + if (f) { + writer.writeBool( 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f ); } }; /** - * optional bytes identity = 1; + * optional bytes id = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes identity = 1; - * This is a type-conversion wrapper around `getIdentity()` + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getIdentity())); + this.getId())); }; /** - * optional bytes identity = 1; + * optional bytes id = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdentity()` + * This is a type-conversion wrapper around `getId()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getIdentity())); + this.getId())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setIdentity = function(value) { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], value); -}; - - -/** - * Clears the field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearIdentity = function() { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasIdentity = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * Returns whether this field is set. + * optional bool prove = 2; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional GetIdentityResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} + * optional GetIdentityBalanceRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -4973,7 +5072,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.clearV0 = function * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -4987,21 +5086,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.hasV0 = function() * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_[0])); }; @@ -5019,8 +5118,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject(opt_includeInstance, this); }; @@ -5029,13 +5128,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.toObject = functi * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -5049,23 +5148,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.toObject = function(include /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesRequest; - return proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5073,8 +5172,8 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinaryFromReader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -5090,9 +5189,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinaryFromReader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5100,31 +5199,24 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.serializeBinary = /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter ); } }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.repeatedFields_ = [1]; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -5140,8 +5232,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(opt_includeInstance, this); }; @@ -5150,13 +5242,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - idsList: msg.getIdsList_asB64(), + id: msg.getId_asB64(), prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; @@ -5171,23 +5263,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.toOb /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5196,7 +5288,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.dese switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addIds(value); + msg.setId(value); break; case 2: var value = /** @type {boolean} */ (reader.readBool()); @@ -5215,9 +5307,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.dese * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5225,15 +5317,15 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdsList_asU8(); + f = message.getId_asU8(); if (f.length > 0) { - writer.writeRepeatedBytes( + writer.writeBytes( 1, f ); @@ -5249,63 +5341,44 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.seri /** - * repeated bytes ids = 1; - * @return {!Array} + * optional bytes id = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.getIdsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * repeated bytes ids = 1; - * This is a type-conversion wrapper around `getIdsList()` - * @return {!Array} + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.getIdsList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getIdsList())); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getId())); }; /** - * repeated bytes ids = 1; + * optional bytes id = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdsList()` - * @return {!Array} + * This is a type-conversion wrapper around `getId()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.getIdsList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getIdsList())); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getId())); }; /** - * @param {!(Array|Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} returns this + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.setIdsList = function(value) { - return jspb.Message.setField(this, 1, value || []); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.addIds = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.clearIdsList = function() { - return this.setIdsList([]); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; @@ -5313,44 +5386,44 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prot * optional bool prove = 2; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.getProve = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getProve = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.setProve = function(value) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.setProve = function(value) { return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional GetIdentitiesRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} + * optional GetIdentityBalanceAndRevisionRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -5359,7 +5432,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.clearV0 = functio * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -5373,21 +5446,21 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.hasV0 = function( * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_[0])); }; @@ -5405,8 +5478,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject(opt_includeInstance, this); }; @@ -5415,13 +5488,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.toObject = funct * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -5435,23 +5508,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.toObject = function(includ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5459,8 +5532,8 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinaryFromReade var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -5476,9 +5549,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinaryFromReade * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5486,24 +5559,50 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter ); } }; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + IDENTITY: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0])); +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -5519,8 +5618,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(opt_includeInstance, this); }; @@ -5529,13 +5628,15 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.to * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - value: msg.getValue_asB64() + identity: msg.getIdentity_asB64(), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -5549,23 +5650,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.toObject = f /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5574,7 +5675,17 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeB switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setValue(value); + msg.setIdentity(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -5589,9 +5700,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeB * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5599,257 +5710,197 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.se /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getValue_asU8(); - if (f.length > 0) { + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); + if (f != null) { writer.writeBytes( 1, f ); } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } }; /** - * optional bytes value = 1; + * optional bytes identity = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.getValue = function() { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes value = 1; - * This is a type-conversion wrapper around `getValue()` + * optional bytes identity = 1; + * This is a type-conversion wrapper around `getIdentity()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.getValue_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getValue())); + this.getIdentity())); }; /** - * optional bytes value = 1; + * optional bytes identity = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getValue()` + * This is a type-conversion wrapper around `getIdentity()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.getValue_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getValue())); + this.getIdentity())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.setValue = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setIdentity = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], value); }; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearIdentity = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], undefined); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.toObject = function(includeInstance, msg) { - var f, obj = { - key: msg.getKey_asB64(), - value: (f = msg.getValue()) && proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasIdentity = function() { + return jspb.Message.getField(this, 1) != null; }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setKey(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeBinaryFromReader); - msg.setValue(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], value); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getKey_asU8(); - if (f.length > 0) { - writer.writeBytes( - 1, - f - ); - } - f = message.getValue(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * optional bytes key = 1; - * @return {string} + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.getKey = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; /** - * optional bytes key = 1; - * This is a type-conversion wrapper around `getKey()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.getKey_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getKey())); + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; /** - * optional bytes key = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getKey()` - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.getKey_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getKey())); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.setKey = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; }; /** - * optional IdentityValue value = 2; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} + * optional GetIdentityResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.getValue = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue, 2)); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.setValue = function(value) { - return jspb.Message.setWrapperField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.clearValue = function() { - return this.setValue(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.clearV0 = function() { + return this.setV0(undefined); }; @@ -5857,18 +5908,36 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.cl * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.hasValue = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * List of repeated fields within this message type. - * @private {!Array} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.oneofGroups_[0])); +}; @@ -5885,8 +5954,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.toObject(opt_includeInstance, this); }; @@ -5895,14 +5964,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.toObj * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.toObject = function(includeInstance, msg) { var f, obj = { - identityEntriesList: jspb.Message.toObjectList(msg.getIdentityEntriesList(), - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.toObject, includeInstance) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -5916,23 +5984,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.toObject = func /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5940,9 +6008,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBina var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeBinaryFromReader); - msg.addIdentityEntries(value); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -5957,9 +6025,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBina * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5967,61 +6035,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.seria /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdentityEntriesList(); - if (f.length > 0) { - writer.writeRepeatedMessage( + f = message.getV0(); + if (f != null) { + writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.serializeBinaryToWriter ); } }; -/** - * repeated IdentityEntry identity_entries = 1; - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.getIdentityEntriesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.setIdentityEntriesList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.addIdentityEntries = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.clearIdentityEntriesList = function() { - return this.setIdentityEntriesList([]); -}; - - /** * Oneof group definitions for this message. Each group defines the field @@ -6031,22 +6061,22 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.clear * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.ResultCase = { RESULT_NOT_SET: 0, - IDENTITIES: 1, + IDENTITY_NONCE: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_[0])); }; @@ -6064,8 +6094,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.toObject(opt_includeInstance, this); }; @@ -6074,13 +6104,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - identities: (f = msg.getIdentities()) && proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.toObject(includeInstance, f), + identityNonce: jspb.Message.getFieldWithDefault(msg, 1, 0), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -6096,23 +6126,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.to /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6120,9 +6150,8 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.de var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBinaryFromReader); - msg.setIdentities(value); + var value = /** @type {number} */ (reader.readUint64()); + msg.setIdentityNonce(value); break; case 2: var value = new proto.org.dash.platform.dapi.v0.Proof; @@ -6147,9 +6176,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.de * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6157,18 +6186,17 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdentities(); + f = /** @type {number} */ (jspb.Message.getField(message, 1)); if (f != null) { - writer.writeMessage( + writer.writeUint64( 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.serializeBinaryToWriter + f ); } f = message.getProof(); @@ -6191,30 +6219,29 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.se /** - * optional Identities identities = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} + * optional uint64 identity_nonce = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.getIdentities = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.getIdentityNonce = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.setIdentities = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_[0], value); + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.setIdentityNonce = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_[0], value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.clearIdentities = function() { - return this.setIdentities(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.clearIdentityNonce = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_[0], undefined); }; @@ -6222,7 +6249,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.hasIdentities = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.hasIdentityNonce = function() { return jspb.Message.getField(this, 1) != null; }; @@ -6231,7 +6258,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -6239,18 +6266,18 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -6259,7 +6286,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -6268,7 +6295,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -6276,18 +6303,18 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -6296,35 +6323,35 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetIdentitiesResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} + * optional GetIdentityNonceResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -6333,7 +6360,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.clearV0 = functi * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -6347,21 +6374,21 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.hasV0 = function * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.oneofGroups_[0])); }; @@ -6379,8 +6406,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.toObject(opt_includeInstance, this); }; @@ -6389,13 +6416,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.toObject = * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -6409,23 +6436,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject = function(i /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6433,8 +6460,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFrom var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -6450,9 +6477,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFrom * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6460,18 +6487,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.serializeBi /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.serializeBinaryToWriter ); } }; @@ -6486,22 +6513,22 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWrit * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.ResultCase = { RESULT_NOT_SET: 0, - BALANCE: 1, + IDENTITY_CONTRACT_NONCE: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_[0])); }; @@ -6519,8 +6546,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.toObject(opt_includeInstance, this); }; @@ -6529,13 +6556,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - balance: jspb.Message.getFieldWithDefault(msg, 1, 0), + identityContractNonce: jspb.Message.getFieldWithDefault(msg, 1, 0), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -6551,23 +6578,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6576,7 +6603,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes switch (field) { case 1: var value = /** @type {number} */ (reader.readUint64()); - msg.setBalance(value); + msg.setIdentityContractNonce(value); break; case 2: var value = new proto.org.dash.platform.dapi.v0.Proof; @@ -6601,9 +6628,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6611,11 +6638,11 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {number} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -6644,29 +6671,29 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes /** - * optional uint64 balance = 1; + * optional uint64 identity_contract_nonce = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getBalance = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.getIdentityContractNonce = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setBalance = function(value) { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.setIdentityContractNonce = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_[0], value); }; /** * Clears the field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearBalance = function() { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], undefined); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.clearIdentityContractNonce = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_[0], undefined); }; @@ -6674,7 +6701,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasBalance = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.hasIdentityContractNonce = function() { return jspb.Message.getField(this, 1) != null; }; @@ -6683,7 +6710,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -6691,18 +6718,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -6711,7 +6738,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -6720,7 +6747,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -6728,18 +6755,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -6748,35 +6775,35 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetIdentityBalanceResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} + * optional GetIdentityContractNonceResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -6785,7 +6812,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.clearV0 = f * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -6799,21 +6826,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.hasV0 = fun * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_[0])); }; @@ -6831,8 +6858,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject(opt_includeInstance, this); }; @@ -6841,13 +6868,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -6861,23 +6888,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6885,8 +6912,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -6902,9 +6929,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6912,18 +6939,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter ); } }; @@ -6938,22 +6965,22 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeB * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase = { RESULT_NOT_SET: 0, - BALANCE_AND_REVISION: 1, + BALANCE: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0])); }; @@ -6971,8 +6998,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject(opt_includeInstance, this); }; @@ -6981,13 +7008,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - balanceAndRevision: (f = msg.getBalanceAndRevision()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject(includeInstance, f), + balance: jspb.Message.getFieldWithDefault(msg, 1, 0), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -7003,23 +7030,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -7027,9 +7054,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader); - msg.setBalanceAndRevision(value); + var value = /** @type {number} */ (reader.readUint64()); + msg.setBalance(value); break; case 2: var value = new proto.org.dash.platform.dapi.v0.Proof; @@ -7054,9 +7080,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7064,18 +7090,17 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getBalanceAndRevision(); + f = /** @type {number} */ (jspb.Message.getField(message, 1)); if (f != null) { - writer.writeMessage( + writer.writeUint64( 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter + f ); } f = message.getProof(); @@ -7097,191 +7122,30 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit }; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject = function(includeInstance, msg) { - var f, obj = { - balance: jspb.Message.getFieldWithDefault(msg, 1, 0), - revision: jspb.Message.getFieldWithDefault(msg, 2, 0) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readUint64()); - msg.setBalance(value); - break; - case 2: - var value = /** @type {number} */ (reader.readUint64()); - msg.setRevision(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getBalance(); - if (f !== 0) { - writer.writeUint64( - 1, - f - ); - } - f = message.getRevision(); - if (f !== 0) { - writer.writeUint64( - 2, - f - ); - } -}; - - /** * optional uint64 balance = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.getBalance = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getBalance = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.setBalance = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional uint64 revision = 2; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.getRevision = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.setRevision = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * optional BalanceAndRevision balance_and_revision = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getBalanceAndRevision = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setBalanceAndRevision = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setBalance = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearBalanceAndRevision = function() { - return this.setBalanceAndRevision(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearBalance = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], undefined); }; @@ -7289,7 +7153,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasBalanceAndRevision = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasBalance = function() { return jspb.Message.getField(this, 1) != null; }; @@ -7298,7 +7162,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -7306,18 +7170,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -7326,7 +7190,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -7335,7 +7199,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -7343,18 +7207,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -7363,35 +7227,35 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetIdentityBalanceAndRevisionResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} + * optional GetIdentityBalanceResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -7400,7 +7264,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype. * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -7414,23 +7278,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype. * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_ = [[1,2,3]]; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase = { - REQUEST_NOT_SET: 0, - ALL_KEYS: 1, - SPECIFIC_KEYS: 2, - SEARCH_KEY: 3 +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getRequestCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_[0])); }; @@ -7448,8 +7310,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.KeyRequestType.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.toObject(opt_includeInstance, this); }; @@ -7458,15 +7320,13 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.toObject = function(opt * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.KeyRequestType.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.toObject = function(includeInstance, msg) { var f, obj = { - allKeys: (f = msg.getAllKeys()) && proto.org.dash.platform.dapi.v0.AllKeys.toObject(includeInstance, f), - specificKeys: (f = msg.getSpecificKeys()) && proto.org.dash.platform.dapi.v0.SpecificKeys.toObject(includeInstance, f), - searchKey: (f = msg.getSearchKey()) && proto.org.dash.platform.dapi.v0.SearchKey.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -7480,23 +7340,23 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.toObject = function(includeInstan /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.KeyRequestType; - return proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -7504,19 +7364,9 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader = fun var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.AllKeys; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader); - msg.setAllKeys(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.SpecificKeys; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader); - msg.setSpecificKeys(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.SearchKey; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader); - msg.setSearchKey(value); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -7531,9 +7381,9 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader = fun * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7541,153 +7391,52 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.serializeBinary = funct /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getAllKeys(); + f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter - ); - } - f = message.getSpecificKeys(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter - ); - } - f = message.getSearchKey(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter ); } }; -/** - * optional AllKeys all_keys = 1; - * @return {?proto.org.dash.platform.dapi.v0.AllKeys} - */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getAllKeys = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.AllKeys} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.AllKeys, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.AllKeys|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this -*/ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setAllKeys = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this - */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearAllKeys = function() { - return this.setAllKeys(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasAllKeys = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional SpecificKeys specific_keys = 2; - * @return {?proto.org.dash.platform.dapi.v0.SpecificKeys} - */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getSpecificKeys = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.SpecificKeys} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.SpecificKeys, 2)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.SpecificKeys|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this -*/ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setSpecificKeys = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this - */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSpecificKeys = function() { - return this.setSpecificKeys(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasSpecificKeys = function() { - return jspb.Message.getField(this, 2) != null; -}; - /** - * optional SearchKey search_key = 3; - * @return {?proto.org.dash.platform.dapi.v0.SearchKey} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getSearchKey = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.SearchKey} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.SearchKey, 3)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.SearchKey|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this -*/ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setSearchKey = function(value) { - return jspb.Message.setOneofWrapperField(this, 3, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); -}; - +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_ = [[1,2]]; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + * @enum {number} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSearchKey = function() { - return this.setSearchKey(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + BALANCE_AND_REVISION: 1, + PROOF: 2 }; - /** - * Returns whether this field is set. - * @return {boolean} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasSearchKey = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0])); }; - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -7701,8 +7450,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.AllKeys.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.AllKeys.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject(opt_includeInstance, this); }; @@ -7711,13 +7460,15 @@ proto.org.dash.platform.dapi.v0.AllKeys.prototype.toObject = function(opt_includ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.AllKeys} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.AllKeys.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - + balanceAndRevision: (f = msg.getBalanceAndRevision()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -7731,29 +7482,44 @@ proto.org.dash.platform.dapi.v0.AllKeys.toObject = function(includeInstance, msg /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.AllKeys} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} */ -proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.AllKeys; - return proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.AllKeys} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.AllKeys} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} */ -proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader); + msg.setBalanceAndRevision(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; default: reader.skipField(); break; @@ -7767,9 +7533,9 @@ proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader = function(m * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.AllKeys.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7777,22 +7543,39 @@ proto.org.dash.platform.dapi.v0.AllKeys.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.AllKeys} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; -}; - + f = message.getBalanceAndRevision(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.org.dash.platform.dapi.v0.SpecificKeys.repeatedFields_ = [1]; @@ -7809,8 +7592,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.SpecificKeys.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject(opt_includeInstance, this); }; @@ -7819,13 +7602,14 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.toObject = function(opt_i * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.SpecificKeys.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject = function(includeInstance, msg) { var f, obj = { - keyIdsList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f + balance: jspb.Message.getFieldWithDefault(msg, 1, 0), + revision: jspb.Message.getFieldWithDefault(msg, 2, 0) }; if (includeInstance) { @@ -7839,23 +7623,23 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.toObject = function(includeInstance /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.SpecificKeys; - return proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -7863,10 +7647,12 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader = funct var field = reader.getFieldNumber(); switch (field) { case 1: - var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint32() : [reader.readUint32()]); - for (var i = 0; i < values.length; i++) { - msg.addKeyIds(values[i]); - } + var value = /** @type {number} */ (reader.readUint64()); + msg.setBalance(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setRevision(value); break; default: reader.skipField(); @@ -7881,9 +7667,9 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader = funct * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7891,333 +7677,213 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.serializeBinary = functio /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getKeyIdsList(); - if (f.length > 0) { - writer.writePackedUint32( + f = message.getBalance(); + if (f !== 0) { + writer.writeUint64( 1, f ); } + f = message.getRevision(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } }; /** - * repeated uint32 key_ids = 1; - * @return {!Array} + * optional uint64 balance = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.getKeyIdsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.getBalance = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} returns this */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.setKeyIdsList = function(value) { - return jspb.Message.setField(this, 1, value || []); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.setBalance = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; /** - * @param {number} value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + * optional uint64 revision = 2; + * @return {number} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.addKeyIds = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.getRevision = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} returns this */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.clearKeyIdsList = function() { - return this.setKeyIdsList([]); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.setRevision = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); }; +/** + * optional BalanceAndRevision balance_and_revision = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getBalanceAndRevision = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision, 1)); +}; + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setBalanceAndRevision = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0], value); +}; -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.SearchKey.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.SearchKey.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearBalanceAndRevision = function() { + return this.setBalanceAndRevision(undefined); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.SearchKey} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.SearchKey.toObject = function(includeInstance, msg) { - var f, obj = { - purposeMapMap: (f = msg.getPurposeMapMap()) ? f.toObject(includeInstance, proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject) : [] - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasBalanceAndRevision = function() { + return jspb.Message.getField(this, 1) != null; }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.SearchKey} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.SearchKey; - return proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.SearchKey} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.SearchKey} - */ -proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = msg.getPurposeMapMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readMessage, proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader, 0, new proto.org.dash.platform.dapi.v0.SecurityLevelMap()); - }); - break; - default: - reader.skipField(); - break; - } - } - return msg; + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0], value); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.SearchKey.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.SearchKey} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getPurposeMapMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeMessage, proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter); - } +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * map purpose_map = 1; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.SearchKey.prototype.getPurposeMapMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 1, opt_noLazyCreate, - proto.org.dash.platform.dapi.v0.SecurityLevelMap)); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; /** - * Clears values from the map. The map will be non-null. - * @return {!proto.org.dash.platform.dapi.v0.SearchKey} returns this - */ -proto.org.dash.platform.dapi.v0.SearchKey.prototype.clearPurposeMapMap = function() { - this.getPurposeMapMap().clear(); - return this;}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject(opt_includeInstance, this); + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject = function(includeInstance, msg) { - var f, obj = { - securityLevelMapMap: (f = msg.getSecurityLevelMapMap()) ? f.toObject(includeInstance, undefined) : [] - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.SecurityLevelMap; - return proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} + * optional GetIdentityBalanceAndRevisionResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = msg.getSecurityLevelMapMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readEnum, null, 0, 0); - }); - break; - default: - reader.skipField(); - break; - } - } - return msg; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0, 1)); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_[0], value); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} returns this */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getSecurityLevelMapMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeEnum); - } +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.clearV0 = function() { + return this.setV0(undefined); }; /** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.KeyKindRequestType = { - CURRENT_KEY_OF_KIND_REQUEST: 0, - ALL_KEYS_OF_KIND_REQUEST: 1 -}; - -/** - * map security_level_map = 1; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.getSecurityLevelMapMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 1, opt_noLazyCreate, - null)); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} returns this - */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.clearSecurityLevelMapMap = function() { - this.getSecurityLevelMapMap().clear(); - return this;}; - - /** * Oneof group definitions for this message. Each group defines the field @@ -8227,21 +7893,23 @@ proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.clearSecurityLevelMap * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_ = [[1,2,3]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase = { + REQUEST_NOT_SET: 0, + ALL_KEYS: 1, + SPECIFIC_KEYS: 2, + SEARCH_KEY: 3 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getRequestCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0])); }; @@ -8259,8 +7927,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.KeyRequestType.toObject(opt_includeInstance, this); }; @@ -8269,13 +7937,15 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.toObject = func * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.KeyRequestType.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject(includeInstance, f) + allKeys: (f = msg.getAllKeys()) && proto.org.dash.platform.dapi.v0.AllKeys.toObject(includeInstance, f), + specificKeys: (f = msg.getSpecificKeys()) && proto.org.dash.platform.dapi.v0.SpecificKeys.toObject(includeInstance, f), + searchKey: (f = msg.getSearchKey()) && proto.org.dash.platform.dapi.v0.SearchKey.toObject(includeInstance, f) }; if (includeInstance) { @@ -8289,23 +7959,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject = function(inclu /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.KeyRequestType; + return proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8313,9 +7983,19 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromRead var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = new proto.org.dash.platform.dapi.v0.AllKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader); + msg.setAllKeys(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.SpecificKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader); + msg.setSpecificKeys(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.SearchKey; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader); + msg.setSearchKey(value); break; default: reader.skipField(); @@ -8330,9 +8010,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromRead * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8340,59 +8020,2013 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} message + * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); + f = message.getAllKeys(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter + ); + } + f = message.getSpecificKeys(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter + ); + } + f = message.getSearchKey(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter ); } }; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * optional AllKeys all_keys = 1; + * @return {?proto.org.dash.platform.dapi.v0.AllKeys} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getAllKeys = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.AllKeys} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.AllKeys, 1)); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: + * @param {?proto.org.dash.platform.dapi.v0.AllKeys|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this +*/ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setAllKeys = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearAllKeys = function() { + return this.setAllKeys(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasAllKeys = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional SpecificKeys specific_keys = 2; + * @return {?proto.org.dash.platform.dapi.v0.SpecificKeys} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getSpecificKeys = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.SpecificKeys} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.SpecificKeys, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.SpecificKeys|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this +*/ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setSpecificKeys = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSpecificKeys = function() { + return this.setSpecificKeys(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasSpecificKeys = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional SearchKey search_key = 3; + * @return {?proto.org.dash.platform.dapi.v0.SearchKey} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getSearchKey = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.SearchKey} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.SearchKey, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.SearchKey|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this +*/ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setSearchKey = function(value) { + return jspb.Message.setOneofWrapperField(this, 3, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSearchKey = function() { + return this.setSearchKey(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasSearchKey = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.AllKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.AllKeys.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.AllKeys} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.AllKeys.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.AllKeys} + */ +proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.AllKeys; + return proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.AllKeys} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.AllKeys} + */ +proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.AllKeys.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.AllKeys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.SpecificKeys.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.toObject = function(includeInstance, msg) { + var f, obj = { + keyIdsList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.SpecificKeys; + return proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint32() : [reader.readUint32()]); + for (var i = 0; i < values.length; i++) { + msg.addKeyIds(values[i]); + } + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKeyIdsList(); + if (f.length > 0) { + writer.writePackedUint32( + 1, + f + ); + } +}; + + +/** + * repeated uint32 key_ids = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.getKeyIdsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.setKeyIdsList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.addKeyIds = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.clearKeyIdsList = function() { + return this.setKeyIdsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.SearchKey.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.SearchKey.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.SearchKey} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SearchKey.toObject = function(includeInstance, msg) { + var f, obj = { + purposeMapMap: (f = msg.getPurposeMapMap()) ? f.toObject(includeInstance, proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject) : [] + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.SearchKey} + */ +proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.SearchKey; + return proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.SearchKey} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.SearchKey} + */ +proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = msg.getPurposeMapMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readMessage, proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader, 0, new proto.org.dash.platform.dapi.v0.SecurityLevelMap()); + }); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.SearchKey.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.SearchKey} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPurposeMapMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeMessage, proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter); + } +}; + + +/** + * map purpose_map = 1; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.org.dash.platform.dapi.v0.SearchKey.prototype.getPurposeMapMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 1, opt_noLazyCreate, + proto.org.dash.platform.dapi.v0.SecurityLevelMap)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.org.dash.platform.dapi.v0.SearchKey} returns this + */ +proto.org.dash.platform.dapi.v0.SearchKey.prototype.clearPurposeMapMap = function() { + this.getPurposeMapMap().clear(); + return this;}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject = function(includeInstance, msg) { + var f, obj = { + securityLevelMapMap: (f = msg.getSecurityLevelMapMap()) ? f.toObject(includeInstance, undefined) : [] + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.SecurityLevelMap; + return proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = msg.getSecurityLevelMapMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readEnum, null, 0, 0); + }); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSecurityLevelMapMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeEnum); + } +}; + + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.KeyKindRequestType = { + CURRENT_KEY_OF_KIND_REQUEST: 0, + ALL_KEYS_OF_KIND_REQUEST: 1 +}; + +/** + * map security_level_map = 1; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.getSecurityLevelMapMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 1, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} returns this + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.clearSecurityLevelMapMap = function() { + this.getSecurityLevelMapMap().clear(); + return this;}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + identityId: msg.getIdentityId_asB64(), + requestType: (f = msg.getRequestType()) && proto.org.dash.platform.dapi.v0.KeyRequestType.toObject(includeInstance, f), + limit: (f = msg.getLimit()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + offset: (f = msg.getOffset()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 5, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentityId(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.KeyRequestType; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader); + msg.setRequestType(value); + break; + case 3: + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setLimit(value); + break; + case 4: + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setOffset(value); + break; + case 5: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentityId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getRequestType(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter + ); + } + f = message.getLimit(); + if (f != null) { + writer.writeMessage( + 3, + f, + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + ); + } + f = message.getOffset(); + if (f != null) { + writer.writeMessage( + 4, + f, + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 5, + f + ); + } +}; + + +/** + * optional bytes identity_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentityId())); +}; + + +/** + * optional bytes identity_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentityId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentityId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setIdentityId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional KeyRequestType request_type = 2; + * @return {?proto.org.dash.platform.dapi.v0.KeyRequestType} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getRequestType = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.KeyRequestType} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.KeyRequestType, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.KeyRequestType|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setRequestType = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearRequestType = function() { + return this.setRequestType(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasRequestType = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional google.protobuf.UInt32Value limit = 3; + * @return {?proto.google.protobuf.UInt32Value} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getLimit = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 3)); +}; + + +/** + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setLimit = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearLimit = function() { + return this.setLimit(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasLimit = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional google.protobuf.UInt32Value offset = 4; + * @return {?proto.google.protobuf.UInt32Value} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getOffset = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 4)); +}; + + +/** + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setOffset = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearOffset = function() { + return this.setOffset(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasOffset = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional bool prove = 5; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 5, value); +}; + + +/** + * optional GetIdentityKeysRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + KEYS: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + keys: (f = msg.getKeys()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader); + msg.setKeys(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKeys(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject = function(includeInstance, msg) { + var f, obj = { + keysBytesList: msg.getKeysBytesList_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addKeysBytes(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKeysBytesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 1, + f + ); + } +}; + + +/** + * repeated bytes keys_bytes = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * repeated bytes keys_bytes = 1; + * This is a type-conversion wrapper around `getKeysBytesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getKeysBytesList())); +}; + + +/** + * repeated bytes keys_bytes = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKeysBytesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getKeysBytesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.setKeysBytesList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.addKeysBytes = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.clearKeysBytesList = function() { + return this.setKeysBytesList([]); +}; + + +/** + * optional Keys keys = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getKeys = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setKeys = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearKeys = function() { + return this.setKeys(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasKeys = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetIdentityKeysResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.repeatedFields_ = [1,4]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} msg The msg instance to transform. + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - identityId: msg.getIdentityId_asB64(), - requestType: (f = msg.getRequestType()) && proto.org.dash.platform.dapi.v0.KeyRequestType.toObject(includeInstance, f), - limit: (f = msg.getLimit()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), - offset: (f = msg.getOffset()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + identitiesIdsList: msg.getIdentitiesIdsList_asB64(), + contractId: msg.getContractId_asB64(), + documentTypeName: jspb.Message.getFieldWithDefault(msg, 3, ""), + purposesList: (f = jspb.Message.getRepeatedField(msg, 4)) == null ? undefined : f, prove: jspb.Message.getBooleanFieldWithDefault(msg, 5, false) }; @@ -8407,23 +10041,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8432,22 +10066,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setIdentityId(value); + msg.addIdentitiesIds(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.KeyRequestType; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader); - msg.setRequestType(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); break; case 3: - var value = new google_protobuf_wrappers_pb.UInt32Value; - reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); - msg.setLimit(value); + var value = /** @type {string} */ (reader.readString()); + msg.setDocumentTypeName(value); break; case 4: - var value = new google_protobuf_wrappers_pb.UInt32Value; - reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); - msg.setOffset(value); + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedEnum() : [reader.readEnum()]); + for (var i = 0; i < values.length; i++) { + msg.addPurposes(values[i]); + } break; case 5: var value = /** @type {boolean} */ (reader.readBool()); @@ -8466,9 +10099,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8476,41 +10109,38 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdentityId_asU8(); + f = message.getIdentitiesIdsList_asU8(); if (f.length > 0) { - writer.writeBytes( + writer.writeRepeatedBytes( 1, f ); } - f = message.getRequestType(); - if (f != null) { - writer.writeMessage( + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( 2, - f, - proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter + f ); } - f = message.getLimit(); + f = /** @type {string} */ (jspb.Message.getField(message, 3)); if (f != null) { - writer.writeMessage( + writer.writeString( 3, - f, - google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + f ); } - f = message.getOffset(); - if (f != null) { - writer.writeMessage( + f = message.getPurposesList(); + if (f.length > 0) { + writer.writePackedEnum( 4, - f, - google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + f ); } f = message.getProve(); @@ -8524,72 +10154,224 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. /** - * optional bytes identity_id = 1; + * repeated bytes identities_ids = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getIdentitiesIdsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * repeated bytes identities_ids = 1; + * This is a type-conversion wrapper around `getIdentitiesIdsList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getIdentitiesIdsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getIdentitiesIdsList())); +}; + + +/** + * repeated bytes identities_ids = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentitiesIdsList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getIdentitiesIdsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getIdentitiesIdsList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setIdentitiesIdsList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.addIdentitiesIds = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.clearIdentitiesIdsList = function() { + return this.setIdentitiesIdsList([]); +}; + + +/** + * optional bytes contract_id = 2; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * optional bytes identity_id = 1; - * This is a type-conversion wrapper around `getIdentityId()` + * optional bytes contract_id = 2; + * This is a type-conversion wrapper around `getContractId()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getContractId_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getIdentityId())); + this.getContractId())); }; /** - * optional bytes identity_id = 1; + * optional bytes contract_id = 2; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdentityId()` + * This is a type-conversion wrapper around `getContractId()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getContractId_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getIdentityId())); + this.getContractId())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setIdentityId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); }; /** - * optional KeyRequestType request_type = 2; - * @return {?proto.org.dash.platform.dapi.v0.KeyRequestType} + * optional string document_type_name = 3; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getRequestType = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.KeyRequestType} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.KeyRequestType, 2)); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getDocumentTypeName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** - * @param {?proto.org.dash.platform.dapi.v0.KeyRequestType|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setDocumentTypeName = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.clearDocumentTypeName = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.hasDocumentTypeName = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * repeated KeyPurpose purposes = 4; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getPurposesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setPurposesList = function(value) { + return jspb.Message.setField(this, 4, value || []); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.KeyPurpose} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.addPurposes = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 4, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.clearPurposesList = function() { + return this.setPurposesList([]); +}; + + +/** + * optional bool prove = 5; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 5, value); +}; + + +/** + * optional GetIdentitiesContractKeysRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setRequestType = function(value) { - return jspb.Message.setWrapperField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearRequestType = function() { - return this.setRequestType(undefined); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.clearV0 = function() { + return this.setV0(undefined); }; @@ -8597,165 +10379,325 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasRequestType = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.toObject(opt_includeInstance, this); }; /** - * optional google.protobuf.UInt32Value limit = 3; - * @return {?proto.google.protobuf.UInt32Value} + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getLimit = function() { - return /** @type{?proto.google.protobuf.UInt32Value} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 3)); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * @param {?proto.google.protobuf.UInt32Value|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setLimit = function(value) { - return jspb.Message.setWrapperField(this, 3, value); + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.deserializeBinaryFromReader(msg, reader); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearLimit = function() { - return this.setLimit(undefined); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * Returns whether this field is set. - * @return {boolean} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasLimit = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * optional google.protobuf.UInt32Value offset = 4; - * @return {?proto.google.protobuf.UInt32Value} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getOffset = function() { - return /** @type{?proto.google.protobuf.UInt32Value} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 4)); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.serializeBinaryToWriter + ); + } }; -/** - * @param {?proto.google.protobuf.UInt32Value|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setOffset = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_ = [[1,2]]; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearOffset = function() { - return this.setOffset(undefined); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + IDENTITIES_KEYS: 1, + PROOF: 2 }; - /** - * Returns whether this field is set. - * @return {boolean} + * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasOffset = function() { - return jspb.Message.getField(this, 4) != null; +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_[0])); }; + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional bool prove = 5; - * @return {boolean} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.toObject(opt_includeInstance, this); }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 5, value); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + identitiesKeys: (f = msg.getIdentitiesKeys()) && proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional GetIdentityKeysRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.deserializeBinaryFromReader(msg, reader); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_[0], value); + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.deserializeBinaryFromReader); + msg.setIdentitiesKeys(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} returns this + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * Returns whether this field is set. - * @return {boolean} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentitiesKeys(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } }; /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} + * List of repeated fields within this message type. + * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_ = [[1]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_[0])); -}; +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.repeatedFields_ = [2]; @@ -8772,8 +10714,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.toObject(opt_includeInstance, this); }; @@ -8782,13 +10724,14 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.toObject = fun * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject(includeInstance, f) + purpose: jspb.Message.getFieldWithDefault(msg, 1, 0), + keysBytesList: msg.getKeysBytesList_asB64() }; if (includeInstance) { @@ -8802,23 +10745,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject = function(incl /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8826,9 +10769,12 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromRea var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = /** @type {!proto.org.dash.platform.dapi.v0.KeyPurpose} */ (reader.readEnum()); + msg.setPurpose(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addKeysBytes(value); break; default: reader.skipField(); @@ -8843,9 +10789,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromRea * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8853,51 +10799,117 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.serializeBinar /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( + f = message.getPurpose(); + if (f !== 0.0) { + writer.writeEnum( 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter + f + ); + } + f = message.getKeysBytesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 2, + f ); } }; +/** + * optional KeyPurpose purpose = 1; + * @return {!proto.org.dash.platform.dapi.v0.KeyPurpose} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.getPurpose = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.KeyPurpose} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const + * @param {!proto.org.dash.platform.dapi.v0.KeyPurpose} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.setPurpose = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + /** - * @enum {number} + * repeated bytes keys_bytes = 2; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - KEYS: 1, - PROOF: 2 +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.getKeysBytesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase} + * repeated bytes keys_bytes = 2; + * This is a type-conversion wrapper around `getKeysBytesList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.getKeysBytesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getKeysBytesList())); +}; + + +/** + * repeated bytes keys_bytes = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKeysBytesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.getKeysBytesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getKeysBytesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.setKeysBytesList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.addKeysBytes = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); }; +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.clearKeysBytesList = function() { + return this.setKeysBytesList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.repeatedFields_ = [2]; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** @@ -8912,8 +10924,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.toObject(opt_includeInstance, this); }; @@ -8922,15 +10934,15 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.toObject = function(includeInstance, msg) { var f, obj = { - keys: (f = msg.getKeys()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + identityId: msg.getIdentityId_asB64(), + keysList: jspb.Message.toObjectList(msg.getKeysList(), + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.toObject, includeInstance) }; if (includeInstance) { @@ -8944,23 +10956,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8968,19 +10980,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader); - msg.setKeys(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentityId(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.deserializeBinaryFromReader); + msg.addKeys(value); break; default: reader.skipField(); @@ -8995,9 +11001,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9005,46 +11011,117 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getKeys(); - if (f != null) { - writer.writeMessage( + f = message.getIdentityId_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter + f ); } - f = message.getProof(); - if (f != null) { - writer.writeMessage( + f = message.getKeysList(); + if (f.length > 0) { + writer.writeRepeatedMessage( 2, f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.serializeBinaryToWriter ); } }; +/** + * optional bytes identity_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.getIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.getIdentityId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentityId())); +}; + + +/** + * optional bytes identity_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentityId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.getIdentityId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentityId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.setIdentityId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * repeated PurposeKeys keys = 2; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.getKeysList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.setKeysList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.addKeys = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.clearKeysList = function() { + return this.setKeysList([]); +}; + + /** * List of repeated fields within this message type. * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.repeatedFields_ = [1]; @@ -9061,8 +11138,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.toObject(opt_includeInstance, this); }; @@ -9071,13 +11148,14 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.toObject = function(includeInstance, msg) { var f, obj = { - keysBytesList: msg.getKeysBytesList_asB64() + entriesList: jspb.Message.toObjectList(msg.getEntriesList(), + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.toObject, includeInstance) }; if (includeInstance) { @@ -9091,23 +11169,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9115,8 +11193,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addKeysBytes(value); + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.deserializeBinaryFromReader); + msg.addEntries(value); break; default: reader.skipField(); @@ -9131,118 +11210,96 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getKeysBytesList_asU8(); - if (f.length > 0) { - writer.writeRepeatedBytes( - 1, - f - ); - } -}; - - -/** - * repeated bytes keys_bytes = 1; - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * repeated bytes keys_bytes = 1; - * This is a type-conversion wrapper around `getKeysBytesList()` - * @return {!Array} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getKeysBytesList())); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEntriesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.serializeBinaryToWriter + ); + } }; /** - * repeated bytes keys_bytes = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getKeysBytesList()` - * @return {!Array} + * repeated IdentityKeys entries = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getKeysBytesList())); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.getEntriesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys, 1)); }; /** - * @param {!(Array|Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.setKeysBytesList = function(value) { - return jspb.Message.setField(this, 1, value || []); + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.setEntriesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * @param {!(string|Uint8Array)} value + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys=} opt_value * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.addKeysBytes = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.addEntries = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys, opt_index); }; /** * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.clearKeysBytesList = function() { - return this.setKeysBytesList([]); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.clearEntriesList = function() { + return this.setEntriesList([]); }; /** - * optional Keys keys = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + * optional IdentitiesKeys identities_keys = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getKeys = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys, 1)); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.getIdentitiesKeys = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setKeys = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.setIdentitiesKeys = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearKeys = function() { - return this.setKeys(undefined); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.clearIdentitiesKeys = function() { + return this.setIdentitiesKeys(undefined); }; @@ -9250,7 +11307,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasKeys = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.hasIdentitiesKeys = function() { return jspb.Message.getField(this, 1) != null; }; @@ -9259,7 +11316,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -9267,18 +11324,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -9287,7 +11344,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -9296,7 +11353,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -9304,18 +11361,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -9324,35 +11381,35 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetIdentityKeysResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + * optional GetIdentitiesContractKeysResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -9361,7 +11418,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.clearV0 = func * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -10055,7 +12112,8 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type = { FULL_IDENTITY: 0, BALANCE: 1, - KEYS: 2 + KEYS: 2, + REVISION: 3 }; /** @@ -15501,21 +17559,21 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.hasV0 = function( * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_[0])); }; @@ -15533,8 +17591,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.toObject(opt_includeInstance, this); }; @@ -15543,13 +17601,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -15563,23 +17621,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -15587,8 +17645,8 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -15604,9 +17662,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -15614,31 +17672,24 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter ); } }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.repeatedFields_ = [1]; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -15654,8 +17705,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(opt_includeInstance, this); }; @@ -15664,13 +17715,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - publicKeyHashesList: msg.getPublicKeyHashesList_asB64(), + publicKeyHash: msg.getPublicKeyHash_asB64(), prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; @@ -15685,23 +17736,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -15710,7 +17761,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addPublicKeyHashes(value); + msg.setPublicKeyHash(value); break; case 2: var value = /** @type {boolean} */ (reader.readBool()); @@ -15729,9 +17780,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -15739,15 +17790,15 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getPublicKeyHashesList_asU8(); + f = message.getPublicKeyHash_asU8(); if (f.length > 0) { - writer.writeRepeatedBytes( + writer.writeBytes( 1, f ); @@ -15763,63 +17814,44 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit /** - * repeated bytes public_key_hashes = 1; - * @return {!Array} + * optional bytes public_key_hash = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.getPublicKeyHashesList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * repeated bytes public_key_hashes = 1; - * This is a type-conversion wrapper around `getPublicKeyHashesList()` - * @return {!Array} + * optional bytes public_key_hash = 1; + * This is a type-conversion wrapper around `getPublicKeyHash()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.getPublicKeyHashesList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getPublicKeyHashesList())); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getPublicKeyHash())); }; /** - * repeated bytes public_key_hashes = 1; + * optional bytes public_key_hash = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPublicKeyHashesList()` - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.getPublicKeyHashesList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getPublicKeyHashesList())); -}; - - -/** - * @param {!(Array|Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} returns this + * This is a type-conversion wrapper around `getPublicKeyHash()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.setPublicKeyHashesList = function(value) { - return jspb.Message.setField(this, 1, value || []); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getPublicKeyHash())); }; /** * @param {!(string|Uint8Array)} value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.addPublicKeyHashes = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.clearPublicKeyHashesList = function() { - return this.setPublicKeyHashesList([]); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.setPublicKeyHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; @@ -15827,44 +17859,44 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit * optional bool prove = 2; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.getProve = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getProve = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.setProve = function(value) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.setProve = function(value) { return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional GetIdentitiesByPublicKeyHashesRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} + * optional GetIdentityByPublicKeyHashRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -15873,7 +17905,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype. * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -15887,21 +17919,21 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype. * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_[0])); }; @@ -15919,8 +17951,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject(opt_includeInstance, this); }; @@ -15929,13 +17961,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -15949,23 +17981,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.toObject /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -15973,8 +18005,8 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deseriali var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -15990,9 +18022,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deseriali * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16000,24 +18032,50 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter ); } }; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + IDENTITY: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0])); +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -16033,8 +18091,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(opt_includeInstance, this); }; @@ -16043,14 +18101,15 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - publicKeyHash: msg.getPublicKeyHash_asB64(), - value: (f = msg.getValue()) && google_protobuf_wrappers_pb.BytesValue.toObject(includeInstance, f) + identity: msg.getIdentity_asB64(), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -16064,23 +18123,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -16089,12 +18148,17 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setPublicKeyHash(value); + msg.setIdentity(value); break; case 2: - var value = new google_protobuf_wrappers_pb.BytesValue; - reader.readMessage(value,google_protobuf_wrappers_pb.BytesValue.deserializeBinaryFromReader); - msg.setValue(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -16109,9 +18173,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16119,97 +18183,123 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getPublicKeyHash_asU8(); - if (f.length > 0) { + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); + if (f != null) { writer.writeBytes( 1, f ); } - f = message.getValue(); + f = message.getProof(); if (f != null) { writer.writeMessage( 2, f, - google_protobuf_wrappers_pb.BytesValue.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; /** - * optional bytes public_key_hash = 1; + * optional bytes identity = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.getPublicKeyHash = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes public_key_hash = 1; - * This is a type-conversion wrapper around `getPublicKeyHash()` + * optional bytes identity = 1; + * This is a type-conversion wrapper around `getIdentity()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.getPublicKeyHash_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getPublicKeyHash())); + this.getIdentity())); }; /** - * optional bytes public_key_hash = 1; + * optional bytes identity = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPublicKeyHash()` + * This is a type-conversion wrapper around `getIdentity()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.getPublicKeyHash_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getPublicKeyHash())); + this.getIdentity())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.setPublicKeyHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setIdentity = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], value); }; /** - * optional google.protobuf.BytesValue value = 2; - * @return {?proto.google.protobuf.BytesValue} + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.getValue = function() { - return /** @type{?proto.google.protobuf.BytesValue} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.BytesValue, 2)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearIdentity = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], undefined); }; /** - * @param {?proto.google.protobuf.BytesValue|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} returns this + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasIdentity = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.setValue = function(value) { - return jspb.Message.setWrapperField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.clearValue = function() { - return this.setValue(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; @@ -16217,18 +18307,110 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.hasValue = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + /** - * List of repeated fields within this message type. - * @private {!Array} + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetIdentityByPublicKeyHashResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_[0])); +}; @@ -16245,8 +18427,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.toObject(opt_includeInstance, this); }; @@ -16255,14 +18437,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.Identitie * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.toObject = function(includeInstance, msg) { var f, obj = { - identityEntriesList: jspb.Message.toObjectList(msg.getIdentityEntriesList(), - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.toObject, includeInstance) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -16276,23 +18457,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.Identitie /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest; + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -16300,117 +18481,53 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.Identitie var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.deserializeBinaryFromReader); - msg.addIdentityEntries(value); + var value = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getIdentityEntriesList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.serializeBinaryToWriter - ); - } -}; - - -/** - * repeated PublicKeyHashIdentityEntry identity_entries = 1; - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.getIdentityEntriesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.setIdentityEntriesList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.addIdentityEntries = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.clearIdentityEntriesList = function() { - return this.setIdentityEntriesList([]); -}; - - - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_ = [[1,2]]; + } + } + return msg; +}; + /** - * @enum {number} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - IDENTITIES: 1, - PROOF: 2 +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.ResultCase} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter + ); + } }; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -16424,8 +18541,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(opt_includeInstance, this); }; @@ -16434,15 +18551,14 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - identities: (f = msg.getIdentities()) && proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + stateTransitionHash: msg.getStateTransitionHash_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -16456,23 +18572,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0; + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -16480,19 +18596,12 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.deserializeBinaryFromReader); - msg.setIdentities(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStateTransitionHash(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -16507,9 +18616,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16517,174 +18626,113 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdentities(); - if (f != null) { - writer.writeMessage( + f = message.getStateTransitionHash_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.serializeBinaryToWriter + f ); } - f = message.getProof(); - if (f != null) { - writer.writeMessage( + f = message.getProve(); + if (f) { + writer.writeBool( 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f ); } }; /** - * optional IdentitiesByPublicKeyHashes identities = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.getIdentities = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.setIdentities = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this + * optional bytes state_transition_hash = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.clearIdentities = function() { - return this.setIdentities(undefined); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * Returns whether this field is set. - * @return {boolean} + * optional bytes state_transition_hash = 1; + * This is a type-conversion wrapper around `getStateTransitionHash()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.hasIdentities = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStateTransitionHash())); }; /** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * optional bytes state_transition_hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStateTransitionHash()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStateTransitionHash())); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.setStateTransitionHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * Returns whether this field is set. + * optional bool prove = 2; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional GetIdentitiesByPublicKeyHashesResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} + * optional WaitForStateTransitionResultRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0, 1)); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -16693,7 +18741,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -16707,21 +18755,21 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_[0])); }; @@ -16739,8 +18787,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject(opt_includeInstance, this); }; @@ -16749,13 +18797,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.toOb * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -16769,23 +18817,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.toObject = fun /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest; - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse; + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -16793,8 +18841,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBin var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -16810,9 +18858,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBin * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16820,26 +18868,52 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.seri /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} message + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter ); } }; - - +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + ERROR: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0])); +}; + + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -16853,8 +18927,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(opt_includeInstance, this); }; @@ -16863,14 +18937,15 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - publicKeyHash: msg.getPublicKeyHash_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + error: (f = msg.getError()) && proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -16884,23 +18959,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0; + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -16908,12 +18983,19 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setPublicKeyHash(value); + var value = new proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryFromReader); + msg.setError(value); break; case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -16928,9 +19010,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16938,113 +19020,174 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getPublicKeyHash_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getError(); + if (f != null) { + writer.writeMessage( 1, - f + f, + proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.serializeBinaryToWriter ); } - f = message.getProve(); - if (f) { - writer.writeBool( + f = message.getProof(); + if (f != null) { + writer.writeMessage( 2, - f + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; /** - * optional bytes public_key_hash = 1; - * @return {string} + * optional StateTransitionBroadcastError error = 1; + * @return {?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getError = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError, 1)); }; /** - * optional bytes public_key_hash = 1; - * This is a type-conversion wrapper around `getPublicKeyHash()` - * @return {string} + * @param {?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setError = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getPublicKeyHash())); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearError = function() { + return this.setError(undefined); }; /** - * optional bytes public_key_hash = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPublicKeyHash()` - * @return {!Uint8Array} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getPublicKeyHash())); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasError = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} returns this + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.setPublicKeyHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * optional bool prove = 2; + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} returns this + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; /** - * optional GetIdentityByPublicKeyHashRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0, 1)); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} returns this + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional WaitForStateTransitionResultResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -17053,7 +19196,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.clea * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -17067,21 +19210,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.hasV * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_[0])); }; @@ -17099,8 +19242,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject(opt_includeInstance, this); }; @@ -17109,13 +19252,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.toO * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -17129,23 +19272,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject = fu /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -17153,8 +19296,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBi var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -17170,9 +19313,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBi * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -17180,50 +19323,24 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.ser /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter ); } }; -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - IDENTITY: 1, - PROOF: 2 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0])); -}; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -17239,8 +19356,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(opt_includeInstance, this); }; @@ -17249,15 +19366,14 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityBy * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - identity: msg.getIdentity_asB64(), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -17271,23 +19387,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityBy /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -17295,18 +19411,12 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityBy var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setIdentity(value); + var value = /** @type {number} */ (reader.readInt32()); + msg.setHeight(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -17321,9 +19431,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityBy * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -17331,196 +19441,89 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityBy /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeBytes( + f = message.getHeight(); + if (f !== 0) { + writer.writeInt32( 1, f ); } - f = message.getProof(); - if (f != null) { - writer.writeMessage( + f = message.getProve(); + if (f) { + writer.writeBool( 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f ); } }; /** - * optional bytes identity = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes identity = 1; - * This is a type-conversion wrapper around `getIdentity()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getIdentity())); -}; - - -/** - * optional bytes identity = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdentity()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getIdentity())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setIdentity = function(value) { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], value); -}; - - -/** - * Clears the field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearIdentity = function() { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasIdentity = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * optional int32 height = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; /** - * Returns whether this field is set. + * optional bool prove = 2; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional GetIdentityByPublicKeyHashResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} + * optional GetConsensusParamsRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -17529,7 +19532,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.cle * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -17543,21 +19546,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.has * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_[0])); }; @@ -17575,8 +19578,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.toObject(opt_includeInstance, this); }; @@ -17585,13 +19588,13 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.to * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -17605,23 +19608,23 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.toObject = f /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest; - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -17629,8 +19632,8 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeB var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -17646,9 +19649,9 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeB * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -17656,18 +19659,18 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.se /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter ); } }; @@ -17689,8 +19692,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(opt_includeInstance, this); }; @@ -17699,14 +19702,15 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject = function(includeInstance, msg) { var f, obj = { - stateTransitionHash: msg.getStateTransitionHash_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + maxBytes: jspb.Message.getFieldWithDefault(msg, 1, ""), + maxGas: jspb.Message.getFieldWithDefault(msg, 2, ""), + timeIotaMs: jspb.Message.getFieldWithDefault(msg, 3, "") }; if (includeInstance) { @@ -17720,23 +19724,23 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0; - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -17744,12 +19748,16 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setStateTransitionHash(value); + var value = /** @type {string} */ (reader.readString()); + msg.setMaxBytes(value); break; case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = /** @type {string} */ (reader.readString()); + msg.setMaxGas(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setTimeIotaMs(value); break; default: reader.skipField(); @@ -17764,9 +19772,9 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -17774,152 +19782,91 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getStateTransitionHash_asU8(); + f = message.getMaxBytes(); if (f.length > 0) { - writer.writeBytes( + writer.writeString( 1, f ); } - f = message.getProve(); - if (f) { - writer.writeBool( + f = message.getMaxGas(); + if (f.length > 0) { + writer.writeString( 2, f ); } + f = message.getTimeIotaMs(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } }; /** - * optional bytes state_transition_hash = 1; + * optional string max_bytes = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getMaxBytes = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes state_transition_hash = 1; - * This is a type-conversion wrapper around `getStateTransitionHash()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getStateTransitionHash())); -}; - - -/** - * optional bytes state_transition_hash = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getStateTransitionHash()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getStateTransitionHash())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.setStateTransitionHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; - - -/** - * optional bool prove = 2; - * @return {boolean} + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setMaxBytes = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} returns this + * optional string max_gas = 2; + * @return {string} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getMaxGas = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * optional WaitForStateTransitionResultRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} returns this -*/ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setMaxGas = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} returns this + * optional string time_iota_ms = 3; + * @return {string} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getTimeIotaMs = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setTimeIotaMs = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); }; -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_ = [[1]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_[0])); -}; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -17935,8 +19882,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(opt_includeInstance, this); }; @@ -17945,13 +19892,15 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.t * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(includeInstance, f) + maxAgeNumBlocks: jspb.Message.getFieldWithDefault(msg, 1, ""), + maxAgeDuration: jspb.Message.getFieldWithDefault(msg, 2, ""), + maxBytes: jspb.Message.getFieldWithDefault(msg, 3, "") }; if (includeInstance) { @@ -17965,23 +19914,23 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse; - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -17989,9 +19938,16 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserialize var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = /** @type {string} */ (reader.readString()); + msg.setMaxAgeNumBlocks(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setMaxAgeDuration(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setMaxBytes(value); break; default: reader.skipField(); @@ -18006,9 +19962,9 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserialize * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18016,52 +19972,93 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.s /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( + f = message.getMaxAgeNumBlocks(); + if (f.length > 0) { + writer.writeString( 1, - f, - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter + f + ); + } + f = message.getMaxAgeDuration(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getMaxBytes(); + if (f.length > 0) { + writer.writeString( + 3, + f ); } }; +/** + * optional string max_age_num_blocks = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxAgeNumBlocks = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxAgeNumBlocks = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + /** - * @enum {number} + * optional string max_age_duration = 2; + * @return {string} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - ERROR: 1, - PROOF: 2 +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxAgeDuration = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; + /** - * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase} + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxAgeDuration = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string max_bytes = 3; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxBytes = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxBytes = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); }; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -18075,8 +20072,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(opt_includeInstance, this); }; @@ -18085,15 +20082,14 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - error: (f = msg.getError()) && proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + block: (f = msg.getBlock()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(includeInstance, f), + evidence: (f = msg.getEvidence()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(includeInstance, f) }; if (includeInstance) { @@ -18107,23 +20103,23 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0; - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -18131,19 +20127,14 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryFromReader); - msg.setError(value); + var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader); + msg.setBlock(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader); + msg.setEvidence(value); break; default: reader.skipField(); @@ -18158,9 +20149,9 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18168,64 +20159,56 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getError(); + f = message.getBlock(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter ); } - f = message.getProof(); + f = message.getEvidence(); if (f != null) { writer.writeMessage( 2, f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter ); } }; /** - * optional StateTransitionBroadcastError error = 1; - * @return {?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} + * optional ConsensusParamsBlock block = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getError = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError, 1)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.getBlock = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setError = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.setBlock = function(value) { + return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearError = function() { - return this.setError(undefined); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.clearBlock = function() { + return this.setBlock(undefined); }; @@ -18233,36 +20216,36 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasError = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.hasBlock = function() { return jspb.Message.getField(this, 1) != null; }; /** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * optional ConsensusParamsEvidence evidence = 2; + * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.getEvidence = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence, 2)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.setEvidence = function(value) { + return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.clearEvidence = function() { + return this.setEvidence(undefined); }; @@ -18270,72 +20253,35 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.hasEvidence = function() { return jspb.Message.getField(this, 2) != null; }; /** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional WaitForStateTransitionResultResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} + * optional GetConsensusParamsResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -18344,7 +20290,7 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.c * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -18358,21 +20304,21 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.h * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_[0])); }; @@ -18390,8 +20336,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject(opt_includeInstance, this); }; @@ -18400,13 +20346,13 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.toObject = f * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -18420,23 +20366,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject = function(in /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -18444,8 +20390,8 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromR var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -18461,9 +20407,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromR * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18471,18 +20417,18 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.serializeBin /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter ); } }; @@ -18504,8 +20450,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(opt_includeInstance, this); }; @@ -18514,14 +20460,13 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - height: jspb.Message.getFieldWithDefault(msg, 1, 0), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + prove: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) }; if (includeInstance) { @@ -18535,23 +20480,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -18559,10 +20504,6 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readInt32()); - msg.setHeight(value); - break; - case 2: var value = /** @type {boolean} */ (reader.readBool()); msg.setProve(value); break; @@ -18579,9 +20520,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18589,23 +20530,16 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getHeight(); - if (f !== 0) { - writer.writeInt32( - 1, - f - ); - } f = message.getProve(); if (f) { writer.writeBool( - 2, + 1, f ); } @@ -18613,65 +20547,47 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ /** - * optional int32 height = 1; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.getHeight = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.setHeight = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional bool prove = 2; + * optional bool prove = 1; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 1, value); }; /** - * optional GetConsensusParamsRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} + * optional GetProtocolVersionUpgradeStateRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -18680,7 +20596,7 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.clearV0 = fu * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -18694,21 +20610,21 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.hasV0 = func * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_[0])); }; @@ -18726,8 +20642,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.toObject(opt_includeInstance, this); }; @@ -18736,13 +20652,13 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.toObject = * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -18756,23 +20672,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.toObject = function(i /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -18780,8 +20696,8 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFrom var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -18797,9 +20713,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFrom * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18807,24 +20723,50 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.serializeBi /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter ); } }; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + VERSIONS: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0])); +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -18840,8 +20782,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(opt_includeInstance, this); }; @@ -18850,15 +20792,15 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - maxBytes: jspb.Message.getFieldWithDefault(msg, 1, ""), - maxGas: jspb.Message.getFieldWithDefault(msg, 2, ""), - timeIotaMs: jspb.Message.getFieldWithDefault(msg, 3, "") + versions: (f = msg.getVersions()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -18872,23 +20814,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -18896,16 +20838,19 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxBytes(value); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader); + msg.setVersions(value); break; case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxGas(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); break; case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setTimeIotaMs(value); + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -18920,9 +20865,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18930,90 +20875,46 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getMaxBytes(); - if (f.length > 0) { - writer.writeString( + f = message.getVersions(); + if (f != null) { + writer.writeMessage( 1, - f + f, + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter ); } - f = message.getMaxGas(); - if (f.length > 0) { - writer.writeString( + f = message.getProof(); + if (f != null) { + writer.writeMessage( 2, - f + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter ); } - f = message.getTimeIotaMs(); - if (f.length > 0) { - writer.writeString( + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( 3, - f + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; -/** - * optional string max_bytes = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getMaxBytes = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setMaxBytes = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string max_gas = 2; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getMaxGas = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setMaxGas = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional string time_iota_ms = 3; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getTimeIotaMs = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - /** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setTimeIotaMs = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); -}; - - +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.repeatedFields_ = [1]; @@ -19030,8 +20931,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(opt_includeInstance, this); }; @@ -19040,15 +20941,14 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject = function(includeInstance, msg) { var f, obj = { - maxAgeNumBlocks: jspb.Message.getFieldWithDefault(msg, 1, ""), - maxAgeDuration: jspb.Message.getFieldWithDefault(msg, 2, ""), - maxBytes: jspb.Message.getFieldWithDefault(msg, 3, "") + versionsList: jspb.Message.toObjectList(msg.getVersionsList(), + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject, includeInstance) }; if (includeInstance) { @@ -19062,23 +20962,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19086,16 +20986,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxAgeNumBlocks(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxAgeDuration(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxBytes(value); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader); + msg.addVersions(value); break; default: reader.skipField(); @@ -19110,9 +21003,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -19120,87 +21013,58 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getMaxAgeNumBlocks(); + f = message.getVersionsList(); if (f.length > 0) { - writer.writeString( + writer.writeRepeatedMessage( 1, - f - ); - } - f = message.getMaxAgeDuration(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getMaxBytes(); - if (f.length > 0) { - writer.writeString( - 3, - f + f, + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter ); } }; /** - * optional string max_age_num_blocks = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxAgeNumBlocks = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxAgeNumBlocks = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string max_age_duration = 2; - * @return {string} + * repeated VersionEntry versions = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxAgeDuration = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.getVersionsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, 1)); }; /** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxAgeDuration = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.setVersionsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * optional string max_bytes = 3; - * @return {string} + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxBytes = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.addVersions = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, opt_index); }; /** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxBytes = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.clearVersionsList = function() { + return this.setVersionsList([]); }; @@ -19220,8 +21084,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject(opt_includeInstance, this); }; @@ -19230,14 +21094,14 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject = function(includeInstance, msg) { var f, obj = { - block: (f = msg.getBlock()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(includeInstance, f), - evidence: (f = msg.getEvidence()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(includeInstance, f) + versionNumber: jspb.Message.getFieldWithDefault(msg, 1, 0), + voteCount: jspb.Message.getFieldWithDefault(msg, 2, 0) }; if (includeInstance) { @@ -19251,23 +21115,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19275,14 +21139,12 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader); - msg.setBlock(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setVersionNumber(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader); - msg.setEvidence(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setVoteCount(value); break; default: reader.skipField(); @@ -19297,9 +21159,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -19307,56 +21169,90 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getBlock(); - if (f != null) { - writer.writeMessage( + f = message.getVersionNumber(); + if (f !== 0) { + writer.writeUint32( 1, - f, - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter + f ); } - f = message.getEvidence(); - if (f != null) { - writer.writeMessage( + f = message.getVoteCount(); + if (f !== 0) { + writer.writeUint32( 2, - f, - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter + f ); } }; /** - * optional ConsensusParamsBlock block = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} + * optional uint32 version_number = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.getBlock = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.getVersionNumber = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.setVersionNumber = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint32 vote_count = 2; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.getVoteCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.setVoteCount = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional Versions versions = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getVersions = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.setBlock = function(value) { - return jspb.Message.setWrapperField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setVersions = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.clearBlock = function() { - return this.setBlock(undefined); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearVersions = function() { + return this.setVersions(undefined); }; @@ -19364,36 +21260,36 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.hasBlock = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasVersions = function() { return jspb.Message.getField(this, 1) != null; }; /** - * optional ConsensusParamsEvidence evidence = 2; - * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.getEvidence = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence, 2)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.setEvidence = function(value) { - return jspb.Message.setWrapperField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.clearEvidence = function() { - return this.setEvidence(undefined); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; @@ -19401,35 +21297,72 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.hasEvidence = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; /** - * optional GetConsensusParamsResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetProtocolVersionUpgradeStateResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -19438,7 +21371,7 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.clearV0 = f * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -19452,21 +21385,21 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.hasV0 = fun * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_[0])); }; @@ -19484,8 +21417,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObject(opt_includeInstance, this); }; @@ -19494,13 +21427,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -19514,23 +21447,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19538,8 +21471,8 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -19555,9 +21488,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -19565,18 +21498,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter ); } }; @@ -19598,8 +21531,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(opt_includeInstance, this); }; @@ -19608,13 +21541,15 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - prove: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) + startProTxHash: msg.getStartProTxHash_asB64(), + count: jspb.Message.getFieldWithDefault(msg, 2, 0), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) }; if (includeInstance) { @@ -19628,23 +21563,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19652,6 +21587,14 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco var field = reader.getFieldNumber(); switch (field) { case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStartProTxHash(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCount(value); + break; + case 3: var value = /** @type {boolean} */ (reader.readBool()); msg.setProve(value); break; @@ -19668,9 +21611,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -19678,16 +21621,30 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; + f = message.getStartProTxHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getCount(); + if (f !== 0) { + writer.writeUint32( + 2, + f + ); + } f = message.getProve(); if (f) { writer.writeBool( - 1, + 3, f ); } @@ -19695,47 +21652,107 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco /** - * optional bool prove = 1; + * optional bytes start_pro_tx_hash = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes start_pro_tx_hash = 1; + * This is a type-conversion wrapper around `getStartProTxHash()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStartProTxHash())); +}; + + +/** + * optional bytes start_pro_tx_hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStartProTxHash()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStartProTxHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setStartProTxHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional uint32 count = 2; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setCount = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional bool prove = 3; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); }; /** - * optional GetProtocolVersionUpgradeStateRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} + * optional GetProtocolVersionUpgradeVoteStatusRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -19744,7 +21761,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype. * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -19758,21 +21775,21 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype. * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_[0])); }; @@ -19790,8 +21807,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toObject(opt_includeInstance, this); }; @@ -19800,13 +21817,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -19820,23 +21837,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.toObject /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19844,8 +21861,8 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deseriali var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -19861,9 +21878,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deseriali * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -19871,18 +21888,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter ); } }; @@ -19897,22 +21914,22 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.serialize * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase = { RESULT_NOT_SET: 0, VERSIONS: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0])); }; @@ -19930,8 +21947,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(opt_includeInstance, this); }; @@ -19940,13 +21957,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - versions: (f = msg.getVersions()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(includeInstance, f), + versions: (f = msg.getVersions()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(includeInstance, f), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -19962,23 +21979,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19986,8 +22003,8 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader); msg.setVersions(value); break; case 2: @@ -20013,9 +22030,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -20023,18 +22040,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getVersions(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter ); } f = message.getProof(); @@ -20062,7 +22079,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.repeatedFields_ = [1]; @@ -20079,8 +22096,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(opt_includeInstance, this); }; @@ -20089,14 +22106,14 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject = function(includeInstance, msg) { var f, obj = { - versionsList: jspb.Message.toObjectList(msg.getVersionsList(), - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject, includeInstance) + versionSignalsList: jspb.Message.toObjectList(msg.getVersionSignalsList(), + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject, includeInstance) }; if (includeInstance) { @@ -20110,23 +22127,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -20134,9 +22151,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader); - msg.addVersions(value); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader); + msg.addVersionSignals(value); break; default: reader.skipField(); @@ -20151,9 +22168,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -20161,58 +22178,58 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getVersionsList(); + f = message.getVersionSignalsList(); if (f.length > 0) { writer.writeRepeatedMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter ); } }; /** - * repeated VersionEntry versions = 1; - * @return {!Array} + * repeated VersionSignal version_signals = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.getVersionsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.getVersionSignalsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, 1)); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} returns this + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.setVersionsList = function(value) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.setVersionSignalsList = function(value) { return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry=} opt_value + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal=} opt_value * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.addVersions = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, opt_index); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.addVersionSignals = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, opt_index); }; /** * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.clearVersionsList = function() { - return this.setVersionsList([]); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.clearVersionSignalsList = function() { + return this.setVersionSignalsList([]); }; @@ -20232,8 +22249,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject(opt_includeInstance, this); }; @@ -20242,14 +22259,14 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject = function(includeInstance, msg) { var f, obj = { - versionNumber: jspb.Message.getFieldWithDefault(msg, 1, 0), - voteCount: jspb.Message.getFieldWithDefault(msg, 2, 0) + proTxHash: msg.getProTxHash_asB64(), + version: jspb.Message.getFieldWithDefault(msg, 2, 0) }; if (includeInstance) { @@ -20263,23 +22280,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -20287,12 +22304,12 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readUint32()); - msg.setVersionNumber(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setProTxHash(value); break; case 2: var value = /** @type {number} */ (reader.readUint32()); - msg.setVoteCount(value); + msg.setVersion(value); break; default: reader.skipField(); @@ -20307,9 +22324,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -20317,20 +22334,20 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getVersionNumber(); - if (f !== 0) { - writer.writeUint32( + f = message.getProTxHash_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, f ); } - f = message.getVoteCount(); + f = message.getVersion(); if (f !== 0) { writer.writeUint32( 2, @@ -20341,65 +22358,89 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** - * optional uint32 version_number = 1; - * @return {number} + * optional bytes pro_tx_hash = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.getVersionNumber = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} returns this + * optional bytes pro_tx_hash = 1; + * This is a type-conversion wrapper around `getProTxHash()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.setVersionNumber = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getProTxHash())); }; /** - * optional uint32 vote_count = 2; + * optional bytes pro_tx_hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getProTxHash()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getProTxHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.setProTxHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional uint32 version = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.getVoteCount = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getVersion = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.setVoteCount = function(value) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.setVersion = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; /** - * optional Versions versions = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} + * optional VersionSignals versions = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getVersions = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getVersions = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setVersions = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setVersions = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearVersions = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearVersions = function() { return this.setVersions(undefined); }; @@ -20408,7 +22449,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasVersions = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasVersions = function() { return jspb.Message.getField(this, 1) != null; }; @@ -20417,7 +22458,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -20425,18 +22466,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -20445,7 +22486,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -20454,7 +22495,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -20462,18 +22503,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -20482,35 +22523,35 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetProtocolVersionUpgradeStateResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} + * optional GetProtocolVersionUpgradeVoteStatusResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -20519,7 +22560,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -20533,21 +22574,21 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_[0])); }; @@ -20565,8 +22606,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject(opt_includeInstance, this); }; @@ -20575,13 +22616,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.proto * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -20595,23 +22636,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObj /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -20619,8 +22660,8 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deser var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -20636,9 +22677,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deser * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -20646,18 +22687,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.proto /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter ); } }; @@ -20679,8 +22720,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(opt_includeInstance, this); }; @@ -20689,15 +22730,16 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - startProTxHash: msg.getStartProTxHash_asB64(), + startEpoch: (f = msg.getStartEpoch()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), count: jspb.Message.getFieldWithDefault(msg, 2, 0), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) + ascending: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 4, false) }; if (includeInstance) { @@ -20711,23 +22753,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -20735,14 +22777,19 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setStartProTxHash(value); + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setStartEpoch(value); break; case 2: var value = /** @type {number} */ (reader.readUint32()); msg.setCount(value); break; case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setAscending(value); + break; + case 4: var value = /** @type {boolean} */ (reader.readBool()); msg.setProve(value); break; @@ -20759,9 +22806,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -20769,17 +22816,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getStartProTxHash_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getStartEpoch(); + if (f != null) { + writer.writeMessage( 1, - f + f, + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter ); } f = message.getCount(); @@ -20789,55 +22837,57 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr f ); } - f = message.getProve(); + f = message.getAscending(); if (f) { writer.writeBool( 3, f ); } + f = message.getProve(); + if (f) { + writer.writeBool( + 4, + f + ); + } }; /** - * optional bytes start_pro_tx_hash = 1; - * @return {string} + * optional google.protobuf.UInt32Value start_epoch = 1; + * @return {?proto.google.protobuf.UInt32Value} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getStartEpoch = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 1)); }; /** - * optional bytes start_pro_tx_hash = 1; - * This is a type-conversion wrapper around `getStartProTxHash()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getStartProTxHash())); + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setStartEpoch = function(value) { + return jspb.Message.setWrapperField(this, 1, value); }; /** - * optional bytes start_pro_tx_hash = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getStartProTxHash()` - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getStartProTxHash())); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.clearStartEpoch = function() { + return this.setStartEpoch(undefined); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setStartProTxHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.hasStartEpoch = function() { + return jspb.Message.getField(this, 1) != null; }; @@ -20845,62 +22895,80 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr * optional uint32 count = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getCount = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getCount = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setCount = function(value) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setCount = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; /** - * optional bool prove = 3; + * optional bool ascending = 3; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getProve = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getAscending = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setProve = function(value) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setAscending = function(value) { return jspb.Message.setProto3BooleanField(this, 3, value); }; /** - * optional GetProtocolVersionUpgradeVoteStatusRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} + * optional bool prove = 4; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} returns this + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 4, value); +}; + + +/** + * optional GetEpochsInfoRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -20909,7 +22977,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.proto * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -20923,21 +22991,21 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.proto * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_[0])); }; @@ -20955,8 +23023,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject(opt_includeInstance, this); }; @@ -20965,13 +23033,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -20985,23 +23053,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toOb /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21009,8 +23077,8 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.dese var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -21026,9 +23094,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.dese * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21036,18 +23104,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter ); } }; @@ -21062,22 +23130,22 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.seri * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase = { RESULT_NOT_SET: 0, - VERSIONS: 1, + EPOCHS: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0])); }; @@ -21095,8 +23163,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(opt_includeInstance, this); }; @@ -21105,13 +23173,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - versions: (f = msg.getVersions()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(includeInstance, f), + epochs: (f = msg.getEpochs()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(includeInstance, f), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -21127,23 +23195,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21151,9 +23219,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader); - msg.setVersions(value); + var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader); + msg.setEpochs(value); break; case 2: var value = new proto.org.dash.platform.dapi.v0.Proof; @@ -21178,9 +23246,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21188,18 +23256,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getVersions(); + f = message.getEpochs(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter ); } f = message.getProof(); @@ -21227,7 +23295,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.repeatedFields_ = [1]; @@ -21244,8 +23312,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(opt_includeInstance, this); }; @@ -21254,14 +23322,14 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject = function(includeInstance, msg) { var f, obj = { - versionSignalsList: jspb.Message.toObjectList(msg.getVersionSignalsList(), - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject, includeInstance) + epochInfosList: jspb.Message.toObjectList(msg.getEpochInfosList(), + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject, includeInstance) }; if (includeInstance) { @@ -21275,23 +23343,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21299,9 +23367,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader); - msg.addVersionSignals(value); + var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader); + msg.addEpochInfos(value); break; default: reader.skipField(); @@ -21316,9 +23384,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21326,58 +23394,58 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getVersionSignalsList(); + f = message.getEpochInfosList(); if (f.length > 0) { writer.writeRepeatedMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter ); } }; /** - * repeated VersionSignal version_signals = 1; - * @return {!Array} + * repeated EpochInfo epoch_infos = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.getVersionSignalsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, 1)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.getEpochInfosList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, 1)); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} returns this + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.setVersionSignalsList = function(value) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.setEpochInfosList = function(value) { return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal=} opt_value + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo=} opt_value * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.addVersionSignals = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, opt_index); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.addEpochInfos = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, opt_index); }; /** * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.clearVersionSignalsList = function() { - return this.setVersionSignalsList([]); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.clearEpochInfosList = function() { + return this.setEpochInfosList([]); }; @@ -21397,8 +23465,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject(opt_includeInstance, this); }; @@ -21407,14 +23475,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject = function(includeInstance, msg) { var f, obj = { - proTxHash: msg.getProTxHash_asB64(), - version: jspb.Message.getFieldWithDefault(msg, 2, 0) + number: jspb.Message.getFieldWithDefault(msg, 1, 0), + firstBlockHeight: jspb.Message.getFieldWithDefault(msg, 2, 0), + firstCoreBlockHeight: jspb.Message.getFieldWithDefault(msg, 3, 0), + startTime: jspb.Message.getFieldWithDefault(msg, 4, 0), + feeMultiplier: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0), + protocolVersion: jspb.Message.getFieldWithDefault(msg, 6, 0) }; if (includeInstance) { @@ -21428,23 +23500,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21452,12 +23524,28 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setProTxHash(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setNumber(value); break; case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setFirstBlockHeight(value); + break; + case 3: var value = /** @type {number} */ (reader.readUint32()); - msg.setVersion(value); + msg.setFirstCoreBlockHeight(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint64()); + msg.setStartTime(value); + break; + case 5: + var value = /** @type {number} */ (reader.readDouble()); + msg.setFeeMultiplier(value); + break; + case 6: + var value = /** @type {number} */ (reader.readUint32()); + msg.setProtocolVersion(value); break; default: reader.skipField(); @@ -21472,9 +23560,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21482,114 +23570,190 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getProTxHash_asU8(); - if (f.length > 0) { - writer.writeBytes( - 1, - f - ); - } - f = message.getVersion(); - if (f !== 0) { - writer.writeUint32( - 2, - f - ); - } +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getNumber(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getFirstBlockHeight(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } + f = message.getFirstCoreBlockHeight(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } + f = message.getStartTime(); + if (f !== 0) { + writer.writeUint64( + 4, + f + ); + } + f = message.getFeeMultiplier(); + if (f !== 0.0) { + writer.writeDouble( + 5, + f + ); + } + f = message.getProtocolVersion(); + if (f !== 0) { + writer.writeUint32( + 6, + f + ); + } +}; + + +/** + * optional uint32 number = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getNumber = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setNumber = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint64 first_block_height = 2; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFirstBlockHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFirstBlockHeight = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional uint32 first_core_block_height = 3; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFirstCoreBlockHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFirstCoreBlockHeight = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); }; /** - * optional bytes pro_tx_hash = 1; - * @return {string} + * optional uint64 start_time = 4; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getStartTime = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); }; /** - * optional bytes pro_tx_hash = 1; - * This is a type-conversion wrapper around `getProTxHash()` - * @return {string} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getProTxHash())); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setStartTime = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); }; /** - * optional bytes pro_tx_hash = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getProTxHash()` - * @return {!Uint8Array} + * optional double fee_multiplier = 5; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getProTxHash())); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFeeMultiplier = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.setProTxHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFeeMultiplier = function(value) { + return jspb.Message.setProto3FloatField(this, 5, value); }; /** - * optional uint32 version = 2; + * optional uint32 protocol_version = 6; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getVersion = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getProtocolVersion = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.setVersion = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setProtocolVersion = function(value) { + return jspb.Message.setProto3IntField(this, 6, value); }; /** - * optional VersionSignals versions = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} + * optional EpochInfos epochs = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getVersions = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals, 1)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getEpochs = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setVersions = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setEpochs = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearVersions = function() { - return this.setVersions(undefined); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearEpochs = function() { + return this.setEpochs(undefined); }; @@ -21597,7 +23761,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasVersions = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasEpochs = function() { return jspb.Message.getField(this, 1) != null; }; @@ -21606,7 +23770,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -21614,18 +23778,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -21634,7 +23798,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -21643,7 +23807,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -21651,18 +23815,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -21671,35 +23835,35 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetProtocolVersionUpgradeVoteStatusResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} + * optional GetEpochsInfoResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -21708,7 +23872,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prot * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -21722,21 +23886,21 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prot * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetPathElementsRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetPathElementsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.oneofGroups_[0])); }; @@ -21754,8 +23918,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsRequest.toObject(opt_includeInstance, this); }; @@ -21764,13 +23928,13 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.toObject = functi * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -21784,23 +23948,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject = function(include /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsRequest; + return proto.org.dash.platform.dapi.v0.GetPathElementsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21808,8 +23972,8 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -21825,9 +23989,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21835,24 +23999,31 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.serializeBinary = /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.serializeBinaryToWriter ); } }; +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.repeatedFields_ = [1,2]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -21868,8 +24039,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.toObject(opt_includeInstance, this); }; @@ -21878,16 +24049,15 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - startEpoch: (f = msg.getStartEpoch()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), - count: jspb.Message.getFieldWithDefault(msg, 2, 0), - ascending: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 4, false) + pathList: msg.getPathList_asB64(), + keysList: msg.getKeysList_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) }; if (includeInstance) { @@ -21901,23 +24071,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toOb /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0; + return proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21925,19 +24095,14 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.dese var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new google_protobuf_wrappers_pb.UInt32Value; - reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); - msg.setStartEpoch(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addPath(value); break; case 2: - var value = /** @type {number} */ (reader.readUint32()); - msg.setCount(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addKeys(value); break; case 3: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setAscending(value); - break; - case 4: var value = /** @type {boolean} */ (reader.readBool()); msg.setProve(value); break; @@ -21954,9 +24119,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.dese * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21964,38 +24129,30 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getStartEpoch(); - if (f != null) { - writer.writeMessage( + f = message.getPathList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( 1, - f, - google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter - ); - } - f = message.getCount(); - if (f !== 0) { - writer.writeUint32( - 2, f ); } - f = message.getAscending(); - if (f) { - writer.writeBool( - 3, + f = message.getKeysList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 2, f ); } f = message.getProve(); if (f) { writer.writeBool( - 4, + 3, f ); } @@ -22003,120 +24160,169 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.seri /** - * optional google.protobuf.UInt32Value start_epoch = 1; - * @return {?proto.google.protobuf.UInt32Value} + * repeated bytes path = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getPathList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * repeated bytes path = 1; + * This is a type-conversion wrapper around `getPathList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getPathList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getPathList())); +}; + + +/** + * repeated bytes path = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPathList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getPathList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getPathList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.setPathList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getStartEpoch = function() { - return /** @type{?proto.google.protobuf.UInt32Value} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 1)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.addPath = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; /** - * @param {?proto.google.protobuf.UInt32Value|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setStartEpoch = function(value) { - return jspb.Message.setWrapperField(this, 1, value); + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.clearPathList = function() { + return this.setPathList([]); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + * repeated bytes keys = 2; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.clearStartEpoch = function() { - return this.setStartEpoch(undefined); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getKeysList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); }; /** - * Returns whether this field is set. - * @return {boolean} + * repeated bytes keys = 2; + * This is a type-conversion wrapper around `getKeysList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.hasStartEpoch = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getKeysList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getKeysList())); }; /** - * optional uint32 count = 2; - * @return {number} + * repeated bytes keys = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKeysList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getCount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getKeysList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getKeysList())); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setCount = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.setKeysList = function(value) { + return jspb.Message.setField(this, 2, value || []); }; /** - * optional bool ascending = 3; - * @return {boolean} + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getAscending = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.addKeys = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setAscending = function(value) { - return jspb.Message.setProto3BooleanField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.clearKeysList = function() { + return this.setKeysList([]); }; /** - * optional bool prove = 4; + * optional bool prove = 3; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); }; /** - * optional GetEpochsInfoRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} + * optional GetPathElementsRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -22125,7 +24331,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.clearV0 = functio * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -22139,21 +24345,21 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.hasV0 = function( * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetPathElementsResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetPathElementsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.oneofGroups_[0])); }; @@ -22171,8 +24377,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.toObject(opt_includeInstance, this); }; @@ -22181,13 +24387,13 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.toObject = funct * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -22201,23 +24407,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject = function(includ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse; + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -22225,8 +24431,8 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReade var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -22242,9 +24448,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReade * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -22252,18 +24458,18 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.serializeBinaryToWriter ); } }; @@ -22278,22 +24484,22 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter = * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.ResultCase = { RESULT_NOT_SET: 0, - EPOCHS: 1, + ELEMENTS: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_[0])); }; @@ -22311,8 +24517,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.toObject(opt_includeInstance, this); }; @@ -22321,13 +24527,13 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - epochs: (f = msg.getEpochs()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(includeInstance, f), + elements: (f = msg.getElements()) && proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.toObject(includeInstance, f), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -22343,23 +24549,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.to /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0; + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -22367,157 +24573,19 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.de var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader); - msg.setEpochs(value); + var value = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.deserializeBinaryFromReader); + msg.setElements(value); break; case 2: var value = new proto.org.dash.platform.dapi.v0.Proof; reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); msg.setProof(value); break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getEpochs(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter - ); - } - f = message.getProof(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter - ); - } -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.repeatedFields_ = [1]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject = function(includeInstance, msg) { - var f, obj = { - epochInfosList: jspb.Message.toObjectList(msg.getEpochInfosList(), - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject, includeInstance) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader); - msg.addEpochInfos(value); + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -22532,9 +24600,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -22542,61 +24610,46 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getEpochInfosList(); - if (f.length > 0) { - writer.writeRepeatedMessage( + f = message.getElements(); + if (f != null) { + writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; -/** - * repeated EpochInfo epoch_infos = 1; - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.getEpochInfosList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} returns this -*/ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.setEpochInfosList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.addEpochInfos = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, opt_index); -}; - /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} returns this + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.clearEpochInfosList = function() { - return this.setEpochInfosList([]); -}; - - +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.repeatedFields_ = [1]; @@ -22613,8 +24666,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.toObject(opt_includeInstance, this); }; @@ -22623,17 +24676,13 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.toObject = function(includeInstance, msg) { var f, obj = { - number: jspb.Message.getFieldWithDefault(msg, 1, 0), - firstBlockHeight: jspb.Message.getFieldWithDefault(msg, 2, 0), - firstCoreBlockHeight: jspb.Message.getFieldWithDefault(msg, 3, 0), - startTime: jspb.Message.getFieldWithDefault(msg, 4, 0), - feeMultiplier: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0) + elementsList: msg.getElementsList_asB64() }; if (includeInstance) { @@ -22647,23 +24696,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements; + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -22671,24 +24720,8 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readUint32()); - msg.setNumber(value); - break; - case 2: - var value = /** @type {number} */ (reader.readUint64()); - msg.setFirstBlockHeight(value); - break; - case 3: - var value = /** @type {number} */ (reader.readUint32()); - msg.setFirstCoreBlockHeight(value); - break; - case 4: - var value = /** @type {number} */ (reader.readUint64()); - msg.setStartTime(value); - break; - case 5: - var value = /** @type {number} */ (reader.readDouble()); - msg.setFeeMultiplier(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addElements(value); break; default: reader.skipField(); @@ -22703,9 +24736,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -22713,165 +24746,108 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getNumber(); - if (f !== 0) { - writer.writeUint32( + f = message.getElementsList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( 1, f ); } - f = message.getFirstBlockHeight(); - if (f !== 0) { - writer.writeUint64( - 2, - f - ); - } - f = message.getFirstCoreBlockHeight(); - if (f !== 0) { - writer.writeUint32( - 3, - f - ); - } - f = message.getStartTime(); - if (f !== 0) { - writer.writeUint64( - 4, - f - ); - } - f = message.getFeeMultiplier(); - if (f !== 0.0) { - writer.writeDouble( - 5, - f - ); - } -}; - - -/** - * optional uint32 number = 1; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getNumber = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setNumber = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional uint64 first_block_height = 2; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFirstBlockHeight = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFirstBlockHeight = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); }; /** - * optional uint32 first_core_block_height = 3; - * @return {number} + * repeated bytes elements = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFirstCoreBlockHeight = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.getElementsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + * repeated bytes elements = 1; + * This is a type-conversion wrapper around `getElementsList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFirstCoreBlockHeight = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.getElementsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getElementsList())); }; /** - * optional uint64 start_time = 4; - * @return {number} + * repeated bytes elements = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getElementsList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getStartTime = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.getElementsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getElementsList())); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setStartTime = function(value) { - return jspb.Message.setProto3IntField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.setElementsList = function(value) { + return jspb.Message.setField(this, 1, value || []); }; /** - * optional double fee_multiplier = 5; - * @return {number} + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFeeMultiplier = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.addElements = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFeeMultiplier = function(value) { - return jspb.Message.setProto3FloatField(this, 5, value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.clearElementsList = function() { + return this.setElementsList([]); }; /** - * optional EpochInfos epochs = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} + * optional Elements elements = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getEpochs = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos, 1)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.getElements = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setEpochs = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.setElements = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearEpochs = function() { - return this.setEpochs(undefined); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.clearElements = function() { + return this.setElements(undefined); }; @@ -22879,7 +24855,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasEpochs = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.hasElements = function() { return jspb.Message.getField(this, 1) != null; }; @@ -22888,7 +24864,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -22896,18 +24872,18 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -22916,7 +24892,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -22925,7 +24901,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -22933,18 +24909,18 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -22953,35 +24929,35 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetEpochsInfoResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} + * optional GetPathElementsResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -22990,9 +24966,20 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.clearV0 = functi * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.KeyPurpose = { + AUTHENTICATION: 0, + ENCRYPTION: 1, + DECRYPTION: 2, + TRANSFER: 3, + VOTING: 5 +}; + goog.object.extend(exports, proto.org.dash.platform.dapi.v0); diff --git a/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbobjc.h b/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbobjc.h index 6939dd72dc5..658a32ab954 100644 --- a/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbobjc.h +++ b/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbobjc.h @@ -51,15 +51,11 @@ CF_EXTERN_C_BEGIN @class GetEpochsInfoResponse_GetEpochsInfoResponseV0; @class GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo; @class GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos; -@class GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0; -@class GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0; -@class GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes; -@class GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry; -@class GetIdentitiesRequest_GetIdentitiesRequestV0; -@class GetIdentitiesResponse_GetIdentitiesResponseV0; -@class GetIdentitiesResponse_Identities; -@class GetIdentitiesResponse_IdentityEntry; -@class GetIdentitiesResponse_IdentityValue; +@class GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0; +@class GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0; +@class GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys; +@class GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys; +@class GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys; @class GetIdentityBalanceAndRevisionRequest_GetIdentityBalanceAndRevisionRequestV0; @class GetIdentityBalanceAndRevisionResponse_GetIdentityBalanceAndRevisionResponseV0; @class GetIdentityBalanceAndRevisionResponse_GetIdentityBalanceAndRevisionResponseV0_BalanceAndRevision; @@ -67,11 +63,18 @@ CF_EXTERN_C_BEGIN @class GetIdentityBalanceResponse_GetIdentityBalanceResponseV0; @class GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0; @class GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0; +@class GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0; +@class GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0; @class GetIdentityKeysRequest_GetIdentityKeysRequestV0; @class GetIdentityKeysResponse_GetIdentityKeysResponseV0; @class GetIdentityKeysResponse_GetIdentityKeysResponseV0_Keys; +@class GetIdentityNonceRequest_GetIdentityNonceRequestV0; +@class GetIdentityNonceResponse_GetIdentityNonceResponseV0; @class GetIdentityRequest_GetIdentityRequestV0; @class GetIdentityResponse_GetIdentityResponseV0; +@class GetPathElementsRequest_GetPathElementsRequestV0; +@class GetPathElementsResponse_GetPathElementsResponseV0; +@class GetPathElementsResponse_GetPathElementsResponseV0_Elements; @class GetProofsRequest_GetProofsRequestV0; @class GetProofsRequest_GetProofsRequestV0_ContractRequest; @class GetProofsRequest_GetProofsRequestV0_DocumentRequest; @@ -97,6 +100,30 @@ CF_EXTERN_C_BEGIN NS_ASSUME_NONNULL_BEGIN +#pragma mark - Enum KeyPurpose + +typedef GPB_ENUM(KeyPurpose) { + /** + * Value used if any message's field encounters a value that is not defined + * by this enum. The message will also have C functions to get/set the rawValue + * of the field. + **/ + KeyPurpose_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, + KeyPurpose_Authentication = 0, + KeyPurpose_Encryption = 1, + KeyPurpose_Decryption = 2, + KeyPurpose_Transfer = 3, + KeyPurpose_Voting = 5, +}; + +GPBEnumDescriptor *KeyPurpose_EnumDescriptor(void); + +/** + * Checks to see if the given value is defined by the enum or was not known at + * the time this source was generated. + **/ +BOOL KeyPurpose_IsValidValue(int32_t value); + #pragma mark - Enum SecurityLevelMap_KeyKindRequestType typedef GPB_ENUM(SecurityLevelMap_KeyKindRequestType) { @@ -130,6 +157,7 @@ typedef GPB_ENUM(GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type) { GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_FullIdentity = 0, GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Balance = 1, GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Keys = 2, + GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Revision = 3, }; GPBEnumDescriptor *GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_EnumDescriptor(void); @@ -284,6 +312,87 @@ GPB_FINAL @interface GetIdentityRequest_GetIdentityRequestV0 : GPBMessage @end +#pragma mark - GetIdentityNonceRequest + +typedef GPB_ENUM(GetIdentityNonceRequest_FieldNumber) { + GetIdentityNonceRequest_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetIdentityNonceRequest_Version_OneOfCase) { + GetIdentityNonceRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetIdentityNonceRequest_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetIdentityNonceRequest : GPBMessage + +@property(nonatomic, readonly) GetIdentityNonceRequest_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetIdentityNonceRequest_GetIdentityNonceRequestV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetIdentityNonceRequest_ClearVersionOneOfCase(GetIdentityNonceRequest *message); + +#pragma mark - GetIdentityNonceRequest_GetIdentityNonceRequestV0 + +typedef GPB_ENUM(GetIdentityNonceRequest_GetIdentityNonceRequestV0_FieldNumber) { + GetIdentityNonceRequest_GetIdentityNonceRequestV0_FieldNumber_IdentityId = 1, + GetIdentityNonceRequest_GetIdentityNonceRequestV0_FieldNumber_Prove = 2, +}; + +GPB_FINAL @interface GetIdentityNonceRequest_GetIdentityNonceRequestV0 : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *identityId; + +@property(nonatomic, readwrite) BOOL prove; + +@end + +#pragma mark - GetIdentityContractNonceRequest + +typedef GPB_ENUM(GetIdentityContractNonceRequest_FieldNumber) { + GetIdentityContractNonceRequest_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetIdentityContractNonceRequest_Version_OneOfCase) { + GetIdentityContractNonceRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetIdentityContractNonceRequest_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetIdentityContractNonceRequest : GPBMessage + +@property(nonatomic, readonly) GetIdentityContractNonceRequest_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetIdentityContractNonceRequest_ClearVersionOneOfCase(GetIdentityContractNonceRequest *message); + +#pragma mark - GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0 + +typedef GPB_ENUM(GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0_FieldNumber) { + GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0_FieldNumber_IdentityId = 1, + GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0_FieldNumber_ContractId = 2, + GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0_FieldNumber_Prove = 3, +}; + +GPB_FINAL @interface GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0 : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *identityId; + +@property(nonatomic, readwrite, copy, null_resettable) NSData *contractId; + +@property(nonatomic, readwrite) BOOL prove; + +@end + #pragma mark - GetIdentityBalanceRequest typedef GPB_ENUM(GetIdentityBalanceRequest_FieldNumber) { @@ -419,133 +528,106 @@ GPB_FINAL @interface GetIdentityResponse_GetIdentityResponseV0 : GPBMessage **/ void GetIdentityResponse_GetIdentityResponseV0_ClearResultOneOfCase(GetIdentityResponse_GetIdentityResponseV0 *message); -#pragma mark - GetIdentitiesRequest +#pragma mark - GetIdentityNonceResponse -typedef GPB_ENUM(GetIdentitiesRequest_FieldNumber) { - GetIdentitiesRequest_FieldNumber_V0 = 1, +typedef GPB_ENUM(GetIdentityNonceResponse_FieldNumber) { + GetIdentityNonceResponse_FieldNumber_V0 = 1, }; -typedef GPB_ENUM(GetIdentitiesRequest_Version_OneOfCase) { - GetIdentitiesRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, - GetIdentitiesRequest_Version_OneOfCase_V0 = 1, +typedef GPB_ENUM(GetIdentityNonceResponse_Version_OneOfCase) { + GetIdentityNonceResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetIdentityNonceResponse_Version_OneOfCase_V0 = 1, }; -GPB_FINAL @interface GetIdentitiesRequest : GPBMessage +GPB_FINAL @interface GetIdentityNonceResponse : GPBMessage -@property(nonatomic, readonly) GetIdentitiesRequest_Version_OneOfCase versionOneOfCase; +@property(nonatomic, readonly) GetIdentityNonceResponse_Version_OneOfCase versionOneOfCase; -@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesRequest_GetIdentitiesRequestV0 *v0; +@property(nonatomic, readwrite, strong, null_resettable) GetIdentityNonceResponse_GetIdentityNonceResponseV0 *v0; @end /** * Clears whatever value was set for the oneof 'version'. **/ -void GetIdentitiesRequest_ClearVersionOneOfCase(GetIdentitiesRequest *message); +void GetIdentityNonceResponse_ClearVersionOneOfCase(GetIdentityNonceResponse *message); -#pragma mark - GetIdentitiesRequest_GetIdentitiesRequestV0 +#pragma mark - GetIdentityNonceResponse_GetIdentityNonceResponseV0 -typedef GPB_ENUM(GetIdentitiesRequest_GetIdentitiesRequestV0_FieldNumber) { - GetIdentitiesRequest_GetIdentitiesRequestV0_FieldNumber_IdsArray = 1, - GetIdentitiesRequest_GetIdentitiesRequestV0_FieldNumber_Prove = 2, +typedef GPB_ENUM(GetIdentityNonceResponse_GetIdentityNonceResponseV0_FieldNumber) { + GetIdentityNonceResponse_GetIdentityNonceResponseV0_FieldNumber_IdentityNonce = 1, + GetIdentityNonceResponse_GetIdentityNonceResponseV0_FieldNumber_Proof = 2, + GetIdentityNonceResponse_GetIdentityNonceResponseV0_FieldNumber_Metadata = 3, }; -GPB_FINAL @interface GetIdentitiesRequest_GetIdentitiesRequestV0 : GPBMessage - -@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *idsArray; -/** The number of items in @c idsArray without causing the array to be created. */ -@property(nonatomic, readonly) NSUInteger idsArray_Count; - -@property(nonatomic, readwrite) BOOL prove; - -@end - -#pragma mark - GetIdentitiesResponse - -typedef GPB_ENUM(GetIdentitiesResponse_FieldNumber) { - GetIdentitiesResponse_FieldNumber_V0 = 1, +typedef GPB_ENUM(GetIdentityNonceResponse_GetIdentityNonceResponseV0_Result_OneOfCase) { + GetIdentityNonceResponse_GetIdentityNonceResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, + GetIdentityNonceResponse_GetIdentityNonceResponseV0_Result_OneOfCase_IdentityNonce = 1, + GetIdentityNonceResponse_GetIdentityNonceResponseV0_Result_OneOfCase_Proof = 2, }; -typedef GPB_ENUM(GetIdentitiesResponse_Version_OneOfCase) { - GetIdentitiesResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, - GetIdentitiesResponse_Version_OneOfCase_V0 = 1, -}; +GPB_FINAL @interface GetIdentityNonceResponse_GetIdentityNonceResponseV0 : GPBMessage + +@property(nonatomic, readonly) GetIdentityNonceResponse_GetIdentityNonceResponseV0_Result_OneOfCase resultOneOfCase; -GPB_FINAL @interface GetIdentitiesResponse : GPBMessage +@property(nonatomic, readwrite) uint64_t identityNonce; -@property(nonatomic, readonly) GetIdentitiesResponse_Version_OneOfCase versionOneOfCase; +@property(nonatomic, readwrite, strong, null_resettable) Proof *proof; -@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesResponse_GetIdentitiesResponseV0 *v0; +@property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; +/** Test to see if @c metadata has been set. */ +@property(nonatomic, readwrite) BOOL hasMetadata; @end /** - * Clears whatever value was set for the oneof 'version'. + * Clears whatever value was set for the oneof 'result'. **/ -void GetIdentitiesResponse_ClearVersionOneOfCase(GetIdentitiesResponse *message); +void GetIdentityNonceResponse_GetIdentityNonceResponseV0_ClearResultOneOfCase(GetIdentityNonceResponse_GetIdentityNonceResponseV0 *message); -#pragma mark - GetIdentitiesResponse_IdentityValue +#pragma mark - GetIdentityContractNonceResponse -typedef GPB_ENUM(GetIdentitiesResponse_IdentityValue_FieldNumber) { - GetIdentitiesResponse_IdentityValue_FieldNumber_Value = 1, +typedef GPB_ENUM(GetIdentityContractNonceResponse_FieldNumber) { + GetIdentityContractNonceResponse_FieldNumber_V0 = 1, }; -GPB_FINAL @interface GetIdentitiesResponse_IdentityValue : GPBMessage - -@property(nonatomic, readwrite, copy, null_resettable) NSData *value; - -@end - -#pragma mark - GetIdentitiesResponse_IdentityEntry - -typedef GPB_ENUM(GetIdentitiesResponse_IdentityEntry_FieldNumber) { - GetIdentitiesResponse_IdentityEntry_FieldNumber_Key = 1, - GetIdentitiesResponse_IdentityEntry_FieldNumber_Value = 2, +typedef GPB_ENUM(GetIdentityContractNonceResponse_Version_OneOfCase) { + GetIdentityContractNonceResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetIdentityContractNonceResponse_Version_OneOfCase_V0 = 1, }; -GPB_FINAL @interface GetIdentitiesResponse_IdentityEntry : GPBMessage +GPB_FINAL @interface GetIdentityContractNonceResponse : GPBMessage -@property(nonatomic, readwrite, copy, null_resettable) NSData *key; +@property(nonatomic, readonly) GetIdentityContractNonceResponse_Version_OneOfCase versionOneOfCase; -@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesResponse_IdentityValue *value; -/** Test to see if @c value has been set. */ -@property(nonatomic, readwrite) BOOL hasValue; +@property(nonatomic, readwrite, strong, null_resettable) GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 *v0; @end -#pragma mark - GetIdentitiesResponse_Identities - -typedef GPB_ENUM(GetIdentitiesResponse_Identities_FieldNumber) { - GetIdentitiesResponse_Identities_FieldNumber_IdentityEntriesArray = 1, -}; - -GPB_FINAL @interface GetIdentitiesResponse_Identities : GPBMessage - -@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *identityEntriesArray; -/** The number of items in @c identityEntriesArray without causing the array to be created. */ -@property(nonatomic, readonly) NSUInteger identityEntriesArray_Count; - -@end +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetIdentityContractNonceResponse_ClearVersionOneOfCase(GetIdentityContractNonceResponse *message); -#pragma mark - GetIdentitiesResponse_GetIdentitiesResponseV0 +#pragma mark - GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 -typedef GPB_ENUM(GetIdentitiesResponse_GetIdentitiesResponseV0_FieldNumber) { - GetIdentitiesResponse_GetIdentitiesResponseV0_FieldNumber_Identities = 1, - GetIdentitiesResponse_GetIdentitiesResponseV0_FieldNumber_Proof = 2, - GetIdentitiesResponse_GetIdentitiesResponseV0_FieldNumber_Metadata = 3, +typedef GPB_ENUM(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_FieldNumber) { + GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_FieldNumber_IdentityContractNonce = 1, + GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_FieldNumber_Proof = 2, + GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_FieldNumber_Metadata = 3, }; -typedef GPB_ENUM(GetIdentitiesResponse_GetIdentitiesResponseV0_Result_OneOfCase) { - GetIdentitiesResponse_GetIdentitiesResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, - GetIdentitiesResponse_GetIdentitiesResponseV0_Result_OneOfCase_Identities = 1, - GetIdentitiesResponse_GetIdentitiesResponseV0_Result_OneOfCase_Proof = 2, +typedef GPB_ENUM(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_Result_OneOfCase) { + GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, + GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_Result_OneOfCase_IdentityContractNonce = 1, + GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_Result_OneOfCase_Proof = 2, }; -GPB_FINAL @interface GetIdentitiesResponse_GetIdentitiesResponseV0 : GPBMessage +GPB_FINAL @interface GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 : GPBMessage -@property(nonatomic, readonly) GetIdentitiesResponse_GetIdentitiesResponseV0_Result_OneOfCase resultOneOfCase; +@property(nonatomic, readonly) GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_Result_OneOfCase resultOneOfCase; -@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesResponse_Identities *identities; +@property(nonatomic, readwrite) uint64_t identityContractNonce; @property(nonatomic, readwrite, strong, null_resettable) Proof *proof; @@ -558,7 +640,7 @@ GPB_FINAL @interface GetIdentitiesResponse_GetIdentitiesResponseV0 : GPBMessage /** * Clears whatever value was set for the oneof 'result'. **/ -void GetIdentitiesResponse_GetIdentitiesResponseV0_ClearResultOneOfCase(GetIdentitiesResponse_GetIdentitiesResponseV0 *message); +void GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_ClearResultOneOfCase(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 *message); #pragma mark - GetIdentityBalanceResponse @@ -895,6 +977,178 @@ GPB_FINAL @interface GetIdentityKeysResponse_GetIdentityKeysResponseV0_Keys : GP @end +#pragma mark - GetIdentitiesContractKeysRequest + +typedef GPB_ENUM(GetIdentitiesContractKeysRequest_FieldNumber) { + GetIdentitiesContractKeysRequest_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetIdentitiesContractKeysRequest_Version_OneOfCase) { + GetIdentitiesContractKeysRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetIdentitiesContractKeysRequest_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetIdentitiesContractKeysRequest : GPBMessage + +@property(nonatomic, readonly) GetIdentitiesContractKeysRequest_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetIdentitiesContractKeysRequest_ClearVersionOneOfCase(GetIdentitiesContractKeysRequest *message); + +#pragma mark - GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0 + +typedef GPB_ENUM(GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber) { + GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_IdentitiesIdsArray = 1, + GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_ContractId = 2, + GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_DocumentTypeName = 3, + GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_PurposesArray = 4, + GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_Prove = 5, +}; + +GPB_FINAL @interface GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0 : GPBMessage + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *identitiesIdsArray; +/** The number of items in @c identitiesIdsArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger identitiesIdsArray_Count; + +@property(nonatomic, readwrite, copy, null_resettable) NSData *contractId; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *documentTypeName; +/** Test to see if @c documentTypeName has been set. */ +@property(nonatomic, readwrite) BOOL hasDocumentTypeName; + +// |purposesArray| contains |KeyPurpose| +@property(nonatomic, readwrite, strong, null_resettable) GPBEnumArray *purposesArray; +/** The number of items in @c purposesArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger purposesArray_Count; + +@property(nonatomic, readwrite) BOOL prove; + +@end + +#pragma mark - GetIdentitiesContractKeysResponse + +typedef GPB_ENUM(GetIdentitiesContractKeysResponse_FieldNumber) { + GetIdentitiesContractKeysResponse_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetIdentitiesContractKeysResponse_Version_OneOfCase) { + GetIdentitiesContractKeysResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetIdentitiesContractKeysResponse_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetIdentitiesContractKeysResponse : GPBMessage + +@property(nonatomic, readonly) GetIdentitiesContractKeysResponse_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetIdentitiesContractKeysResponse_ClearVersionOneOfCase(GetIdentitiesContractKeysResponse *message); + +#pragma mark - GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 + +typedef GPB_ENUM(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_FieldNumber) { + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_FieldNumber_IdentitiesKeys = 1, + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_FieldNumber_Proof = 2, + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_FieldNumber_Metadata = 3, +}; + +typedef GPB_ENUM(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_Result_OneOfCase) { + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_Result_OneOfCase_IdentitiesKeys = 1, + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_Result_OneOfCase_Proof = 2, +}; + +GPB_FINAL @interface GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 : GPBMessage + +@property(nonatomic, readonly) GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_Result_OneOfCase resultOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys *identitiesKeys; + +@property(nonatomic, readwrite, strong, null_resettable) Proof *proof; + +@property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; +/** Test to see if @c metadata has been set. */ +@property(nonatomic, readwrite) BOOL hasMetadata; + +@end + +/** + * Clears whatever value was set for the oneof 'result'. + **/ +void GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_ClearResultOneOfCase(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 *message); + +#pragma mark - GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys + +typedef GPB_ENUM(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_FieldNumber) { + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_FieldNumber_Purpose = 1, + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_FieldNumber_KeysBytesArray = 2, +}; + +GPB_FINAL @interface GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys : GPBMessage + +@property(nonatomic, readwrite) KeyPurpose purpose; + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *keysBytesArray; +/** The number of items in @c keysBytesArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger keysBytesArray_Count; + +@end + +/** + * Fetches the raw value of a @c GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys's @c purpose property, even + * if the value was not defined by the enum at the time the code was generated. + **/ +int32_t GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_Purpose_RawValue(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys *message); +/** + * Sets the raw value of an @c GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys's @c purpose property, allowing + * it to be set to a value that was not defined by the enum at the time the code + * was generated. + **/ +void SetGetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_Purpose_RawValue(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys *message, int32_t value); + +#pragma mark - GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys + +typedef GPB_ENUM(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys_FieldNumber) { + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys_FieldNumber_IdentityId = 1, + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys_FieldNumber_KeysArray = 2, +}; + +GPB_FINAL @interface GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSData *identityId; + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *keysArray; +/** The number of items in @c keysArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger keysArray_Count; + +@end + +#pragma mark - GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys + +typedef GPB_ENUM(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys_FieldNumber) { + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys_FieldNumber_EntriesArray = 1, +}; + +GPB_FINAL @interface GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys : GPBMessage + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *entriesArray; +/** The number of items in @c entriesArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger entriesArray_Count; + +@end + #pragma mark - GetProofsRequest typedef GPB_ENUM(GetProofsRequest_FieldNumber) { @@ -1560,135 +1814,6 @@ GPB_FINAL @interface GetDocumentsResponse_GetDocumentsResponseV0_Documents : GPB @end -#pragma mark - GetIdentitiesByPublicKeyHashesRequest - -typedef GPB_ENUM(GetIdentitiesByPublicKeyHashesRequest_FieldNumber) { - GetIdentitiesByPublicKeyHashesRequest_FieldNumber_V0 = 1, -}; - -typedef GPB_ENUM(GetIdentitiesByPublicKeyHashesRequest_Version_OneOfCase) { - GetIdentitiesByPublicKeyHashesRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, - GetIdentitiesByPublicKeyHashesRequest_Version_OneOfCase_V0 = 1, -}; - -GPB_FINAL @interface GetIdentitiesByPublicKeyHashesRequest : GPBMessage - -@property(nonatomic, readonly) GetIdentitiesByPublicKeyHashesRequest_Version_OneOfCase versionOneOfCase; - -@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0 *v0; - -@end - -/** - * Clears whatever value was set for the oneof 'version'. - **/ -void GetIdentitiesByPublicKeyHashesRequest_ClearVersionOneOfCase(GetIdentitiesByPublicKeyHashesRequest *message); - -#pragma mark - GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0 - -typedef GPB_ENUM(GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0_FieldNumber) { - GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0_FieldNumber_PublicKeyHashesArray = 1, - GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0_FieldNumber_Prove = 2, -}; - -GPB_FINAL @interface GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0 : GPBMessage - -@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *publicKeyHashesArray; -/** The number of items in @c publicKeyHashesArray without causing the array to be created. */ -@property(nonatomic, readonly) NSUInteger publicKeyHashesArray_Count; - -@property(nonatomic, readwrite) BOOL prove; - -@end - -#pragma mark - GetIdentitiesByPublicKeyHashesResponse - -typedef GPB_ENUM(GetIdentitiesByPublicKeyHashesResponse_FieldNumber) { - GetIdentitiesByPublicKeyHashesResponse_FieldNumber_V0 = 1, -}; - -typedef GPB_ENUM(GetIdentitiesByPublicKeyHashesResponse_Version_OneOfCase) { - GetIdentitiesByPublicKeyHashesResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, - GetIdentitiesByPublicKeyHashesResponse_Version_OneOfCase_V0 = 1, -}; - -GPB_FINAL @interface GetIdentitiesByPublicKeyHashesResponse : GPBMessage - -@property(nonatomic, readonly) GetIdentitiesByPublicKeyHashesResponse_Version_OneOfCase versionOneOfCase; - -@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 *v0; - -@end - -/** - * Clears whatever value was set for the oneof 'version'. - **/ -void GetIdentitiesByPublicKeyHashesResponse_ClearVersionOneOfCase(GetIdentitiesByPublicKeyHashesResponse *message); - -#pragma mark - GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry - -typedef GPB_ENUM(GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry_FieldNumber) { - GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry_FieldNumber_PublicKeyHash = 1, - GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry_FieldNumber_Value = 2, -}; - -GPB_FINAL @interface GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry : GPBMessage - -@property(nonatomic, readwrite, copy, null_resettable) NSData *publicKeyHash; - -@property(nonatomic, readwrite, strong, null_resettable) GPBBytesValue *value; -/** Test to see if @c value has been set. */ -@property(nonatomic, readwrite) BOOL hasValue; - -@end - -#pragma mark - GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes - -typedef GPB_ENUM(GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes_FieldNumber) { - GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes_FieldNumber_IdentityEntriesArray = 1, -}; - -GPB_FINAL @interface GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes : GPBMessage - -@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *identityEntriesArray; -/** The number of items in @c identityEntriesArray without causing the array to be created. */ -@property(nonatomic, readonly) NSUInteger identityEntriesArray_Count; - -@end - -#pragma mark - GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 - -typedef GPB_ENUM(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_FieldNumber) { - GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_FieldNumber_Identities = 1, - GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_FieldNumber_Proof = 2, - GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_FieldNumber_Metadata = 3, -}; - -typedef GPB_ENUM(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_Result_OneOfCase) { - GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, - GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_Result_OneOfCase_Identities = 1, - GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_Result_OneOfCase_Proof = 2, -}; - -GPB_FINAL @interface GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 : GPBMessage - -@property(nonatomic, readonly) GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_Result_OneOfCase resultOneOfCase; - -@property(nonatomic, readwrite, strong, null_resettable) GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes *identities; - -@property(nonatomic, readwrite, strong, null_resettable) Proof *proof; - -@property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; -/** Test to see if @c metadata has been set. */ -@property(nonatomic, readwrite) BOOL hasMetadata; - -@end - -/** - * Clears whatever value was set for the oneof 'result'. - **/ -void GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_ClearResultOneOfCase(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 *message); - #pragma mark - GetIdentityByPublicKeyHashRequest typedef GPB_ENUM(GetIdentityByPublicKeyHashRequest_FieldNumber) { @@ -2375,6 +2500,7 @@ typedef GPB_ENUM(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNu GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_FirstCoreBlockHeight = 3, GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_StartTime = 4, GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_FeeMultiplier = 5, + GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_ProtocolVersion = 6, }; GPB_FINAL @interface GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo : GPBMessage @@ -2389,6 +2515,125 @@ GPB_FINAL @interface GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo : G @property(nonatomic, readwrite) double feeMultiplier; +@property(nonatomic, readwrite) uint32_t protocolVersion; + +@end + +#pragma mark - GetPathElementsRequest + +typedef GPB_ENUM(GetPathElementsRequest_FieldNumber) { + GetPathElementsRequest_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetPathElementsRequest_Version_OneOfCase) { + GetPathElementsRequest_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetPathElementsRequest_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetPathElementsRequest : GPBMessage + +@property(nonatomic, readonly) GetPathElementsRequest_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetPathElementsRequest_GetPathElementsRequestV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetPathElementsRequest_ClearVersionOneOfCase(GetPathElementsRequest *message); + +#pragma mark - GetPathElementsRequest_GetPathElementsRequestV0 + +typedef GPB_ENUM(GetPathElementsRequest_GetPathElementsRequestV0_FieldNumber) { + GetPathElementsRequest_GetPathElementsRequestV0_FieldNumber_PathArray = 1, + GetPathElementsRequest_GetPathElementsRequestV0_FieldNumber_KeysArray = 2, + GetPathElementsRequest_GetPathElementsRequestV0_FieldNumber_Prove = 3, +}; + +GPB_FINAL @interface GetPathElementsRequest_GetPathElementsRequestV0 : GPBMessage + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *pathArray; +/** The number of items in @c pathArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger pathArray_Count; + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *keysArray; +/** The number of items in @c keysArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger keysArray_Count; + +@property(nonatomic, readwrite) BOOL prove; + +@end + +#pragma mark - GetPathElementsResponse + +typedef GPB_ENUM(GetPathElementsResponse_FieldNumber) { + GetPathElementsResponse_FieldNumber_V0 = 1, +}; + +typedef GPB_ENUM(GetPathElementsResponse_Version_OneOfCase) { + GetPathElementsResponse_Version_OneOfCase_GPBUnsetOneOfCase = 0, + GetPathElementsResponse_Version_OneOfCase_V0 = 1, +}; + +GPB_FINAL @interface GetPathElementsResponse : GPBMessage + +@property(nonatomic, readonly) GetPathElementsResponse_Version_OneOfCase versionOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetPathElementsResponse_GetPathElementsResponseV0 *v0; + +@end + +/** + * Clears whatever value was set for the oneof 'version'. + **/ +void GetPathElementsResponse_ClearVersionOneOfCase(GetPathElementsResponse *message); + +#pragma mark - GetPathElementsResponse_GetPathElementsResponseV0 + +typedef GPB_ENUM(GetPathElementsResponse_GetPathElementsResponseV0_FieldNumber) { + GetPathElementsResponse_GetPathElementsResponseV0_FieldNumber_Elements = 1, + GetPathElementsResponse_GetPathElementsResponseV0_FieldNumber_Proof = 2, + GetPathElementsResponse_GetPathElementsResponseV0_FieldNumber_Metadata = 3, +}; + +typedef GPB_ENUM(GetPathElementsResponse_GetPathElementsResponseV0_Result_OneOfCase) { + GetPathElementsResponse_GetPathElementsResponseV0_Result_OneOfCase_GPBUnsetOneOfCase = 0, + GetPathElementsResponse_GetPathElementsResponseV0_Result_OneOfCase_Elements = 1, + GetPathElementsResponse_GetPathElementsResponseV0_Result_OneOfCase_Proof = 2, +}; + +GPB_FINAL @interface GetPathElementsResponse_GetPathElementsResponseV0 : GPBMessage + +@property(nonatomic, readonly) GetPathElementsResponse_GetPathElementsResponseV0_Result_OneOfCase resultOneOfCase; + +@property(nonatomic, readwrite, strong, null_resettable) GetPathElementsResponse_GetPathElementsResponseV0_Elements *elements; + +@property(nonatomic, readwrite, strong, null_resettable) Proof *proof; + +@property(nonatomic, readwrite, strong, null_resettable) ResponseMetadata *metadata; +/** Test to see if @c metadata has been set. */ +@property(nonatomic, readwrite) BOOL hasMetadata; + +@end + +/** + * Clears whatever value was set for the oneof 'result'. + **/ +void GetPathElementsResponse_GetPathElementsResponseV0_ClearResultOneOfCase(GetPathElementsResponse_GetPathElementsResponseV0 *message); + +#pragma mark - GetPathElementsResponse_GetPathElementsResponseV0_Elements + +typedef GPB_ENUM(GetPathElementsResponse_GetPathElementsResponseV0_Elements_FieldNumber) { + GetPathElementsResponse_GetPathElementsResponseV0_Elements_FieldNumber_ElementsArray = 1, +}; + +GPB_FINAL @interface GetPathElementsResponse_GetPathElementsResponseV0_Elements : GPBMessage + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *elementsArray; +/** The number of items in @c elementsArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger elementsArray_Count; + @end NS_ASSUME_NONNULL_END diff --git a/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbobjc.m b/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbobjc.m index e5ece015ecf..65bdc7ed82c 100644 --- a/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbobjc.m +++ b/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbobjc.m @@ -63,19 +63,13 @@ GPBObjCClassDeclaration(GetEpochsInfoResponse_GetEpochsInfoResponseV0); GPBObjCClassDeclaration(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo); GPBObjCClassDeclaration(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfos); -GPBObjCClassDeclaration(GetIdentitiesByPublicKeyHashesRequest); -GPBObjCClassDeclaration(GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0); -GPBObjCClassDeclaration(GetIdentitiesByPublicKeyHashesResponse); -GPBObjCClassDeclaration(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0); -GPBObjCClassDeclaration(GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes); -GPBObjCClassDeclaration(GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry); -GPBObjCClassDeclaration(GetIdentitiesRequest); -GPBObjCClassDeclaration(GetIdentitiesRequest_GetIdentitiesRequestV0); -GPBObjCClassDeclaration(GetIdentitiesResponse); -GPBObjCClassDeclaration(GetIdentitiesResponse_GetIdentitiesResponseV0); -GPBObjCClassDeclaration(GetIdentitiesResponse_Identities); -GPBObjCClassDeclaration(GetIdentitiesResponse_IdentityEntry); -GPBObjCClassDeclaration(GetIdentitiesResponse_IdentityValue); +GPBObjCClassDeclaration(GetIdentitiesContractKeysRequest); +GPBObjCClassDeclaration(GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0); +GPBObjCClassDeclaration(GetIdentitiesContractKeysResponse); +GPBObjCClassDeclaration(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0); +GPBObjCClassDeclaration(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys); +GPBObjCClassDeclaration(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys); +GPBObjCClassDeclaration(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys); GPBObjCClassDeclaration(GetIdentityBalanceAndRevisionRequest); GPBObjCClassDeclaration(GetIdentityBalanceAndRevisionRequest_GetIdentityBalanceAndRevisionRequestV0); GPBObjCClassDeclaration(GetIdentityBalanceAndRevisionResponse); @@ -89,15 +83,28 @@ GPBObjCClassDeclaration(GetIdentityByPublicKeyHashRequest_GetIdentityByPublicKeyHashRequestV0); GPBObjCClassDeclaration(GetIdentityByPublicKeyHashResponse); GPBObjCClassDeclaration(GetIdentityByPublicKeyHashResponse_GetIdentityByPublicKeyHashResponseV0); +GPBObjCClassDeclaration(GetIdentityContractNonceRequest); +GPBObjCClassDeclaration(GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0); +GPBObjCClassDeclaration(GetIdentityContractNonceResponse); +GPBObjCClassDeclaration(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0); GPBObjCClassDeclaration(GetIdentityKeysRequest); GPBObjCClassDeclaration(GetIdentityKeysRequest_GetIdentityKeysRequestV0); GPBObjCClassDeclaration(GetIdentityKeysResponse); GPBObjCClassDeclaration(GetIdentityKeysResponse_GetIdentityKeysResponseV0); GPBObjCClassDeclaration(GetIdentityKeysResponse_GetIdentityKeysResponseV0_Keys); +GPBObjCClassDeclaration(GetIdentityNonceRequest); +GPBObjCClassDeclaration(GetIdentityNonceRequest_GetIdentityNonceRequestV0); +GPBObjCClassDeclaration(GetIdentityNonceResponse); +GPBObjCClassDeclaration(GetIdentityNonceResponse_GetIdentityNonceResponseV0); GPBObjCClassDeclaration(GetIdentityRequest); GPBObjCClassDeclaration(GetIdentityRequest_GetIdentityRequestV0); GPBObjCClassDeclaration(GetIdentityResponse); GPBObjCClassDeclaration(GetIdentityResponse_GetIdentityResponseV0); +GPBObjCClassDeclaration(GetPathElementsRequest); +GPBObjCClassDeclaration(GetPathElementsRequest_GetPathElementsRequestV0); +GPBObjCClassDeclaration(GetPathElementsResponse); +GPBObjCClassDeclaration(GetPathElementsResponse_GetPathElementsResponseV0); +GPBObjCClassDeclaration(GetPathElementsResponse_GetPathElementsResponseV0_Elements); GPBObjCClassDeclaration(GetProofsRequest); GPBObjCClassDeclaration(GetProofsRequest_GetProofsRequestV0); GPBObjCClassDeclaration(GetProofsRequest_GetProofsRequestV0_ContractRequest); @@ -152,6 +159,48 @@ @implementation PlatformRoot return descriptor; } +#pragma mark - Enum KeyPurpose + +GPBEnumDescriptor *KeyPurpose_EnumDescriptor(void) { + static _Atomic(GPBEnumDescriptor*) descriptor = nil; + if (!descriptor) { + static const char *valueNames = + "Authentication\000Encryption\000Decryption\000Tra" + "nsfer\000Voting\000"; + static const int32_t values[] = { + KeyPurpose_Authentication, + KeyPurpose_Encryption, + KeyPurpose_Decryption, + KeyPurpose_Transfer, + KeyPurpose_Voting, + }; + GPBEnumDescriptor *worker = + [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(KeyPurpose) + valueNames:valueNames + values:values + count:(uint32_t)(sizeof(values) / sizeof(int32_t)) + enumVerifier:KeyPurpose_IsValidValue]; + GPBEnumDescriptor *expected = nil; + if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) { + [worker release]; + } + } + return descriptor; +} + +BOOL KeyPurpose_IsValidValue(int32_t value__) { + switch (value__) { + case KeyPurpose_Authentication: + case KeyPurpose_Encryption: + case KeyPurpose_Decryption: + case KeyPurpose_Transfer: + case KeyPurpose_Voting: + return YES; + default: + return NO; + } +} + #pragma mark - Proof @implementation Proof @@ -609,6 +658,243 @@ + (GPBDescriptor *)descriptor { @end +#pragma mark - GetIdentityNonceRequest + +@implementation GetIdentityNonceRequest + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetIdentityNonceRequest__storage_ { + uint32_t _has_storage_[2]; + GetIdentityNonceRequest_GetIdentityNonceRequestV0 *v0; +} GetIdentityNonceRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentityNonceRequest_GetIdentityNonceRequestV0), + .number = GetIdentityNonceRequest_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetIdentityNonceRequest__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetIdentityNonceRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetIdentityNonceRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetIdentityNonceRequest_ClearVersionOneOfCase(GetIdentityNonceRequest *message) { + GPBDescriptor *descriptor = [GetIdentityNonceRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetIdentityNonceRequest_GetIdentityNonceRequestV0 + +@implementation GetIdentityNonceRequest_GetIdentityNonceRequestV0 + +@dynamic identityId; +@dynamic prove; + +typedef struct GetIdentityNonceRequest_GetIdentityNonceRequestV0__storage_ { + uint32_t _has_storage_[1]; + NSData *identityId; +} GetIdentityNonceRequest_GetIdentityNonceRequestV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "identityId", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentityNonceRequest_GetIdentityNonceRequestV0_FieldNumber_IdentityId, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetIdentityNonceRequest_GetIdentityNonceRequestV0__storage_, identityId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentityNonceRequest_GetIdentityNonceRequestV0_FieldNumber_Prove, + .hasIndex = 1, + .offset = 2, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetIdentityNonceRequest_GetIdentityNonceRequestV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetIdentityNonceRequest_GetIdentityNonceRequestV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentityNonceRequest)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetIdentityContractNonceRequest + +@implementation GetIdentityContractNonceRequest + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetIdentityContractNonceRequest__storage_ { + uint32_t _has_storage_[2]; + GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0 *v0; +} GetIdentityContractNonceRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0), + .number = GetIdentityContractNonceRequest_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetIdentityContractNonceRequest__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetIdentityContractNonceRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetIdentityContractNonceRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetIdentityContractNonceRequest_ClearVersionOneOfCase(GetIdentityContractNonceRequest *message) { + GPBDescriptor *descriptor = [GetIdentityContractNonceRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0 + +@implementation GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0 + +@dynamic identityId; +@dynamic contractId; +@dynamic prove; + +typedef struct GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0__storage_ { + uint32_t _has_storage_[1]; + NSData *identityId; + NSData *contractId; +} GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "identityId", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0_FieldNumber_IdentityId, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0__storage_, identityId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "contractId", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0_FieldNumber_ContractId, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0__storage_, contractId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0_FieldNumber_Prove, + .hasIndex = 2, + .offset = 3, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetIdentityContractNonceRequest_GetIdentityContractNonceRequestV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentityContractNonceRequest)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + #pragma mark - GetIdentityBalanceRequest @implementation GetIdentityBalanceRequest @@ -972,17 +1258,17 @@ void GetIdentityResponse_GetIdentityResponseV0_ClearResultOneOfCase(GetIdentityR GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetIdentitiesRequest +#pragma mark - GetIdentityNonceResponse -@implementation GetIdentitiesRequest +@implementation GetIdentityNonceResponse @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetIdentitiesRequest__storage_ { +typedef struct GetIdentityNonceResponse__storage_ { uint32_t _has_storage_[2]; - GetIdentitiesRequest_GetIdentitiesRequestV0 *v0; -} GetIdentitiesRequest__storage_; + GetIdentityNonceResponse_GetIdentityNonceResponseV0 *v0; +} GetIdentityNonceResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -992,21 +1278,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesRequest_GetIdentitiesRequestV0), - .number = GetIdentitiesRequest_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentityNonceResponse_GetIdentityNonceResponseV0), + .number = GetIdentityNonceResponse_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentitiesRequest__storage_, v0), + .offset = (uint32_t)offsetof(GetIdentityNonceResponse__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesRequest class] + [GPBDescriptor allocDescriptorForClass:[GetIdentityNonceResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesRequest__storage_) + storageSize:sizeof(GetIdentityNonceResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -1024,22 +1310,26 @@ + (GPBDescriptor *)descriptor { @end -void GetIdentitiesRequest_ClearVersionOneOfCase(GetIdentitiesRequest *message) { - GPBDescriptor *descriptor = [GetIdentitiesRequest descriptor]; +void GetIdentityNonceResponse_ClearVersionOneOfCase(GetIdentityNonceResponse *message) { + GPBDescriptor *descriptor = [GetIdentityNonceResponse descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetIdentitiesRequest_GetIdentitiesRequestV0 +#pragma mark - GetIdentityNonceResponse_GetIdentityNonceResponseV0 -@implementation GetIdentitiesRequest_GetIdentitiesRequestV0 +@implementation GetIdentityNonceResponse_GetIdentityNonceResponseV0 -@dynamic idsArray, idsArray_Count; -@dynamic prove; +@dynamic resultOneOfCase; +@dynamic identityNonce; +@dynamic proof; +@dynamic hasMetadata, metadata; -typedef struct GetIdentitiesRequest_GetIdentitiesRequestV0__storage_ { - uint32_t _has_storage_[1]; - NSMutableArray *idsArray; -} GetIdentitiesRequest_GetIdentitiesRequestV0__storage_; +typedef struct GetIdentityNonceResponse_GetIdentityNonceResponseV0__storage_ { + uint32_t _has_storage_[2]; + Proof *proof; + ResponseMetadata *metadata; + uint64_t identityNonce; +} GetIdentityNonceResponse_GetIdentityNonceResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -1048,33 +1338,48 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "idsArray", + .name = "identityNonce", .dataTypeSpecific.clazz = Nil, - .number = GetIdentitiesRequest_GetIdentitiesRequestV0_FieldNumber_IdsArray, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetIdentitiesRequest_GetIdentitiesRequestV0__storage_, idsArray), - .flags = GPBFieldRepeated, - .dataType = GPBDataTypeBytes, + .number = GetIdentityNonceResponse_GetIdentityNonceResponseV0_FieldNumber_IdentityNonce, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetIdentityNonceResponse_GetIdentityNonceResponseV0__storage_, identityNonce), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeUInt64, }, { - .name = "prove", - .dataTypeSpecific.clazz = Nil, - .number = GetIdentitiesRequest_GetIdentitiesRequestV0_FieldNumber_Prove, + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetIdentityNonceResponse_GetIdentityNonceResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetIdentityNonceResponse_GetIdentityNonceResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetIdentityNonceResponse_GetIdentityNonceResponseV0_FieldNumber_Metadata, .hasIndex = 0, - .offset = 1, // Stored in _has_storage_ to save space. - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBool, + .offset = (uint32_t)offsetof(GetIdentityNonceResponse_GetIdentityNonceResponseV0__storage_, metadata), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesRequest_GetIdentitiesRequestV0 class] + [GPBDescriptor allocDescriptorForClass:[GetIdentityNonceResponse_GetIdentityNonceResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesRequest_GetIdentitiesRequestV0__storage_) + storageSize:sizeof(GetIdentityNonceResponse_GetIdentityNonceResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesRequest)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentityNonceResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -1085,17 +1390,22 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetIdentitiesResponse - -@implementation GetIdentitiesResponse +void GetIdentityNonceResponse_GetIdentityNonceResponseV0_ClearResultOneOfCase(GetIdentityNonceResponse_GetIdentityNonceResponseV0 *message) { + GPBDescriptor *descriptor = [GetIdentityNonceResponse_GetIdentityNonceResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetIdentityContractNonceResponse + +@implementation GetIdentityContractNonceResponse @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetIdentitiesResponse__storage_ { +typedef struct GetIdentityContractNonceResponse__storage_ { uint32_t _has_storage_[2]; - GetIdentitiesResponse_GetIdentitiesResponseV0 *v0; -} GetIdentitiesResponse__storage_; + GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 *v0; +} GetIdentityContractNonceResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -1105,21 +1415,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesResponse_GetIdentitiesResponseV0), - .number = GetIdentitiesResponse_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0), + .number = GetIdentityContractNonceResponse_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentitiesResponse__storage_, v0), + .offset = (uint32_t)offsetof(GetIdentityContractNonceResponse__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesResponse class] + [GPBDescriptor allocDescriptorForClass:[GetIdentityContractNonceResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesResponse__storage_) + storageSize:sizeof(GetIdentityContractNonceResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -1137,175 +1447,26 @@ + (GPBDescriptor *)descriptor { @end -void GetIdentitiesResponse_ClearVersionOneOfCase(GetIdentitiesResponse *message) { - GPBDescriptor *descriptor = [GetIdentitiesResponse descriptor]; +void GetIdentityContractNonceResponse_ClearVersionOneOfCase(GetIdentityContractNonceResponse *message) { + GPBDescriptor *descriptor = [GetIdentityContractNonceResponse descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetIdentitiesResponse_IdentityValue - -@implementation GetIdentitiesResponse_IdentityValue - -@dynamic value; - -typedef struct GetIdentitiesResponse_IdentityValue__storage_ { - uint32_t _has_storage_[1]; - NSData *value; -} GetIdentitiesResponse_IdentityValue__storage_; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "value", - .dataTypeSpecific.clazz = Nil, - .number = GetIdentitiesResponse_IdentityValue_FieldNumber_Value, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetIdentitiesResponse_IdentityValue__storage_, value), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, - }, - }; - GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesResponse_IdentityValue class] - rootClass:[PlatformRoot class] - file:PlatformRoot_FileDescriptor() - fields:fields - fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesResponse_IdentityValue__storage_) - flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesResponse)]; - #if defined(DEBUG) && DEBUG - NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG - descriptor = localDescriptor; - } - return descriptor; -} - -@end - -#pragma mark - GetIdentitiesResponse_IdentityEntry - -@implementation GetIdentitiesResponse_IdentityEntry - -@dynamic key; -@dynamic hasValue, value; - -typedef struct GetIdentitiesResponse_IdentityEntry__storage_ { - uint32_t _has_storage_[1]; - NSData *key; - GetIdentitiesResponse_IdentityValue *value; -} GetIdentitiesResponse_IdentityEntry__storage_; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "key", - .dataTypeSpecific.clazz = Nil, - .number = GetIdentitiesResponse_IdentityEntry_FieldNumber_Key, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetIdentitiesResponse_IdentityEntry__storage_, key), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, - }, - { - .name = "value", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesResponse_IdentityValue), - .number = GetIdentitiesResponse_IdentityEntry_FieldNumber_Value, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetIdentitiesResponse_IdentityEntry__storage_, value), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - }; - GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesResponse_IdentityEntry class] - rootClass:[PlatformRoot class] - file:PlatformRoot_FileDescriptor() - fields:fields - fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesResponse_IdentityEntry__storage_) - flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesResponse)]; - #if defined(DEBUG) && DEBUG - NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG - descriptor = localDescriptor; - } - return descriptor; -} - -@end - -#pragma mark - GetIdentitiesResponse_Identities - -@implementation GetIdentitiesResponse_Identities - -@dynamic identityEntriesArray, identityEntriesArray_Count; - -typedef struct GetIdentitiesResponse_Identities__storage_ { - uint32_t _has_storage_[1]; - NSMutableArray *identityEntriesArray; -} GetIdentitiesResponse_Identities__storage_; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "identityEntriesArray", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesResponse_IdentityEntry), - .number = GetIdentitiesResponse_Identities_FieldNumber_IdentityEntriesArray, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetIdentitiesResponse_Identities__storage_, identityEntriesArray), - .flags = GPBFieldRepeated, - .dataType = GPBDataTypeMessage, - }, - }; - GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesResponse_Identities class] - rootClass:[PlatformRoot class] - file:PlatformRoot_FileDescriptor() - fields:fields - fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesResponse_Identities__storage_) - flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesResponse)]; - #if defined(DEBUG) && DEBUG - NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG - descriptor = localDescriptor; - } - return descriptor; -} - -@end - -#pragma mark - GetIdentitiesResponse_GetIdentitiesResponseV0 +#pragma mark - GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 -@implementation GetIdentitiesResponse_GetIdentitiesResponseV0 +@implementation GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 @dynamic resultOneOfCase; -@dynamic identities; +@dynamic identityContractNonce; @dynamic proof; @dynamic hasMetadata, metadata; -typedef struct GetIdentitiesResponse_GetIdentitiesResponseV0__storage_ { +typedef struct GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0__storage_ { uint32_t _has_storage_[2]; - GetIdentitiesResponse_Identities *identities; Proof *proof; ResponseMetadata *metadata; -} GetIdentitiesResponse_GetIdentitiesResponseV0__storage_; + uint64_t identityContractNonce; +} GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -1314,40 +1475,40 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "identities", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesResponse_Identities), - .number = GetIdentitiesResponse_GetIdentitiesResponseV0_FieldNumber_Identities, + .name = "identityContractNonce", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_FieldNumber_IdentityContractNonce, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentitiesResponse_GetIdentitiesResponseV0__storage_, identities), + .offset = (uint32_t)offsetof(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0__storage_, identityContractNonce), .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .dataType = GPBDataTypeUInt64, }, { .name = "proof", .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = GetIdentitiesResponse_GetIdentitiesResponseV0_FieldNumber_Proof, + .number = GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_FieldNumber_Proof, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentitiesResponse_GetIdentitiesResponseV0__storage_, proof), + .offset = (uint32_t)offsetof(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0__storage_, proof), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "metadata", .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = GetIdentitiesResponse_GetIdentitiesResponseV0_FieldNumber_Metadata, + .number = GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_FieldNumber_Metadata, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetIdentitiesResponse_GetIdentitiesResponseV0__storage_, metadata), + .offset = (uint32_t)offsetof(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0__storage_, metadata), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesResponse_GetIdentitiesResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesResponse_GetIdentitiesResponseV0__storage_) + storageSize:sizeof(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "result", @@ -1355,7 +1516,7 @@ + (GPBDescriptor *)descriptor { [localDescriptor setupOneofs:oneofs count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentityContractNonceResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -1366,8 +1527,8 @@ + (GPBDescriptor *)descriptor { @end -void GetIdentitiesResponse_GetIdentitiesResponseV0_ClearResultOneOfCase(GetIdentitiesResponse_GetIdentitiesResponseV0 *message) { - GPBDescriptor *descriptor = [GetIdentitiesResponse_GetIdentitiesResponseV0 descriptor]; +void GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0_ClearResultOneOfCase(GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 *message) { + GPBDescriptor *descriptor = [GetIdentityContractNonceResponse_GetIdentityContractNonceResponseV0 descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } @@ -2313,17 +2474,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetProofsRequest +#pragma mark - GetIdentitiesContractKeysRequest -@implementation GetProofsRequest +@implementation GetIdentitiesContractKeysRequest @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetProofsRequest__storage_ { +typedef struct GetIdentitiesContractKeysRequest__storage_ { uint32_t _has_storage_[2]; - GetProofsRequest_GetProofsRequestV0 *v0; -} GetProofsRequest__storage_; + GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0 *v0; +} GetIdentitiesContractKeysRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2333,21 +2494,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetProofsRequest_GetProofsRequestV0), - .number = GetProofsRequest_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0), + .number = GetIdentitiesContractKeysRequest_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetProofsRequest__storage_, v0), + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysRequest__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProofsRequest class] + [GPBDescriptor allocDescriptorForClass:[GetIdentitiesContractKeysRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProofsRequest__storage_) + storageSize:sizeof(GetIdentitiesContractKeysRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -2365,25 +2526,28 @@ + (GPBDescriptor *)descriptor { @end -void GetProofsRequest_ClearVersionOneOfCase(GetProofsRequest *message) { - GPBDescriptor *descriptor = [GetProofsRequest descriptor]; +void GetIdentitiesContractKeysRequest_ClearVersionOneOfCase(GetIdentitiesContractKeysRequest *message) { + GPBDescriptor *descriptor = [GetIdentitiesContractKeysRequest descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetProofsRequest_GetProofsRequestV0 +#pragma mark - GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0 -@implementation GetProofsRequest_GetProofsRequestV0 +@implementation GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0 -@dynamic identitiesArray, identitiesArray_Count; -@dynamic contractsArray, contractsArray_Count; -@dynamic documentsArray, documentsArray_Count; +@dynamic identitiesIdsArray, identitiesIdsArray_Count; +@dynamic contractId; +@dynamic hasDocumentTypeName, documentTypeName; +@dynamic purposesArray, purposesArray_Count; +@dynamic prove; -typedef struct GetProofsRequest_GetProofsRequestV0__storage_ { +typedef struct GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0__storage_ { uint32_t _has_storage_[1]; - NSMutableArray *identitiesArray; - NSMutableArray *contractsArray; - NSMutableArray *documentsArray; -} GetProofsRequest_GetProofsRequestV0__storage_; + NSMutableArray *identitiesIdsArray; + NSData *contractId; + NSString *documentTypeName; + GPBEnumArray *purposesArray; +} GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2392,42 +2556,60 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "identitiesArray", - .dataTypeSpecific.clazz = GPBObjCClass(GetProofsRequest_GetProofsRequestV0_IdentityRequest), - .number = GetProofsRequest_GetProofsRequestV0_FieldNumber_IdentitiesArray, + .name = "identitiesIdsArray", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_IdentitiesIdsArray, .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0__storage_, identitiesArray), + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0__storage_, identitiesIdsArray), .flags = GPBFieldRepeated, - .dataType = GPBDataTypeMessage, + .dataType = GPBDataTypeBytes, }, { - .name = "contractsArray", - .dataTypeSpecific.clazz = GPBObjCClass(GetProofsRequest_GetProofsRequestV0_ContractRequest), - .number = GetProofsRequest_GetProofsRequestV0_FieldNumber_ContractsArray, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0__storage_, contractsArray), - .flags = GPBFieldRepeated, - .dataType = GPBDataTypeMessage, + .name = "contractId", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_ContractId, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0__storage_, contractId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, }, { - .name = "documentsArray", - .dataTypeSpecific.clazz = GPBObjCClass(GetProofsRequest_GetProofsRequestV0_DocumentRequest), - .number = GetProofsRequest_GetProofsRequestV0_FieldNumber_DocumentsArray, + .name = "documentTypeName", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_DocumentTypeName, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0__storage_, documentTypeName), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "purposesArray", + .dataTypeSpecific.enumDescFunc = KeyPurpose_EnumDescriptor, + .number = GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_PurposesArray, .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0__storage_, documentsArray), - .flags = GPBFieldRepeated, - .dataType = GPBDataTypeMessage, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0__storage_, purposesArray), + .flags = (GPBFieldFlags)(GPBFieldRepeated | GPBFieldPacked | GPBFieldHasEnumDescriptor), + .dataType = GPBDataTypeEnum, + }, + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0_FieldNumber_Prove, + .hasIndex = 2, + .offset = 3, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProofsRequest_GetProofsRequestV0 class] + [GPBDescriptor allocDescriptorForClass:[GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProofsRequest_GetProofsRequestV0__storage_) + storageSize:sizeof(GetIdentitiesContractKeysRequest_GetIdentitiesContractKeysRequestV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsRequest)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesContractKeysRequest)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -2438,21 +2620,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetProofsRequest_GetProofsRequestV0_DocumentRequest +#pragma mark - GetIdentitiesContractKeysResponse -@implementation GetProofsRequest_GetProofsRequestV0_DocumentRequest +@implementation GetIdentitiesContractKeysResponse -@dynamic contractId; -@dynamic documentType; -@dynamic documentTypeKeepsHistory; -@dynamic documentId; +@dynamic versionOneOfCase; +@dynamic v0; -typedef struct GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_ { - uint32_t _has_storage_[1]; - NSData *contractId; - NSString *documentType; - NSData *documentId; -} GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_; +typedef struct GetIdentitiesContractKeysResponse__storage_ { + uint32_t _has_storage_[2]; + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 *v0; +} GetIdentitiesContractKeysResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2461,51 +2639,29 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "contractId", - .dataTypeSpecific.clazz = Nil, - .number = GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_ContractId, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_, contractId), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, - }, - { - .name = "documentType", - .dataTypeSpecific.clazz = Nil, - .number = GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentType, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_, documentType), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeString, - }, - { - .name = "documentTypeKeepsHistory", - .dataTypeSpecific.clazz = Nil, - .number = GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentTypeKeepsHistory, - .hasIndex = 2, - .offset = 3, // Stored in _has_storage_ to save space. - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBool, - }, - { - .name = "documentId", - .dataTypeSpecific.clazz = Nil, - .number = GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentId, - .hasIndex = 4, - .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_, documentId), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0), + .number = GetIdentitiesContractKeysResponse_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysResponse__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProofsRequest_GetProofsRequestV0_DocumentRequest class] + [GPBDescriptor allocDescriptorForClass:[GetIdentitiesContractKeysResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_) + storageSize:sizeof(GetIdentitiesContractKeysResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsRequest_GetProofsRequestV0)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -2516,18 +2672,26 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetProofsRequest_GetProofsRequestV0_IdentityRequest - -@implementation GetProofsRequest_GetProofsRequestV0_IdentityRequest +void GetIdentitiesContractKeysResponse_ClearVersionOneOfCase(GetIdentitiesContractKeysResponse *message) { + GPBDescriptor *descriptor = [GetIdentitiesContractKeysResponse descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 -@dynamic identityId; -@dynamic requestType; +@implementation GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 -typedef struct GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_ { - uint32_t _has_storage_[1]; - GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type requestType; - NSData *identityId; -} GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_; +@dynamic resultOneOfCase; +@dynamic identitiesKeys; +@dynamic proof; +@dynamic hasMetadata, metadata; + +typedef struct GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0__storage_ { + uint32_t _has_storage_[2]; + GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys *identitiesKeys; + Proof *proof; + ResponseMetadata *metadata; +} GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2536,33 +2700,48 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "identityId", - .dataTypeSpecific.clazz = Nil, - .number = GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_IdentityId, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_, identityId), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, + .name = "identitiesKeys", + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys), + .number = GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_FieldNumber_IdentitiesKeys, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0__storage_, identitiesKeys), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, { - .name = "requestType", - .dataTypeSpecific.enumDescFunc = GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_EnumDescriptor, - .number = GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_RequestType, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_, requestType), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeEnum, + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_FieldNumber_Metadata, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0__storage_, metadata), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProofsRequest_GetProofsRequestV0_IdentityRequest class] + [GPBDescriptor allocDescriptorForClass:[GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_) + storageSize:sizeof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsRequest_GetProofsRequestV0)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesContractKeysResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -2573,65 +2752,23 @@ + (GPBDescriptor *)descriptor { @end -int32_t GetProofsRequest_GetProofsRequestV0_IdentityRequest_RequestType_RawValue(GetProofsRequest_GetProofsRequestV0_IdentityRequest *message) { - GPBDescriptor *descriptor = [GetProofsRequest_GetProofsRequestV0_IdentityRequest descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_RequestType]; - return GPBGetMessageRawEnumField(message, field); -} - -void SetGetProofsRequest_GetProofsRequestV0_IdentityRequest_RequestType_RawValue(GetProofsRequest_GetProofsRequestV0_IdentityRequest *message, int32_t value) { - GPBDescriptor *descriptor = [GetProofsRequest_GetProofsRequestV0_IdentityRequest descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_RequestType]; - GPBSetMessageRawEnumField(message, field, value); -} - -#pragma mark - Enum GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type - -GPBEnumDescriptor *GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_EnumDescriptor(void) { - static _Atomic(GPBEnumDescriptor*) descriptor = nil; - if (!descriptor) { - static const char *valueNames = - "FullIdentity\000Balance\000Keys\000"; - static const int32_t values[] = { - GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_FullIdentity, - GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Balance, - GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Keys, - }; - GPBEnumDescriptor *worker = - [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type) - valueNames:valueNames - values:values - count:(uint32_t)(sizeof(values) / sizeof(int32_t)) - enumVerifier:GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_IsValidValue]; - GPBEnumDescriptor *expected = nil; - if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) { - [worker release]; - } - } - return descriptor; -} - -BOOL GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_IsValidValue(int32_t value__) { - switch (value__) { - case GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_FullIdentity: - case GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Balance: - case GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Keys: - return YES; - default: - return NO; - } +void GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_ClearResultOneOfCase(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 *message) { + GPBDescriptor *descriptor = [GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); } +#pragma mark - GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys -#pragma mark - GetProofsRequest_GetProofsRequestV0_ContractRequest - -@implementation GetProofsRequest_GetProofsRequestV0_ContractRequest +@implementation GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys -@dynamic contractId; +@dynamic purpose; +@dynamic keysBytesArray, keysBytesArray_Count; -typedef struct GetProofsRequest_GetProofsRequestV0_ContractRequest__storage_ { +typedef struct GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys__storage_ { uint32_t _has_storage_[1]; - NSData *contractId; -} GetProofsRequest_GetProofsRequestV0_ContractRequest__storage_; + KeyPurpose purpose; + NSMutableArray *keysBytesArray; +} GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2640,24 +2777,33 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "contractId", - .dataTypeSpecific.clazz = Nil, - .number = GetProofsRequest_GetProofsRequestV0_ContractRequest_FieldNumber_ContractId, + .name = "purpose", + .dataTypeSpecific.enumDescFunc = KeyPurpose_EnumDescriptor, + .number = GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_FieldNumber_Purpose, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_ContractRequest__storage_, contractId), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys__storage_, purpose), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeEnum, + }, + { + .name = "keysBytesArray", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_FieldNumber_KeysBytesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys__storage_, keysBytesArray), + .flags = GPBFieldRepeated, .dataType = GPBDataTypeBytes, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProofsRequest_GetProofsRequestV0_ContractRequest class] + [GPBDescriptor allocDescriptorForClass:[GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProofsRequest_GetProofsRequestV0_ContractRequest__storage_) + storageSize:sizeof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsRequest_GetProofsRequestV0)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -2668,17 +2814,30 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetProofsResponse +int32_t GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_Purpose_RawValue(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys *message) { + GPBDescriptor *descriptor = [GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_FieldNumber_Purpose]; + return GPBGetMessageRawEnumField(message, field); +} -@implementation GetProofsResponse +void SetGetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_Purpose_RawValue(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys *message, int32_t value) { + GPBDescriptor *descriptor = [GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys_FieldNumber_Purpose]; + GPBSetMessageRawEnumField(message, field, value); +} -@dynamic versionOneOfCase; -@dynamic v0; +#pragma mark - GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys -typedef struct GetProofsResponse__storage_ { - uint32_t _has_storage_[2]; - GetProofsResponse_GetProofsResponseV0 *v0; -} GetProofsResponse__storage_; +@implementation GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys + +@dynamic identityId; +@dynamic keysArray, keysArray_Count; + +typedef struct GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys__storage_ { + uint32_t _has_storage_[1]; + NSData *identityId; + NSMutableArray *keysArray; +} GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2687,29 +2846,33 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetProofsResponse_GetProofsResponseV0), - .number = GetProofsResponse_FieldNumber_V0, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetProofsResponse__storage_, v0), - .flags = GPBFieldOptional, + .name = "identityId", + .dataTypeSpecific.clazz = Nil, + .number = GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys_FieldNumber_IdentityId, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys__storage_, identityId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "keysArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_PurposeKeys), + .number = GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys_FieldNumber_KeysArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys__storage_, keysArray), + .flags = GPBFieldRepeated, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProofsResponse class] + [GPBDescriptor allocDescriptorForClass:[GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProofsResponse__storage_) + storageSize:sizeof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "version", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -2720,24 +2883,16 @@ + (GPBDescriptor *)descriptor { @end -void GetProofsResponse_ClearVersionOneOfCase(GetProofsResponse *message) { - GPBDescriptor *descriptor = [GetProofsResponse descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} -#pragma mark - GetProofsResponse_GetProofsResponseV0 +#pragma mark - GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys -@implementation GetProofsResponse_GetProofsResponseV0 +@implementation GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys -@dynamic resultOneOfCase; -@dynamic proof; -@dynamic hasMetadata, metadata; +@dynamic entriesArray, entriesArray_Count; -typedef struct GetProofsResponse_GetProofsResponseV0__storage_ { - uint32_t _has_storage_[2]; - Proof *proof; - ResponseMetadata *metadata; -} GetProofsResponse_GetProofsResponseV0__storage_; +typedef struct GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys__storage_ { + uint32_t _has_storage_[1]; + NSMutableArray *entriesArray; +} GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2746,39 +2901,24 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "proof", - .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = GetProofsResponse_GetProofsResponseV0_FieldNumber_Proof, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetProofsResponse_GetProofsResponseV0__storage_, proof), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "metadata", - .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = GetProofsResponse_GetProofsResponseV0_FieldNumber_Metadata, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetProofsResponse_GetProofsResponseV0__storage_, metadata), - .flags = GPBFieldOptional, + .name = "entriesArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentityKeys), + .number = GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys_FieldNumber_EntriesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys__storage_, entriesArray), + .flags = GPBFieldRepeated, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetProofsResponse_GetProofsResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetProofsResponse_GetProofsResponseV0__storage_) + storageSize:sizeof(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0_IdentitiesKeys__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "result", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesContractKeysResponse_GetIdentitiesContractKeysResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -2789,22 +2929,17 @@ + (GPBDescriptor *)descriptor { @end -void GetProofsResponse_GetProofsResponseV0_ClearResultOneOfCase(GetProofsResponse_GetProofsResponseV0 *message) { - GPBDescriptor *descriptor = [GetProofsResponse_GetProofsResponseV0 descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} -#pragma mark - GetDataContractRequest +#pragma mark - GetProofsRequest -@implementation GetDataContractRequest +@implementation GetProofsRequest @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetDataContractRequest__storage_ { +typedef struct GetProofsRequest__storage_ { uint32_t _has_storage_[2]; - GetDataContractRequest_GetDataContractRequestV0 *v0; -} GetDataContractRequest__storage_; + GetProofsRequest_GetProofsRequestV0 *v0; +} GetProofsRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2814,21 +2949,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractRequest_GetDataContractRequestV0), - .number = GetDataContractRequest_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetProofsRequest_GetProofsRequestV0), + .number = GetProofsRequest_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractRequest__storage_, v0), + .offset = (uint32_t)offsetof(GetProofsRequest__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractRequest class] + [GPBDescriptor allocDescriptorForClass:[GetProofsRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractRequest__storage_) + storageSize:sizeof(GetProofsRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -2846,22 +2981,25 @@ + (GPBDescriptor *)descriptor { @end -void GetDataContractRequest_ClearVersionOneOfCase(GetDataContractRequest *message) { - GPBDescriptor *descriptor = [GetDataContractRequest descriptor]; +void GetProofsRequest_ClearVersionOneOfCase(GetProofsRequest *message) { + GPBDescriptor *descriptor = [GetProofsRequest descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetDataContractRequest_GetDataContractRequestV0 +#pragma mark - GetProofsRequest_GetProofsRequestV0 -@implementation GetDataContractRequest_GetDataContractRequestV0 +@implementation GetProofsRequest_GetProofsRequestV0 -@dynamic id_p; -@dynamic prove; +@dynamic identitiesArray, identitiesArray_Count; +@dynamic contractsArray, contractsArray_Count; +@dynamic documentsArray, documentsArray_Count; -typedef struct GetDataContractRequest_GetDataContractRequestV0__storage_ { +typedef struct GetProofsRequest_GetProofsRequestV0__storage_ { uint32_t _has_storage_[1]; - NSData *id_p; -} GetDataContractRequest_GetDataContractRequestV0__storage_; + NSMutableArray *identitiesArray; + NSMutableArray *contractsArray; + NSMutableArray *documentsArray; +} GetProofsRequest_GetProofsRequestV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2870,33 +3008,120 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "id_p", - .dataTypeSpecific.clazz = Nil, - .number = GetDataContractRequest_GetDataContractRequestV0_FieldNumber_Id_p, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetDataContractRequest_GetDataContractRequestV0__storage_, id_p), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .name = "identitiesArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetProofsRequest_GetProofsRequestV0_IdentityRequest), + .number = GetProofsRequest_GetProofsRequestV0_FieldNumber_IdentitiesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0__storage_, identitiesArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + }, + { + .name = "contractsArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetProofsRequest_GetProofsRequestV0_ContractRequest), + .number = GetProofsRequest_GetProofsRequestV0_FieldNumber_ContractsArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0__storage_, contractsArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + }, + { + .name = "documentsArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetProofsRequest_GetProofsRequestV0_DocumentRequest), + .number = GetProofsRequest_GetProofsRequestV0_FieldNumber_DocumentsArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0__storage_, documentsArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetProofsRequest_GetProofsRequestV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetProofsRequest_GetProofsRequestV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsRequest)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetProofsRequest_GetProofsRequestV0_DocumentRequest + +@implementation GetProofsRequest_GetProofsRequestV0_DocumentRequest + +@dynamic contractId; +@dynamic documentType; +@dynamic documentTypeKeepsHistory; +@dynamic documentId; + +typedef struct GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_ { + uint32_t _has_storage_[1]; + NSData *contractId; + NSString *documentType; + NSData *documentId; +} GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "contractId", + .dataTypeSpecific.clazz = Nil, + .number = GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_ContractId, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_, contractId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBytes, }, { - .name = "prove", + .name = "documentType", .dataTypeSpecific.clazz = Nil, - .number = GetDataContractRequest_GetDataContractRequestV0_FieldNumber_Prove, + .number = GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentType, .hasIndex = 1, - .offset = 2, // Stored in _has_storage_ to save space. + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_, documentType), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeString, + }, + { + .name = "documentTypeKeepsHistory", + .dataTypeSpecific.clazz = Nil, + .number = GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentTypeKeepsHistory, + .hasIndex = 2, + .offset = 3, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBool, }, + { + .name = "documentId", + .dataTypeSpecific.clazz = Nil, + .number = GetProofsRequest_GetProofsRequestV0_DocumentRequest_FieldNumber_DocumentId, + .hasIndex = 4, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_, documentId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractRequest_GetDataContractRequestV0 class] + [GPBDescriptor allocDescriptorForClass:[GetProofsRequest_GetProofsRequestV0_DocumentRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractRequest_GetDataContractRequestV0__storage_) + storageSize:sizeof(GetProofsRequest_GetProofsRequestV0_DocumentRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractRequest)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsRequest_GetProofsRequestV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -2907,17 +3132,18 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetDataContractResponse +#pragma mark - GetProofsRequest_GetProofsRequestV0_IdentityRequest -@implementation GetDataContractResponse +@implementation GetProofsRequest_GetProofsRequestV0_IdentityRequest -@dynamic versionOneOfCase; -@dynamic v0; +@dynamic identityId; +@dynamic requestType; -typedef struct GetDataContractResponse__storage_ { - uint32_t _has_storage_[2]; - GetDataContractResponse_GetDataContractResponseV0 *v0; -} GetDataContractResponse__storage_; +typedef struct GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_ { + uint32_t _has_storage_[1]; + GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type requestType; + NSData *identityId; +} GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2926,29 +3152,33 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractResponse_GetDataContractResponseV0), - .number = GetDataContractResponse_FieldNumber_V0, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractResponse__storage_, v0), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .name = "identityId", + .dataTypeSpecific.clazz = Nil, + .number = GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_IdentityId, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_, identityId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "requestType", + .dataTypeSpecific.enumDescFunc = GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_EnumDescriptor, + .number = GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_RequestType, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_, requestType), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeEnum, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractResponse class] + [GPBDescriptor allocDescriptorForClass:[GetProofsRequest_GetProofsRequestV0_IdentityRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractResponse__storage_) + storageSize:sizeof(GetProofsRequest_GetProofsRequestV0_IdentityRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "version", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsRequest_GetProofsRequestV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -2959,26 +3189,67 @@ + (GPBDescriptor *)descriptor { @end -void GetDataContractResponse_ClearVersionOneOfCase(GetDataContractResponse *message) { - GPBDescriptor *descriptor = [GetDataContractResponse descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); +int32_t GetProofsRequest_GetProofsRequestV0_IdentityRequest_RequestType_RawValue(GetProofsRequest_GetProofsRequestV0_IdentityRequest *message) { + GPBDescriptor *descriptor = [GetProofsRequest_GetProofsRequestV0_IdentityRequest descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_RequestType]; + return GPBGetMessageRawEnumField(message, field); } -#pragma mark - GetDataContractResponse_GetDataContractResponseV0 -@implementation GetDataContractResponse_GetDataContractResponseV0 +void SetGetProofsRequest_GetProofsRequestV0_IdentityRequest_RequestType_RawValue(GetProofsRequest_GetProofsRequestV0_IdentityRequest *message, int32_t value) { + GPBDescriptor *descriptor = [GetProofsRequest_GetProofsRequestV0_IdentityRequest descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:GetProofsRequest_GetProofsRequestV0_IdentityRequest_FieldNumber_RequestType]; + GPBSetMessageRawEnumField(message, field, value); +} -@dynamic resultOneOfCase; -@dynamic dataContract; -@dynamic proof; -@dynamic hasMetadata, metadata; +#pragma mark - Enum GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type -typedef struct GetDataContractResponse_GetDataContractResponseV0__storage_ { - uint32_t _has_storage_[2]; - NSData *dataContract; - Proof *proof; - ResponseMetadata *metadata; -} GetDataContractResponse_GetDataContractResponseV0__storage_; +GPBEnumDescriptor *GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_EnumDescriptor(void) { + static _Atomic(GPBEnumDescriptor*) descriptor = nil; + if (!descriptor) { + static const char *valueNames = + "FullIdentity\000Balance\000Keys\000Revision\000"; + static const int32_t values[] = { + GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_FullIdentity, + GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Balance, + GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Keys, + GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Revision, + }; + GPBEnumDescriptor *worker = + [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type) + valueNames:valueNames + values:values + count:(uint32_t)(sizeof(values) / sizeof(int32_t)) + enumVerifier:GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_IsValidValue]; + GPBEnumDescriptor *expected = nil; + if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) { + [worker release]; + } + } + return descriptor; +} + +BOOL GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_IsValidValue(int32_t value__) { + switch (value__) { + case GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_FullIdentity: + case GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Balance: + case GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Keys: + case GetProofsRequest_GetProofsRequestV0_IdentityRequest_Type_Revision: + return YES; + default: + return NO; + } +} + +#pragma mark - GetProofsRequest_GetProofsRequestV0_ContractRequest + +@implementation GetProofsRequest_GetProofsRequestV0_ContractRequest + +@dynamic contractId; + +typedef struct GetProofsRequest_GetProofsRequestV0_ContractRequest__storage_ { + uint32_t _has_storage_[1]; + NSData *contractId; +} GetProofsRequest_GetProofsRequestV0_ContractRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -2987,48 +3258,24 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "dataContract", + .name = "contractId", .dataTypeSpecific.clazz = Nil, - .number = GetDataContractResponse_GetDataContractResponseV0_FieldNumber_DataContract, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractResponse_GetDataContractResponseV0__storage_, dataContract), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeBytes, - }, - { - .name = "proof", - .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = GetDataContractResponse_GetDataContractResponseV0_FieldNumber_Proof, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractResponse_GetDataContractResponseV0__storage_, proof), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "metadata", - .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = GetDataContractResponse_GetDataContractResponseV0_FieldNumber_Metadata, + .number = GetProofsRequest_GetProofsRequestV0_ContractRequest_FieldNumber_ContractId, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetDataContractResponse_GetDataContractResponseV0__storage_, metadata), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .offset = (uint32_t)offsetof(GetProofsRequest_GetProofsRequestV0_ContractRequest__storage_, contractId), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractResponse_GetDataContractResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetProofsRequest_GetProofsRequestV0_ContractRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractResponse_GetDataContractResponseV0__storage_) + storageSize:sizeof(GetProofsRequest_GetProofsRequestV0_ContractRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "result", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsRequest_GetProofsRequestV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -3039,22 +3286,17 @@ + (GPBDescriptor *)descriptor { @end -void GetDataContractResponse_GetDataContractResponseV0_ClearResultOneOfCase(GetDataContractResponse_GetDataContractResponseV0 *message) { - GPBDescriptor *descriptor = [GetDataContractResponse_GetDataContractResponseV0 descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} -#pragma mark - GetDataContractsRequest +#pragma mark - GetProofsResponse -@implementation GetDataContractsRequest +@implementation GetProofsResponse @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetDataContractsRequest__storage_ { +typedef struct GetProofsResponse__storage_ { uint32_t _has_storage_[2]; - GetDataContractsRequest_GetDataContractsRequestV0 *v0; -} GetDataContractsRequest__storage_; + GetProofsResponse_GetProofsResponseV0 *v0; +} GetProofsResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3064,21 +3306,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractsRequest_GetDataContractsRequestV0), - .number = GetDataContractsRequest_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetProofsResponse_GetProofsResponseV0), + .number = GetProofsResponse_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractsRequest__storage_, v0), + .offset = (uint32_t)offsetof(GetProofsResponse__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractsRequest class] + [GPBDescriptor allocDescriptorForClass:[GetProofsResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractsRequest__storage_) + storageSize:sizeof(GetProofsResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -3096,22 +3338,24 @@ + (GPBDescriptor *)descriptor { @end -void GetDataContractsRequest_ClearVersionOneOfCase(GetDataContractsRequest *message) { - GPBDescriptor *descriptor = [GetDataContractsRequest descriptor]; +void GetProofsResponse_ClearVersionOneOfCase(GetProofsResponse *message) { + GPBDescriptor *descriptor = [GetProofsResponse descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetDataContractsRequest_GetDataContractsRequestV0 +#pragma mark - GetProofsResponse_GetProofsResponseV0 -@implementation GetDataContractsRequest_GetDataContractsRequestV0 +@implementation GetProofsResponse_GetProofsResponseV0 -@dynamic idsArray, idsArray_Count; -@dynamic prove; +@dynamic resultOneOfCase; +@dynamic proof; +@dynamic hasMetadata, metadata; -typedef struct GetDataContractsRequest_GetDataContractsRequestV0__storage_ { - uint32_t _has_storage_[1]; - NSMutableArray *idsArray; -} GetDataContractsRequest_GetDataContractsRequestV0__storage_; +typedef struct GetProofsResponse_GetProofsResponseV0__storage_ { + uint32_t _has_storage_[2]; + Proof *proof; + ResponseMetadata *metadata; +} GetProofsResponse_GetProofsResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3120,33 +3364,39 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "idsArray", - .dataTypeSpecific.clazz = Nil, - .number = GetDataContractsRequest_GetDataContractsRequestV0_FieldNumber_IdsArray, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetDataContractsRequest_GetDataContractsRequestV0__storage_, idsArray), - .flags = GPBFieldRepeated, - .dataType = GPBDataTypeBytes, + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetProofsResponse_GetProofsResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetProofsResponse_GetProofsResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, { - .name = "prove", - .dataTypeSpecific.clazz = Nil, - .number = GetDataContractsRequest_GetDataContractsRequestV0_FieldNumber_Prove, + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetProofsResponse_GetProofsResponseV0_FieldNumber_Metadata, .hasIndex = 0, - .offset = 1, // Stored in _has_storage_ to save space. - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBool, + .offset = (uint32_t)offsetof(GetProofsResponse_GetProofsResponseV0__storage_, metadata), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractsRequest_GetDataContractsRequestV0 class] + [GPBDescriptor allocDescriptorForClass:[GetProofsResponse_GetProofsResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractsRequest_GetDataContractsRequestV0__storage_) + storageSize:sizeof(GetProofsResponse_GetProofsResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractsRequest)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetProofsResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -3157,17 +3407,22 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetDataContractsResponse +void GetProofsResponse_GetProofsResponseV0_ClearResultOneOfCase(GetProofsResponse_GetProofsResponseV0 *message) { + GPBDescriptor *descriptor = [GetProofsResponse_GetProofsResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDataContractRequest -@implementation GetDataContractsResponse +@implementation GetDataContractRequest @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetDataContractsResponse__storage_ { +typedef struct GetDataContractRequest__storage_ { uint32_t _has_storage_[2]; - GetDataContractsResponse_GetDataContractsResponseV0 *v0; -} GetDataContractsResponse__storage_; + GetDataContractRequest_GetDataContractRequestV0 *v0; +} GetDataContractRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3177,21 +3432,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractsResponse_GetDataContractsResponseV0), - .number = GetDataContractsResponse_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractRequest_GetDataContractRequestV0), + .number = GetDataContractRequest_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractsResponse__storage_, v0), + .offset = (uint32_t)offsetof(GetDataContractRequest__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractsResponse class] + [GPBDescriptor allocDescriptorForClass:[GetDataContractRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractsResponse__storage_) + storageSize:sizeof(GetDataContractRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -3209,23 +3464,22 @@ + (GPBDescriptor *)descriptor { @end -void GetDataContractsResponse_ClearVersionOneOfCase(GetDataContractsResponse *message) { - GPBDescriptor *descriptor = [GetDataContractsResponse descriptor]; +void GetDataContractRequest_ClearVersionOneOfCase(GetDataContractRequest *message) { + GPBDescriptor *descriptor = [GetDataContractRequest descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetDataContractsResponse_DataContractEntry +#pragma mark - GetDataContractRequest_GetDataContractRequestV0 -@implementation GetDataContractsResponse_DataContractEntry +@implementation GetDataContractRequest_GetDataContractRequestV0 -@dynamic identifier; -@dynamic hasDataContract, dataContract; +@dynamic id_p; +@dynamic prove; -typedef struct GetDataContractsResponse_DataContractEntry__storage_ { +typedef struct GetDataContractRequest_GetDataContractRequestV0__storage_ { uint32_t _has_storage_[1]; - NSData *identifier; - GPBBytesValue *dataContract; -} GetDataContractsResponse_DataContractEntry__storage_; + NSData *id_p; +} GetDataContractRequest_GetDataContractRequestV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3234,33 +3488,33 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "identifier", + .name = "id_p", .dataTypeSpecific.clazz = Nil, - .number = GetDataContractsResponse_DataContractEntry_FieldNumber_Identifier, + .number = GetDataContractRequest_GetDataContractRequestV0_FieldNumber_Id_p, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetDataContractsResponse_DataContractEntry__storage_, identifier), + .offset = (uint32_t)offsetof(GetDataContractRequest_GetDataContractRequestV0__storage_, id_p), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBytes, }, { - .name = "dataContract", - .dataTypeSpecific.clazz = GPBObjCClass(GPBBytesValue), - .number = GetDataContractsResponse_DataContractEntry_FieldNumber_DataContract, + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetDataContractRequest_GetDataContractRequestV0_FieldNumber_Prove, .hasIndex = 1, - .offset = (uint32_t)offsetof(GetDataContractsResponse_DataContractEntry__storage_, dataContract), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .offset = 2, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractsResponse_DataContractEntry class] + [GPBDescriptor allocDescriptorForClass:[GetDataContractRequest_GetDataContractRequestV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractsResponse_DataContractEntry__storage_) + storageSize:sizeof(GetDataContractRequest_GetDataContractRequestV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractsResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractRequest)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -3271,16 +3525,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetDataContractsResponse_DataContracts +#pragma mark - GetDataContractResponse -@implementation GetDataContractsResponse_DataContracts +@implementation GetDataContractResponse -@dynamic dataContractEntriesArray, dataContractEntriesArray_Count; +@dynamic versionOneOfCase; +@dynamic v0; -typedef struct GetDataContractsResponse_DataContracts__storage_ { - uint32_t _has_storage_[1]; - NSMutableArray *dataContractEntriesArray; -} GetDataContractsResponse_DataContracts__storage_; +typedef struct GetDataContractResponse__storage_ { + uint32_t _has_storage_[2]; + GetDataContractResponse_GetDataContractResponseV0 *v0; +} GetDataContractResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3289,24 +3544,29 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "dataContractEntriesArray", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractsResponse_DataContractEntry), - .number = GetDataContractsResponse_DataContracts_FieldNumber_DataContractEntriesArray, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetDataContractsResponse_DataContracts__storage_, dataContractEntriesArray), - .flags = GPBFieldRepeated, + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractResponse_GetDataContractResponseV0), + .number = GetDataContractResponse_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDataContractResponse__storage_, v0), + .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractsResponse_DataContracts class] + [GPBDescriptor allocDescriptorForClass:[GetDataContractResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractsResponse_DataContracts__storage_) + storageSize:sizeof(GetDataContractResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractsResponse)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -3317,21 +3577,26 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetDataContractsResponse_GetDataContractsResponseV0 +void GetDataContractResponse_ClearVersionOneOfCase(GetDataContractResponse *message) { + GPBDescriptor *descriptor = [GetDataContractResponse descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDataContractResponse_GetDataContractResponseV0 -@implementation GetDataContractsResponse_GetDataContractsResponseV0 +@implementation GetDataContractResponse_GetDataContractResponseV0 @dynamic resultOneOfCase; -@dynamic dataContracts; +@dynamic dataContract; @dynamic proof; @dynamic hasMetadata, metadata; -typedef struct GetDataContractsResponse_GetDataContractsResponseV0__storage_ { +typedef struct GetDataContractResponse_GetDataContractResponseV0__storage_ { uint32_t _has_storage_[2]; - GetDataContractsResponse_DataContracts *dataContracts; + NSData *dataContract; Proof *proof; ResponseMetadata *metadata; -} GetDataContractsResponse_GetDataContractsResponseV0__storage_; +} GetDataContractResponse_GetDataContractResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3340,40 +3605,40 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "dataContracts", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractsResponse_DataContracts), - .number = GetDataContractsResponse_GetDataContractsResponseV0_FieldNumber_DataContracts, + .name = "dataContract", + .dataTypeSpecific.clazz = Nil, + .number = GetDataContractResponse_GetDataContractResponseV0_FieldNumber_DataContract, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractsResponse_GetDataContractsResponseV0__storage_, dataContracts), + .offset = (uint32_t)offsetof(GetDataContractResponse_GetDataContractResponseV0__storage_, dataContract), .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .dataType = GPBDataTypeBytes, }, { .name = "proof", .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = GetDataContractsResponse_GetDataContractsResponseV0_FieldNumber_Proof, + .number = GetDataContractResponse_GetDataContractResponseV0_FieldNumber_Proof, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractsResponse_GetDataContractsResponseV0__storage_, proof), + .offset = (uint32_t)offsetof(GetDataContractResponse_GetDataContractResponseV0__storage_, proof), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "metadata", .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = GetDataContractsResponse_GetDataContractsResponseV0_FieldNumber_Metadata, + .number = GetDataContractResponse_GetDataContractResponseV0_FieldNumber_Metadata, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetDataContractsResponse_GetDataContractsResponseV0__storage_, metadata), + .offset = (uint32_t)offsetof(GetDataContractResponse_GetDataContractResponseV0__storage_, metadata), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractsResponse_GetDataContractsResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetDataContractResponse_GetDataContractResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractsResponse_GetDataContractsResponseV0__storage_) + storageSize:sizeof(GetDataContractResponse_GetDataContractResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "result", @@ -3381,7 +3646,7 @@ + (GPBDescriptor *)descriptor { [localDescriptor setupOneofs:oneofs count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractsResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -3392,22 +3657,22 @@ + (GPBDescriptor *)descriptor { @end -void GetDataContractsResponse_GetDataContractsResponseV0_ClearResultOneOfCase(GetDataContractsResponse_GetDataContractsResponseV0 *message) { - GPBDescriptor *descriptor = [GetDataContractsResponse_GetDataContractsResponseV0 descriptor]; +void GetDataContractResponse_GetDataContractResponseV0_ClearResultOneOfCase(GetDataContractResponse_GetDataContractResponseV0 *message) { + GPBDescriptor *descriptor = [GetDataContractResponse_GetDataContractResponseV0 descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetDataContractHistoryRequest +#pragma mark - GetDataContractsRequest -@implementation GetDataContractHistoryRequest +@implementation GetDataContractsRequest @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetDataContractHistoryRequest__storage_ { +typedef struct GetDataContractsRequest__storage_ { uint32_t _has_storage_[2]; - GetDataContractHistoryRequest_GetDataContractHistoryRequestV0 *v0; -} GetDataContractHistoryRequest__storage_; + GetDataContractsRequest_GetDataContractsRequestV0 *v0; +} GetDataContractsRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3417,21 +3682,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0), - .number = GetDataContractHistoryRequest_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractsRequest_GetDataContractsRequestV0), + .number = GetDataContractsRequest_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractHistoryRequest__storage_, v0), + .offset = (uint32_t)offsetof(GetDataContractsRequest__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryRequest class] + [GPBDescriptor allocDescriptorForClass:[GetDataContractsRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractHistoryRequest__storage_) + storageSize:sizeof(GetDataContractsRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -3449,90 +3714,57 @@ + (GPBDescriptor *)descriptor { @end -void GetDataContractHistoryRequest_ClearVersionOneOfCase(GetDataContractHistoryRequest *message) { - GPBDescriptor *descriptor = [GetDataContractHistoryRequest descriptor]; +void GetDataContractsRequest_ClearVersionOneOfCase(GetDataContractsRequest *message) { + GPBDescriptor *descriptor = [GetDataContractsRequest descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetDataContractHistoryRequest_GetDataContractHistoryRequestV0 +#pragma mark - GetDataContractsRequest_GetDataContractsRequestV0 -@implementation GetDataContractHistoryRequest_GetDataContractHistoryRequestV0 +@implementation GetDataContractsRequest_GetDataContractsRequestV0 -@dynamic id_p; -@dynamic hasLimit, limit; -@dynamic hasOffset, offset; -@dynamic startAtMs; +@dynamic idsArray, idsArray_Count; @dynamic prove; -typedef struct GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_ { - uint32_t _has_storage_[1]; - NSData *id_p; - GPBUInt32Value *limit; - GPBUInt32Value *offset; - uint64_t startAtMs; -} GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "id_p", - .dataTypeSpecific.clazz = Nil, - .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_Id_p, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_, id_p), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, - }, - { - .name = "limit", - .dataTypeSpecific.clazz = GPBObjCClass(GPBUInt32Value), - .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_Limit, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_, limit), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "offset", - .dataTypeSpecific.clazz = GPBObjCClass(GPBUInt32Value), - .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_Offset, - .hasIndex = 2, - .offset = (uint32_t)offsetof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_, offset), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, +typedef struct GetDataContractsRequest_GetDataContractsRequestV0__storage_ { + uint32_t _has_storage_[1]; + NSMutableArray *idsArray; +} GetDataContractsRequest_GetDataContractsRequestV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { { - .name = "startAtMs", + .name = "idsArray", .dataTypeSpecific.clazz = Nil, - .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_StartAtMs, - .hasIndex = 3, - .offset = (uint32_t)offsetof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_, startAtMs), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeUInt64, + .number = GetDataContractsRequest_GetDataContractsRequestV0_FieldNumber_IdsArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetDataContractsRequest_GetDataContractsRequestV0__storage_, idsArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeBytes, }, { .name = "prove", .dataTypeSpecific.clazz = Nil, - .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_Prove, - .hasIndex = 4, - .offset = 5, // Stored in _has_storage_ to save space. + .number = GetDataContractsRequest_GetDataContractsRequestV0_FieldNumber_Prove, + .hasIndex = 0, + .offset = 1, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBool, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryRequest_GetDataContractHistoryRequestV0 class] + [GPBDescriptor allocDescriptorForClass:[GetDataContractsRequest_GetDataContractsRequestV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_) + storageSize:sizeof(GetDataContractsRequest_GetDataContractsRequestV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractHistoryRequest)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractsRequest)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -3543,17 +3775,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetDataContractHistoryResponse +#pragma mark - GetDataContractsResponse -@implementation GetDataContractHistoryResponse +@implementation GetDataContractsResponse @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetDataContractHistoryResponse__storage_ { +typedef struct GetDataContractsResponse__storage_ { uint32_t _has_storage_[2]; - GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 *v0; -} GetDataContractHistoryResponse__storage_; + GetDataContractsResponse_GetDataContractsResponseV0 *v0; +} GetDataContractsResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3563,21 +3795,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0), - .number = GetDataContractHistoryResponse_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractsResponse_GetDataContractsResponseV0), + .number = GetDataContractsResponse_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractHistoryResponse__storage_, v0), + .offset = (uint32_t)offsetof(GetDataContractsResponse__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryResponse class] + [GPBDescriptor allocDescriptorForClass:[GetDataContractsResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractHistoryResponse__storage_) + storageSize:sizeof(GetDataContractsResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -3595,26 +3827,23 @@ + (GPBDescriptor *)descriptor { @end -void GetDataContractHistoryResponse_ClearVersionOneOfCase(GetDataContractHistoryResponse *message) { - GPBDescriptor *descriptor = [GetDataContractHistoryResponse descriptor]; +void GetDataContractsResponse_ClearVersionOneOfCase(GetDataContractsResponse *message) { + GPBDescriptor *descriptor = [GetDataContractsResponse descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 +#pragma mark - GetDataContractsResponse_DataContractEntry -@implementation GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 +@implementation GetDataContractsResponse_DataContractEntry -@dynamic resultOneOfCase; -@dynamic dataContractHistory; -@dynamic proof; -@dynamic hasMetadata, metadata; +@dynamic identifier; +@dynamic hasDataContract, dataContract; -typedef struct GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_ { - uint32_t _has_storage_[2]; - GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory *dataContractHistory; - Proof *proof; - ResponseMetadata *metadata; -} GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_; +typedef struct GetDataContractsResponse_DataContractEntry__storage_ { + uint32_t _has_storage_[1]; + NSData *identifier; + GPBBytesValue *dataContract; +} GetDataContractsResponse_DataContractEntry__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3623,48 +3852,33 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "dataContractHistory", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory), - .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_FieldNumber_DataContractHistory, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_, dataContractHistory), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "proof", - .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_FieldNumber_Proof, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_, proof), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .name = "identifier", + .dataTypeSpecific.clazz = Nil, + .number = GetDataContractsResponse_DataContractEntry_FieldNumber_Identifier, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetDataContractsResponse_DataContractEntry__storage_, identifier), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, }, { - .name = "metadata", - .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_FieldNumber_Metadata, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_, metadata), + .name = "dataContract", + .dataTypeSpecific.clazz = GPBObjCClass(GPBBytesValue), + .number = GetDataContractsResponse_DataContractEntry_FieldNumber_DataContract, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetDataContractsResponse_DataContractEntry__storage_, dataContract), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetDataContractsResponse_DataContractEntry class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_) + storageSize:sizeof(GetDataContractsResponse_DataContractEntry__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "result", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractHistoryResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractsResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -3675,23 +3889,16 @@ + (GPBDescriptor *)descriptor { @end -void GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_ClearResultOneOfCase(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 *message) { - GPBDescriptor *descriptor = [GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} -#pragma mark - GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry +#pragma mark - GetDataContractsResponse_DataContracts -@implementation GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry +@implementation GetDataContractsResponse_DataContracts -@dynamic date; -@dynamic value; +@dynamic dataContractEntriesArray, dataContractEntriesArray_Count; -typedef struct GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_ { +typedef struct GetDataContractsResponse_DataContracts__storage_ { uint32_t _has_storage_[1]; - NSData *value; - uint64_t date; -} GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_; + NSMutableArray *dataContractEntriesArray; +} GetDataContractsResponse_DataContracts__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3700,33 +3907,24 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "date", - .dataTypeSpecific.clazz = Nil, - .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry_FieldNumber_Date, - .hasIndex = 0, - .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_, date), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeUInt64, - }, - { - .name = "value", - .dataTypeSpecific.clazz = Nil, - .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry_FieldNumber_Value, - .hasIndex = 1, - .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_, value), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, + .name = "dataContractEntriesArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractsResponse_DataContractEntry), + .number = GetDataContractsResponse_DataContracts_FieldNumber_DataContractEntriesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetDataContractsResponse_DataContracts__storage_, dataContractEntriesArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry class] + [GPBDescriptor allocDescriptorForClass:[GetDataContractsResponse_DataContracts class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_) + storageSize:sizeof(GetDataContractsResponse_DataContracts__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractsResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -3737,16 +3935,21 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory +#pragma mark - GetDataContractsResponse_GetDataContractsResponseV0 -@implementation GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory +@implementation GetDataContractsResponse_GetDataContractsResponseV0 -@dynamic dataContractEntriesArray, dataContractEntriesArray_Count; +@dynamic resultOneOfCase; +@dynamic dataContracts; +@dynamic proof; +@dynamic hasMetadata, metadata; -typedef struct GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory__storage_ { - uint32_t _has_storage_[1]; - NSMutableArray *dataContractEntriesArray; -} GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory__storage_; +typedef struct GetDataContractsResponse_GetDataContractsResponseV0__storage_ { + uint32_t _has_storage_[2]; + GetDataContractsResponse_DataContracts *dataContracts; + Proof *proof; + ResponseMetadata *metadata; +} GetDataContractsResponse_GetDataContractsResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3755,24 +3958,48 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "dataContractEntriesArray", - .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry), - .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory_FieldNumber_DataContractEntriesArray, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory__storage_, dataContractEntriesArray), - .flags = GPBFieldRepeated, + .name = "dataContracts", + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractsResponse_DataContracts), + .number = GetDataContractsResponse_GetDataContractsResponseV0_FieldNumber_DataContracts, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDataContractsResponse_GetDataContractsResponseV0__storage_, dataContracts), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetDataContractsResponse_GetDataContractsResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDataContractsResponse_GetDataContractsResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetDataContractsResponse_GetDataContractsResponseV0_FieldNumber_Metadata, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetDataContractsResponse_GetDataContractsResponseV0__storage_, metadata), + .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory class] + [GPBDescriptor allocDescriptorForClass:[GetDataContractsResponse_GetDataContractsResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory__storage_) + storageSize:sizeof(GetDataContractsResponse_GetDataContractsResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractsResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -3783,17 +4010,22 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetDocumentsRequest +void GetDataContractsResponse_GetDataContractsResponseV0_ClearResultOneOfCase(GetDataContractsResponse_GetDataContractsResponseV0 *message) { + GPBDescriptor *descriptor = [GetDataContractsResponse_GetDataContractsResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDataContractHistoryRequest -@implementation GetDocumentsRequest +@implementation GetDataContractHistoryRequest @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetDocumentsRequest__storage_ { +typedef struct GetDataContractHistoryRequest__storage_ { uint32_t _has_storage_[2]; - GetDocumentsRequest_GetDocumentsRequestV0 *v0; -} GetDocumentsRequest__storage_; + GetDataContractHistoryRequest_GetDataContractHistoryRequestV0 *v0; +} GetDataContractHistoryRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3803,21 +4035,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetDocumentsRequest_GetDocumentsRequestV0), - .number = GetDocumentsRequest_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0), + .number = GetDataContractHistoryRequest_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDocumentsRequest__storage_, v0), + .offset = (uint32_t)offsetof(GetDataContractHistoryRequest__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDocumentsRequest class] + [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDocumentsRequest__storage_) + storageSize:sizeof(GetDataContractHistoryRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -3835,35 +4067,28 @@ + (GPBDescriptor *)descriptor { @end -void GetDocumentsRequest_ClearVersionOneOfCase(GetDocumentsRequest *message) { - GPBDescriptor *descriptor = [GetDocumentsRequest descriptor]; +void GetDataContractHistoryRequest_ClearVersionOneOfCase(GetDataContractHistoryRequest *message) { + GPBDescriptor *descriptor = [GetDataContractHistoryRequest descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetDocumentsRequest_GetDocumentsRequestV0 +#pragma mark - GetDataContractHistoryRequest_GetDataContractHistoryRequestV0 -@implementation GetDocumentsRequest_GetDocumentsRequestV0 +@implementation GetDataContractHistoryRequest_GetDataContractHistoryRequestV0 -@dynamic startOneOfCase; -@dynamic dataContractId; -@dynamic documentType; -@dynamic where; -@dynamic orderBy; -@dynamic limit; -@dynamic startAfter; -@dynamic startAt; +@dynamic id_p; +@dynamic hasLimit, limit; +@dynamic hasOffset, offset; +@dynamic startAtMs; @dynamic prove; -typedef struct GetDocumentsRequest_GetDocumentsRequestV0__storage_ { - uint32_t _has_storage_[2]; - uint32_t limit; - NSData *dataContractId; - NSString *documentType; - NSData *where; - NSData *orderBy; - NSData *startAfter; - NSData *startAt; -} GetDocumentsRequest_GetDocumentsRequestV0__storage_; +typedef struct GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_ { + uint32_t _has_storage_[1]; + NSData *id_p; + GPBUInt32Value *limit; + GPBUInt32Value *offset; + uint64_t startAtMs; +} GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3872,93 +4097,60 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "dataContractId", + .name = "id_p", .dataTypeSpecific.clazz = Nil, - .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_DataContractId, + .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_Id_p, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, dataContractId), + .offset = (uint32_t)offsetof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_, id_p), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBytes, }, { - .name = "documentType", - .dataTypeSpecific.clazz = Nil, - .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_DocumentType, + .name = "limit", + .dataTypeSpecific.clazz = GPBObjCClass(GPBUInt32Value), + .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_Limit, .hasIndex = 1, - .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, documentType), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeString, + .offset = (uint32_t)offsetof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_, limit), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, { - .name = "where", - .dataTypeSpecific.clazz = Nil, - .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_Where, + .name = "offset", + .dataTypeSpecific.clazz = GPBObjCClass(GPBUInt32Value), + .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_Offset, .hasIndex = 2, - .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, where), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, + .offset = (uint32_t)offsetof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_, offset), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, }, { - .name = "orderBy", + .name = "startAtMs", .dataTypeSpecific.clazz = Nil, - .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_OrderBy, + .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_StartAtMs, .hasIndex = 3, - .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, orderBy), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBytes, - }, - { - .name = "limit", - .dataTypeSpecific.clazz = Nil, - .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_Limit, - .hasIndex = 4, - .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, limit), + .offset = (uint32_t)offsetof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_, startAtMs), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeUInt32, - }, - { - .name = "startAfter", - .dataTypeSpecific.clazz = Nil, - .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_StartAfter, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, startAfter), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeBytes, - }, - { - .name = "startAt", - .dataTypeSpecific.clazz = Nil, - .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_StartAt, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, startAt), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeBytes, + .dataType = GPBDataTypeUInt64, }, { .name = "prove", .dataTypeSpecific.clazz = Nil, - .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_Prove, - .hasIndex = 5, - .offset = 6, // Stored in _has_storage_ to save space. + .number = GetDataContractHistoryRequest_GetDataContractHistoryRequestV0_FieldNumber_Prove, + .hasIndex = 4, + .offset = 5, // Stored in _has_storage_ to save space. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBool, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDocumentsRequest_GetDocumentsRequestV0 class] + [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryRequest_GetDataContractHistoryRequestV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDocumentsRequest_GetDocumentsRequestV0__storage_) + storageSize:sizeof(GetDataContractHistoryRequest_GetDataContractHistoryRequestV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "start", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDocumentsRequest)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractHistoryRequest)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -3969,22 +4161,17 @@ + (GPBDescriptor *)descriptor { @end -void GetDocumentsRequest_GetDocumentsRequestV0_ClearStartOneOfCase(GetDocumentsRequest_GetDocumentsRequestV0 *message) { - GPBDescriptor *descriptor = [GetDocumentsRequest_GetDocumentsRequestV0 descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} -#pragma mark - GetDocumentsResponse +#pragma mark - GetDataContractHistoryResponse -@implementation GetDocumentsResponse +@implementation GetDataContractHistoryResponse @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetDocumentsResponse__storage_ { +typedef struct GetDataContractHistoryResponse__storage_ { uint32_t _has_storage_[2]; - GetDocumentsResponse_GetDocumentsResponseV0 *v0; -} GetDocumentsResponse__storage_; + GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 *v0; +} GetDataContractHistoryResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -3994,21 +4181,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetDocumentsResponse_GetDocumentsResponseV0), - .number = GetDocumentsResponse_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0), + .number = GetDataContractHistoryResponse_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDocumentsResponse__storage_, v0), + .offset = (uint32_t)offsetof(GetDataContractHistoryResponse__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDocumentsResponse class] + [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDocumentsResponse__storage_) + storageSize:sizeof(GetDataContractHistoryResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -4026,26 +4213,26 @@ + (GPBDescriptor *)descriptor { @end -void GetDocumentsResponse_ClearVersionOneOfCase(GetDocumentsResponse *message) { - GPBDescriptor *descriptor = [GetDocumentsResponse descriptor]; +void GetDataContractHistoryResponse_ClearVersionOneOfCase(GetDataContractHistoryResponse *message) { + GPBDescriptor *descriptor = [GetDataContractHistoryResponse descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetDocumentsResponse_GetDocumentsResponseV0 +#pragma mark - GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 -@implementation GetDocumentsResponse_GetDocumentsResponseV0 +@implementation GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 @dynamic resultOneOfCase; -@dynamic documents; +@dynamic dataContractHistory; @dynamic proof; @dynamic hasMetadata, metadata; -typedef struct GetDocumentsResponse_GetDocumentsResponseV0__storage_ { +typedef struct GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_ { uint32_t _has_storage_[2]; - GetDocumentsResponse_GetDocumentsResponseV0_Documents *documents; + GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory *dataContractHistory; Proof *proof; ResponseMetadata *metadata; -} GetDocumentsResponse_GetDocumentsResponseV0__storage_; +} GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4054,40 +4241,40 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "documents", - .dataTypeSpecific.clazz = GPBObjCClass(GetDocumentsResponse_GetDocumentsResponseV0_Documents), - .number = GetDocumentsResponse_GetDocumentsResponseV0_FieldNumber_Documents, + .name = "dataContractHistory", + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory), + .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_FieldNumber_DataContractHistory, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDocumentsResponse_GetDocumentsResponseV0__storage_, documents), + .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_, dataContractHistory), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "proof", .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = GetDocumentsResponse_GetDocumentsResponseV0_FieldNumber_Proof, + .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_FieldNumber_Proof, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetDocumentsResponse_GetDocumentsResponseV0__storage_, proof), + .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_, proof), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "metadata", .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = GetDocumentsResponse_GetDocumentsResponseV0_FieldNumber_Metadata, + .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_FieldNumber_Metadata, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetDocumentsResponse_GetDocumentsResponseV0__storage_, metadata), + .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_, metadata), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDocumentsResponse_GetDocumentsResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDocumentsResponse_GetDocumentsResponseV0__storage_) + storageSize:sizeof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "result", @@ -4095,7 +4282,7 @@ + (GPBDescriptor *)descriptor { [localDescriptor setupOneofs:oneofs count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDocumentsResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractHistoryResponse)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -4106,21 +4293,23 @@ + (GPBDescriptor *)descriptor { @end -void GetDocumentsResponse_GetDocumentsResponseV0_ClearResultOneOfCase(GetDocumentsResponse_GetDocumentsResponseV0 *message) { - GPBDescriptor *descriptor = [GetDocumentsResponse_GetDocumentsResponseV0 descriptor]; +void GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_ClearResultOneOfCase(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 *message) { + GPBDescriptor *descriptor = [GetDataContractHistoryResponse_GetDataContractHistoryResponseV0 descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetDocumentsResponse_GetDocumentsResponseV0_Documents +#pragma mark - GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry -@implementation GetDocumentsResponse_GetDocumentsResponseV0_Documents +@implementation GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry -@dynamic documentsArray, documentsArray_Count; +@dynamic date; +@dynamic value; -typedef struct GetDocumentsResponse_GetDocumentsResponseV0_Documents__storage_ { +typedef struct GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_ { uint32_t _has_storage_[1]; - NSMutableArray *documentsArray; -} GetDocumentsResponse_GetDocumentsResponseV0_Documents__storage_; + NSData *value; + uint64_t date; +} GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4129,76 +4318,33 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "documentsArray", + .name = "date", .dataTypeSpecific.clazz = Nil, - .number = GetDocumentsResponse_GetDocumentsResponseV0_Documents_FieldNumber_DocumentsArray, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetDocumentsResponse_GetDocumentsResponseV0_Documents__storage_, documentsArray), - .flags = GPBFieldRepeated, - .dataType = GPBDataTypeBytes, + .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry_FieldNumber_Date, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_, date), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt64, }, - }; - GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetDocumentsResponse_GetDocumentsResponseV0_Documents class] - rootClass:[PlatformRoot class] - file:PlatformRoot_FileDescriptor() - fields:fields - fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetDocumentsResponse_GetDocumentsResponseV0_Documents__storage_) - flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDocumentsResponse_GetDocumentsResponseV0)]; - #if defined(DEBUG) && DEBUG - NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG - descriptor = localDescriptor; - } - return descriptor; -} - -@end - -#pragma mark - GetIdentitiesByPublicKeyHashesRequest - -@implementation GetIdentitiesByPublicKeyHashesRequest - -@dynamic versionOneOfCase; -@dynamic v0; - -typedef struct GetIdentitiesByPublicKeyHashesRequest__storage_ { - uint32_t _has_storage_[2]; - GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0 *v0; -} GetIdentitiesByPublicKeyHashesRequest__storage_; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { { - .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0), - .number = GetIdentitiesByPublicKeyHashesRequest_FieldNumber_V0, - .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentitiesByPublicKeyHashesRequest__storage_, v0), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .name = "value", + .dataTypeSpecific.clazz = Nil, + .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry_FieldNumber_Value, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_, value), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesByPublicKeyHashesRequest class] + [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesByPublicKeyHashesRequest__storage_) + storageSize:sizeof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "version", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -4209,22 +4355,16 @@ + (GPBDescriptor *)descriptor { @end -void GetIdentitiesByPublicKeyHashesRequest_ClearVersionOneOfCase(GetIdentitiesByPublicKeyHashesRequest *message) { - GPBDescriptor *descriptor = [GetIdentitiesByPublicKeyHashesRequest descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} -#pragma mark - GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0 +#pragma mark - GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory -@implementation GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0 +@implementation GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory -@dynamic publicKeyHashesArray, publicKeyHashesArray_Count; -@dynamic prove; +@dynamic dataContractEntriesArray, dataContractEntriesArray_Count; -typedef struct GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0__storage_ { +typedef struct GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory__storage_ { uint32_t _has_storage_[1]; - NSMutableArray *publicKeyHashesArray; -} GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0__storage_; + NSMutableArray *dataContractEntriesArray; +} GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4233,33 +4373,24 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "publicKeyHashesArray", - .dataTypeSpecific.clazz = Nil, - .number = GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0_FieldNumber_PublicKeyHashesArray, + .name = "dataContractEntriesArray", + .dataTypeSpecific.clazz = GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistoryEntry), + .number = GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory_FieldNumber_DataContractEntriesArray, .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0__storage_, publicKeyHashesArray), + .offset = (uint32_t)offsetof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory__storage_, dataContractEntriesArray), .flags = GPBFieldRepeated, - .dataType = GPBDataTypeBytes, - }, - { - .name = "prove", - .dataTypeSpecific.clazz = Nil, - .number = GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0_FieldNumber_Prove, - .hasIndex = 0, - .offset = 1, // Stored in _has_storage_ to save space. - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), - .dataType = GPBDataTypeBool, + .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0 class] + [GPBDescriptor allocDescriptorForClass:[GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesByPublicKeyHashesRequest_GetIdentitiesByPublicKeyHashesRequestV0__storage_) + storageSize:sizeof(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0_DataContractHistory__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesByPublicKeyHashesRequest)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDataContractHistoryResponse_GetDataContractHistoryResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -4270,17 +4401,17 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetIdentitiesByPublicKeyHashesResponse +#pragma mark - GetDocumentsRequest -@implementation GetIdentitiesByPublicKeyHashesResponse +@implementation GetDocumentsRequest @dynamic versionOneOfCase; @dynamic v0; -typedef struct GetIdentitiesByPublicKeyHashesResponse__storage_ { +typedef struct GetDocumentsRequest__storage_ { uint32_t _has_storage_[2]; - GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 *v0; -} GetIdentitiesByPublicKeyHashesResponse__storage_; + GetDocumentsRequest_GetDocumentsRequestV0 *v0; +} GetDocumentsRequest__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4290,21 +4421,21 @@ + (GPBDescriptor *)descriptor { static GPBMessageFieldDescription fields[] = { { .name = "v0", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0), - .number = GetIdentitiesByPublicKeyHashesResponse_FieldNumber_V0, + .dataTypeSpecific.clazz = GPBObjCClass(GetDocumentsRequest_GetDocumentsRequestV0), + .number = GetDocumentsRequest_FieldNumber_V0, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentitiesByPublicKeyHashesResponse__storage_, v0), + .offset = (uint32_t)offsetof(GetDocumentsRequest__storage_, v0), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesByPublicKeyHashesResponse class] + [GPBDescriptor allocDescriptorForClass:[GetDocumentsRequest class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesByPublicKeyHashesResponse__storage_) + storageSize:sizeof(GetDocumentsRequest__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; static const char *oneofs[] = { "version", @@ -4322,23 +4453,35 @@ + (GPBDescriptor *)descriptor { @end -void GetIdentitiesByPublicKeyHashesResponse_ClearVersionOneOfCase(GetIdentitiesByPublicKeyHashesResponse *message) { - GPBDescriptor *descriptor = [GetIdentitiesByPublicKeyHashesResponse descriptor]; +void GetDocumentsRequest_ClearVersionOneOfCase(GetDocumentsRequest *message) { + GPBDescriptor *descriptor = [GetDocumentsRequest descriptor]; GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBClearOneof(message, oneof); } -#pragma mark - GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry +#pragma mark - GetDocumentsRequest_GetDocumentsRequestV0 -@implementation GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry +@implementation GetDocumentsRequest_GetDocumentsRequestV0 -@dynamic publicKeyHash; -@dynamic hasValue, value; +@dynamic startOneOfCase; +@dynamic dataContractId; +@dynamic documentType; +@dynamic where; +@dynamic orderBy; +@dynamic limit; +@dynamic startAfter; +@dynamic startAt; +@dynamic prove; -typedef struct GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry__storage_ { - uint32_t _has_storage_[1]; - NSData *publicKeyHash; - GPBBytesValue *value; -} GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry__storage_; +typedef struct GetDocumentsRequest_GetDocumentsRequestV0__storage_ { + uint32_t _has_storage_[2]; + uint32_t limit; + NSData *dataContractId; + NSString *documentType; + NSData *where; + NSData *orderBy; + NSData *startAfter; + NSData *startAt; +} GetDocumentsRequest_GetDocumentsRequestV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4347,33 +4490,93 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "publicKeyHash", + .name = "dataContractId", .dataTypeSpecific.clazz = Nil, - .number = GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry_FieldNumber_PublicKeyHash, + .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_DataContractId, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry__storage_, publicKeyHash), + .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, dataContractId), .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeBytes, }, { - .name = "value", - .dataTypeSpecific.clazz = GPBObjCClass(GPBBytesValue), - .number = GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry_FieldNumber_Value, + .name = "documentType", + .dataTypeSpecific.clazz = Nil, + .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_DocumentType, .hasIndex = 1, - .offset = (uint32_t)offsetof(GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry__storage_, value), + .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, documentType), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeString, + }, + { + .name = "where", + .dataTypeSpecific.clazz = Nil, + .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_Where, + .hasIndex = 2, + .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, where), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "orderBy", + .dataTypeSpecific.clazz = Nil, + .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_OrderBy, + .hasIndex = 3, + .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, orderBy), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBytes, + }, + { + .name = "limit", + .dataTypeSpecific.clazz = Nil, + .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_Limit, + .hasIndex = 4, + .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, limit), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt32, + }, + { + .name = "startAfter", + .dataTypeSpecific.clazz = Nil, + .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_StartAfter, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, startAfter), .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, + .dataType = GPBDataTypeBytes, + }, + { + .name = "startAt", + .dataTypeSpecific.clazz = Nil, + .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_StartAt, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDocumentsRequest_GetDocumentsRequestV0__storage_, startAt), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeBytes, + }, + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetDocumentsRequest_GetDocumentsRequestV0_FieldNumber_Prove, + .hasIndex = 5, + .offset = 6, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry class] + [GPBDescriptor allocDescriptorForClass:[GetDocumentsRequest_GetDocumentsRequestV0 class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry__storage_) + storageSize:sizeof(GetDocumentsRequest_GetDocumentsRequestV0__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesByPublicKeyHashesResponse)]; + static const char *oneofs[] = { + "start", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDocumentsRequest)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -4384,16 +4587,22 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes +void GetDocumentsRequest_GetDocumentsRequestV0_ClearStartOneOfCase(GetDocumentsRequest_GetDocumentsRequestV0 *message) { + GPBDescriptor *descriptor = [GetDocumentsRequest_GetDocumentsRequestV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDocumentsResponse -@implementation GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes +@implementation GetDocumentsResponse -@dynamic identityEntriesArray, identityEntriesArray_Count; +@dynamic versionOneOfCase; +@dynamic v0; -typedef struct GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes__storage_ { - uint32_t _has_storage_[1]; - NSMutableArray *identityEntriesArray; -} GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes__storage_; +typedef struct GetDocumentsResponse__storage_ { + uint32_t _has_storage_[2]; + GetDocumentsResponse_GetDocumentsResponseV0 *v0; +} GetDocumentsResponse__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4402,24 +4611,29 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "identityEntriesArray", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesByPublicKeyHashesResponse_PublicKeyHashIdentityEntry), - .number = GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes_FieldNumber_IdentityEntriesArray, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes__storage_, identityEntriesArray), - .flags = GPBFieldRepeated, + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetDocumentsResponse_GetDocumentsResponseV0), + .number = GetDocumentsResponse_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetDocumentsResponse__storage_, v0), + .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes class] + [GPBDescriptor allocDescriptorForClass:[GetDocumentsResponse class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes__storage_) + storageSize:sizeof(GetDocumentsResponse__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesByPublicKeyHashesResponse)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -4430,21 +4644,26 @@ + (GPBDescriptor *)descriptor { @end -#pragma mark - GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 +void GetDocumentsResponse_ClearVersionOneOfCase(GetDocumentsResponse *message) { + GPBDescriptor *descriptor = [GetDocumentsResponse descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDocumentsResponse_GetDocumentsResponseV0 -@implementation GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 +@implementation GetDocumentsResponse_GetDocumentsResponseV0 @dynamic resultOneOfCase; -@dynamic identities; +@dynamic documents; @dynamic proof; @dynamic hasMetadata, metadata; -typedef struct GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0__storage_ { +typedef struct GetDocumentsResponse_GetDocumentsResponseV0__storage_ { uint32_t _has_storage_[2]; - GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes *identities; + GetDocumentsResponse_GetDocumentsResponseV0_Documents *documents; Proof *proof; ResponseMetadata *metadata; -} GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0__storage_; +} GetDocumentsResponse_GetDocumentsResponseV0__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. @@ -4453,48 +4672,99 @@ + (GPBDescriptor *)descriptor { if (!descriptor) { static GPBMessageFieldDescription fields[] = { { - .name = "identities", - .dataTypeSpecific.clazz = GPBObjCClass(GetIdentitiesByPublicKeyHashesResponse_IdentitiesByPublicKeyHashes), - .number = GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_FieldNumber_Identities, + .name = "documents", + .dataTypeSpecific.clazz = GPBObjCClass(GetDocumentsResponse_GetDocumentsResponseV0_Documents), + .number = GetDocumentsResponse_GetDocumentsResponseV0_FieldNumber_Documents, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0__storage_, identities), + .offset = (uint32_t)offsetof(GetDocumentsResponse_GetDocumentsResponseV0__storage_, documents), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "proof", .dataTypeSpecific.clazz = GPBObjCClass(Proof), - .number = GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_FieldNumber_Proof, + .number = GetDocumentsResponse_GetDocumentsResponseV0_FieldNumber_Proof, .hasIndex = -1, - .offset = (uint32_t)offsetof(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0__storage_, proof), + .offset = (uint32_t)offsetof(GetDocumentsResponse_GetDocumentsResponseV0__storage_, proof), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, { .name = "metadata", .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), - .number = GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_FieldNumber_Metadata, + .number = GetDocumentsResponse_GetDocumentsResponseV0_FieldNumber_Metadata, .hasIndex = 0, - .offset = (uint32_t)offsetof(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0__storage_, metadata), + .offset = (uint32_t)offsetof(GetDocumentsResponse_GetDocumentsResponseV0__storage_, metadata), .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, }; GPBDescriptor *localDescriptor = - [GPBDescriptor allocDescriptorForClass:[GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 class] + [GPBDescriptor allocDescriptorForClass:[GetDocumentsResponse_GetDocumentsResponseV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetDocumentsResponse_GetDocumentsResponseV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDocumentsResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetDocumentsResponse_GetDocumentsResponseV0_ClearResultOneOfCase(GetDocumentsResponse_GetDocumentsResponseV0 *message) { + GPBDescriptor *descriptor = [GetDocumentsResponse_GetDocumentsResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetDocumentsResponse_GetDocumentsResponseV0_Documents + +@implementation GetDocumentsResponse_GetDocumentsResponseV0_Documents + +@dynamic documentsArray, documentsArray_Count; + +typedef struct GetDocumentsResponse_GetDocumentsResponseV0_Documents__storage_ { + uint32_t _has_storage_[1]; + NSMutableArray *documentsArray; +} GetDocumentsResponse_GetDocumentsResponseV0_Documents__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "documentsArray", + .dataTypeSpecific.clazz = Nil, + .number = GetDocumentsResponse_GetDocumentsResponseV0_Documents_FieldNumber_DocumentsArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetDocumentsResponse_GetDocumentsResponseV0_Documents__storage_, documentsArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeBytes, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetDocumentsResponse_GetDocumentsResponseV0_Documents class] rootClass:[PlatformRoot class] file:PlatformRoot_FileDescriptor() fields:fields fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0__storage_) + storageSize:sizeof(GetDocumentsResponse_GetDocumentsResponseV0_Documents__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; - static const char *oneofs[] = { - "result", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; - [localDescriptor setupContainingMessageClass:GPBObjCClass(GetIdentitiesByPublicKeyHashesResponse)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetDocumentsResponse_GetDocumentsResponseV0)]; #if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); #endif // DEBUG @@ -4505,11 +4775,6 @@ + (GPBDescriptor *)descriptor { @end -void GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0_ClearResultOneOfCase(GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 *message) { - GPBDescriptor *descriptor = [GetIdentitiesByPublicKeyHashesResponse_GetIdentitiesByPublicKeyHashesResponseV0 descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBClearOneof(message, oneof); -} #pragma mark - GetIdentityByPublicKeyHashRequest @implementation GetIdentityByPublicKeyHashRequest @@ -6405,11 +6670,13 @@ @implementation GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo @dynamic firstCoreBlockHeight; @dynamic startTime; @dynamic feeMultiplier; +@dynamic protocolVersion; typedef struct GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_ { uint32_t _has_storage_[1]; uint32_t number; uint32_t firstCoreBlockHeight; + uint32_t protocolVersion; uint64_t firstBlockHeight; uint64_t startTime; double feeMultiplier; @@ -6466,6 +6733,15 @@ + (GPBDescriptor *)descriptor { .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), .dataType = GPBDataTypeDouble, }, + { + .name = "protocolVersion", + .dataTypeSpecific.clazz = Nil, + .number = GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo_FieldNumber_ProtocolVersion, + .hasIndex = 5, + .offset = (uint32_t)offsetof(GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo__storage_, protocolVersion), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeUInt32, + }, }; GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[GetEpochsInfoResponse_GetEpochsInfoResponseV0_EpochInfo class] @@ -6486,6 +6762,313 @@ + (GPBDescriptor *)descriptor { @end +#pragma mark - GetPathElementsRequest + +@implementation GetPathElementsRequest + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetPathElementsRequest__storage_ { + uint32_t _has_storage_[2]; + GetPathElementsRequest_GetPathElementsRequestV0 *v0; +} GetPathElementsRequest__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetPathElementsRequest_GetPathElementsRequestV0), + .number = GetPathElementsRequest_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetPathElementsRequest__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetPathElementsRequest class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetPathElementsRequest__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetPathElementsRequest_ClearVersionOneOfCase(GetPathElementsRequest *message) { + GPBDescriptor *descriptor = [GetPathElementsRequest descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetPathElementsRequest_GetPathElementsRequestV0 + +@implementation GetPathElementsRequest_GetPathElementsRequestV0 + +@dynamic pathArray, pathArray_Count; +@dynamic keysArray, keysArray_Count; +@dynamic prove; + +typedef struct GetPathElementsRequest_GetPathElementsRequestV0__storage_ { + uint32_t _has_storage_[1]; + NSMutableArray *pathArray; + NSMutableArray *keysArray; +} GetPathElementsRequest_GetPathElementsRequestV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "pathArray", + .dataTypeSpecific.clazz = Nil, + .number = GetPathElementsRequest_GetPathElementsRequestV0_FieldNumber_PathArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetPathElementsRequest_GetPathElementsRequestV0__storage_, pathArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeBytes, + }, + { + .name = "keysArray", + .dataTypeSpecific.clazz = Nil, + .number = GetPathElementsRequest_GetPathElementsRequestV0_FieldNumber_KeysArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetPathElementsRequest_GetPathElementsRequestV0__storage_, keysArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeBytes, + }, + { + .name = "prove", + .dataTypeSpecific.clazz = Nil, + .number = GetPathElementsRequest_GetPathElementsRequestV0_FieldNumber_Prove, + .hasIndex = 0, + .offset = 1, // Stored in _has_storage_ to save space. + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero), + .dataType = GPBDataTypeBool, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetPathElementsRequest_GetPathElementsRequestV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetPathElementsRequest_GetPathElementsRequestV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetPathElementsRequest)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetPathElementsResponse + +@implementation GetPathElementsResponse + +@dynamic versionOneOfCase; +@dynamic v0; + +typedef struct GetPathElementsResponse__storage_ { + uint32_t _has_storage_[2]; + GetPathElementsResponse_GetPathElementsResponseV0 *v0; +} GetPathElementsResponse__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "v0", + .dataTypeSpecific.clazz = GPBObjCClass(GetPathElementsResponse_GetPathElementsResponseV0), + .number = GetPathElementsResponse_FieldNumber_V0, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetPathElementsResponse__storage_, v0), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetPathElementsResponse class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetPathElementsResponse__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "version", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetPathElementsResponse_ClearVersionOneOfCase(GetPathElementsResponse *message) { + GPBDescriptor *descriptor = [GetPathElementsResponse descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetPathElementsResponse_GetPathElementsResponseV0 + +@implementation GetPathElementsResponse_GetPathElementsResponseV0 + +@dynamic resultOneOfCase; +@dynamic elements; +@dynamic proof; +@dynamic hasMetadata, metadata; + +typedef struct GetPathElementsResponse_GetPathElementsResponseV0__storage_ { + uint32_t _has_storage_[2]; + GetPathElementsResponse_GetPathElementsResponseV0_Elements *elements; + Proof *proof; + ResponseMetadata *metadata; +} GetPathElementsResponse_GetPathElementsResponseV0__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "elements", + .dataTypeSpecific.clazz = GPBObjCClass(GetPathElementsResponse_GetPathElementsResponseV0_Elements), + .number = GetPathElementsResponse_GetPathElementsResponseV0_FieldNumber_Elements, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetPathElementsResponse_GetPathElementsResponseV0__storage_, elements), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "proof", + .dataTypeSpecific.clazz = GPBObjCClass(Proof), + .number = GetPathElementsResponse_GetPathElementsResponseV0_FieldNumber_Proof, + .hasIndex = -1, + .offset = (uint32_t)offsetof(GetPathElementsResponse_GetPathElementsResponseV0__storage_, proof), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "metadata", + .dataTypeSpecific.clazz = GPBObjCClass(ResponseMetadata), + .number = GetPathElementsResponse_GetPathElementsResponseV0_FieldNumber_Metadata, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetPathElementsResponse_GetPathElementsResponseV0__storage_, metadata), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetPathElementsResponse_GetPathElementsResponseV0 class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetPathElementsResponse_GetPathElementsResponseV0__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + static const char *oneofs[] = { + "result", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetPathElementsResponse)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void GetPathElementsResponse_GetPathElementsResponseV0_ClearResultOneOfCase(GetPathElementsResponse_GetPathElementsResponseV0 *message) { + GPBDescriptor *descriptor = [GetPathElementsResponse_GetPathElementsResponseV0 descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBClearOneof(message, oneof); +} +#pragma mark - GetPathElementsResponse_GetPathElementsResponseV0_Elements + +@implementation GetPathElementsResponse_GetPathElementsResponseV0_Elements + +@dynamic elementsArray, elementsArray_Count; + +typedef struct GetPathElementsResponse_GetPathElementsResponseV0_Elements__storage_ { + uint32_t _has_storage_[1]; + NSMutableArray *elementsArray; +} GetPathElementsResponse_GetPathElementsResponseV0_Elements__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "elementsArray", + .dataTypeSpecific.clazz = Nil, + .number = GetPathElementsResponse_GetPathElementsResponseV0_Elements_FieldNumber_ElementsArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(GetPathElementsResponse_GetPathElementsResponseV0_Elements__storage_, elementsArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeBytes, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetPathElementsResponse_GetPathElementsResponseV0_Elements class] + rootClass:[PlatformRoot class] + file:PlatformRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetPathElementsResponse_GetPathElementsResponseV0_Elements__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(GetPathElementsResponse_GetPathElementsResponseV0)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + #pragma clang diagnostic pop diff --git a/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbrpc.h b/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbrpc.h index 062e8b49445..e3182d0c379 100644 --- a/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbrpc.h +++ b/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbrpc.h @@ -28,20 +28,24 @@ @class GetDocumentsResponse; @class GetEpochsInfoRequest; @class GetEpochsInfoResponse; -@class GetIdentitiesByPublicKeyHashesRequest; -@class GetIdentitiesByPublicKeyHashesResponse; -@class GetIdentitiesRequest; -@class GetIdentitiesResponse; +@class GetIdentitiesContractKeysRequest; +@class GetIdentitiesContractKeysResponse; @class GetIdentityBalanceAndRevisionRequest; @class GetIdentityBalanceAndRevisionResponse; @class GetIdentityBalanceRequest; @class GetIdentityBalanceResponse; @class GetIdentityByPublicKeyHashRequest; @class GetIdentityByPublicKeyHashResponse; +@class GetIdentityContractNonceRequest; +@class GetIdentityContractNonceResponse; @class GetIdentityKeysRequest; @class GetIdentityKeysResponse; +@class GetIdentityNonceRequest; +@class GetIdentityNonceResponse; @class GetIdentityRequest; @class GetIdentityResponse; +@class GetPathElementsRequest; +@class GetPathElementsResponse; @class GetProofsRequest; @class GetProofsResponse; @class GetProtocolVersionUpgradeStateRequest; @@ -88,14 +92,22 @@ NS_ASSUME_NONNULL_BEGIN - (GRPCUnaryProtoCall *)getIdentityWithMessage:(GetIdentityRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; -#pragma mark getIdentities(GetIdentitiesRequest) returns (GetIdentitiesResponse) - -- (GRPCUnaryProtoCall *)getIdentitiesWithMessage:(GetIdentitiesRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; - #pragma mark getIdentityKeys(GetIdentityKeysRequest) returns (GetIdentityKeysResponse) - (GRPCUnaryProtoCall *)getIdentityKeysWithMessage:(GetIdentityKeysRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; +#pragma mark getIdentitiesContractKeys(GetIdentitiesContractKeysRequest) returns (GetIdentitiesContractKeysResponse) + +- (GRPCUnaryProtoCall *)getIdentitiesContractKeysWithMessage:(GetIdentitiesContractKeysRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + +#pragma mark getIdentityNonce(GetIdentityNonceRequest) returns (GetIdentityNonceResponse) + +- (GRPCUnaryProtoCall *)getIdentityNonceWithMessage:(GetIdentityNonceRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + +#pragma mark getIdentityContractNonce(GetIdentityContractNonceRequest) returns (GetIdentityContractNonceResponse) + +- (GRPCUnaryProtoCall *)getIdentityContractNonceWithMessage:(GetIdentityContractNonceRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + #pragma mark getIdentityBalance(GetIdentityBalanceRequest) returns (GetIdentityBalanceResponse) - (GRPCUnaryProtoCall *)getIdentityBalanceWithMessage:(GetIdentityBalanceRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; @@ -124,10 +136,6 @@ NS_ASSUME_NONNULL_BEGIN - (GRPCUnaryProtoCall *)getDocumentsWithMessage:(GetDocumentsRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; -#pragma mark getIdentitiesByPublicKeyHashes(GetIdentitiesByPublicKeyHashesRequest) returns (GetIdentitiesByPublicKeyHashesResponse) - -- (GRPCUnaryProtoCall *)getIdentitiesByPublicKeyHashesWithMessage:(GetIdentitiesByPublicKeyHashesRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; - #pragma mark getIdentityByPublicKeyHash(GetIdentityByPublicKeyHashRequest) returns (GetIdentityByPublicKeyHashResponse) - (GRPCUnaryProtoCall *)getIdentityByPublicKeyHashWithMessage:(GetIdentityByPublicKeyHashRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; @@ -152,6 +160,10 @@ NS_ASSUME_NONNULL_BEGIN - (GRPCUnaryProtoCall *)getEpochsInfoWithMessage:(GetEpochsInfoRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; +#pragma mark getPathElements(GetPathElementsRequest) returns (GetPathElementsResponse) + +- (GRPCUnaryProtoCall *)getPathElementsWithMessage:(GetPathElementsRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions; + @end /** @@ -174,18 +186,32 @@ NS_ASSUME_NONNULL_BEGIN - (GRPCProtoCall *)RPCTogetIdentityWithRequest:(GetIdentityRequest *)request handler:(void(^)(GetIdentityResponse *_Nullable response, NSError *_Nullable error))handler; -#pragma mark getIdentities(GetIdentitiesRequest) returns (GetIdentitiesResponse) +#pragma mark getIdentityKeys(GetIdentityKeysRequest) returns (GetIdentityKeysResponse) -- (void)getIdentitiesWithRequest:(GetIdentitiesRequest *)request handler:(void(^)(GetIdentitiesResponse *_Nullable response, NSError *_Nullable error))handler; +- (void)getIdentityKeysWithRequest:(GetIdentityKeysRequest *)request handler:(void(^)(GetIdentityKeysResponse *_Nullable response, NSError *_Nullable error))handler; -- (GRPCProtoCall *)RPCTogetIdentitiesWithRequest:(GetIdentitiesRequest *)request handler:(void(^)(GetIdentitiesResponse *_Nullable response, NSError *_Nullable error))handler; +- (GRPCProtoCall *)RPCTogetIdentityKeysWithRequest:(GetIdentityKeysRequest *)request handler:(void(^)(GetIdentityKeysResponse *_Nullable response, NSError *_Nullable error))handler; -#pragma mark getIdentityKeys(GetIdentityKeysRequest) returns (GetIdentityKeysResponse) +#pragma mark getIdentitiesContractKeys(GetIdentitiesContractKeysRequest) returns (GetIdentitiesContractKeysResponse) -- (void)getIdentityKeysWithRequest:(GetIdentityKeysRequest *)request handler:(void(^)(GetIdentityKeysResponse *_Nullable response, NSError *_Nullable error))handler; +- (void)getIdentitiesContractKeysWithRequest:(GetIdentitiesContractKeysRequest *)request handler:(void(^)(GetIdentitiesContractKeysResponse *_Nullable response, NSError *_Nullable error))handler; -- (GRPCProtoCall *)RPCTogetIdentityKeysWithRequest:(GetIdentityKeysRequest *)request handler:(void(^)(GetIdentityKeysResponse *_Nullable response, NSError *_Nullable error))handler; +- (GRPCProtoCall *)RPCTogetIdentitiesContractKeysWithRequest:(GetIdentitiesContractKeysRequest *)request handler:(void(^)(GetIdentitiesContractKeysResponse *_Nullable response, NSError *_Nullable error))handler; + + +#pragma mark getIdentityNonce(GetIdentityNonceRequest) returns (GetIdentityNonceResponse) + +- (void)getIdentityNonceWithRequest:(GetIdentityNonceRequest *)request handler:(void(^)(GetIdentityNonceResponse *_Nullable response, NSError *_Nullable error))handler; + +- (GRPCProtoCall *)RPCTogetIdentityNonceWithRequest:(GetIdentityNonceRequest *)request handler:(void(^)(GetIdentityNonceResponse *_Nullable response, NSError *_Nullable error))handler; + + +#pragma mark getIdentityContractNonce(GetIdentityContractNonceRequest) returns (GetIdentityContractNonceResponse) + +- (void)getIdentityContractNonceWithRequest:(GetIdentityContractNonceRequest *)request handler:(void(^)(GetIdentityContractNonceResponse *_Nullable response, NSError *_Nullable error))handler; + +- (GRPCProtoCall *)RPCTogetIdentityContractNonceWithRequest:(GetIdentityContractNonceRequest *)request handler:(void(^)(GetIdentityContractNonceResponse *_Nullable response, NSError *_Nullable error))handler; #pragma mark getIdentityBalance(GetIdentityBalanceRequest) returns (GetIdentityBalanceResponse) @@ -237,13 +263,6 @@ NS_ASSUME_NONNULL_BEGIN - (GRPCProtoCall *)RPCTogetDocumentsWithRequest:(GetDocumentsRequest *)request handler:(void(^)(GetDocumentsResponse *_Nullable response, NSError *_Nullable error))handler; -#pragma mark getIdentitiesByPublicKeyHashes(GetIdentitiesByPublicKeyHashesRequest) returns (GetIdentitiesByPublicKeyHashesResponse) - -- (void)getIdentitiesByPublicKeyHashesWithRequest:(GetIdentitiesByPublicKeyHashesRequest *)request handler:(void(^)(GetIdentitiesByPublicKeyHashesResponse *_Nullable response, NSError *_Nullable error))handler; - -- (GRPCProtoCall *)RPCTogetIdentitiesByPublicKeyHashesWithRequest:(GetIdentitiesByPublicKeyHashesRequest *)request handler:(void(^)(GetIdentitiesByPublicKeyHashesResponse *_Nullable response, NSError *_Nullable error))handler; - - #pragma mark getIdentityByPublicKeyHash(GetIdentityByPublicKeyHashRequest) returns (GetIdentityByPublicKeyHashResponse) - (void)getIdentityByPublicKeyHashWithRequest:(GetIdentityByPublicKeyHashRequest *)request handler:(void(^)(GetIdentityByPublicKeyHashResponse *_Nullable response, NSError *_Nullable error))handler; @@ -286,6 +305,13 @@ NS_ASSUME_NONNULL_BEGIN - (GRPCProtoCall *)RPCTogetEpochsInfoWithRequest:(GetEpochsInfoRequest *)request handler:(void(^)(GetEpochsInfoResponse *_Nullable response, NSError *_Nullable error))handler; +#pragma mark getPathElements(GetPathElementsRequest) returns (GetPathElementsResponse) + +- (void)getPathElementsWithRequest:(GetPathElementsRequest *)request handler:(void(^)(GetPathElementsResponse *_Nullable response, NSError *_Nullable error))handler; + +- (GRPCProtoCall *)RPCTogetPathElementsWithRequest:(GetPathElementsRequest *)request handler:(void(^)(GetPathElementsResponse *_Nullable response, NSError *_Nullable error))handler; + + @end diff --git a/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbrpc.m b/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbrpc.m index 4d4611e93d2..c418ebd11d0 100644 --- a/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbrpc.m +++ b/packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbrpc.m @@ -110,44 +110,84 @@ - (GRPCUnaryProtoCall *)getIdentityWithMessage:(GetIdentityRequest *)message res responseClass:[GetIdentityResponse class]]; } -#pragma mark getIdentities(GetIdentitiesRequest) returns (GetIdentitiesResponse) +#pragma mark getIdentityKeys(GetIdentityKeysRequest) returns (GetIdentityKeysResponse) -- (void)getIdentitiesWithRequest:(GetIdentitiesRequest *)request handler:(void(^)(GetIdentitiesResponse *_Nullable response, NSError *_Nullable error))handler{ - [[self RPCTogetIdentitiesWithRequest:request handler:handler] start]; +- (void)getIdentityKeysWithRequest:(GetIdentityKeysRequest *)request handler:(void(^)(GetIdentityKeysResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetIdentityKeysWithRequest:request handler:handler] start]; } // Returns a not-yet-started RPC object. -- (GRPCProtoCall *)RPCTogetIdentitiesWithRequest:(GetIdentitiesRequest *)request handler:(void(^)(GetIdentitiesResponse *_Nullable response, NSError *_Nullable error))handler{ - return [self RPCToMethod:@"getIdentities" +- (GRPCProtoCall *)RPCTogetIdentityKeysWithRequest:(GetIdentityKeysRequest *)request handler:(void(^)(GetIdentityKeysResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getIdentityKeys" requestsWriter:[GRXWriter writerWithValue:request] - responseClass:[GetIdentitiesResponse class] + responseClass:[GetIdentityKeysResponse class] responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; } -- (GRPCUnaryProtoCall *)getIdentitiesWithMessage:(GetIdentitiesRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { - return [self RPCToMethod:@"getIdentities" +- (GRPCUnaryProtoCall *)getIdentityKeysWithMessage:(GetIdentityKeysRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getIdentityKeys" message:message responseHandler:handler callOptions:callOptions - responseClass:[GetIdentitiesResponse class]]; + responseClass:[GetIdentityKeysResponse class]]; } -#pragma mark getIdentityKeys(GetIdentityKeysRequest) returns (GetIdentityKeysResponse) +#pragma mark getIdentitiesContractKeys(GetIdentitiesContractKeysRequest) returns (GetIdentitiesContractKeysResponse) -- (void)getIdentityKeysWithRequest:(GetIdentityKeysRequest *)request handler:(void(^)(GetIdentityKeysResponse *_Nullable response, NSError *_Nullable error))handler{ - [[self RPCTogetIdentityKeysWithRequest:request handler:handler] start]; +- (void)getIdentitiesContractKeysWithRequest:(GetIdentitiesContractKeysRequest *)request handler:(void(^)(GetIdentitiesContractKeysResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetIdentitiesContractKeysWithRequest:request handler:handler] start]; } // Returns a not-yet-started RPC object. -- (GRPCProtoCall *)RPCTogetIdentityKeysWithRequest:(GetIdentityKeysRequest *)request handler:(void(^)(GetIdentityKeysResponse *_Nullable response, NSError *_Nullable error))handler{ - return [self RPCToMethod:@"getIdentityKeys" +- (GRPCProtoCall *)RPCTogetIdentitiesContractKeysWithRequest:(GetIdentitiesContractKeysRequest *)request handler:(void(^)(GetIdentitiesContractKeysResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getIdentitiesContractKeys" requestsWriter:[GRXWriter writerWithValue:request] - responseClass:[GetIdentityKeysResponse class] + responseClass:[GetIdentitiesContractKeysResponse class] responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; } -- (GRPCUnaryProtoCall *)getIdentityKeysWithMessage:(GetIdentityKeysRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { - return [self RPCToMethod:@"getIdentityKeys" +- (GRPCUnaryProtoCall *)getIdentitiesContractKeysWithMessage:(GetIdentitiesContractKeysRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getIdentitiesContractKeys" message:message responseHandler:handler callOptions:callOptions - responseClass:[GetIdentityKeysResponse class]]; + responseClass:[GetIdentitiesContractKeysResponse class]]; +} + +#pragma mark getIdentityNonce(GetIdentityNonceRequest) returns (GetIdentityNonceResponse) + +- (void)getIdentityNonceWithRequest:(GetIdentityNonceRequest *)request handler:(void(^)(GetIdentityNonceResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetIdentityNonceWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +- (GRPCProtoCall *)RPCTogetIdentityNonceWithRequest:(GetIdentityNonceRequest *)request handler:(void(^)(GetIdentityNonceResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getIdentityNonce" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[GetIdentityNonceResponse class] + responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; +} +- (GRPCUnaryProtoCall *)getIdentityNonceWithMessage:(GetIdentityNonceRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getIdentityNonce" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[GetIdentityNonceResponse class]]; +} + +#pragma mark getIdentityContractNonce(GetIdentityContractNonceRequest) returns (GetIdentityContractNonceResponse) + +- (void)getIdentityContractNonceWithRequest:(GetIdentityContractNonceRequest *)request handler:(void(^)(GetIdentityContractNonceResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetIdentityContractNonceWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +- (GRPCProtoCall *)RPCTogetIdentityContractNonceWithRequest:(GetIdentityContractNonceRequest *)request handler:(void(^)(GetIdentityContractNonceResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getIdentityContractNonce" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[GetIdentityContractNonceResponse class] + responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; +} +- (GRPCUnaryProtoCall *)getIdentityContractNonceWithMessage:(GetIdentityContractNonceRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getIdentityContractNonce" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[GetIdentityContractNonceResponse class]]; } #pragma mark getIdentityBalance(GetIdentityBalanceRequest) returns (GetIdentityBalanceResponse) @@ -290,26 +330,6 @@ - (GRPCUnaryProtoCall *)getDocumentsWithMessage:(GetDocumentsRequest *)message r responseClass:[GetDocumentsResponse class]]; } -#pragma mark getIdentitiesByPublicKeyHashes(GetIdentitiesByPublicKeyHashesRequest) returns (GetIdentitiesByPublicKeyHashesResponse) - -- (void)getIdentitiesByPublicKeyHashesWithRequest:(GetIdentitiesByPublicKeyHashesRequest *)request handler:(void(^)(GetIdentitiesByPublicKeyHashesResponse *_Nullable response, NSError *_Nullable error))handler{ - [[self RPCTogetIdentitiesByPublicKeyHashesWithRequest:request handler:handler] start]; -} -// Returns a not-yet-started RPC object. -- (GRPCProtoCall *)RPCTogetIdentitiesByPublicKeyHashesWithRequest:(GetIdentitiesByPublicKeyHashesRequest *)request handler:(void(^)(GetIdentitiesByPublicKeyHashesResponse *_Nullable response, NSError *_Nullable error))handler{ - return [self RPCToMethod:@"getIdentitiesByPublicKeyHashes" - requestsWriter:[GRXWriter writerWithValue:request] - responseClass:[GetIdentitiesByPublicKeyHashesResponse class] - responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; -} -- (GRPCUnaryProtoCall *)getIdentitiesByPublicKeyHashesWithMessage:(GetIdentitiesByPublicKeyHashesRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { - return [self RPCToMethod:@"getIdentitiesByPublicKeyHashes" - message:message - responseHandler:handler - callOptions:callOptions - responseClass:[GetIdentitiesByPublicKeyHashesResponse class]]; -} - #pragma mark getIdentityByPublicKeyHash(GetIdentityByPublicKeyHashRequest) returns (GetIdentityByPublicKeyHashResponse) - (void)getIdentityByPublicKeyHashWithRequest:(GetIdentityByPublicKeyHashRequest *)request handler:(void(^)(GetIdentityByPublicKeyHashResponse *_Nullable response, NSError *_Nullable error))handler{ @@ -430,5 +450,25 @@ - (GRPCUnaryProtoCall *)getEpochsInfoWithMessage:(GetEpochsInfoRequest *)message responseClass:[GetEpochsInfoResponse class]]; } +#pragma mark getPathElements(GetPathElementsRequest) returns (GetPathElementsResponse) + +- (void)getPathElementsWithRequest:(GetPathElementsRequest *)request handler:(void(^)(GetPathElementsResponse *_Nullable response, NSError *_Nullable error))handler{ + [[self RPCTogetPathElementsWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +- (GRPCProtoCall *)RPCTogetPathElementsWithRequest:(GetPathElementsRequest *)request handler:(void(^)(GetPathElementsResponse *_Nullable response, NSError *_Nullable error))handler{ + return [self RPCToMethod:@"getPathElements" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[GetPathElementsResponse class] + responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]]; +} +- (GRPCUnaryProtoCall *)getPathElementsWithMessage:(GetPathElementsRequest *)message responseHandler:(id)handler callOptions:(GRPCCallOptions *_Nullable)callOptions { + return [self RPCToMethod:@"getPathElements" + message:message + responseHandler:handler + callOptions:callOptions + responseClass:[GetPathElementsResponse class]]; +} + @end #endif diff --git a/packages/dapi-grpc/clients/platform/v0/python/platform_pb2.py b/packages/dapi-grpc/clients/platform/v0/python/platform_pb2.py index 36cc42d1234..700073633a7 100644 --- a/packages/dapi-grpc/clients/platform/v0/python/platform_pb2.py +++ b/packages/dapi-grpc/clients/platform/v0/python/platform_pb2.py @@ -2,6 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: platform.proto """Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection @@ -22,10 +23,56 @@ syntax='proto3', serialized_options=None, create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\x0eplatform.proto\x12\x19org.dash.platform.dapi.v0\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x81\x01\n\x05Proof\x12\x15\n\rgrovedb_proof\x18\x01 \x01(\x0c\x12\x13\n\x0bquorum_hash\x18\x02 \x01(\x0c\x12\x11\n\tsignature\x18\x03 \x01(\x0c\x12\r\n\x05round\x18\x04 \x01(\r\x12\x15\n\rblock_id_hash\x18\x05 \x01(\x0c\x12\x13\n\x0bquorum_type\x18\x06 \x01(\r\"\x90\x01\n\x10ResponseMetadata\x12\x0e\n\x06height\x18\x01 \x01(\x04\x12 \n\x18\x63ore_chain_locked_height\x18\x02 \x01(\r\x12\r\n\x05\x65poch\x18\x03 \x01(\r\x12\x0f\n\x07time_ms\x18\x04 \x01(\x04\x12\x18\n\x10protocol_version\x18\x05 \x01(\r\x12\x10\n\x08\x63hain_id\x18\x06 \x01(\t\"L\n\x1dStateTransitionBroadcastError\x12\x0c\n\x04\x63ode\x18\x01 \x01(\r\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\";\n\x1f\x42roadcastStateTransitionRequest\x12\x18\n\x10state_transition\x18\x01 \x01(\x0c\"\"\n BroadcastStateTransitionResponse\"\xa4\x01\n\x12GetIdentityRequest\x12P\n\x02v0\x18\x01 \x01(\x0b\x32\x42.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0H\x00\x1a\x31\n\x14GetIdentityRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xc0\x01\n\x19GetIdentityBalanceRequest\x12^\n\x02v0\x18\x01 \x01(\x0b\x32P.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0H\x00\x1a\x38\n\x1bGetIdentityBalanceRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xec\x01\n$GetIdentityBalanceAndRevisionRequest\x12t\n\x02v0\x18\x01 \x01(\x0b\x32\x66.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0H\x00\x1a\x43\n&GetIdentityBalanceAndRevisionRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\x9e\x02\n\x13GetIdentityResponse\x12R\n\x02v0\x18\x01 \x01(\x0b\x32\x44.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0H\x00\x1a\xa7\x01\n\x15GetIdentityResponseV0\x12\x12\n\x08identity\x18\x01 \x01(\x0cH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xad\x01\n\x14GetIdentitiesRequest\x12T\n\x02v0\x18\x01 \x01(\x0b\x32\x46.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0H\x00\x1a\x34\n\x16GetIdentitiesRequestV0\x12\x0b\n\x03ids\x18\x01 \x03(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xda\x04\n\x15GetIdentitiesResponse\x12V\n\x02v0\x18\x01 \x01(\x0b\x32H.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0H\x00\x1a\x1e\n\rIdentityValue\x12\r\n\x05value\x18\x01 \x01(\x0c\x1ak\n\rIdentityEntry\x12\x0b\n\x03key\x18\x01 \x01(\x0c\x12M\n\x05value\x18\x02 \x01(\x0b\x32>.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue\x1a\x66\n\nIdentities\x12X\n\x10identity_entries\x18\x01 \x03(\x0b\x32>.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry\x1a\xe8\x01\n\x17GetIdentitiesResponseV0\x12Q\n\nidentities\x18\x01 \x01(\x0b\x32;.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentitiesH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xb9\x02\n\x1aGetIdentityBalanceResponse\x12`\n\x02v0\x18\x01 \x01(\x0b\x32R.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0H\x00\x1a\xad\x01\n\x1cGetIdentityBalanceResponseV0\x12\x11\n\x07\x62\x61lance\x18\x01 \x01(\x04H\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xa9\x04\n%GetIdentityBalanceAndRevisionResponse\x12v\n\x02v0\x18\x01 \x01(\x0b\x32h.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0H\x00\x1a\xfc\x02\n\'GetIdentityBalanceAndRevisionResponseV0\x12\x9b\x01\n\x14\x62\x61lance_and_revision\x18\x01 \x01(\x0b\x32{.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevisionH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x37\n\x12\x42\x61lanceAndRevision\x12\x0f\n\x07\x62\x61lance\x18\x01 \x01(\x04\x12\x10\n\x08revision\x18\x02 \x01(\x04\x42\x08\n\x06resultB\t\n\x07version\"\xd1\x01\n\x0eKeyRequestType\x12\x36\n\x08\x61ll_keys\x18\x01 \x01(\x0b\x32\".org.dash.platform.dapi.v0.AllKeysH\x00\x12@\n\rspecific_keys\x18\x02 \x01(\x0b\x32\'.org.dash.platform.dapi.v0.SpecificKeysH\x00\x12:\n\nsearch_key\x18\x03 \x01(\x0b\x32$.org.dash.platform.dapi.v0.SearchKeyH\x00\x42\t\n\x07request\"\t\n\x07\x41llKeys\"\x1f\n\x0cSpecificKeys\x12\x0f\n\x07key_ids\x18\x01 \x03(\r\"\xb6\x01\n\tSearchKey\x12I\n\x0bpurpose_map\x18\x01 \x03(\x0b\x32\x34.org.dash.platform.dapi.v0.SearchKey.PurposeMapEntry\x1a^\n\x0fPurposeMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\r\x12:\n\x05value\x18\x02 \x01(\x0b\x32+.org.dash.platform.dapi.v0.SecurityLevelMap:\x02\x38\x01\"\xbf\x02\n\x10SecurityLevelMap\x12]\n\x12security_level_map\x18\x01 \x03(\x0b\x32\x41.org.dash.platform.dapi.v0.SecurityLevelMap.SecurityLevelMapEntry\x1aw\n\x15SecurityLevelMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\r\x12M\n\x05value\x18\x02 \x01(\x0e\x32>.org.dash.platform.dapi.v0.SecurityLevelMap.KeyKindRequestType:\x02\x38\x01\"S\n\x12KeyKindRequestType\x12\x1f\n\x1b\x43URRENT_KEY_OF_KIND_REQUEST\x10\x00\x12\x1c\n\x18\x41LL_KEYS_OF_KIND_REQUEST\x10\x01\"\xda\x02\n\x16GetIdentityKeysRequest\x12X\n\x02v0\x18\x01 \x01(\x0b\x32J.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0H\x00\x1a\xda\x01\n\x18GetIdentityKeysRequestV0\x12\x13\n\x0bidentity_id\x18\x01 \x01(\x0c\x12?\n\x0crequest_type\x18\x02 \x01(\x0b\x32).org.dash.platform.dapi.v0.KeyRequestType\x12+\n\x05limit\x18\x03 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12,\n\x06offset\x18\x04 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12\r\n\x05prove\x18\x05 \x01(\x08\x42\t\n\x07version\"\x99\x03\n\x17GetIdentityKeysResponse\x12Z\n\x02v0\x18\x01 \x01(\x0b\x32L.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0H\x00\x1a\x96\x02\n\x19GetIdentityKeysResponseV0\x12\x61\n\x04keys\x18\x01 \x01(\x0b\x32Q.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.KeysH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x1a\n\x04Keys\x12\x12\n\nkeys_bytes\x18\x01 \x03(\x0c\x42\x08\n\x06resultB\t\n\x07version\"\x93\x06\n\x10GetProofsRequest\x12L\n\x02v0\x18\x01 \x01(\x0b\x32>.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0H\x00\x1a\xa5\x05\n\x12GetProofsRequestV0\x12\x62\n\nidentities\x18\x01 \x03(\x0b\x32N.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest\x12\x61\n\tcontracts\x18\x02 \x03(\x0b\x32N.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest\x12\x61\n\tdocuments\x18\x03 \x03(\x0b\x32N.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest\x1aw\n\x0f\x44ocumentRequest\x12\x13\n\x0b\x63ontract_id\x18\x01 \x01(\x0c\x12\x15\n\rdocument_type\x18\x02 \x01(\t\x12#\n\x1b\x64ocument_type_keeps_history\x18\x03 \x01(\x08\x12\x13\n\x0b\x64ocument_id\x18\x04 \x01(\x0c\x1a\xc3\x01\n\x0fIdentityRequest\x12\x13\n\x0bidentity_id\x18\x01 \x01(\x0c\x12i\n\x0crequest_type\x18\x02 \x01(\x0e\x32S.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type\"0\n\x04Type\x12\x11\n\rFULL_IDENTITY\x10\x00\x12\x0b\n\x07\x42\x41LANCE\x10\x01\x12\x08\n\x04KEYS\x10\x02\x1a&\n\x0f\x43ontractRequest\x12\x13\n\x0b\x63ontract_id\x18\x01 \x01(\x0c\x42\t\n\x07version\"\x82\x02\n\x11GetProofsResponse\x12N\n\x02v0\x18\x01 \x01(\x0b\x32@.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0H\x00\x1a\x91\x01\n\x13GetProofsResponseV0\x12\x31\n\x05proof\x18\x01 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x02 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xb4\x01\n\x16GetDataContractRequest\x12X\n\x02v0\x18\x01 \x01(\x0b\x32J.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0H\x00\x1a\x35\n\x18GetDataContractRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xb3\x02\n\x17GetDataContractResponse\x12Z\n\x02v0\x18\x01 \x01(\x0b\x32L.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0H\x00\x1a\xb0\x01\n\x19GetDataContractResponseV0\x12\x17\n\rdata_contract\x18\x01 \x01(\x0cH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xb9\x01\n\x17GetDataContractsRequest\x12Z\n\x02v0\x18\x01 \x01(\x0b\x32L.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0H\x00\x1a\x37\n\x19GetDataContractsRequestV0\x12\x0b\n\x03ids\x18\x01 \x03(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xcf\x04\n\x18GetDataContractsResponse\x12\\\n\x02v0\x18\x01 \x01(\x0b\x32N.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0H\x00\x1a[\n\x11\x44\x61taContractEntry\x12\x12\n\nidentifier\x18\x01 \x01(\x0c\x12\x32\n\rdata_contract\x18\x02 \x01(\x0b\x32\x1b.google.protobuf.BytesValue\x1au\n\rDataContracts\x12\x64\n\x15\x64\x61ta_contract_entries\x18\x01 \x03(\x0b\x32\x45.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry\x1a\xf5\x01\n\x1aGetDataContractsResponseV0\x12[\n\x0e\x64\x61ta_contracts\x18\x01 \x01(\x0b\x32\x41.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xc1\x02\n\x1dGetDataContractHistoryRequest\x12\x66\n\x02v0\x18\x01 \x01(\x0b\x32X.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0H\x00\x1a\xac\x01\n\x1fGetDataContractHistoryRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12+\n\x05limit\x18\x02 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12,\n\x06offset\x18\x03 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12\x13\n\x0bstart_at_ms\x18\x04 \x01(\x04\x12\r\n\x05prove\x18\x05 \x01(\x08\x42\t\n\x07version\"\xae\x05\n\x1eGetDataContractHistoryResponse\x12h\n\x02v0\x18\x01 \x01(\x0b\x32Z.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0H\x00\x1a\x96\x04\n GetDataContractHistoryResponseV0\x12\x8f\x01\n\x15\x64\x61ta_contract_history\x18\x01 \x01(\x0b\x32n.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x37\n\x18\x44\x61taContractHistoryEntry\x12\x0c\n\x04\x64\x61te\x18\x01 \x01(\x04\x12\r\n\x05value\x18\x02 \x01(\x0c\x1a\xaa\x01\n\x13\x44\x61taContractHistory\x12\x92\x01\n\x15\x64\x61ta_contract_entries\x18\x01 \x03(\x0b\x32s.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntryB\x08\n\x06resultB\t\n\x07version\"\xb2\x02\n\x13GetDocumentsRequest\x12R\n\x02v0\x18\x01 \x01(\x0b\x32\x44.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0H\x00\x1a\xbb\x01\n\x15GetDocumentsRequestV0\x12\x18\n\x10\x64\x61ta_contract_id\x18\x01 \x01(\x0c\x12\x15\n\rdocument_type\x18\x02 \x01(\t\x12\r\n\x05where\x18\x03 \x01(\x0c\x12\x10\n\x08order_by\x18\x04 \x01(\x0c\x12\r\n\x05limit\x18\x05 \x01(\r\x12\x15\n\x0bstart_after\x18\x06 \x01(\x0cH\x00\x12\x12\n\x08start_at\x18\x07 \x01(\x0cH\x00\x12\r\n\x05prove\x18\x08 \x01(\x08\x42\x07\n\x05startB\t\n\x07version\"\x95\x03\n\x14GetDocumentsResponse\x12T\n\x02v0\x18\x01 \x01(\x0b\x32\x46.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0H\x00\x1a\x9b\x02\n\x16GetDocumentsResponseV0\x12\x65\n\tdocuments\x18\x01 \x01(\x0b\x32P.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.DocumentsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x1e\n\tDocuments\x12\x11\n\tdocuments\x18\x01 \x03(\x0c\x42\x08\n\x06resultB\t\n\x07version\"\xff\x01\n%GetIdentitiesByPublicKeyHashesRequest\x12v\n\x02v0\x18\x01 \x01(\x0b\x32h.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0H\x00\x1aS\n\'GetIdentitiesByPublicKeyHashesRequestV0\x12\x19\n\x11public_key_hashes\x18\x01 \x03(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xc6\x05\n&GetIdentitiesByPublicKeyHashesResponse\x12x\n\x02v0\x18\x01 \x01(\x0b\x32j.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0H\x00\x1a\x61\n\x1aPublicKeyHashIdentityEntry\x12\x17\n\x0fpublic_key_hash\x18\x01 \x01(\x0c\x12*\n\x05value\x18\x02 \x01(\x0b\x32\x1b.google.protobuf.BytesValue\x1a\x95\x01\n\x1bIdentitiesByPublicKeyHashes\x12v\n\x10identity_entries\x18\x01 \x03(\x0b\x32\\.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry\x1a\x9b\x02\n(GetIdentitiesByPublicKeyHashesResponseV0\x12s\n\nidentities\x18\x01 \x01(\x0b\x32].org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashesH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xed\x01\n!GetIdentityByPublicKeyHashRequest\x12n\n\x02v0\x18\x01 \x01(\x0b\x32`.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0H\x00\x1aM\n#GetIdentityByPublicKeyHashRequestV0\x12\x17\n\x0fpublic_key_hash\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xda\x02\n\"GetIdentityByPublicKeyHashResponse\x12p\n\x02v0\x18\x01 \x01(\x0b\x32\x62.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0H\x00\x1a\xb6\x01\n$GetIdentityByPublicKeyHashResponseV0\x12\x12\n\x08identity\x18\x01 \x01(\x0cH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xfb\x01\n#WaitForStateTransitionResultRequest\x12r\n\x02v0\x18\x01 \x01(\x0b\x32\x64.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0H\x00\x1aU\n%WaitForStateTransitionResultRequestV0\x12\x1d\n\x15state_transition_hash\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\x99\x03\n$WaitForStateTransitionResultResponse\x12t\n\x02v0\x18\x01 \x01(\x0b\x32\x66.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0H\x00\x1a\xef\x01\n&WaitForStateTransitionResultResponseV0\x12I\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x38.org.dash.platform.dapi.v0.StateTransitionBroadcastErrorH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xc4\x01\n\x19GetConsensusParamsRequest\x12^\n\x02v0\x18\x01 \x01(\x0b\x32P.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0H\x00\x1a<\n\x1bGetConsensusParamsRequestV0\x12\x0e\n\x06height\x18\x01 \x01(\x05\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\x9c\x04\n\x1aGetConsensusParamsResponse\x12`\n\x02v0\x18\x01 \x01(\x0b\x32R.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0H\x00\x1aP\n\x14\x43onsensusParamsBlock\x12\x11\n\tmax_bytes\x18\x01 \x01(\t\x12\x0f\n\x07max_gas\x18\x02 \x01(\t\x12\x14\n\x0ctime_iota_ms\x18\x03 \x01(\t\x1a\x62\n\x17\x43onsensusParamsEvidence\x12\x1a\n\x12max_age_num_blocks\x18\x01 \x01(\t\x12\x18\n\x10max_age_duration\x18\x02 \x01(\t\x12\x11\n\tmax_bytes\x18\x03 \x01(\t\x1a\xda\x01\n\x1cGetConsensusParamsResponseV0\x12Y\n\x05\x62lock\x18\x01 \x01(\x0b\x32J.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock\x12_\n\x08\x65vidence\x18\x02 \x01(\x0b\x32M.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidenceB\t\n\x07version\"\xe4\x01\n%GetProtocolVersionUpgradeStateRequest\x12v\n\x02v0\x18\x01 \x01(\x0b\x32h.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0H\x00\x1a\x38\n\'GetProtocolVersionUpgradeStateRequestV0\x12\r\n\x05prove\x18\x01 \x01(\x08\x42\t\n\x07version\"\xb5\x05\n&GetProtocolVersionUpgradeStateResponse\x12x\n\x02v0\x18\x01 \x01(\x0b\x32j.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0H\x00\x1a\x85\x04\n(GetProtocolVersionUpgradeStateResponseV0\x12\x87\x01\n\x08versions\x18\x01 \x01(\x0b\x32s.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x96\x01\n\x08Versions\x12\x89\x01\n\x08versions\x18\x01 \x03(\x0b\x32w.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry\x1a:\n\x0cVersionEntry\x12\x16\n\x0eversion_number\x18\x01 \x01(\r\x12\x12\n\nvote_count\x18\x02 \x01(\rB\x08\n\x06resultB\t\n\x07version\"\xa3\x02\n*GetProtocolVersionUpgradeVoteStatusRequest\x12\x80\x01\n\x02v0\x18\x01 \x01(\x0b\x32r.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0H\x00\x1ag\n,GetProtocolVersionUpgradeVoteStatusRequestV0\x12\x19\n\x11start_pro_tx_hash\x18\x01 \x01(\x0c\x12\r\n\x05\x63ount\x18\x02 \x01(\r\x12\r\n\x05prove\x18\x03 \x01(\x08\x42\t\n\x07version\"\xef\x05\n+GetProtocolVersionUpgradeVoteStatusResponse\x12\x82\x01\n\x02v0\x18\x01 \x01(\x0b\x32t.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0H\x00\x1a\xaf\x04\n-GetProtocolVersionUpgradeVoteStatusResponseV0\x12\x98\x01\n\x08versions\x18\x01 \x01(\x0b\x32\x83\x01.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignalsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\xaf\x01\n\x0eVersionSignals\x12\x9c\x01\n\x0fversion_signals\x18\x01 \x03(\x0b\x32\x82\x01.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal\x1a\x35\n\rVersionSignal\x12\x13\n\x0bpro_tx_hash\x18\x01 \x01(\x0c\x12\x0f\n\x07version\x18\x02 \x01(\rB\x08\n\x06resultB\t\n\x07version\"\xf5\x01\n\x14GetEpochsInfoRequest\x12T\n\x02v0\x18\x01 \x01(\x0b\x32\x46.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0H\x00\x1a|\n\x16GetEpochsInfoRequestV0\x12\x31\n\x0bstart_epoch\x18\x01 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12\r\n\x05\x63ount\x18\x02 \x01(\r\x12\x11\n\tascending\x18\x03 \x01(\x08\x12\r\n\x05prove\x18\x04 \x01(\x08\x42\t\n\x07version\"\xf7\x04\n\x15GetEpochsInfoResponse\x12V\n\x02v0\x18\x01 \x01(\x0b\x32H.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0H\x00\x1a\xfa\x03\n\x17GetEpochsInfoResponseV0\x12\x65\n\x06\x65pochs\x18\x01 \x01(\x0b\x32S.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfosH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1au\n\nEpochInfos\x12g\n\x0b\x65poch_infos\x18\x01 \x03(\x0b\x32R.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo\x1a\x84\x01\n\tEpochInfo\x12\x0e\n\x06number\x18\x01 \x01(\r\x12\x1a\n\x12\x66irst_block_height\x18\x02 \x01(\x04\x12\x1f\n\x17\x66irst_core_block_height\x18\x03 \x01(\r\x12\x12\n\nstart_time\x18\x04 \x01(\x04\x12\x16\n\x0e\x66\x65\x65_multiplier\x18\x05 \x01(\x01\x42\x08\n\x06resultB\t\n\x07version2\xc2\x13\n\x08Platform\x12\x93\x01\n\x18\x62roadcastStateTransition\x12:.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest\x1a;.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse\x12l\n\x0bgetIdentity\x12-.org.dash.platform.dapi.v0.GetIdentityRequest\x1a..org.dash.platform.dapi.v0.GetIdentityResponse\x12r\n\rgetIdentities\x12/.org.dash.platform.dapi.v0.GetIdentitiesRequest\x1a\x30.org.dash.platform.dapi.v0.GetIdentitiesResponse\x12x\n\x0fgetIdentityKeys\x12\x31.org.dash.platform.dapi.v0.GetIdentityKeysRequest\x1a\x32.org.dash.platform.dapi.v0.GetIdentityKeysResponse\x12\x81\x01\n\x12getIdentityBalance\x12\x34.org.dash.platform.dapi.v0.GetIdentityBalanceRequest\x1a\x35.org.dash.platform.dapi.v0.GetIdentityBalanceResponse\x12\xa2\x01\n\x1dgetIdentityBalanceAndRevision\x12?.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest\x1a@.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse\x12\x66\n\tgetProofs\x12+.org.dash.platform.dapi.v0.GetProofsRequest\x1a,.org.dash.platform.dapi.v0.GetProofsResponse\x12x\n\x0fgetDataContract\x12\x31.org.dash.platform.dapi.v0.GetDataContractRequest\x1a\x32.org.dash.platform.dapi.v0.GetDataContractResponse\x12\x8d\x01\n\x16getDataContractHistory\x12\x38.org.dash.platform.dapi.v0.GetDataContractHistoryRequest\x1a\x39.org.dash.platform.dapi.v0.GetDataContractHistoryResponse\x12{\n\x10getDataContracts\x12\x32.org.dash.platform.dapi.v0.GetDataContractsRequest\x1a\x33.org.dash.platform.dapi.v0.GetDataContractsResponse\x12o\n\x0cgetDocuments\x12..org.dash.platform.dapi.v0.GetDocumentsRequest\x1a/.org.dash.platform.dapi.v0.GetDocumentsResponse\x12\xa5\x01\n\x1egetIdentitiesByPublicKeyHashes\x12@.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest\x1a\x41.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse\x12\x99\x01\n\x1agetIdentityByPublicKeyHash\x12<.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest\x1a=.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse\x12\x9f\x01\n\x1cwaitForStateTransitionResult\x12>.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest\x1a?.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse\x12\x81\x01\n\x12getConsensusParams\x12\x34.org.dash.platform.dapi.v0.GetConsensusParamsRequest\x1a\x35.org.dash.platform.dapi.v0.GetConsensusParamsResponse\x12\xa5\x01\n\x1egetProtocolVersionUpgradeState\x12@.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest\x1a\x41.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse\x12\xb4\x01\n#getProtocolVersionUpgradeVoteStatus\x12\x45.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest\x1a\x46.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse\x12r\n\rgetEpochsInfo\x12/.org.dash.platform.dapi.v0.GetEpochsInfoRequest\x1a\x30.org.dash.platform.dapi.v0.GetEpochsInfoResponseb\x06proto3' + serialized_pb=b'\n\x0eplatform.proto\x12\x19org.dash.platform.dapi.v0\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x81\x01\n\x05Proof\x12\x15\n\rgrovedb_proof\x18\x01 \x01(\x0c\x12\x13\n\x0bquorum_hash\x18\x02 \x01(\x0c\x12\x11\n\tsignature\x18\x03 \x01(\x0c\x12\r\n\x05round\x18\x04 \x01(\r\x12\x15\n\rblock_id_hash\x18\x05 \x01(\x0c\x12\x13\n\x0bquorum_type\x18\x06 \x01(\r\"\x90\x01\n\x10ResponseMetadata\x12\x0e\n\x06height\x18\x01 \x01(\x04\x12 \n\x18\x63ore_chain_locked_height\x18\x02 \x01(\r\x12\r\n\x05\x65poch\x18\x03 \x01(\r\x12\x0f\n\x07time_ms\x18\x04 \x01(\x04\x12\x18\n\x10protocol_version\x18\x05 \x01(\r\x12\x10\n\x08\x63hain_id\x18\x06 \x01(\t\"L\n\x1dStateTransitionBroadcastError\x12\x0c\n\x04\x63ode\x18\x01 \x01(\r\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\";\n\x1f\x42roadcastStateTransitionRequest\x12\x18\n\x10state_transition\x18\x01 \x01(\x0c\"\"\n BroadcastStateTransitionResponse\"\xa4\x01\n\x12GetIdentityRequest\x12P\n\x02v0\x18\x01 \x01(\x0b\x32\x42.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0H\x00\x1a\x31\n\x14GetIdentityRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xc1\x01\n\x17GetIdentityNonceRequest\x12Z\n\x02v0\x18\x01 \x01(\x0b\x32L.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0H\x00\x1a?\n\x19GetIdentityNonceRequestV0\x12\x13\n\x0bidentity_id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xf6\x01\n\x1fGetIdentityContractNonceRequest\x12j\n\x02v0\x18\x01 \x01(\x0b\x32\\.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0H\x00\x1a\\\n!GetIdentityContractNonceRequestV0\x12\x13\n\x0bidentity_id\x18\x01 \x01(\x0c\x12\x13\n\x0b\x63ontract_id\x18\x02 \x01(\x0c\x12\r\n\x05prove\x18\x03 \x01(\x08\x42\t\n\x07version\"\xc0\x01\n\x19GetIdentityBalanceRequest\x12^\n\x02v0\x18\x01 \x01(\x0b\x32P.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0H\x00\x1a\x38\n\x1bGetIdentityBalanceRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xec\x01\n$GetIdentityBalanceAndRevisionRequest\x12t\n\x02v0\x18\x01 \x01(\x0b\x32\x66.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0H\x00\x1a\x43\n&GetIdentityBalanceAndRevisionRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\x9e\x02\n\x13GetIdentityResponse\x12R\n\x02v0\x18\x01 \x01(\x0b\x32\x44.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0H\x00\x1a\xa7\x01\n\x15GetIdentityResponseV0\x12\x12\n\x08identity\x18\x01 \x01(\x0cH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xb8\x02\n\x18GetIdentityNonceResponse\x12\\\n\x02v0\x18\x01 \x01(\x0b\x32N.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0H\x00\x1a\xb2\x01\n\x1aGetIdentityNonceResponseV0\x12\x18\n\x0eidentity_nonce\x18\x01 \x01(\x04H\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xe1\x02\n GetIdentityContractNonceResponse\x12l\n\x02v0\x18\x01 \x01(\x0b\x32^.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0H\x00\x1a\xc3\x01\n\"GetIdentityContractNonceResponseV0\x12!\n\x17identity_contract_nonce\x18\x01 \x01(\x04H\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xb9\x02\n\x1aGetIdentityBalanceResponse\x12`\n\x02v0\x18\x01 \x01(\x0b\x32R.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0H\x00\x1a\xad\x01\n\x1cGetIdentityBalanceResponseV0\x12\x11\n\x07\x62\x61lance\x18\x01 \x01(\x04H\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xa9\x04\n%GetIdentityBalanceAndRevisionResponse\x12v\n\x02v0\x18\x01 \x01(\x0b\x32h.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0H\x00\x1a\xfc\x02\n\'GetIdentityBalanceAndRevisionResponseV0\x12\x9b\x01\n\x14\x62\x61lance_and_revision\x18\x01 \x01(\x0b\x32{.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevisionH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x37\n\x12\x42\x61lanceAndRevision\x12\x0f\n\x07\x62\x61lance\x18\x01 \x01(\x04\x12\x10\n\x08revision\x18\x02 \x01(\x04\x42\x08\n\x06resultB\t\n\x07version\"\xd1\x01\n\x0eKeyRequestType\x12\x36\n\x08\x61ll_keys\x18\x01 \x01(\x0b\x32\".org.dash.platform.dapi.v0.AllKeysH\x00\x12@\n\rspecific_keys\x18\x02 \x01(\x0b\x32\'.org.dash.platform.dapi.v0.SpecificKeysH\x00\x12:\n\nsearch_key\x18\x03 \x01(\x0b\x32$.org.dash.platform.dapi.v0.SearchKeyH\x00\x42\t\n\x07request\"\t\n\x07\x41llKeys\"\x1f\n\x0cSpecificKeys\x12\x0f\n\x07key_ids\x18\x01 \x03(\r\"\xb6\x01\n\tSearchKey\x12I\n\x0bpurpose_map\x18\x01 \x03(\x0b\x32\x34.org.dash.platform.dapi.v0.SearchKey.PurposeMapEntry\x1a^\n\x0fPurposeMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\r\x12:\n\x05value\x18\x02 \x01(\x0b\x32+.org.dash.platform.dapi.v0.SecurityLevelMap:\x02\x38\x01\"\xbf\x02\n\x10SecurityLevelMap\x12]\n\x12security_level_map\x18\x01 \x03(\x0b\x32\x41.org.dash.platform.dapi.v0.SecurityLevelMap.SecurityLevelMapEntry\x1aw\n\x15SecurityLevelMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\r\x12M\n\x05value\x18\x02 \x01(\x0e\x32>.org.dash.platform.dapi.v0.SecurityLevelMap.KeyKindRequestType:\x02\x38\x01\"S\n\x12KeyKindRequestType\x12\x1f\n\x1b\x43URRENT_KEY_OF_KIND_REQUEST\x10\x00\x12\x1c\n\x18\x41LL_KEYS_OF_KIND_REQUEST\x10\x01\"\xda\x02\n\x16GetIdentityKeysRequest\x12X\n\x02v0\x18\x01 \x01(\x0b\x32J.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0H\x00\x1a\xda\x01\n\x18GetIdentityKeysRequestV0\x12\x13\n\x0bidentity_id\x18\x01 \x01(\x0c\x12?\n\x0crequest_type\x18\x02 \x01(\x0b\x32).org.dash.platform.dapi.v0.KeyRequestType\x12+\n\x05limit\x18\x03 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12,\n\x06offset\x18\x04 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12\r\n\x05prove\x18\x05 \x01(\x08\x42\t\n\x07version\"\x99\x03\n\x17GetIdentityKeysResponse\x12Z\n\x02v0\x18\x01 \x01(\x0b\x32L.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0H\x00\x1a\x96\x02\n\x19GetIdentityKeysResponseV0\x12\x61\n\x04keys\x18\x01 \x01(\x0b\x32Q.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.KeysH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x1a\n\x04Keys\x12\x12\n\nkeys_bytes\x18\x01 \x03(\x0c\x42\x08\n\x06resultB\t\n\x07version\"\xef\x02\n GetIdentitiesContractKeysRequest\x12l\n\x02v0\x18\x01 \x01(\x0b\x32^.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0H\x00\x1a\xd1\x01\n\"GetIdentitiesContractKeysRequestV0\x12\x16\n\x0eidentities_ids\x18\x01 \x03(\x0c\x12\x13\n\x0b\x63ontract_id\x18\x02 \x01(\x0c\x12\x1f\n\x12\x64ocument_type_name\x18\x03 \x01(\tH\x00\x88\x01\x01\x12\x37\n\x08purposes\x18\x04 \x03(\x0e\x32%.org.dash.platform.dapi.v0.KeyPurpose\x12\r\n\x05prove\x18\x05 \x01(\x08\x42\x15\n\x13_document_type_nameB\t\n\x07version\"\xdf\x06\n!GetIdentitiesContractKeysResponse\x12n\n\x02v0\x18\x01 \x01(\x0b\x32`.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0H\x00\x1a\xbe\x05\n#GetIdentitiesContractKeysResponseV0\x12\x8a\x01\n\x0fidentities_keys\x18\x01 \x01(\x0b\x32o.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeysH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1aY\n\x0bPurposeKeys\x12\x36\n\x07purpose\x18\x01 \x01(\x0e\x32%.org.dash.platform.dapi.v0.KeyPurpose\x12\x12\n\nkeys_bytes\x18\x02 \x03(\x0c\x1a\x9f\x01\n\x0cIdentityKeys\x12\x13\n\x0bidentity_id\x18\x01 \x01(\x0c\x12z\n\x04keys\x18\x02 \x03(\x0b\x32l.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys\x1a\x90\x01\n\x0eIdentitiesKeys\x12~\n\x07\x65ntries\x18\x01 \x03(\x0b\x32m.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeysB\x08\n\x06resultB\t\n\x07version\"\xa1\x06\n\x10GetProofsRequest\x12L\n\x02v0\x18\x01 \x01(\x0b\x32>.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0H\x00\x1a\xb3\x05\n\x12GetProofsRequestV0\x12\x62\n\nidentities\x18\x01 \x03(\x0b\x32N.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest\x12\x61\n\tcontracts\x18\x02 \x03(\x0b\x32N.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest\x12\x61\n\tdocuments\x18\x03 \x03(\x0b\x32N.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest\x1aw\n\x0f\x44ocumentRequest\x12\x13\n\x0b\x63ontract_id\x18\x01 \x01(\x0c\x12\x15\n\rdocument_type\x18\x02 \x01(\t\x12#\n\x1b\x64ocument_type_keeps_history\x18\x03 \x01(\x08\x12\x13\n\x0b\x64ocument_id\x18\x04 \x01(\x0c\x1a\xd1\x01\n\x0fIdentityRequest\x12\x13\n\x0bidentity_id\x18\x01 \x01(\x0c\x12i\n\x0crequest_type\x18\x02 \x01(\x0e\x32S.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type\">\n\x04Type\x12\x11\n\rFULL_IDENTITY\x10\x00\x12\x0b\n\x07\x42\x41LANCE\x10\x01\x12\x08\n\x04KEYS\x10\x02\x12\x0c\n\x08REVISION\x10\x03\x1a&\n\x0f\x43ontractRequest\x12\x13\n\x0b\x63ontract_id\x18\x01 \x01(\x0c\x42\t\n\x07version\"\x82\x02\n\x11GetProofsResponse\x12N\n\x02v0\x18\x01 \x01(\x0b\x32@.org.dash.platform.dapi.v0.GetProofsResponse.GetProofsResponseV0H\x00\x1a\x91\x01\n\x13GetProofsResponseV0\x12\x31\n\x05proof\x18\x01 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x02 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xb4\x01\n\x16GetDataContractRequest\x12X\n\x02v0\x18\x01 \x01(\x0b\x32J.org.dash.platform.dapi.v0.GetDataContractRequest.GetDataContractRequestV0H\x00\x1a\x35\n\x18GetDataContractRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xb3\x02\n\x17GetDataContractResponse\x12Z\n\x02v0\x18\x01 \x01(\x0b\x32L.org.dash.platform.dapi.v0.GetDataContractResponse.GetDataContractResponseV0H\x00\x1a\xb0\x01\n\x19GetDataContractResponseV0\x12\x17\n\rdata_contract\x18\x01 \x01(\x0cH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xb9\x01\n\x17GetDataContractsRequest\x12Z\n\x02v0\x18\x01 \x01(\x0b\x32L.org.dash.platform.dapi.v0.GetDataContractsRequest.GetDataContractsRequestV0H\x00\x1a\x37\n\x19GetDataContractsRequestV0\x12\x0b\n\x03ids\x18\x01 \x03(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xcf\x04\n\x18GetDataContractsResponse\x12\\\n\x02v0\x18\x01 \x01(\x0b\x32N.org.dash.platform.dapi.v0.GetDataContractsResponse.GetDataContractsResponseV0H\x00\x1a[\n\x11\x44\x61taContractEntry\x12\x12\n\nidentifier\x18\x01 \x01(\x0c\x12\x32\n\rdata_contract\x18\x02 \x01(\x0b\x32\x1b.google.protobuf.BytesValue\x1au\n\rDataContracts\x12\x64\n\x15\x64\x61ta_contract_entries\x18\x01 \x03(\x0b\x32\x45.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractEntry\x1a\xf5\x01\n\x1aGetDataContractsResponseV0\x12[\n\x0e\x64\x61ta_contracts\x18\x01 \x01(\x0b\x32\x41.org.dash.platform.dapi.v0.GetDataContractsResponse.DataContractsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xc1\x02\n\x1dGetDataContractHistoryRequest\x12\x66\n\x02v0\x18\x01 \x01(\x0b\x32X.org.dash.platform.dapi.v0.GetDataContractHistoryRequest.GetDataContractHistoryRequestV0H\x00\x1a\xac\x01\n\x1fGetDataContractHistoryRequestV0\x12\n\n\x02id\x18\x01 \x01(\x0c\x12+\n\x05limit\x18\x02 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12,\n\x06offset\x18\x03 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12\x13\n\x0bstart_at_ms\x18\x04 \x01(\x04\x12\r\n\x05prove\x18\x05 \x01(\x08\x42\t\n\x07version\"\xae\x05\n\x1eGetDataContractHistoryResponse\x12h\n\x02v0\x18\x01 \x01(\x0b\x32Z.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0H\x00\x1a\x96\x04\n GetDataContractHistoryResponseV0\x12\x8f\x01\n\x15\x64\x61ta_contract_history\x18\x01 \x01(\x0b\x32n.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x37\n\x18\x44\x61taContractHistoryEntry\x12\x0c\n\x04\x64\x61te\x18\x01 \x01(\x04\x12\r\n\x05value\x18\x02 \x01(\x0c\x1a\xaa\x01\n\x13\x44\x61taContractHistory\x12\x92\x01\n\x15\x64\x61ta_contract_entries\x18\x01 \x03(\x0b\x32s.org.dash.platform.dapi.v0.GetDataContractHistoryResponse.GetDataContractHistoryResponseV0.DataContractHistoryEntryB\x08\n\x06resultB\t\n\x07version\"\xb2\x02\n\x13GetDocumentsRequest\x12R\n\x02v0\x18\x01 \x01(\x0b\x32\x44.org.dash.platform.dapi.v0.GetDocumentsRequest.GetDocumentsRequestV0H\x00\x1a\xbb\x01\n\x15GetDocumentsRequestV0\x12\x18\n\x10\x64\x61ta_contract_id\x18\x01 \x01(\x0c\x12\x15\n\rdocument_type\x18\x02 \x01(\t\x12\r\n\x05where\x18\x03 \x01(\x0c\x12\x10\n\x08order_by\x18\x04 \x01(\x0c\x12\r\n\x05limit\x18\x05 \x01(\r\x12\x15\n\x0bstart_after\x18\x06 \x01(\x0cH\x00\x12\x12\n\x08start_at\x18\x07 \x01(\x0cH\x00\x12\r\n\x05prove\x18\x08 \x01(\x08\x42\x07\n\x05startB\t\n\x07version\"\x95\x03\n\x14GetDocumentsResponse\x12T\n\x02v0\x18\x01 \x01(\x0b\x32\x46.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0H\x00\x1a\x9b\x02\n\x16GetDocumentsResponseV0\x12\x65\n\tdocuments\x18\x01 \x01(\x0b\x32P.org.dash.platform.dapi.v0.GetDocumentsResponse.GetDocumentsResponseV0.DocumentsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x1e\n\tDocuments\x12\x11\n\tdocuments\x18\x01 \x03(\x0c\x42\x08\n\x06resultB\t\n\x07version\"\xed\x01\n!GetIdentityByPublicKeyHashRequest\x12n\n\x02v0\x18\x01 \x01(\x0b\x32`.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0H\x00\x1aM\n#GetIdentityByPublicKeyHashRequestV0\x12\x17\n\x0fpublic_key_hash\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\xda\x02\n\"GetIdentityByPublicKeyHashResponse\x12p\n\x02v0\x18\x01 \x01(\x0b\x32\x62.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0H\x00\x1a\xb6\x01\n$GetIdentityByPublicKeyHashResponseV0\x12\x12\n\x08identity\x18\x01 \x01(\x0cH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xfb\x01\n#WaitForStateTransitionResultRequest\x12r\n\x02v0\x18\x01 \x01(\x0b\x32\x64.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0H\x00\x1aU\n%WaitForStateTransitionResultRequestV0\x12\x1d\n\x15state_transition_hash\x18\x01 \x01(\x0c\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\x99\x03\n$WaitForStateTransitionResultResponse\x12t\n\x02v0\x18\x01 \x01(\x0b\x32\x66.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0H\x00\x1a\xef\x01\n&WaitForStateTransitionResultResponseV0\x12I\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x38.org.dash.platform.dapi.v0.StateTransitionBroadcastErrorH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadataB\x08\n\x06resultB\t\n\x07version\"\xc4\x01\n\x19GetConsensusParamsRequest\x12^\n\x02v0\x18\x01 \x01(\x0b\x32P.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0H\x00\x1a<\n\x1bGetConsensusParamsRequestV0\x12\x0e\n\x06height\x18\x01 \x01(\x05\x12\r\n\x05prove\x18\x02 \x01(\x08\x42\t\n\x07version\"\x9c\x04\n\x1aGetConsensusParamsResponse\x12`\n\x02v0\x18\x01 \x01(\x0b\x32R.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0H\x00\x1aP\n\x14\x43onsensusParamsBlock\x12\x11\n\tmax_bytes\x18\x01 \x01(\t\x12\x0f\n\x07max_gas\x18\x02 \x01(\t\x12\x14\n\x0ctime_iota_ms\x18\x03 \x01(\t\x1a\x62\n\x17\x43onsensusParamsEvidence\x12\x1a\n\x12max_age_num_blocks\x18\x01 \x01(\t\x12\x18\n\x10max_age_duration\x18\x02 \x01(\t\x12\x11\n\tmax_bytes\x18\x03 \x01(\t\x1a\xda\x01\n\x1cGetConsensusParamsResponseV0\x12Y\n\x05\x62lock\x18\x01 \x01(\x0b\x32J.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock\x12_\n\x08\x65vidence\x18\x02 \x01(\x0b\x32M.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidenceB\t\n\x07version\"\xe4\x01\n%GetProtocolVersionUpgradeStateRequest\x12v\n\x02v0\x18\x01 \x01(\x0b\x32h.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0H\x00\x1a\x38\n\'GetProtocolVersionUpgradeStateRequestV0\x12\r\n\x05prove\x18\x01 \x01(\x08\x42\t\n\x07version\"\xb5\x05\n&GetProtocolVersionUpgradeStateResponse\x12x\n\x02v0\x18\x01 \x01(\x0b\x32j.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0H\x00\x1a\x85\x04\n(GetProtocolVersionUpgradeStateResponseV0\x12\x87\x01\n\x08versions\x18\x01 \x01(\x0b\x32s.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x96\x01\n\x08Versions\x12\x89\x01\n\x08versions\x18\x01 \x03(\x0b\x32w.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry\x1a:\n\x0cVersionEntry\x12\x16\n\x0eversion_number\x18\x01 \x01(\r\x12\x12\n\nvote_count\x18\x02 \x01(\rB\x08\n\x06resultB\t\n\x07version\"\xa3\x02\n*GetProtocolVersionUpgradeVoteStatusRequest\x12\x80\x01\n\x02v0\x18\x01 \x01(\x0b\x32r.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0H\x00\x1ag\n,GetProtocolVersionUpgradeVoteStatusRequestV0\x12\x19\n\x11start_pro_tx_hash\x18\x01 \x01(\x0c\x12\r\n\x05\x63ount\x18\x02 \x01(\r\x12\r\n\x05prove\x18\x03 \x01(\x08\x42\t\n\x07version\"\xef\x05\n+GetProtocolVersionUpgradeVoteStatusResponse\x12\x82\x01\n\x02v0\x18\x01 \x01(\x0b\x32t.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0H\x00\x1a\xaf\x04\n-GetProtocolVersionUpgradeVoteStatusResponseV0\x12\x98\x01\n\x08versions\x18\x01 \x01(\x0b\x32\x83\x01.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignalsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\xaf\x01\n\x0eVersionSignals\x12\x9c\x01\n\x0fversion_signals\x18\x01 \x03(\x0b\x32\x82\x01.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal\x1a\x35\n\rVersionSignal\x12\x13\n\x0bpro_tx_hash\x18\x01 \x01(\x0c\x12\x0f\n\x07version\x18\x02 \x01(\rB\x08\n\x06resultB\t\n\x07version\"\xf5\x01\n\x14GetEpochsInfoRequest\x12T\n\x02v0\x18\x01 \x01(\x0b\x32\x46.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0H\x00\x1a|\n\x16GetEpochsInfoRequestV0\x12\x31\n\x0bstart_epoch\x18\x01 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12\r\n\x05\x63ount\x18\x02 \x01(\r\x12\x11\n\tascending\x18\x03 \x01(\x08\x12\r\n\x05prove\x18\x04 \x01(\x08\x42\t\n\x07version\"\x91\x05\n\x15GetEpochsInfoResponse\x12V\n\x02v0\x18\x01 \x01(\x0b\x32H.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0H\x00\x1a\x94\x04\n\x17GetEpochsInfoResponseV0\x12\x65\n\x06\x65pochs\x18\x01 \x01(\x0b\x32S.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfosH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1au\n\nEpochInfos\x12g\n\x0b\x65poch_infos\x18\x01 \x03(\x0b\x32R.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo\x1a\x9e\x01\n\tEpochInfo\x12\x0e\n\x06number\x18\x01 \x01(\r\x12\x1a\n\x12\x66irst_block_height\x18\x02 \x01(\x04\x12\x1f\n\x17\x66irst_core_block_height\x18\x03 \x01(\r\x12\x12\n\nstart_time\x18\x04 \x01(\x04\x12\x16\n\x0e\x66\x65\x65_multiplier\x18\x05 \x01(\x01\x12\x18\n\x10protocol_version\x18\x06 \x01(\rB\x08\n\x06resultB\t\n\x07version\"\xc4\x01\n\x16GetPathElementsRequest\x12X\n\x02v0\x18\x01 \x01(\x0b\x32J.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0H\x00\x1a\x45\n\x18GetPathElementsRequestV0\x12\x0c\n\x04path\x18\x01 \x03(\x0c\x12\x0c\n\x04keys\x18\x02 \x03(\x0c\x12\r\n\x05prove\x18\x03 \x01(\x08\x42\t\n\x07version\"\xa3\x03\n\x17GetPathElementsResponse\x12Z\n\x02v0\x18\x01 \x01(\x0b\x32L.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0H\x00\x1a\xa0\x02\n\x19GetPathElementsResponseV0\x12i\n\x08\x65lements\x18\x01 \x01(\x0b\x32U.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.ElementsH\x00\x12\x31\n\x05proof\x18\x02 \x01(\x0b\x32 .org.dash.platform.dapi.v0.ProofH\x00\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32+.org.dash.platform.dapi.v0.ResponseMetadata\x1a\x1c\n\x08\x45lements\x12\x10\n\x08\x65lements\x18\x01 \x03(\x0c\x42\x08\n\x06resultB\t\n\x07version*Z\n\nKeyPurpose\x12\x12\n\x0e\x41UTHENTICATION\x10\x00\x12\x0e\n\nENCRYPTION\x10\x01\x12\x0e\n\nDECRYPTION\x10\x02\x12\x0c\n\x08TRANSFER\x10\x03\x12\n\n\x06VOTING\x10\x05\x32\xcc\x15\n\x08Platform\x12\x93\x01\n\x18\x62roadcastStateTransition\x12:.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest\x1a;.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse\x12l\n\x0bgetIdentity\x12-.org.dash.platform.dapi.v0.GetIdentityRequest\x1a..org.dash.platform.dapi.v0.GetIdentityResponse\x12x\n\x0fgetIdentityKeys\x12\x31.org.dash.platform.dapi.v0.GetIdentityKeysRequest\x1a\x32.org.dash.platform.dapi.v0.GetIdentityKeysResponse\x12\x96\x01\n\x19getIdentitiesContractKeys\x12;.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest\x1a<.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse\x12{\n\x10getIdentityNonce\x12\x32.org.dash.platform.dapi.v0.GetIdentityNonceRequest\x1a\x33.org.dash.platform.dapi.v0.GetIdentityNonceResponse\x12\x93\x01\n\x18getIdentityContractNonce\x12:.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest\x1a;.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse\x12\x81\x01\n\x12getIdentityBalance\x12\x34.org.dash.platform.dapi.v0.GetIdentityBalanceRequest\x1a\x35.org.dash.platform.dapi.v0.GetIdentityBalanceResponse\x12\xa2\x01\n\x1dgetIdentityBalanceAndRevision\x12?.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest\x1a@.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse\x12\x66\n\tgetProofs\x12+.org.dash.platform.dapi.v0.GetProofsRequest\x1a,.org.dash.platform.dapi.v0.GetProofsResponse\x12x\n\x0fgetDataContract\x12\x31.org.dash.platform.dapi.v0.GetDataContractRequest\x1a\x32.org.dash.platform.dapi.v0.GetDataContractResponse\x12\x8d\x01\n\x16getDataContractHistory\x12\x38.org.dash.platform.dapi.v0.GetDataContractHistoryRequest\x1a\x39.org.dash.platform.dapi.v0.GetDataContractHistoryResponse\x12{\n\x10getDataContracts\x12\x32.org.dash.platform.dapi.v0.GetDataContractsRequest\x1a\x33.org.dash.platform.dapi.v0.GetDataContractsResponse\x12o\n\x0cgetDocuments\x12..org.dash.platform.dapi.v0.GetDocumentsRequest\x1a/.org.dash.platform.dapi.v0.GetDocumentsResponse\x12\x99\x01\n\x1agetIdentityByPublicKeyHash\x12<.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest\x1a=.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse\x12\x9f\x01\n\x1cwaitForStateTransitionResult\x12>.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest\x1a?.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse\x12\x81\x01\n\x12getConsensusParams\x12\x34.org.dash.platform.dapi.v0.GetConsensusParamsRequest\x1a\x35.org.dash.platform.dapi.v0.GetConsensusParamsResponse\x12\xa5\x01\n\x1egetProtocolVersionUpgradeState\x12@.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest\x1a\x41.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse\x12\xb4\x01\n#getProtocolVersionUpgradeVoteStatus\x12\x45.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest\x1a\x46.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse\x12r\n\rgetEpochsInfo\x12/.org.dash.platform.dapi.v0.GetEpochsInfoRequest\x1a\x30.org.dash.platform.dapi.v0.GetEpochsInfoResponse\x12x\n\x0fgetPathElements\x12\x31.org.dash.platform.dapi.v0.GetPathElementsRequest\x1a\x32.org.dash.platform.dapi.v0.GetPathElementsResponseb\x06proto3' , dependencies=[google_dot_protobuf_dot_wrappers__pb2.DESCRIPTOR,google_dot_protobuf_dot_struct__pb2.DESCRIPTOR,google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,]) +_KEYPURPOSE = _descriptor.EnumDescriptor( + name='KeyPurpose', + full_name='org.dash.platform.dapi.v0.KeyPurpose', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='AUTHENTICATION', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ENCRYPTION', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DECRYPTION', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='TRANSFER', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='VOTING', index=4, number=5, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=15803, + serialized_end=15893, +) +_sym_db.RegisterEnumDescriptor(_KEYPURPOSE) + +KeyPurpose = enum_type_wrapper.EnumTypeWrapper(_KEYPURPOSE) +AUTHENTICATION = 0 +ENCRYPTION = 1 +DECRYPTION = 2 +TRANSFER = 3 +VOTING = 5 _SECURITYLEVELMAP_KEYKINDREQUESTTYPE = _descriptor.EnumDescriptor( @@ -48,8 +95,8 @@ ], containing_type=None, serialized_options=None, - serialized_start=3815, - serialized_end=3898, + serialized_start=4150, + serialized_end=4233, ) _sym_db.RegisterEnumDescriptor(_SECURITYLEVELMAP_KEYKINDREQUESTTYPE) @@ -75,11 +122,16 @@ serialized_options=None, type=None, create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='REVISION', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), ], containing_type=None, serialized_options=None, - serialized_start=5350, - serialized_end=5398, + serialized_start=6921, + serialized_end=6983, ) _sym_db.RegisterEnumDescriptor(_GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST_TYPE) @@ -396,23 +448,23 @@ ) -_GETIDENTITYBALANCEREQUEST_GETIDENTITYBALANCEREQUESTV0 = _descriptor.Descriptor( - name='GetIdentityBalanceRequestV0', - full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0', +_GETIDENTITYNONCEREQUEST_GETIDENTITYNONCEREQUESTV0 = _descriptor.Descriptor( + name='GetIdentityNonceRequestV0', + full_name='org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='id', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.id', index=0, + name='identity_id', full_name='org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.identity_id', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='prove', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prove', index=1, + name='prove', full_name='org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prove', index=1, number=2, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, @@ -430,20 +482,20 @@ extension_ranges=[], oneofs=[ ], - serialized_start=887, - serialized_end=943, + serialized_start=881, + serialized_end=944, ) -_GETIDENTITYBALANCEREQUEST = _descriptor.Descriptor( - name='GetIdentityBalanceRequest', - full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest', +_GETIDENTITYNONCEREQUEST = _descriptor.Descriptor( + name='GetIdentityNonceRequest', + full_name='org.dash.platform.dapi.v0.GetIdentityNonceRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityNonceRequest.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -452,7 +504,7 @@ ], extensions=[ ], - nested_types=[_GETIDENTITYBALANCEREQUEST_GETIDENTITYBALANCEREQUESTV0, ], + nested_types=[_GETIDENTITYNONCEREQUEST_GETIDENTITYNONCEREQUESTV0, ], enum_types=[ ], serialized_options=None, @@ -461,34 +513,41 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.version', + name='version', full_name='org.dash.platform.dapi.v0.GetIdentityNonceRequest.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], serialized_start=762, - serialized_end=954, + serialized_end=955, ) -_GETIDENTITYBALANCEANDREVISIONREQUEST_GETIDENTITYBALANCEANDREVISIONREQUESTV0 = _descriptor.Descriptor( - name='GetIdentityBalanceAndRevisionRequestV0', - full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0', +_GETIDENTITYCONTRACTNONCEREQUEST_GETIDENTITYCONTRACTNONCEREQUESTV0 = _descriptor.Descriptor( + name='GetIdentityContractNonceRequestV0', + full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='id', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.id', index=0, + name='identity_id', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.identity_id', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='prove', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prove', index=1, - number=2, type=8, cpp_type=7, label=1, + name='contract_id', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.contract_id', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='prove', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prove', index=2, + number=3, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, @@ -505,20 +564,20 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1115, - serialized_end=1182, + serialized_start=1101, + serialized_end=1193, ) -_GETIDENTITYBALANCEANDREVISIONREQUEST = _descriptor.Descriptor( - name='GetIdentityBalanceAndRevisionRequest', - full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest', +_GETIDENTITYCONTRACTNONCEREQUEST = _descriptor.Descriptor( + name='GetIdentityContractNonceRequest', + full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -527,7 +586,7 @@ ], extensions=[ ], - nested_types=[_GETIDENTITYBALANCEANDREVISIONREQUEST_GETIDENTITYBALANCEANDREVISIONREQUESTV0, ], + nested_types=[_GETIDENTITYCONTRACTNONCEREQUEST_GETIDENTITYCONTRACTNONCEREQUESTV0, ], enum_types=[ ], serialized_options=None, @@ -536,42 +595,35 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.version', + name='version', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=957, - serialized_end=1193, + serialized_start=958, + serialized_end=1204, ) -_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0 = _descriptor.Descriptor( - name='GetIdentityResponseV0', - full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0', +_GETIDENTITYBALANCEREQUEST_GETIDENTITYBALANCEREQUESTV0 = _descriptor.Descriptor( + name='GetIdentityBalanceRequestV0', + full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='identity', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.identity', index=0, + name='id', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.id', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='proof', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.proof', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='metadata', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.metadata', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='prove', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prove', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), @@ -586,26 +638,21 @@ syntax='proto3', extension_ranges=[], oneofs=[ - _descriptor.OneofDescriptor( - name='result', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.result', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), ], - serialized_start=1304, - serialized_end=1471, + serialized_start=1332, + serialized_end=1388, ) -_GETIDENTITYRESPONSE = _descriptor.Descriptor( - name='GetIdentityResponse', - full_name='org.dash.platform.dapi.v0.GetIdentityResponse', +_GETIDENTITYBALANCEREQUEST = _descriptor.Descriptor( + name='GetIdentityBalanceRequest', + full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -614,7 +661,7 @@ ], extensions=[ ], - nested_types=[_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0, ], + nested_types=[_GETIDENTITYBALANCEREQUEST_GETIDENTITYBALANCEREQUESTV0, ], enum_types=[ ], serialized_options=None, @@ -623,33 +670,33 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.version', + name='version', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceRequest.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=1196, - serialized_end=1482, + serialized_start=1207, + serialized_end=1399, ) -_GETIDENTITIESREQUEST_GETIDENTITIESREQUESTV0 = _descriptor.Descriptor( - name='GetIdentitiesRequestV0', - full_name='org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0', +_GETIDENTITYBALANCEANDREVISIONREQUEST_GETIDENTITYBALANCEANDREVISIONREQUESTV0 = _descriptor.Descriptor( + name='GetIdentityBalanceAndRevisionRequestV0', + full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='ids', full_name='org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.ids', index=0, - number=1, type=12, cpp_type=9, label=3, - has_default_value=False, default_value=[], + name='id', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.id', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='prove', full_name='org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prove', index=1, + name='prove', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prove', index=1, number=2, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, @@ -667,20 +714,20 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1595, - serialized_end=1647, + serialized_start=1560, + serialized_end=1627, ) -_GETIDENTITIESREQUEST = _descriptor.Descriptor( - name='GetIdentitiesRequest', - full_name='org.dash.platform.dapi.v0.GetIdentitiesRequest', +_GETIDENTITYBALANCEANDREVISIONREQUEST = _descriptor.Descriptor( + name='GetIdentityBalanceAndRevisionRequest', + full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetIdentitiesRequest.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -689,7 +736,7 @@ ], extensions=[ ], - nested_types=[_GETIDENTITIESREQUEST_GETIDENTITIESREQUESTV0, ], + nested_types=[_GETIDENTITYBALANCEANDREVISIONREQUEST_GETIDENTITYBALANCEANDREVISIONREQUESTV0, ], enum_types=[ ], serialized_options=None, @@ -698,31 +745,45 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetIdentitiesRequest.version', + name='version', full_name='org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=1485, - serialized_end=1658, + serialized_start=1402, + serialized_end=1638, ) -_GETIDENTITIESRESPONSE_IDENTITYVALUE = _descriptor.Descriptor( - name='IdentityValue', - full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue', +_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0 = _descriptor.Descriptor( + name='GetIdentityResponseV0', + full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='value', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.value', index=0, + name='identity', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.identity', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='proof', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.proof', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], @@ -734,33 +795,82 @@ syntax='proto3', extension_ranges=[], oneofs=[ + _descriptor.OneofDescriptor( + name='result', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.result', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), ], - serialized_start=1774, - serialized_end=1804, + serialized_start=1749, + serialized_end=1916, ) -_GETIDENTITIESRESPONSE_IDENTITYENTRY = _descriptor.Descriptor( - name='IdentityEntry', - full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry', +_GETIDENTITYRESPONSE = _descriptor.Descriptor( + name='GetIdentityResponse', + full_name='org.dash.platform.dapi.v0.GetIdentityResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='key', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.key', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", + name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETIDENTITYRESPONSE_GETIDENTITYRESPONSEV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetIdentityResponse.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=1641, + serialized_end=1927, +) + + +_GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0 = _descriptor.Descriptor( + name='GetIdentityNonceResponseV0', + full_name='org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='identity_nonce', full_name='org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.identity_nonce', index=0, + number=1, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='value', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.value', index=1, + name='proof', full_name='org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.proof', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], @@ -772,30 +882,35 @@ syntax='proto3', extension_ranges=[], oneofs=[ + _descriptor.OneofDescriptor( + name='result', full_name='org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.result', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), ], - serialized_start=1806, - serialized_end=1913, + serialized_start=2053, + serialized_end=2231, ) -_GETIDENTITIESRESPONSE_IDENTITIES = _descriptor.Descriptor( - name='Identities', - full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities', +_GETIDENTITYNONCERESPONSE = _descriptor.Descriptor( + name='GetIdentityNonceResponse', + full_name='org.dash.platform.dapi.v0.GetIdentityNonceResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='identity_entries', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.identity_entries', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], + name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityNonceResponse.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], - nested_types=[], + nested_types=[_GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0, ], enum_types=[ ], serialized_options=None, @@ -803,35 +918,41 @@ syntax='proto3', extension_ranges=[], oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetIdentityNonceResponse.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), ], - serialized_start=1915, - serialized_end=2017, + serialized_start=1930, + serialized_end=2242, ) -_GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0 = _descriptor.Descriptor( - name='GetIdentitiesResponseV0', - full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0', + +_GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0 = _descriptor.Descriptor( + name='GetIdentityContractNonceResponseV0', + full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='identities', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.identities', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='identity_contract_nonce', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.identity_contract_nonce', index=0, + number=1, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='proof', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.proof', index=1, + name='proof', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.proof', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='metadata', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.metadata', index=2, + name='metadata', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.metadata', index=2, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -849,25 +970,25 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='result', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.result', + name='result', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.result', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=2020, - serialized_end=2252, + serialized_start=2392, + serialized_end=2587, ) -_GETIDENTITIESRESPONSE = _descriptor.Descriptor( - name='GetIdentitiesResponse', - full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse', +_GETIDENTITYCONTRACTNONCERESPONSE = _descriptor.Descriptor( + name='GetIdentityContractNonceResponse', + full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -876,7 +997,7 @@ ], extensions=[ ], - nested_types=[_GETIDENTITIESRESPONSE_IDENTITYVALUE, _GETIDENTITIESRESPONSE_IDENTITYENTRY, _GETIDENTITIESRESPONSE_IDENTITIES, _GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0, ], + nested_types=[_GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0, ], enum_types=[ ], serialized_options=None, @@ -885,13 +1006,13 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetIdentitiesResponse.version', + name='version', full_name='org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=1661, - serialized_end=2263, + serialized_start=2245, + serialized_end=2598, ) @@ -941,8 +1062,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=2395, - serialized_end=2568, + serialized_start=2730, + serialized_end=2903, ) _GETIDENTITYBALANCERESPONSE = _descriptor.Descriptor( @@ -977,8 +1098,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=2266, - serialized_end=2579, + serialized_start=2601, + serialized_end=2914, ) @@ -1016,8 +1137,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=3059, - serialized_end=3114, + serialized_start=3394, + serialized_end=3449, ) _GETIDENTITYBALANCEANDREVISIONRESPONSE_GETIDENTITYBALANCEANDREVISIONRESPONSEV0 = _descriptor.Descriptor( @@ -1066,8 +1187,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=2744, - serialized_end=3124, + serialized_start=3079, + serialized_end=3459, ) _GETIDENTITYBALANCEANDREVISIONRESPONSE = _descriptor.Descriptor( @@ -1102,8 +1223,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=2582, - serialized_end=3135, + serialized_start=2917, + serialized_end=3470, ) @@ -1153,8 +1274,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=3138, - serialized_end=3347, + serialized_start=3473, + serialized_end=3682, ) @@ -1178,8 +1299,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=3349, - serialized_end=3358, + serialized_start=3684, + serialized_end=3693, ) @@ -1210,8 +1331,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=3360, - serialized_end=3391, + serialized_start=3695, + serialized_end=3726, ) @@ -1249,8 +1370,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=3482, - serialized_end=3576, + serialized_start=3817, + serialized_end=3911, ) _SEARCHKEY = _descriptor.Descriptor( @@ -1280,8 +1401,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=3394, - serialized_end=3576, + serialized_start=3729, + serialized_end=3911, ) @@ -1319,8 +1440,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=3694, - serialized_end=3813, + serialized_start=4029, + serialized_end=4148, ) _SECURITYLEVELMAP = _descriptor.Descriptor( @@ -1351,8 +1472,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=3579, - serialized_end=3898, + serialized_start=3914, + serialized_end=4233, ) @@ -1411,8 +1532,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=4018, - serialized_end=4236, + serialized_start=4353, + serialized_end=4571, ) _GETIDENTITYKEYSREQUEST = _descriptor.Descriptor( @@ -1447,8 +1568,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=3901, - serialized_end=4247, + serialized_start=4236, + serialized_end=4582, ) @@ -1479,8 +1600,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=4612, - serialized_end=4638, + serialized_start=4947, + serialized_end=4973, ) _GETIDENTITYKEYSRESPONSE_GETIDENTITYKEYSRESPONSEV0 = _descriptor.Descriptor( @@ -1529,8 +1650,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=4370, - serialized_end=4648, + serialized_start=4705, + serialized_end=4983, ) _GETIDENTITYKEYSRESPONSE = _descriptor.Descriptor( @@ -1565,44 +1686,51 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=4250, - serialized_end=4659, + serialized_start=4585, + serialized_end=4994, ) -_GETPROOFSREQUEST_GETPROOFSREQUESTV0_DOCUMENTREQUEST = _descriptor.Descriptor( - name='DocumentRequest', - full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest', +_GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0 = _descriptor.Descriptor( + name='GetIdentitiesContractKeysRequestV0', + full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='contract_id', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.contract_id', index=0, - number=1, type=12, cpp_type=9, label=1, + name='identities_ids', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.identities_ids', index=0, + number=1, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='contract_id', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.contract_id', index=1, + number=2, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='document_type', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.document_type', index=1, - number=2, type=9, cpp_type=9, label=1, + name='document_type_name', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.document_type_name', index=2, + number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b"".decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='document_type_keeps_history', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.document_type_keeps_history', index=2, - number=3, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, + name='purposes', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.purposes', index=3, + number=4, type=14, cpp_type=8, label=3, + has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='document_id', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.document_id', index=3, - number=4, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", + name='prove', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prove', index=4, + number=5, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), @@ -1617,51 +1745,339 @@ syntax='proto3', extension_ranges=[], oneofs=[ + _descriptor.OneofDescriptor( + name='_document_type_name', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0._document_type_name', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), ], - serialized_start=5081, - serialized_end=5200, + serialized_start=5144, + serialized_end=5353, ) -_GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST = _descriptor.Descriptor( - name='IdentityRequest', - full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest', +_GETIDENTITIESCONTRACTKEYSREQUEST = _descriptor.Descriptor( + name='GetIdentitiesContractKeysRequest', + full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='identity_id', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.identity_id', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='request_type', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.request_type', index=1, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], - nested_types=[], + nested_types=[_GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0, ], enum_types=[ - _GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST_TYPE, ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), ], - serialized_start=5203, - serialized_end=5398, + serialized_start=4997, + serialized_end=5364, ) -_GETPROOFSREQUEST_GETPROOFSREQUESTV0_CONTRACTREQUEST = _descriptor.Descriptor( + +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_PURPOSEKEYS = _descriptor.Descriptor( + name='PurposeKeys', + full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='purpose', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.purpose', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='keys_bytes', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.keys_bytes', index=1, + number=2, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=5811, + serialized_end=5900, +) + +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITYKEYS = _descriptor.Descriptor( + name='IdentityKeys', + full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='identity_id', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.identity_id', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='keys', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.keys', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=5903, + serialized_end=6062, +) + +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITIESKEYS = _descriptor.Descriptor( + name='IdentitiesKeys', + full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='entries', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.entries', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=6065, + serialized_end=6209, +) + +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0 = _descriptor.Descriptor( + name='GetIdentitiesContractKeysResponseV0', + full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='identities_keys', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.identities_keys', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='proof', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.proof', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_PURPOSEKEYS, _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITYKEYS, _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITIESKEYS, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='result', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.result', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=5517, + serialized_end=6219, +) + +_GETIDENTITIESCONTRACTKEYSRESPONSE = _descriptor.Descriptor( + name='GetIdentitiesContractKeysResponse', + full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=5367, + serialized_end=6230, +) + + +_GETPROOFSREQUEST_GETPROOFSREQUESTV0_DOCUMENTREQUEST = _descriptor.Descriptor( + name='DocumentRequest', + full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='contract_id', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.contract_id', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='document_type', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.document_type', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='document_type_keeps_history', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.document_type_keeps_history', index=2, + number=3, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='document_id', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.DocumentRequest.document_id', index=3, + number=4, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=6652, + serialized_end=6771, +) + +_GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST = _descriptor.Descriptor( + name='IdentityRequest', + full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='identity_id', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.identity_id', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='request_type', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.request_type', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST_TYPE, + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=6774, + serialized_end=6983, +) + +_GETPROOFSREQUEST_GETPROOFSREQUESTV0_CONTRACTREQUEST = _descriptor.Descriptor( name='ContractRequest', full_name='org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest', filename=None, @@ -1688,8 +2104,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=5400, - serialized_end=5438, + serialized_start=6985, + serialized_end=7023, ) _GETPROOFSREQUEST_GETPROOFSREQUESTV0 = _descriptor.Descriptor( @@ -1733,8 +2149,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=4761, - serialized_end=5438, + serialized_start=6332, + serialized_end=7023, ) _GETPROOFSREQUEST = _descriptor.Descriptor( @@ -1769,8 +2185,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=4662, - serialized_end=5449, + serialized_start=6233, + serialized_end=7034, ) @@ -1813,8 +2229,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=5554, - serialized_end=5699, + serialized_start=7139, + serialized_end=7284, ) _GETPROOFSRESPONSE = _descriptor.Descriptor( @@ -1849,8 +2265,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=5452, - serialized_end=5710, + serialized_start=7037, + serialized_end=7295, ) @@ -1888,8 +2304,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=5829, - serialized_end=5882, + serialized_start=7414, + serialized_end=7467, ) _GETDATACONTRACTREQUEST = _descriptor.Descriptor( @@ -1924,8 +2340,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=5713, - serialized_end=5893, + serialized_start=7298, + serialized_end=7478, ) @@ -1975,8 +2391,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=6016, - serialized_end=6192, + serialized_start=7601, + serialized_end=7777, ) _GETDATACONTRACTRESPONSE = _descriptor.Descriptor( @@ -2011,8 +2427,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=5896, - serialized_end=6203, + serialized_start=7481, + serialized_end=7788, ) @@ -2050,8 +2466,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=6325, - serialized_end=6380, + serialized_start=7910, + serialized_end=7965, ) _GETDATACONTRACTSREQUEST = _descriptor.Descriptor( @@ -2086,8 +2502,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=6206, - serialized_end=6391, + serialized_start=7791, + serialized_end=7976, ) @@ -2125,8 +2541,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=6516, - serialized_end=6607, + serialized_start=8101, + serialized_end=8192, ) _GETDATACONTRACTSRESPONSE_DATACONTRACTS = _descriptor.Descriptor( @@ -2156,8 +2572,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=6609, - serialized_end=6726, + serialized_start=8194, + serialized_end=8311, ) _GETDATACONTRACTSRESPONSE_GETDATACONTRACTSRESPONSEV0 = _descriptor.Descriptor( @@ -2206,8 +2622,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=6729, - serialized_end=6974, + serialized_start=8314, + serialized_end=8559, ) _GETDATACONTRACTSRESPONSE = _descriptor.Descriptor( @@ -2242,8 +2658,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=6394, - serialized_end=6985, + serialized_start=7979, + serialized_end=8570, ) @@ -2302,8 +2718,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=7126, - serialized_end=7298, + serialized_start=8711, + serialized_end=8883, ) _GETDATACONTRACTHISTORYREQUEST = _descriptor.Descriptor( @@ -2338,8 +2754,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=6988, - serialized_end=7309, + serialized_start=8573, + serialized_end=8894, ) @@ -2377,8 +2793,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=7749, - serialized_end=7804, + serialized_start=9334, + serialized_end=9389, ) _GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0_DATACONTRACTHISTORY = _descriptor.Descriptor( @@ -2408,8 +2824,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=7807, - serialized_end=7977, + serialized_start=9392, + serialized_end=9562, ) _GETDATACONTRACTHISTORYRESPONSE_GETDATACONTRACTHISTORYRESPONSEV0 = _descriptor.Descriptor( @@ -2458,8 +2874,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=7453, - serialized_end=7987, + serialized_start=9038, + serialized_end=9572, ) _GETDATACONTRACTHISTORYRESPONSE = _descriptor.Descriptor( @@ -2494,8 +2910,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=7312, - serialized_end=7998, + serialized_start=8897, + serialized_end=9583, ) @@ -2580,8 +2996,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=8109, - serialized_end=8296, + serialized_start=9694, + serialized_end=9881, ) _GETDOCUMENTSREQUEST = _descriptor.Descriptor( @@ -2616,8 +3032,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=8001, - serialized_end=8307, + serialized_start=9586, + serialized_end=9892, ) @@ -2648,8 +3064,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=8664, - serialized_end=8694, + serialized_start=10249, + serialized_end=10279, ) _GETDOCUMENTSRESPONSE_GETDOCUMENTSRESPONSEV0 = _descriptor.Descriptor( @@ -2698,8 +3114,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=8421, - serialized_end=8704, + serialized_start=10006, + serialized_end=10289, ) _GETDOCUMENTSRESPONSE = _descriptor.Descriptor( @@ -2734,28 +3150,28 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=8310, - serialized_end=8715, + serialized_start=9895, + serialized_end=10300, ) -_GETIDENTITIESBYPUBLICKEYHASHESREQUEST_GETIDENTITIESBYPUBLICKEYHASHESREQUESTV0 = _descriptor.Descriptor( - name='GetIdentitiesByPublicKeyHashesRequestV0', - full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0', +_GETIDENTITYBYPUBLICKEYHASHREQUEST_GETIDENTITYBYPUBLICKEYHASHREQUESTV0 = _descriptor.Descriptor( + name='GetIdentityByPublicKeyHashRequestV0', + full_name='org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='public_key_hashes', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.public_key_hashes', index=0, - number=1, type=12, cpp_type=9, label=3, - has_default_value=False, default_value=[], + name='public_key_hash', full_name='org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.public_key_hash', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='prove', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prove', index=1, + name='prove', full_name='org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prove', index=1, number=2, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, @@ -2773,239 +3189,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=8879, - serialized_end=8962, -) - -_GETIDENTITIESBYPUBLICKEYHASHESREQUEST = _descriptor.Descriptor( - name='GetIdentitiesByPublicKeyHashesRequest', - full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.v0', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_GETIDENTITIESBYPUBLICKEYHASHESREQUEST_GETIDENTITIESBYPUBLICKEYHASHESREQUESTV0, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.version', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=8718, - serialized_end=8973, -) - - -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_PUBLICKEYHASHIDENTITYENTRY = _descriptor.Descriptor( - name='PublicKeyHashIdentityEntry', - full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='public_key_hash', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.public_key_hash', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='value', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.value', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=9140, - serialized_end=9237, -) - -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_IDENTITIESBYPUBLICKEYHASHES = _descriptor.Descriptor( - name='IdentitiesByPublicKeyHashes', - full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='identity_entries', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.identity_entries', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=9240, - serialized_end=9389, -) - -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0 = _descriptor.Descriptor( - name='GetIdentitiesByPublicKeyHashesResponseV0', - full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='identities', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.identities', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='proof', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.proof', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='metadata', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.metadata', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='result', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.result', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=9392, - serialized_end=9675, -) - -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE = _descriptor.Descriptor( - name='GetIdentitiesByPublicKeyHashesResponse', - full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.v0', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_PUBLICKEYHASHIDENTITYENTRY, _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_IDENTITIESBYPUBLICKEYHASHES, _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.version', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=8976, - serialized_end=9686, -) - - -_GETIDENTITYBYPUBLICKEYHASHREQUEST_GETIDENTITYBYPUBLICKEYHASHREQUESTV0 = _descriptor.Descriptor( - name='GetIdentityByPublicKeyHashRequestV0', - full_name='org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='public_key_hash', full_name='org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.public_key_hash', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='prove', full_name='org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prove', index=1, - number=2, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=9838, - serialized_end=9915, + serialized_start=10452, + serialized_end=10529, ) _GETIDENTITYBYPUBLICKEYHASHREQUEST = _descriptor.Descriptor( @@ -3040,8 +3225,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=9689, - serialized_end=9926, + serialized_start=10303, + serialized_end=10540, ) @@ -3091,8 +3276,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=10082, - serialized_end=10264, + serialized_start=10696, + serialized_end=10878, ) _GETIDENTITYBYPUBLICKEYHASHRESPONSE = _descriptor.Descriptor( @@ -3127,8 +3312,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=9929, - serialized_end=10275, + serialized_start=10543, + serialized_end=10889, ) @@ -3166,8 +3351,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=10433, - serialized_end=10518, + serialized_start=11047, + serialized_end=11132, ) _WAITFORSTATETRANSITIONRESULTREQUEST = _descriptor.Descriptor( @@ -3202,8 +3387,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=10278, - serialized_end=10529, + serialized_start=10892, + serialized_end=11143, ) @@ -3253,8 +3438,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=10691, - serialized_end=10930, + serialized_start=11305, + serialized_end=11544, ) _WAITFORSTATETRANSITIONRESULTRESPONSE = _descriptor.Descriptor( @@ -3289,8 +3474,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=10532, - serialized_end=10941, + serialized_start=11146, + serialized_end=11555, ) @@ -3328,8 +3513,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=11069, - serialized_end=11129, + serialized_start=11683, + serialized_end=11743, ) _GETCONSENSUSPARAMSREQUEST = _descriptor.Descriptor( @@ -3364,8 +3549,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=10944, - serialized_end=11140, + serialized_start=11558, + serialized_end=11754, ) @@ -3410,8 +3595,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=11271, - serialized_end=11351, + serialized_start=11885, + serialized_end=11965, ) _GETCONSENSUSPARAMSRESPONSE_CONSENSUSPARAMSEVIDENCE = _descriptor.Descriptor( @@ -3455,8 +3640,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=11353, - serialized_end=11451, + serialized_start=11967, + serialized_end=12065, ) _GETCONSENSUSPARAMSRESPONSE_GETCONSENSUSPARAMSRESPONSEV0 = _descriptor.Descriptor( @@ -3493,8 +3678,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=11454, - serialized_end=11672, + serialized_start=12068, + serialized_end=12286, ) _GETCONSENSUSPARAMSRESPONSE = _descriptor.Descriptor( @@ -3529,8 +3714,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=11143, - serialized_end=11683, + serialized_start=11757, + serialized_end=12297, ) @@ -3561,8 +3746,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=11847, - serialized_end=11903, + serialized_start=12461, + serialized_end=12517, ) _GETPROTOCOLVERSIONUPGRADESTATEREQUEST = _descriptor.Descriptor( @@ -3597,8 +3782,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=11686, - serialized_end=11914, + serialized_start=12300, + serialized_end=12528, ) @@ -3629,8 +3814,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=12379, - serialized_end=12529, + serialized_start=12993, + serialized_end=13143, ) _GETPROTOCOLVERSIONUPGRADESTATERESPONSE_GETPROTOCOLVERSIONUPGRADESTATERESPONSEV0_VERSIONENTRY = _descriptor.Descriptor( @@ -3667,8 +3852,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=12531, - serialized_end=12589, + serialized_start=13145, + serialized_end=13203, ) _GETPROTOCOLVERSIONUPGRADESTATERESPONSE_GETPROTOCOLVERSIONUPGRADESTATERESPONSEV0 = _descriptor.Descriptor( @@ -3717,8 +3902,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=12082, - serialized_end=12599, + serialized_start=12696, + serialized_end=13213, ) _GETPROTOCOLVERSIONUPGRADESTATERESPONSE = _descriptor.Descriptor( @@ -3753,8 +3938,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=11917, - serialized_end=12610, + serialized_start=12531, + serialized_end=13224, ) @@ -3799,8 +3984,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=12790, - serialized_end=12893, + serialized_start=13404, + serialized_end=13507, ) _GETPROTOCOLVERSIONUPGRADEVOTESTATUSREQUEST = _descriptor.Descriptor( @@ -3835,8 +4020,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=12613, - serialized_end=12904, + serialized_start=13227, + serialized_end=13518, ) @@ -3867,8 +4052,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=13407, - serialized_end=13582, + serialized_start=14021, + serialized_end=14196, ) _GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE_GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSEV0_VERSIONSIGNAL = _descriptor.Descriptor( @@ -3905,8 +4090,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=13584, - serialized_end=13637, + serialized_start=14198, + serialized_end=14251, ) _GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE_GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSEV0 = _descriptor.Descriptor( @@ -3955,8 +4140,8 @@ create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=13088, - serialized_end=13647, + serialized_start=13702, + serialized_end=14261, ) _GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE = _descriptor.Descriptor( @@ -3977,7 +4162,280 @@ ], extensions=[ ], - nested_types=[_GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE_GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSEV0, ], + nested_types=[_GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE_GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSEV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=13521, + serialized_end=14272, +) + + +_GETEPOCHSINFOREQUEST_GETEPOCHSINFOREQUESTV0 = _descriptor.Descriptor( + name='GetEpochsInfoRequestV0', + full_name='org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='start_epoch', full_name='org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.start_epoch', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='count', full_name='org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.count', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='ascending', full_name='org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.ascending', index=2, + number=3, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='prove', full_name='org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prove', index=3, + number=4, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=14385, + serialized_end=14509, +) + +_GETEPOCHSINFOREQUEST = _descriptor.Descriptor( + name='GetEpochsInfoRequest', + full_name='org.dash.platform.dapi.v0.GetEpochsInfoRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetEpochsInfoRequest.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETEPOCHSINFOREQUEST_GETEPOCHSINFOREQUESTV0, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='version', full_name='org.dash.platform.dapi.v0.GetEpochsInfoRequest.version', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=14275, + serialized_end=14520, +) + + +_GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0_EPOCHINFOS = _descriptor.Descriptor( + name='EpochInfos', + full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='epoch_infos', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.epoch_infos', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=14881, + serialized_end=14998, +) + +_GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0_EPOCHINFO = _descriptor.Descriptor( + name='EpochInfo', + full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='number', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.number', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='first_block_height', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.first_block_height', index=1, + number=2, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='first_core_block_height', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.first_core_block_height', index=2, + number=3, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='start_time', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.start_time', index=3, + number=4, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='fee_multiplier', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.fee_multiplier', index=4, + number=5, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='protocol_version', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.protocol_version', index=5, + number=6, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=15001, + serialized_end=15159, +) + +_GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0 = _descriptor.Descriptor( + name='GetEpochsInfoResponseV0', + full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='epochs', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.epochs', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='proof', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.proof', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0_EPOCHINFOS, _GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0_EPOCHINFO, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='result', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.result', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=14637, + serialized_end=15169, +) + +_GETEPOCHSINFORESPONSE = _descriptor.Descriptor( + name='GetEpochsInfoResponse', + full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='v0', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.v0', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0, ], enum_types=[ ], serialized_options=None, @@ -3986,52 +4444,45 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.version', + name='version', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=12907, - serialized_end=13658, + serialized_start=14523, + serialized_end=15180, ) -_GETEPOCHSINFOREQUEST_GETEPOCHSINFOREQUESTV0 = _descriptor.Descriptor( - name='GetEpochsInfoRequestV0', - full_name='org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0', +_GETPATHELEMENTSREQUEST_GETPATHELEMENTSREQUESTV0 = _descriptor.Descriptor( + name='GetPathElementsRequestV0', + full_name='org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='start_epoch', full_name='org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.start_epoch', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='path', full_name='org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.path', index=0, + number=1, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='count', full_name='org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.count', index=1, - number=2, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, + name='keys', full_name='org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.keys', index=1, + number=2, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='ascending', full_name='org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.ascending', index=2, + name='prove', full_name='org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prove', index=2, number=3, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='prove', full_name='org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prove', index=3, - number=4, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], @@ -4044,20 +4495,20 @@ extension_ranges=[], oneofs=[ ], - serialized_start=13771, - serialized_end=13895, + serialized_start=15299, + serialized_end=15368, ) -_GETEPOCHSINFOREQUEST = _descriptor.Descriptor( - name='GetEpochsInfoRequest', - full_name='org.dash.platform.dapi.v0.GetEpochsInfoRequest', +_GETPATHELEMENTSREQUEST = _descriptor.Descriptor( + name='GetPathElementsRequest', + full_name='org.dash.platform.dapi.v0.GetPathElementsRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetEpochsInfoRequest.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetPathElementsRequest.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -4066,7 +4517,7 @@ ], extensions=[ ], - nested_types=[_GETEPOCHSINFOREQUEST_GETEPOCHSINFOREQUESTV0, ], + nested_types=[_GETPATHELEMENTSREQUEST_GETPATHELEMENTSREQUESTV0, ], enum_types=[ ], serialized_options=None, @@ -4075,27 +4526,27 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetEpochsInfoRequest.version', + name='version', full_name='org.dash.platform.dapi.v0.GetPathElementsRequest.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=13661, - serialized_end=13906, + serialized_start=15183, + serialized_end=15379, ) -_GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0_EPOCHINFOS = _descriptor.Descriptor( - name='EpochInfos', - full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos', +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0_ELEMENTS = _descriptor.Descriptor( + name='Elements', + full_name='org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='epoch_infos', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.epoch_infos', index=0, - number=1, type=11, cpp_type=10, label=3, + name='elements', full_name='org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.elements', index=0, + number=1, type=12, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, @@ -4112,93 +4563,34 @@ extension_ranges=[], oneofs=[ ], - serialized_start=14267, - serialized_end=14384, -) - -_GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0_EPOCHINFO = _descriptor.Descriptor( - name='EpochInfo', - full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='number', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.number', index=0, - number=1, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='first_block_height', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.first_block_height', index=1, - number=2, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='first_core_block_height', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.first_core_block_height', index=2, - number=3, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='start_time', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.start_time', index=3, - number=4, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='fee_multiplier', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.fee_multiplier', index=4, - number=5, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=14387, - serialized_end=14519, + serialized_start=15752, + serialized_end=15780, ) -_GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0 = _descriptor.Descriptor( - name='GetEpochsInfoResponseV0', - full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0', +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0 = _descriptor.Descriptor( + name='GetPathElementsResponseV0', + full_name='org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='epochs', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.epochs', index=0, + name='elements', full_name='org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.elements', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='proof', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.proof', index=1, + name='proof', full_name='org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.proof', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='metadata', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.metadata', index=2, + name='metadata', full_name='org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.metadata', index=2, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -4207,7 +4599,7 @@ ], extensions=[ ], - nested_types=[_GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0_EPOCHINFOS, _GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0_EPOCHINFO, ], + nested_types=[_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0_ELEMENTS, ], enum_types=[ ], serialized_options=None, @@ -4216,25 +4608,25 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='result', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.result', + name='result', full_name='org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.result', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=14023, - serialized_end=14529, + serialized_start=15502, + serialized_end=15790, ) -_GETEPOCHSINFORESPONSE = _descriptor.Descriptor( - name='GetEpochsInfoResponse', - full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse', +_GETPATHELEMENTSRESPONSE = _descriptor.Descriptor( + name='GetPathElementsResponse', + full_name='org.dash.platform.dapi.v0.GetPathElementsResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='v0', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.v0', index=0, + name='v0', full_name='org.dash.platform.dapi.v0.GetPathElementsResponse.v0', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -4243,7 +4635,7 @@ ], extensions=[ ], - nested_types=[_GETEPOCHSINFORESPONSE_GETEPOCHSINFORESPONSEV0, ], + nested_types=[_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0, ], enum_types=[ ], serialized_options=None, @@ -4252,13 +4644,13 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name='version', full_name='org.dash.platform.dapi.v0.GetEpochsInfoResponse.version', + name='version', full_name='org.dash.platform.dapi.v0.GetPathElementsResponse.version', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=13909, - serialized_end=14540, + serialized_start=15382, + serialized_end=15801, ) _GETIDENTITYREQUEST_GETIDENTITYREQUESTV0.containing_type = _GETIDENTITYREQUEST @@ -4266,6 +4658,16 @@ _GETIDENTITYREQUEST.oneofs_by_name['version'].fields.append( _GETIDENTITYREQUEST.fields_by_name['v0']) _GETIDENTITYREQUEST.fields_by_name['v0'].containing_oneof = _GETIDENTITYREQUEST.oneofs_by_name['version'] +_GETIDENTITYNONCEREQUEST_GETIDENTITYNONCEREQUESTV0.containing_type = _GETIDENTITYNONCEREQUEST +_GETIDENTITYNONCEREQUEST.fields_by_name['v0'].message_type = _GETIDENTITYNONCEREQUEST_GETIDENTITYNONCEREQUESTV0 +_GETIDENTITYNONCEREQUEST.oneofs_by_name['version'].fields.append( + _GETIDENTITYNONCEREQUEST.fields_by_name['v0']) +_GETIDENTITYNONCEREQUEST.fields_by_name['v0'].containing_oneof = _GETIDENTITYNONCEREQUEST.oneofs_by_name['version'] +_GETIDENTITYCONTRACTNONCEREQUEST_GETIDENTITYCONTRACTNONCEREQUESTV0.containing_type = _GETIDENTITYCONTRACTNONCEREQUEST +_GETIDENTITYCONTRACTNONCEREQUEST.fields_by_name['v0'].message_type = _GETIDENTITYCONTRACTNONCEREQUEST_GETIDENTITYCONTRACTNONCEREQUESTV0 +_GETIDENTITYCONTRACTNONCEREQUEST.oneofs_by_name['version'].fields.append( + _GETIDENTITYCONTRACTNONCEREQUEST.fields_by_name['v0']) +_GETIDENTITYCONTRACTNONCEREQUEST.fields_by_name['v0'].containing_oneof = _GETIDENTITYCONTRACTNONCEREQUEST.oneofs_by_name['version'] _GETIDENTITYBALANCEREQUEST_GETIDENTITYBALANCEREQUESTV0.containing_type = _GETIDENTITYBALANCEREQUEST _GETIDENTITYBALANCEREQUEST.fields_by_name['v0'].message_type = _GETIDENTITYBALANCEREQUEST_GETIDENTITYBALANCEREQUESTV0 _GETIDENTITYBALANCEREQUEST.oneofs_by_name['version'].fields.append( @@ -4289,30 +4691,32 @@ _GETIDENTITYRESPONSE.oneofs_by_name['version'].fields.append( _GETIDENTITYRESPONSE.fields_by_name['v0']) _GETIDENTITYRESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITYRESPONSE.oneofs_by_name['version'] -_GETIDENTITIESREQUEST_GETIDENTITIESREQUESTV0.containing_type = _GETIDENTITIESREQUEST -_GETIDENTITIESREQUEST.fields_by_name['v0'].message_type = _GETIDENTITIESREQUEST_GETIDENTITIESREQUESTV0 -_GETIDENTITIESREQUEST.oneofs_by_name['version'].fields.append( - _GETIDENTITIESREQUEST.fields_by_name['v0']) -_GETIDENTITIESREQUEST.fields_by_name['v0'].containing_oneof = _GETIDENTITIESREQUEST.oneofs_by_name['version'] -_GETIDENTITIESRESPONSE_IDENTITYVALUE.containing_type = _GETIDENTITIESRESPONSE -_GETIDENTITIESRESPONSE_IDENTITYENTRY.fields_by_name['value'].message_type = _GETIDENTITIESRESPONSE_IDENTITYVALUE -_GETIDENTITIESRESPONSE_IDENTITYENTRY.containing_type = _GETIDENTITIESRESPONSE -_GETIDENTITIESRESPONSE_IDENTITIES.fields_by_name['identity_entries'].message_type = _GETIDENTITIESRESPONSE_IDENTITYENTRY -_GETIDENTITIESRESPONSE_IDENTITIES.containing_type = _GETIDENTITIESRESPONSE -_GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.fields_by_name['identities'].message_type = _GETIDENTITIESRESPONSE_IDENTITIES -_GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.fields_by_name['proof'].message_type = _PROOF -_GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA -_GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.containing_type = _GETIDENTITIESRESPONSE -_GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.oneofs_by_name['result'].fields.append( - _GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.fields_by_name['identities']) -_GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.fields_by_name['identities'].containing_oneof = _GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.oneofs_by_name['result'] -_GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.oneofs_by_name['result'].fields.append( - _GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.fields_by_name['proof']) -_GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.fields_by_name['proof'].containing_oneof = _GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0.oneofs_by_name['result'] -_GETIDENTITIESRESPONSE.fields_by_name['v0'].message_type = _GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0 -_GETIDENTITIESRESPONSE.oneofs_by_name['version'].fields.append( - _GETIDENTITIESRESPONSE.fields_by_name['v0']) -_GETIDENTITIESRESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITIESRESPONSE.oneofs_by_name['version'] +_GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.fields_by_name['proof'].message_type = _PROOF +_GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA +_GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.containing_type = _GETIDENTITYNONCERESPONSE +_GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.oneofs_by_name['result'].fields.append( + _GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.fields_by_name['identity_nonce']) +_GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.fields_by_name['identity_nonce'].containing_oneof = _GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.oneofs_by_name['result'] +_GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.oneofs_by_name['result'].fields.append( + _GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.fields_by_name['proof']) +_GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.fields_by_name['proof'].containing_oneof = _GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0.oneofs_by_name['result'] +_GETIDENTITYNONCERESPONSE.fields_by_name['v0'].message_type = _GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0 +_GETIDENTITYNONCERESPONSE.oneofs_by_name['version'].fields.append( + _GETIDENTITYNONCERESPONSE.fields_by_name['v0']) +_GETIDENTITYNONCERESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITYNONCERESPONSE.oneofs_by_name['version'] +_GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.fields_by_name['proof'].message_type = _PROOF +_GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA +_GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.containing_type = _GETIDENTITYCONTRACTNONCERESPONSE +_GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.oneofs_by_name['result'].fields.append( + _GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.fields_by_name['identity_contract_nonce']) +_GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.fields_by_name['identity_contract_nonce'].containing_oneof = _GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.oneofs_by_name['result'] +_GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.oneofs_by_name['result'].fields.append( + _GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.fields_by_name['proof']) +_GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.fields_by_name['proof'].containing_oneof = _GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0.oneofs_by_name['result'] +_GETIDENTITYCONTRACTNONCERESPONSE.fields_by_name['v0'].message_type = _GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0 +_GETIDENTITYCONTRACTNONCERESPONSE.oneofs_by_name['version'].fields.append( + _GETIDENTITYCONTRACTNONCERESPONSE.fields_by_name['v0']) +_GETIDENTITYCONTRACTNONCERESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITYCONTRACTNONCERESPONSE.oneofs_by_name['version'] _GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.fields_by_name['proof'].message_type = _PROOF _GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA _GETIDENTITYBALANCERESPONSE_GETIDENTITYBALANCERESPONSEV0.containing_type = _GETIDENTITYBALANCERESPONSE @@ -4383,6 +4787,35 @@ _GETIDENTITYKEYSRESPONSE.oneofs_by_name['version'].fields.append( _GETIDENTITYKEYSRESPONSE.fields_by_name['v0']) _GETIDENTITYKEYSRESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITYKEYSRESPONSE.oneofs_by_name['version'] +_GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0.fields_by_name['purposes'].enum_type = _KEYPURPOSE +_GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0.containing_type = _GETIDENTITIESCONTRACTKEYSREQUEST +_GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0.oneofs_by_name['_document_type_name'].fields.append( + _GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0.fields_by_name['document_type_name']) +_GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0.fields_by_name['document_type_name'].containing_oneof = _GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0.oneofs_by_name['_document_type_name'] +_GETIDENTITIESCONTRACTKEYSREQUEST.fields_by_name['v0'].message_type = _GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0 +_GETIDENTITIESCONTRACTKEYSREQUEST.oneofs_by_name['version'].fields.append( + _GETIDENTITIESCONTRACTKEYSREQUEST.fields_by_name['v0']) +_GETIDENTITIESCONTRACTKEYSREQUEST.fields_by_name['v0'].containing_oneof = _GETIDENTITIESCONTRACTKEYSREQUEST.oneofs_by_name['version'] +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_PURPOSEKEYS.fields_by_name['purpose'].enum_type = _KEYPURPOSE +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_PURPOSEKEYS.containing_type = _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0 +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITYKEYS.fields_by_name['keys'].message_type = _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_PURPOSEKEYS +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITYKEYS.containing_type = _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0 +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITIESKEYS.fields_by_name['entries'].message_type = _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITYKEYS +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITIESKEYS.containing_type = _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0 +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.fields_by_name['identities_keys'].message_type = _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITIESKEYS +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.fields_by_name['proof'].message_type = _PROOF +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.containing_type = _GETIDENTITIESCONTRACTKEYSRESPONSE +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.fields_by_name['identities_keys']) +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.fields_by_name['identities_keys'].containing_oneof = _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.oneofs_by_name['result'] +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.fields_by_name['proof']) +_GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.fields_by_name['proof'].containing_oneof = _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0.oneofs_by_name['result'] +_GETIDENTITIESCONTRACTKEYSRESPONSE.fields_by_name['v0'].message_type = _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0 +_GETIDENTITIESCONTRACTKEYSRESPONSE.oneofs_by_name['version'].fields.append( + _GETIDENTITIESCONTRACTKEYSRESPONSE.fields_by_name['v0']) +_GETIDENTITIESCONTRACTKEYSRESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITIESCONTRACTKEYSRESPONSE.oneofs_by_name['version'] _GETPROOFSREQUEST_GETPROOFSREQUESTV0_DOCUMENTREQUEST.containing_type = _GETPROOFSREQUEST_GETPROOFSREQUESTV0 _GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST.fields_by_name['request_type'].enum_type = _GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST_TYPE _GETPROOFSREQUEST_GETPROOFSREQUESTV0_IDENTITYREQUEST.containing_type = _GETPROOFSREQUEST_GETPROOFSREQUESTV0 @@ -4497,29 +4930,6 @@ _GETDOCUMENTSRESPONSE.oneofs_by_name['version'].fields.append( _GETDOCUMENTSRESPONSE.fields_by_name['v0']) _GETDOCUMENTSRESPONSE.fields_by_name['v0'].containing_oneof = _GETDOCUMENTSRESPONSE.oneofs_by_name['version'] -_GETIDENTITIESBYPUBLICKEYHASHESREQUEST_GETIDENTITIESBYPUBLICKEYHASHESREQUESTV0.containing_type = _GETIDENTITIESBYPUBLICKEYHASHESREQUEST -_GETIDENTITIESBYPUBLICKEYHASHESREQUEST.fields_by_name['v0'].message_type = _GETIDENTITIESBYPUBLICKEYHASHESREQUEST_GETIDENTITIESBYPUBLICKEYHASHESREQUESTV0 -_GETIDENTITIESBYPUBLICKEYHASHESREQUEST.oneofs_by_name['version'].fields.append( - _GETIDENTITIESBYPUBLICKEYHASHESREQUEST.fields_by_name['v0']) -_GETIDENTITIESBYPUBLICKEYHASHESREQUEST.fields_by_name['v0'].containing_oneof = _GETIDENTITIESBYPUBLICKEYHASHESREQUEST.oneofs_by_name['version'] -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_PUBLICKEYHASHIDENTITYENTRY.fields_by_name['value'].message_type = google_dot_protobuf_dot_wrappers__pb2._BYTESVALUE -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_PUBLICKEYHASHIDENTITYENTRY.containing_type = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_IDENTITIESBYPUBLICKEYHASHES.fields_by_name['identity_entries'].message_type = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_PUBLICKEYHASHIDENTITYENTRY -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_IDENTITIESBYPUBLICKEYHASHES.containing_type = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.fields_by_name['identities'].message_type = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_IDENTITIESBYPUBLICKEYHASHES -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.fields_by_name['proof'].message_type = _PROOF -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.containing_type = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.oneofs_by_name['result'].fields.append( - _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.fields_by_name['identities']) -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.fields_by_name['identities'].containing_oneof = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.oneofs_by_name['result'] -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.oneofs_by_name['result'].fields.append( - _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.fields_by_name['proof']) -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.fields_by_name['proof'].containing_oneof = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0.oneofs_by_name['result'] -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE.fields_by_name['v0'].message_type = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0 -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE.oneofs_by_name['version'].fields.append( - _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE.fields_by_name['v0']) -_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE.fields_by_name['v0'].containing_oneof = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE.oneofs_by_name['version'] _GETIDENTITYBYPUBLICKEYHASHREQUEST_GETIDENTITYBYPUBLICKEYHASHREQUESTV0.containing_type = _GETIDENTITYBYPUBLICKEYHASHREQUEST _GETIDENTITYBYPUBLICKEYHASHREQUEST.fields_by_name['v0'].message_type = _GETIDENTITYBYPUBLICKEYHASHREQUEST_GETIDENTITYBYPUBLICKEYHASHREQUESTV0 _GETIDENTITYBYPUBLICKEYHASHREQUEST.oneofs_by_name['version'].fields.append( @@ -4638,17 +5048,39 @@ _GETEPOCHSINFORESPONSE.oneofs_by_name['version'].fields.append( _GETEPOCHSINFORESPONSE.fields_by_name['v0']) _GETEPOCHSINFORESPONSE.fields_by_name['v0'].containing_oneof = _GETEPOCHSINFORESPONSE.oneofs_by_name['version'] +_GETPATHELEMENTSREQUEST_GETPATHELEMENTSREQUESTV0.containing_type = _GETPATHELEMENTSREQUEST +_GETPATHELEMENTSREQUEST.fields_by_name['v0'].message_type = _GETPATHELEMENTSREQUEST_GETPATHELEMENTSREQUESTV0 +_GETPATHELEMENTSREQUEST.oneofs_by_name['version'].fields.append( + _GETPATHELEMENTSREQUEST.fields_by_name['v0']) +_GETPATHELEMENTSREQUEST.fields_by_name['v0'].containing_oneof = _GETPATHELEMENTSREQUEST.oneofs_by_name['version'] +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0_ELEMENTS.containing_type = _GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0 +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.fields_by_name['elements'].message_type = _GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0_ELEMENTS +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.fields_by_name['proof'].message_type = _PROOF +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.fields_by_name['metadata'].message_type = _RESPONSEMETADATA +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.containing_type = _GETPATHELEMENTSRESPONSE +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.fields_by_name['elements']) +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.fields_by_name['elements'].containing_oneof = _GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.oneofs_by_name['result'] +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.oneofs_by_name['result'].fields.append( + _GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.fields_by_name['proof']) +_GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.fields_by_name['proof'].containing_oneof = _GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0.oneofs_by_name['result'] +_GETPATHELEMENTSRESPONSE.fields_by_name['v0'].message_type = _GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0 +_GETPATHELEMENTSRESPONSE.oneofs_by_name['version'].fields.append( + _GETPATHELEMENTSRESPONSE.fields_by_name['v0']) +_GETPATHELEMENTSRESPONSE.fields_by_name['v0'].containing_oneof = _GETPATHELEMENTSRESPONSE.oneofs_by_name['version'] DESCRIPTOR.message_types_by_name['Proof'] = _PROOF DESCRIPTOR.message_types_by_name['ResponseMetadata'] = _RESPONSEMETADATA DESCRIPTOR.message_types_by_name['StateTransitionBroadcastError'] = _STATETRANSITIONBROADCASTERROR DESCRIPTOR.message_types_by_name['BroadcastStateTransitionRequest'] = _BROADCASTSTATETRANSITIONREQUEST DESCRIPTOR.message_types_by_name['BroadcastStateTransitionResponse'] = _BROADCASTSTATETRANSITIONRESPONSE DESCRIPTOR.message_types_by_name['GetIdentityRequest'] = _GETIDENTITYREQUEST +DESCRIPTOR.message_types_by_name['GetIdentityNonceRequest'] = _GETIDENTITYNONCEREQUEST +DESCRIPTOR.message_types_by_name['GetIdentityContractNonceRequest'] = _GETIDENTITYCONTRACTNONCEREQUEST DESCRIPTOR.message_types_by_name['GetIdentityBalanceRequest'] = _GETIDENTITYBALANCEREQUEST DESCRIPTOR.message_types_by_name['GetIdentityBalanceAndRevisionRequest'] = _GETIDENTITYBALANCEANDREVISIONREQUEST DESCRIPTOR.message_types_by_name['GetIdentityResponse'] = _GETIDENTITYRESPONSE -DESCRIPTOR.message_types_by_name['GetIdentitiesRequest'] = _GETIDENTITIESREQUEST -DESCRIPTOR.message_types_by_name['GetIdentitiesResponse'] = _GETIDENTITIESRESPONSE +DESCRIPTOR.message_types_by_name['GetIdentityNonceResponse'] = _GETIDENTITYNONCERESPONSE +DESCRIPTOR.message_types_by_name['GetIdentityContractNonceResponse'] = _GETIDENTITYCONTRACTNONCERESPONSE DESCRIPTOR.message_types_by_name['GetIdentityBalanceResponse'] = _GETIDENTITYBALANCERESPONSE DESCRIPTOR.message_types_by_name['GetIdentityBalanceAndRevisionResponse'] = _GETIDENTITYBALANCEANDREVISIONRESPONSE DESCRIPTOR.message_types_by_name['KeyRequestType'] = _KEYREQUESTTYPE @@ -4658,6 +5090,8 @@ DESCRIPTOR.message_types_by_name['SecurityLevelMap'] = _SECURITYLEVELMAP DESCRIPTOR.message_types_by_name['GetIdentityKeysRequest'] = _GETIDENTITYKEYSREQUEST DESCRIPTOR.message_types_by_name['GetIdentityKeysResponse'] = _GETIDENTITYKEYSRESPONSE +DESCRIPTOR.message_types_by_name['GetIdentitiesContractKeysRequest'] = _GETIDENTITIESCONTRACTKEYSREQUEST +DESCRIPTOR.message_types_by_name['GetIdentitiesContractKeysResponse'] = _GETIDENTITIESCONTRACTKEYSRESPONSE DESCRIPTOR.message_types_by_name['GetProofsRequest'] = _GETPROOFSREQUEST DESCRIPTOR.message_types_by_name['GetProofsResponse'] = _GETPROOFSRESPONSE DESCRIPTOR.message_types_by_name['GetDataContractRequest'] = _GETDATACONTRACTREQUEST @@ -4668,8 +5102,6 @@ DESCRIPTOR.message_types_by_name['GetDataContractHistoryResponse'] = _GETDATACONTRACTHISTORYRESPONSE DESCRIPTOR.message_types_by_name['GetDocumentsRequest'] = _GETDOCUMENTSREQUEST DESCRIPTOR.message_types_by_name['GetDocumentsResponse'] = _GETDOCUMENTSRESPONSE -DESCRIPTOR.message_types_by_name['GetIdentitiesByPublicKeyHashesRequest'] = _GETIDENTITIESBYPUBLICKEYHASHESREQUEST -DESCRIPTOR.message_types_by_name['GetIdentitiesByPublicKeyHashesResponse'] = _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE DESCRIPTOR.message_types_by_name['GetIdentityByPublicKeyHashRequest'] = _GETIDENTITYBYPUBLICKEYHASHREQUEST DESCRIPTOR.message_types_by_name['GetIdentityByPublicKeyHashResponse'] = _GETIDENTITYBYPUBLICKEYHASHRESPONSE DESCRIPTOR.message_types_by_name['WaitForStateTransitionResultRequest'] = _WAITFORSTATETRANSITIONRESULTREQUEST @@ -4682,6 +5114,9 @@ DESCRIPTOR.message_types_by_name['GetProtocolVersionUpgradeVoteStatusResponse'] = _GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE DESCRIPTOR.message_types_by_name['GetEpochsInfoRequest'] = _GETEPOCHSINFOREQUEST DESCRIPTOR.message_types_by_name['GetEpochsInfoResponse'] = _GETEPOCHSINFORESPONSE +DESCRIPTOR.message_types_by_name['GetPathElementsRequest'] = _GETPATHELEMENTSREQUEST +DESCRIPTOR.message_types_by_name['GetPathElementsResponse'] = _GETPATHELEMENTSRESPONSE +DESCRIPTOR.enum_types_by_name['KeyPurpose'] = _KEYPURPOSE _sym_db.RegisterFileDescriptor(DESCRIPTOR) Proof = _reflection.GeneratedProtocolMessageType('Proof', (_message.Message,), { @@ -4734,6 +5169,36 @@ _sym_db.RegisterMessage(GetIdentityRequest) _sym_db.RegisterMessage(GetIdentityRequest.GetIdentityRequestV0) +GetIdentityNonceRequest = _reflection.GeneratedProtocolMessageType('GetIdentityNonceRequest', (_message.Message,), { + + 'GetIdentityNonceRequestV0' : _reflection.GeneratedProtocolMessageType('GetIdentityNonceRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETIDENTITYNONCEREQUEST_GETIDENTITYNONCEREQUESTV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0) + }) + , + 'DESCRIPTOR' : _GETIDENTITYNONCEREQUEST, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityNonceRequest) + }) +_sym_db.RegisterMessage(GetIdentityNonceRequest) +_sym_db.RegisterMessage(GetIdentityNonceRequest.GetIdentityNonceRequestV0) + +GetIdentityContractNonceRequest = _reflection.GeneratedProtocolMessageType('GetIdentityContractNonceRequest', (_message.Message,), { + + 'GetIdentityContractNonceRequestV0' : _reflection.GeneratedProtocolMessageType('GetIdentityContractNonceRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETIDENTITYCONTRACTNONCEREQUEST_GETIDENTITYCONTRACTNONCEREQUESTV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0) + }) + , + 'DESCRIPTOR' : _GETIDENTITYCONTRACTNONCEREQUEST, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityContractNonceRequest) + }) +_sym_db.RegisterMessage(GetIdentityContractNonceRequest) +_sym_db.RegisterMessage(GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0) + GetIdentityBalanceRequest = _reflection.GeneratedProtocolMessageType('GetIdentityBalanceRequest', (_message.Message,), { 'GetIdentityBalanceRequestV0' : _reflection.GeneratedProtocolMessageType('GetIdentityBalanceRequestV0', (_message.Message,), { @@ -4779,59 +5244,35 @@ _sym_db.RegisterMessage(GetIdentityResponse) _sym_db.RegisterMessage(GetIdentityResponse.GetIdentityResponseV0) -GetIdentitiesRequest = _reflection.GeneratedProtocolMessageType('GetIdentitiesRequest', (_message.Message,), { +GetIdentityNonceResponse = _reflection.GeneratedProtocolMessageType('GetIdentityNonceResponse', (_message.Message,), { - 'GetIdentitiesRequestV0' : _reflection.GeneratedProtocolMessageType('GetIdentitiesRequestV0', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITIESREQUEST_GETIDENTITIESREQUESTV0, + 'GetIdentityNonceResponseV0' : _reflection.GeneratedProtocolMessageType('GetIdentityNonceResponseV0', (_message.Message,), { + 'DESCRIPTOR' : _GETIDENTITYNONCERESPONSE_GETIDENTITYNONCERESPONSEV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0) }) , - 'DESCRIPTOR' : _GETIDENTITIESREQUEST, + 'DESCRIPTOR' : _GETIDENTITYNONCERESPONSE, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesRequest) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityNonceResponse) }) -_sym_db.RegisterMessage(GetIdentitiesRequest) -_sym_db.RegisterMessage(GetIdentitiesRequest.GetIdentitiesRequestV0) - -GetIdentitiesResponse = _reflection.GeneratedProtocolMessageType('GetIdentitiesResponse', (_message.Message,), { - - 'IdentityValue' : _reflection.GeneratedProtocolMessageType('IdentityValue', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITIESRESPONSE_IDENTITYVALUE, - '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue) - }) - , - - 'IdentityEntry' : _reflection.GeneratedProtocolMessageType('IdentityEntry', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITIESRESPONSE_IDENTITYENTRY, - '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry) - }) - , +_sym_db.RegisterMessage(GetIdentityNonceResponse) +_sym_db.RegisterMessage(GetIdentityNonceResponse.GetIdentityNonceResponseV0) - 'Identities' : _reflection.GeneratedProtocolMessageType('Identities', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITIESRESPONSE_IDENTITIES, - '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities) - }) - , +GetIdentityContractNonceResponse = _reflection.GeneratedProtocolMessageType('GetIdentityContractNonceResponse', (_message.Message,), { - 'GetIdentitiesResponseV0' : _reflection.GeneratedProtocolMessageType('GetIdentitiesResponseV0', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITIESRESPONSE_GETIDENTITIESRESPONSEV0, + 'GetIdentityContractNonceResponseV0' : _reflection.GeneratedProtocolMessageType('GetIdentityContractNonceResponseV0', (_message.Message,), { + 'DESCRIPTOR' : _GETIDENTITYCONTRACTNONCERESPONSE_GETIDENTITYCONTRACTNONCERESPONSEV0, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0) }) , - 'DESCRIPTOR' : _GETIDENTITIESRESPONSE, + 'DESCRIPTOR' : _GETIDENTITYCONTRACTNONCERESPONSE, '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesResponse) + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentityContractNonceResponse) }) -_sym_db.RegisterMessage(GetIdentitiesResponse) -_sym_db.RegisterMessage(GetIdentitiesResponse.IdentityValue) -_sym_db.RegisterMessage(GetIdentitiesResponse.IdentityEntry) -_sym_db.RegisterMessage(GetIdentitiesResponse.Identities) -_sym_db.RegisterMessage(GetIdentitiesResponse.GetIdentitiesResponseV0) +_sym_db.RegisterMessage(GetIdentityContractNonceResponse) +_sym_db.RegisterMessage(GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0) GetIdentityBalanceResponse = _reflection.GeneratedProtocolMessageType('GetIdentityBalanceResponse', (_message.Message,), { @@ -4960,6 +5401,60 @@ _sym_db.RegisterMessage(GetIdentityKeysResponse.GetIdentityKeysResponseV0) _sym_db.RegisterMessage(GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys) +GetIdentitiesContractKeysRequest = _reflection.GeneratedProtocolMessageType('GetIdentitiesContractKeysRequest', (_message.Message,), { + + 'GetIdentitiesContractKeysRequestV0' : _reflection.GeneratedProtocolMessageType('GetIdentitiesContractKeysRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETIDENTITIESCONTRACTKEYSREQUEST_GETIDENTITIESCONTRACTKEYSREQUESTV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0) + }) + , + 'DESCRIPTOR' : _GETIDENTITIESCONTRACTKEYSREQUEST, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest) + }) +_sym_db.RegisterMessage(GetIdentitiesContractKeysRequest) +_sym_db.RegisterMessage(GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0) + +GetIdentitiesContractKeysResponse = _reflection.GeneratedProtocolMessageType('GetIdentitiesContractKeysResponse', (_message.Message,), { + + 'GetIdentitiesContractKeysResponseV0' : _reflection.GeneratedProtocolMessageType('GetIdentitiesContractKeysResponseV0', (_message.Message,), { + + 'PurposeKeys' : _reflection.GeneratedProtocolMessageType('PurposeKeys', (_message.Message,), { + 'DESCRIPTOR' : _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_PURPOSEKEYS, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys) + }) + , + + 'IdentityKeys' : _reflection.GeneratedProtocolMessageType('IdentityKeys', (_message.Message,), { + 'DESCRIPTOR' : _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITYKEYS, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys) + }) + , + + 'IdentitiesKeys' : _reflection.GeneratedProtocolMessageType('IdentitiesKeys', (_message.Message,), { + 'DESCRIPTOR' : _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0_IDENTITIESKEYS, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys) + }) + , + 'DESCRIPTOR' : _GETIDENTITIESCONTRACTKEYSRESPONSE_GETIDENTITIESCONTRACTKEYSRESPONSEV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0) + }) + , + 'DESCRIPTOR' : _GETIDENTITIESCONTRACTKEYSRESPONSE, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse) + }) +_sym_db.RegisterMessage(GetIdentitiesContractKeysResponse) +_sym_db.RegisterMessage(GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0) +_sym_db.RegisterMessage(GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys) +_sym_db.RegisterMessage(GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys) +_sym_db.RegisterMessage(GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys) + GetProofsRequest = _reflection.GeneratedProtocolMessageType('GetProofsRequest', (_message.Message,), { 'GetProofsRequestV0' : _reflection.GeneratedProtocolMessageType('GetProofsRequestV0', (_message.Message,), { @@ -5174,52 +5669,6 @@ _sym_db.RegisterMessage(GetDocumentsResponse.GetDocumentsResponseV0) _sym_db.RegisterMessage(GetDocumentsResponse.GetDocumentsResponseV0.Documents) -GetIdentitiesByPublicKeyHashesRequest = _reflection.GeneratedProtocolMessageType('GetIdentitiesByPublicKeyHashesRequest', (_message.Message,), { - - 'GetIdentitiesByPublicKeyHashesRequestV0' : _reflection.GeneratedProtocolMessageType('GetIdentitiesByPublicKeyHashesRequestV0', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITIESBYPUBLICKEYHASHESREQUEST_GETIDENTITIESBYPUBLICKEYHASHESREQUESTV0, - '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0) - }) - , - 'DESCRIPTOR' : _GETIDENTITIESBYPUBLICKEYHASHESREQUEST, - '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest) - }) -_sym_db.RegisterMessage(GetIdentitiesByPublicKeyHashesRequest) -_sym_db.RegisterMessage(GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0) - -GetIdentitiesByPublicKeyHashesResponse = _reflection.GeneratedProtocolMessageType('GetIdentitiesByPublicKeyHashesResponse', (_message.Message,), { - - 'PublicKeyHashIdentityEntry' : _reflection.GeneratedProtocolMessageType('PublicKeyHashIdentityEntry', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_PUBLICKEYHASHIDENTITYENTRY, - '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry) - }) - , - - 'IdentitiesByPublicKeyHashes' : _reflection.GeneratedProtocolMessageType('IdentitiesByPublicKeyHashes', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_IDENTITIESBYPUBLICKEYHASHES, - '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes) - }) - , - - 'GetIdentitiesByPublicKeyHashesResponseV0' : _reflection.GeneratedProtocolMessageType('GetIdentitiesByPublicKeyHashesResponseV0', (_message.Message,), { - 'DESCRIPTOR' : _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE_GETIDENTITIESBYPUBLICKEYHASHESRESPONSEV0, - '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0) - }) - , - 'DESCRIPTOR' : _GETIDENTITIESBYPUBLICKEYHASHESRESPONSE, - '__module__' : 'platform_pb2' - # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse) - }) -_sym_db.RegisterMessage(GetIdentitiesByPublicKeyHashesResponse) -_sym_db.RegisterMessage(GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry) -_sym_db.RegisterMessage(GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes) -_sym_db.RegisterMessage(GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0) - GetIdentityByPublicKeyHashRequest = _reflection.GeneratedProtocolMessageType('GetIdentityByPublicKeyHashRequest', (_message.Message,), { 'GetIdentityByPublicKeyHashRequestV0' : _reflection.GeneratedProtocolMessageType('GetIdentityByPublicKeyHashRequestV0', (_message.Message,), { @@ -5464,6 +5913,44 @@ _sym_db.RegisterMessage(GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos) _sym_db.RegisterMessage(GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo) +GetPathElementsRequest = _reflection.GeneratedProtocolMessageType('GetPathElementsRequest', (_message.Message,), { + + 'GetPathElementsRequestV0' : _reflection.GeneratedProtocolMessageType('GetPathElementsRequestV0', (_message.Message,), { + 'DESCRIPTOR' : _GETPATHELEMENTSREQUEST_GETPATHELEMENTSREQUESTV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0) + }) + , + 'DESCRIPTOR' : _GETPATHELEMENTSREQUEST, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetPathElementsRequest) + }) +_sym_db.RegisterMessage(GetPathElementsRequest) +_sym_db.RegisterMessage(GetPathElementsRequest.GetPathElementsRequestV0) + +GetPathElementsResponse = _reflection.GeneratedProtocolMessageType('GetPathElementsResponse', (_message.Message,), { + + 'GetPathElementsResponseV0' : _reflection.GeneratedProtocolMessageType('GetPathElementsResponseV0', (_message.Message,), { + + 'Elements' : _reflection.GeneratedProtocolMessageType('Elements', (_message.Message,), { + 'DESCRIPTOR' : _GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0_ELEMENTS, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements) + }) + , + 'DESCRIPTOR' : _GETPATHELEMENTSRESPONSE_GETPATHELEMENTSRESPONSEV0, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0) + }) + , + 'DESCRIPTOR' : _GETPATHELEMENTSRESPONSE, + '__module__' : 'platform_pb2' + # @@protoc_insertion_point(class_scope:org.dash.platform.dapi.v0.GetPathElementsResponse) + }) +_sym_db.RegisterMessage(GetPathElementsResponse) +_sym_db.RegisterMessage(GetPathElementsResponse.GetPathElementsResponseV0) +_sym_db.RegisterMessage(GetPathElementsResponse.GetPathElementsResponseV0.Elements) + _SEARCHKEY_PURPOSEMAPENTRY._options = None _SECURITYLEVELMAP_SECURITYLEVELMAPENTRY._options = None @@ -5475,8 +5962,8 @@ index=0, serialized_options=None, create_key=_descriptor._internal_create_key, - serialized_start=14543, - serialized_end=17041, + serialized_start=15896, + serialized_end=18660, methods=[ _descriptor.MethodDescriptor( name='broadcastStateTransition', @@ -5499,29 +5986,49 @@ create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( - name='getIdentities', - full_name='org.dash.platform.dapi.v0.Platform.getIdentities', + name='getIdentityKeys', + full_name='org.dash.platform.dapi.v0.Platform.getIdentityKeys', index=2, containing_service=None, - input_type=_GETIDENTITIESREQUEST, - output_type=_GETIDENTITIESRESPONSE, + input_type=_GETIDENTITYKEYSREQUEST, + output_type=_GETIDENTITYKEYSRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( - name='getIdentityKeys', - full_name='org.dash.platform.dapi.v0.Platform.getIdentityKeys', + name='getIdentitiesContractKeys', + full_name='org.dash.platform.dapi.v0.Platform.getIdentitiesContractKeys', index=3, containing_service=None, - input_type=_GETIDENTITYKEYSREQUEST, - output_type=_GETIDENTITYKEYSRESPONSE, + input_type=_GETIDENTITIESCONTRACTKEYSREQUEST, + output_type=_GETIDENTITIESCONTRACTKEYSRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='getIdentityNonce', + full_name='org.dash.platform.dapi.v0.Platform.getIdentityNonce', + index=4, + containing_service=None, + input_type=_GETIDENTITYNONCEREQUEST, + output_type=_GETIDENTITYNONCERESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='getIdentityContractNonce', + full_name='org.dash.platform.dapi.v0.Platform.getIdentityContractNonce', + index=5, + containing_service=None, + input_type=_GETIDENTITYCONTRACTNONCEREQUEST, + output_type=_GETIDENTITYCONTRACTNONCERESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name='getIdentityBalance', full_name='org.dash.platform.dapi.v0.Platform.getIdentityBalance', - index=4, + index=6, containing_service=None, input_type=_GETIDENTITYBALANCEREQUEST, output_type=_GETIDENTITYBALANCERESPONSE, @@ -5531,7 +6038,7 @@ _descriptor.MethodDescriptor( name='getIdentityBalanceAndRevision', full_name='org.dash.platform.dapi.v0.Platform.getIdentityBalanceAndRevision', - index=5, + index=7, containing_service=None, input_type=_GETIDENTITYBALANCEANDREVISIONREQUEST, output_type=_GETIDENTITYBALANCEANDREVISIONRESPONSE, @@ -5541,7 +6048,7 @@ _descriptor.MethodDescriptor( name='getProofs', full_name='org.dash.platform.dapi.v0.Platform.getProofs', - index=6, + index=8, containing_service=None, input_type=_GETPROOFSREQUEST, output_type=_GETPROOFSRESPONSE, @@ -5551,7 +6058,7 @@ _descriptor.MethodDescriptor( name='getDataContract', full_name='org.dash.platform.dapi.v0.Platform.getDataContract', - index=7, + index=9, containing_service=None, input_type=_GETDATACONTRACTREQUEST, output_type=_GETDATACONTRACTRESPONSE, @@ -5561,7 +6068,7 @@ _descriptor.MethodDescriptor( name='getDataContractHistory', full_name='org.dash.platform.dapi.v0.Platform.getDataContractHistory', - index=8, + index=10, containing_service=None, input_type=_GETDATACONTRACTHISTORYREQUEST, output_type=_GETDATACONTRACTHISTORYRESPONSE, @@ -5571,7 +6078,7 @@ _descriptor.MethodDescriptor( name='getDataContracts', full_name='org.dash.platform.dapi.v0.Platform.getDataContracts', - index=9, + index=11, containing_service=None, input_type=_GETDATACONTRACTSREQUEST, output_type=_GETDATACONTRACTSRESPONSE, @@ -5581,27 +6088,17 @@ _descriptor.MethodDescriptor( name='getDocuments', full_name='org.dash.platform.dapi.v0.Platform.getDocuments', - index=10, + index=12, containing_service=None, input_type=_GETDOCUMENTSREQUEST, output_type=_GETDOCUMENTSRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), - _descriptor.MethodDescriptor( - name='getIdentitiesByPublicKeyHashes', - full_name='org.dash.platform.dapi.v0.Platform.getIdentitiesByPublicKeyHashes', - index=11, - containing_service=None, - input_type=_GETIDENTITIESBYPUBLICKEYHASHESREQUEST, - output_type=_GETIDENTITIESBYPUBLICKEYHASHESRESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), _descriptor.MethodDescriptor( name='getIdentityByPublicKeyHash', full_name='org.dash.platform.dapi.v0.Platform.getIdentityByPublicKeyHash', - index=12, + index=13, containing_service=None, input_type=_GETIDENTITYBYPUBLICKEYHASHREQUEST, output_type=_GETIDENTITYBYPUBLICKEYHASHRESPONSE, @@ -5611,7 +6108,7 @@ _descriptor.MethodDescriptor( name='waitForStateTransitionResult', full_name='org.dash.platform.dapi.v0.Platform.waitForStateTransitionResult', - index=13, + index=14, containing_service=None, input_type=_WAITFORSTATETRANSITIONRESULTREQUEST, output_type=_WAITFORSTATETRANSITIONRESULTRESPONSE, @@ -5621,7 +6118,7 @@ _descriptor.MethodDescriptor( name='getConsensusParams', full_name='org.dash.platform.dapi.v0.Platform.getConsensusParams', - index=14, + index=15, containing_service=None, input_type=_GETCONSENSUSPARAMSREQUEST, output_type=_GETCONSENSUSPARAMSRESPONSE, @@ -5631,7 +6128,7 @@ _descriptor.MethodDescriptor( name='getProtocolVersionUpgradeState', full_name='org.dash.platform.dapi.v0.Platform.getProtocolVersionUpgradeState', - index=15, + index=16, containing_service=None, input_type=_GETPROTOCOLVERSIONUPGRADESTATEREQUEST, output_type=_GETPROTOCOLVERSIONUPGRADESTATERESPONSE, @@ -5641,7 +6138,7 @@ _descriptor.MethodDescriptor( name='getProtocolVersionUpgradeVoteStatus', full_name='org.dash.platform.dapi.v0.Platform.getProtocolVersionUpgradeVoteStatus', - index=16, + index=17, containing_service=None, input_type=_GETPROTOCOLVERSIONUPGRADEVOTESTATUSREQUEST, output_type=_GETPROTOCOLVERSIONUPGRADEVOTESTATUSRESPONSE, @@ -5651,13 +6148,23 @@ _descriptor.MethodDescriptor( name='getEpochsInfo', full_name='org.dash.platform.dapi.v0.Platform.getEpochsInfo', - index=17, + index=18, containing_service=None, input_type=_GETEPOCHSINFOREQUEST, output_type=_GETEPOCHSINFORESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), + _descriptor.MethodDescriptor( + name='getPathElements', + full_name='org.dash.platform.dapi.v0.Platform.getPathElements', + index=19, + containing_service=None, + input_type=_GETPATHELEMENTSREQUEST, + output_type=_GETPATHELEMENTSRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), ]) _sym_db.RegisterServiceDescriptor(_PLATFORM) diff --git a/packages/dapi-grpc/clients/platform/v0/python/platform_pb2_grpc.py b/packages/dapi-grpc/clients/platform/v0/python/platform_pb2_grpc.py index a28f5122e3f..1abfa77d1d6 100644 --- a/packages/dapi-grpc/clients/platform/v0/python/platform_pb2_grpc.py +++ b/packages/dapi-grpc/clients/platform/v0/python/platform_pb2_grpc.py @@ -24,16 +24,26 @@ def __init__(self, channel): request_serializer=platform__pb2.GetIdentityRequest.SerializeToString, response_deserializer=platform__pb2.GetIdentityResponse.FromString, ) - self.getIdentities = channel.unary_unary( - '/org.dash.platform.dapi.v0.Platform/getIdentities', - request_serializer=platform__pb2.GetIdentitiesRequest.SerializeToString, - response_deserializer=platform__pb2.GetIdentitiesResponse.FromString, - ) self.getIdentityKeys = channel.unary_unary( '/org.dash.platform.dapi.v0.Platform/getIdentityKeys', request_serializer=platform__pb2.GetIdentityKeysRequest.SerializeToString, response_deserializer=platform__pb2.GetIdentityKeysResponse.FromString, ) + self.getIdentitiesContractKeys = channel.unary_unary( + '/org.dash.platform.dapi.v0.Platform/getIdentitiesContractKeys', + request_serializer=platform__pb2.GetIdentitiesContractKeysRequest.SerializeToString, + response_deserializer=platform__pb2.GetIdentitiesContractKeysResponse.FromString, + ) + self.getIdentityNonce = channel.unary_unary( + '/org.dash.platform.dapi.v0.Platform/getIdentityNonce', + request_serializer=platform__pb2.GetIdentityNonceRequest.SerializeToString, + response_deserializer=platform__pb2.GetIdentityNonceResponse.FromString, + ) + self.getIdentityContractNonce = channel.unary_unary( + '/org.dash.platform.dapi.v0.Platform/getIdentityContractNonce', + request_serializer=platform__pb2.GetIdentityContractNonceRequest.SerializeToString, + response_deserializer=platform__pb2.GetIdentityContractNonceResponse.FromString, + ) self.getIdentityBalance = channel.unary_unary( '/org.dash.platform.dapi.v0.Platform/getIdentityBalance', request_serializer=platform__pb2.GetIdentityBalanceRequest.SerializeToString, @@ -69,11 +79,6 @@ def __init__(self, channel): request_serializer=platform__pb2.GetDocumentsRequest.SerializeToString, response_deserializer=platform__pb2.GetDocumentsResponse.FromString, ) - self.getIdentitiesByPublicKeyHashes = channel.unary_unary( - '/org.dash.platform.dapi.v0.Platform/getIdentitiesByPublicKeyHashes', - request_serializer=platform__pb2.GetIdentitiesByPublicKeyHashesRequest.SerializeToString, - response_deserializer=platform__pb2.GetIdentitiesByPublicKeyHashesResponse.FromString, - ) self.getIdentityByPublicKeyHash = channel.unary_unary( '/org.dash.platform.dapi.v0.Platform/getIdentityByPublicKeyHash', request_serializer=platform__pb2.GetIdentityByPublicKeyHashRequest.SerializeToString, @@ -104,6 +109,11 @@ def __init__(self, channel): request_serializer=platform__pb2.GetEpochsInfoRequest.SerializeToString, response_deserializer=platform__pb2.GetEpochsInfoResponse.FromString, ) + self.getPathElements = channel.unary_unary( + '/org.dash.platform.dapi.v0.Platform/getPathElements', + request_serializer=platform__pb2.GetPathElementsRequest.SerializeToString, + response_deserializer=platform__pb2.GetPathElementsResponse.FromString, + ) class PlatformServicer(object): @@ -121,13 +131,25 @@ def getIdentity(self, request, context): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') - def getIdentities(self, request, context): + def getIdentityKeys(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') - def getIdentityKeys(self, request, context): + def getIdentitiesContractKeys(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def getIdentityNonce(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def getIdentityContractNonce(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') @@ -175,12 +197,6 @@ def getDocuments(self, request, context): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') - def getIdentitiesByPublicKeyHashes(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - def getIdentityByPublicKeyHash(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) @@ -217,6 +233,12 @@ def getEpochsInfo(self, request, context): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') + def getPathElements(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + def add_PlatformServicer_to_server(servicer, server): rpc_method_handlers = { @@ -230,16 +252,26 @@ def add_PlatformServicer_to_server(servicer, server): request_deserializer=platform__pb2.GetIdentityRequest.FromString, response_serializer=platform__pb2.GetIdentityResponse.SerializeToString, ), - 'getIdentities': grpc.unary_unary_rpc_method_handler( - servicer.getIdentities, - request_deserializer=platform__pb2.GetIdentitiesRequest.FromString, - response_serializer=platform__pb2.GetIdentitiesResponse.SerializeToString, - ), 'getIdentityKeys': grpc.unary_unary_rpc_method_handler( servicer.getIdentityKeys, request_deserializer=platform__pb2.GetIdentityKeysRequest.FromString, response_serializer=platform__pb2.GetIdentityKeysResponse.SerializeToString, ), + 'getIdentitiesContractKeys': grpc.unary_unary_rpc_method_handler( + servicer.getIdentitiesContractKeys, + request_deserializer=platform__pb2.GetIdentitiesContractKeysRequest.FromString, + response_serializer=platform__pb2.GetIdentitiesContractKeysResponse.SerializeToString, + ), + 'getIdentityNonce': grpc.unary_unary_rpc_method_handler( + servicer.getIdentityNonce, + request_deserializer=platform__pb2.GetIdentityNonceRequest.FromString, + response_serializer=platform__pb2.GetIdentityNonceResponse.SerializeToString, + ), + 'getIdentityContractNonce': grpc.unary_unary_rpc_method_handler( + servicer.getIdentityContractNonce, + request_deserializer=platform__pb2.GetIdentityContractNonceRequest.FromString, + response_serializer=platform__pb2.GetIdentityContractNonceResponse.SerializeToString, + ), 'getIdentityBalance': grpc.unary_unary_rpc_method_handler( servicer.getIdentityBalance, request_deserializer=platform__pb2.GetIdentityBalanceRequest.FromString, @@ -275,11 +307,6 @@ def add_PlatformServicer_to_server(servicer, server): request_deserializer=platform__pb2.GetDocumentsRequest.FromString, response_serializer=platform__pb2.GetDocumentsResponse.SerializeToString, ), - 'getIdentitiesByPublicKeyHashes': grpc.unary_unary_rpc_method_handler( - servicer.getIdentitiesByPublicKeyHashes, - request_deserializer=platform__pb2.GetIdentitiesByPublicKeyHashesRequest.FromString, - response_serializer=platform__pb2.GetIdentitiesByPublicKeyHashesResponse.SerializeToString, - ), 'getIdentityByPublicKeyHash': grpc.unary_unary_rpc_method_handler( servicer.getIdentityByPublicKeyHash, request_deserializer=platform__pb2.GetIdentityByPublicKeyHashRequest.FromString, @@ -310,6 +337,11 @@ def add_PlatformServicer_to_server(servicer, server): request_deserializer=platform__pb2.GetEpochsInfoRequest.FromString, response_serializer=platform__pb2.GetEpochsInfoResponse.SerializeToString, ), + 'getPathElements': grpc.unary_unary_rpc_method_handler( + servicer.getPathElements, + request_deserializer=platform__pb2.GetPathElementsRequest.FromString, + response_serializer=platform__pb2.GetPathElementsResponse.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( 'org.dash.platform.dapi.v0.Platform', rpc_method_handlers) @@ -355,7 +387,7 @@ def getIdentity(request, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod - def getIdentities(request, + def getIdentityKeys(request, target, options=(), channel_credentials=None, @@ -365,14 +397,14 @@ def getIdentities(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getIdentities', - platform__pb2.GetIdentitiesRequest.SerializeToString, - platform__pb2.GetIdentitiesResponse.FromString, + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getIdentityKeys', + platform__pb2.GetIdentityKeysRequest.SerializeToString, + platform__pb2.GetIdentityKeysResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod - def getIdentityKeys(request, + def getIdentitiesContractKeys(request, target, options=(), channel_credentials=None, @@ -382,9 +414,43 @@ def getIdentityKeys(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getIdentityKeys', - platform__pb2.GetIdentityKeysRequest.SerializeToString, - platform__pb2.GetIdentityKeysResponse.FromString, + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getIdentitiesContractKeys', + platform__pb2.GetIdentitiesContractKeysRequest.SerializeToString, + platform__pb2.GetIdentitiesContractKeysResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def getIdentityNonce(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getIdentityNonce', + platform__pb2.GetIdentityNonceRequest.SerializeToString, + platform__pb2.GetIdentityNonceResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def getIdentityContractNonce(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getIdentityContractNonce', + platform__pb2.GetIdentityContractNonceRequest.SerializeToString, + platform__pb2.GetIdentityContractNonceResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -507,23 +573,6 @@ def getDocuments(request, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - @staticmethod - def getIdentitiesByPublicKeyHashes(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getIdentitiesByPublicKeyHashes', - platform__pb2.GetIdentitiesByPublicKeyHashesRequest.SerializeToString, - platform__pb2.GetIdentitiesByPublicKeyHashesResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - @staticmethod def getIdentityByPublicKeyHash(request, target, @@ -625,3 +674,20 @@ def getEpochsInfo(request, platform__pb2.GetEpochsInfoResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def getPathElements(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/org.dash.platform.dapi.v0.Platform/getPathElements', + platform__pb2.GetPathElementsRequest.SerializeToString, + platform__pb2.GetPathElementsResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/packages/dapi-grpc/clients/platform/v0/rust/platform_example.rs b/packages/dapi-grpc/clients/platform/v0/rust/platform_example.rs index 84b1ab6c009..855bec65b37 100644 --- a/packages/dapi-grpc/clients/platform/v0/rust/platform_example.rs +++ b/packages/dapi-grpc/clients/platform/v0/rust/platform_example.rs @@ -1,6 +1,6 @@ use dapi_grpc::platform::v0 as platform; use dapi_grpc::platform::v0::get_consensus_params_request::GetConsensusParamsRequestV0; -use prost::Message; +use dapi_grpc::Message; fn main() { let request = platform::GetConsensusParamsRequest { diff --git a/packages/dapi-grpc/clients/platform/v0/web/PlatformPromiseClient.js b/packages/dapi-grpc/clients/platform/v0/web/PlatformPromiseClient.js index fdb3f86fae4..9805cd84ffb 100644 --- a/packages/dapi-grpc/clients/platform/v0/web/PlatformPromiseClient.js +++ b/packages/dapi-grpc/clients/platform/v0/web/PlatformPromiseClient.js @@ -7,8 +7,8 @@ class PlatformPromiseClient { * @param {?Object} credentials * @param {?Object} options */ - constructor(hostname, credentials , options = {}) { - this.client = new PlatformClient(hostname, options) + constructor(hostname, credentials, options = {}) { + this.client = new PlatformClient(hostname, options); this.protocolVersion = undefined; } @@ -41,6 +41,20 @@ class PlatformPromiseClient { ); } + /** + * @param {!GetIdentitiesContractKeysRequest} getIdentitiesContractKeysRequest + * @param {?Object} metadata + * @return {Promise} + */ + getIdentitiesContractKeys(getIdentitiesContractKeysRequest, metadata = {}) { + return promisify( + this.client.getIdentitiesContractKeys.bind(this.client), + )( + getIdentitiesContractKeysRequest, + metadata, + ); + } + /** * * @param {!GetDataContractRequest} getDataContractRequest @@ -87,17 +101,17 @@ class PlatformPromiseClient { } /** - * @param {!GetIdentitiesByPublicKeyHashesRequest} getIdentitiesByPublicKeyHashesRequest + * @param {!GetIdentityByPublicKeyHash} getIdentityByPublicKeyHashRequest * @param {?Object} metadata - * @returns {Promise} + * @returns {Promise} */ - getIdentitiesByPublicKeyHashes( - getIdentitiesByPublicKeyHashesRequest, metadata = {} + getIdentityByPublicKeyHash( + getIdentityByPublicKeyHashRequest, metadata = {} ) { return promisify( - this.client.getIdentitiesByPublicKeyHashes.bind(this.client), + this.client.getIdentityByPublicKeyHash.bind(this.client), )( - getIdentitiesByPublicKeyHashesRequest, + getIdentityByPublicKeyHashRequest, metadata, ); } @@ -176,6 +190,48 @@ class PlatformPromiseClient { ); } + /** + * @param {!GetIdentityContractNonceRequest} getIdentityContractNonceRequest + * @param {?Object} metadata + * @return {Promise} + */ + getIdentityContractNonce(getIdentityContractNonceRequest, metadata = {}) { + return promisify( + this.client.getIdentityContractNonce.bind(this.client), + )( + getIdentityContractNonceRequest, + metadata, + ); + } + + /** + * @param {!GetIdentityNonceRequest} getIdentityNonceRequest + * @param {?Object} metadata + * @return {Promise} + */ + getIdentityNonce(getIdentityNonceRequest, metadata = {}) { + return promisify( + this.client.getIdentityNonce.bind(this.client), + )( + getIdentityNonceRequest, + metadata, + ); + } + + /** + * @param {!GetIdentityKeysRequest} getIdentityKeysRequest + * @param {?Object} metadata + * @return {Promise} + */ + getIdentityKeys(getIdentityKeysRequest, metadata = {}) { + return promisify( + this.client.getIdentityKeys.bind(this.client), + )( + getIdentityKeysRequest, + metadata, + ); + } + /** * @param {string} protocolVersion */ diff --git a/packages/dapi-grpc/clients/platform/v0/web/platform_pb.d.ts b/packages/dapi-grpc/clients/platform/v0/web/platform_pb.d.ts index 9ff5ae3c997..db12d1300ff 100644 --- a/packages/dapi-grpc/clients/platform/v0/web/platform_pb.d.ts +++ b/packages/dapi-grpc/clients/platform/v0/web/platform_pb.d.ts @@ -216,6 +216,120 @@ export namespace GetIdentityRequest { } } +export class GetIdentityNonceRequest extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetIdentityNonceRequest.GetIdentityNonceRequestV0 | undefined; + setV0(value?: GetIdentityNonceRequest.GetIdentityNonceRequestV0): void; + + getVersionCase(): GetIdentityNonceRequest.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetIdentityNonceRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentityNonceRequest): GetIdentityNonceRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetIdentityNonceRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentityNonceRequest; + static deserializeBinaryFromReader(message: GetIdentityNonceRequest, reader: jspb.BinaryReader): GetIdentityNonceRequest; +} + +export namespace GetIdentityNonceRequest { + export type AsObject = { + v0?: GetIdentityNonceRequest.GetIdentityNonceRequestV0.AsObject, + } + + export class GetIdentityNonceRequestV0 extends jspb.Message { + getIdentityId(): Uint8Array | string; + getIdentityId_asU8(): Uint8Array; + getIdentityId_asB64(): string; + setIdentityId(value: Uint8Array | string): void; + + getProve(): boolean; + setProve(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetIdentityNonceRequestV0.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentityNonceRequestV0): GetIdentityNonceRequestV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetIdentityNonceRequestV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentityNonceRequestV0; + static deserializeBinaryFromReader(message: GetIdentityNonceRequestV0, reader: jspb.BinaryReader): GetIdentityNonceRequestV0; + } + + export namespace GetIdentityNonceRequestV0 { + export type AsObject = { + identityId: Uint8Array | string, + prove: boolean, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetIdentityContractNonceRequest extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 | undefined; + setV0(value?: GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0): void; + + getVersionCase(): GetIdentityContractNonceRequest.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetIdentityContractNonceRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentityContractNonceRequest): GetIdentityContractNonceRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetIdentityContractNonceRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentityContractNonceRequest; + static deserializeBinaryFromReader(message: GetIdentityContractNonceRequest, reader: jspb.BinaryReader): GetIdentityContractNonceRequest; +} + +export namespace GetIdentityContractNonceRequest { + export type AsObject = { + v0?: GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.AsObject, + } + + export class GetIdentityContractNonceRequestV0 extends jspb.Message { + getIdentityId(): Uint8Array | string; + getIdentityId_asU8(): Uint8Array; + getIdentityId_asB64(): string; + setIdentityId(value: Uint8Array | string): void; + + getContractId(): Uint8Array | string; + getContractId_asU8(): Uint8Array; + getContractId_asB64(): string; + setContractId(value: Uint8Array | string): void; + + getProve(): boolean; + setProve(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetIdentityContractNonceRequestV0.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentityContractNonceRequestV0): GetIdentityContractNonceRequestV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetIdentityContractNonceRequestV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentityContractNonceRequestV0; + static deserializeBinaryFromReader(message: GetIdentityContractNonceRequestV0, reader: jspb.BinaryReader): GetIdentityContractNonceRequestV0; + } + + export namespace GetIdentityContractNonceRequestV0 { + export type AsObject = { + identityId: Uint8Array | string, + contractId: Uint8Array | string, + prove: boolean, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + export class GetIdentityBalanceRequest extends jspb.Message { hasV0(): boolean; clearV0(): void; @@ -395,53 +509,66 @@ export namespace GetIdentityResponse { } } -export class GetIdentitiesRequest extends jspb.Message { +export class GetIdentityNonceResponse extends jspb.Message { hasV0(): boolean; clearV0(): void; - getV0(): GetIdentitiesRequest.GetIdentitiesRequestV0 | undefined; - setV0(value?: GetIdentitiesRequest.GetIdentitiesRequestV0): void; + getV0(): GetIdentityNonceResponse.GetIdentityNonceResponseV0 | undefined; + setV0(value?: GetIdentityNonceResponse.GetIdentityNonceResponseV0): void; - getVersionCase(): GetIdentitiesRequest.VersionCase; + getVersionCase(): GetIdentityNonceResponse.VersionCase; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetIdentitiesRequest.AsObject; - static toObject(includeInstance: boolean, msg: GetIdentitiesRequest): GetIdentitiesRequest.AsObject; + toObject(includeInstance?: boolean): GetIdentityNonceResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentityNonceResponse): GetIdentityNonceResponse.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetIdentitiesRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetIdentitiesRequest; - static deserializeBinaryFromReader(message: GetIdentitiesRequest, reader: jspb.BinaryReader): GetIdentitiesRequest; + static serializeBinaryToWriter(message: GetIdentityNonceResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentityNonceResponse; + static deserializeBinaryFromReader(message: GetIdentityNonceResponse, reader: jspb.BinaryReader): GetIdentityNonceResponse; } -export namespace GetIdentitiesRequest { +export namespace GetIdentityNonceResponse { export type AsObject = { - v0?: GetIdentitiesRequest.GetIdentitiesRequestV0.AsObject, + v0?: GetIdentityNonceResponse.GetIdentityNonceResponseV0.AsObject, } - export class GetIdentitiesRequestV0 extends jspb.Message { - clearIdsList(): void; - getIdsList(): Array; - getIdsList_asU8(): Array; - getIdsList_asB64(): Array; - setIdsList(value: Array): void; - addIds(value: Uint8Array | string, index?: number): Uint8Array | string; + export class GetIdentityNonceResponseV0 extends jspb.Message { + hasIdentityNonce(): boolean; + clearIdentityNonce(): void; + getIdentityNonce(): number; + setIdentityNonce(value: number): void; - getProve(): boolean; - setProve(value: boolean): void; + hasProof(): boolean; + clearProof(): void; + getProof(): Proof | undefined; + setProof(value?: Proof): void; + hasMetadata(): boolean; + clearMetadata(): void; + getMetadata(): ResponseMetadata | undefined; + setMetadata(value?: ResponseMetadata): void; + + getResultCase(): GetIdentityNonceResponseV0.ResultCase; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetIdentitiesRequestV0.AsObject; - static toObject(includeInstance: boolean, msg: GetIdentitiesRequestV0): GetIdentitiesRequestV0.AsObject; + toObject(includeInstance?: boolean): GetIdentityNonceResponseV0.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentityNonceResponseV0): GetIdentityNonceResponseV0.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetIdentitiesRequestV0, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetIdentitiesRequestV0; - static deserializeBinaryFromReader(message: GetIdentitiesRequestV0, reader: jspb.BinaryReader): GetIdentitiesRequestV0; + static serializeBinaryToWriter(message: GetIdentityNonceResponseV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentityNonceResponseV0; + static deserializeBinaryFromReader(message: GetIdentityNonceResponseV0, reader: jspb.BinaryReader): GetIdentityNonceResponseV0; } - export namespace GetIdentitiesRequestV0 { + export namespace GetIdentityNonceResponseV0 { export type AsObject = { - idsList: Array, - prove: boolean, + identityNonce: number, + proof?: Proof.AsObject, + metadata?: ResponseMetadata.AsObject, + } + + export enum ResultCase { + RESULT_NOT_SET = 0, + IDENTITY_NONCE = 1, + PROOF = 2, } } @@ -451,105 +578,33 @@ export namespace GetIdentitiesRequest { } } -export class GetIdentitiesResponse extends jspb.Message { +export class GetIdentityContractNonceResponse extends jspb.Message { hasV0(): boolean; clearV0(): void; - getV0(): GetIdentitiesResponse.GetIdentitiesResponseV0 | undefined; - setV0(value?: GetIdentitiesResponse.GetIdentitiesResponseV0): void; + getV0(): GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 | undefined; + setV0(value?: GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0): void; - getVersionCase(): GetIdentitiesResponse.VersionCase; + getVersionCase(): GetIdentityContractNonceResponse.VersionCase; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetIdentitiesResponse.AsObject; - static toObject(includeInstance: boolean, msg: GetIdentitiesResponse): GetIdentitiesResponse.AsObject; + toObject(includeInstance?: boolean): GetIdentityContractNonceResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentityContractNonceResponse): GetIdentityContractNonceResponse.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetIdentitiesResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetIdentitiesResponse; - static deserializeBinaryFromReader(message: GetIdentitiesResponse, reader: jspb.BinaryReader): GetIdentitiesResponse; + static serializeBinaryToWriter(message: GetIdentityContractNonceResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentityContractNonceResponse; + static deserializeBinaryFromReader(message: GetIdentityContractNonceResponse, reader: jspb.BinaryReader): GetIdentityContractNonceResponse; } -export namespace GetIdentitiesResponse { +export namespace GetIdentityContractNonceResponse { export type AsObject = { - v0?: GetIdentitiesResponse.GetIdentitiesResponseV0.AsObject, - } - - export class IdentityValue extends jspb.Message { - getValue(): Uint8Array | string; - getValue_asU8(): Uint8Array; - getValue_asB64(): string; - setValue(value: Uint8Array | string): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): IdentityValue.AsObject; - static toObject(includeInstance: boolean, msg: IdentityValue): IdentityValue.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: IdentityValue, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): IdentityValue; - static deserializeBinaryFromReader(message: IdentityValue, reader: jspb.BinaryReader): IdentityValue; - } - - export namespace IdentityValue { - export type AsObject = { - value: Uint8Array | string, - } - } - - export class IdentityEntry extends jspb.Message { - getKey(): Uint8Array | string; - getKey_asU8(): Uint8Array; - getKey_asB64(): string; - setKey(value: Uint8Array | string): void; - - hasValue(): boolean; - clearValue(): void; - getValue(): GetIdentitiesResponse.IdentityValue | undefined; - setValue(value?: GetIdentitiesResponse.IdentityValue): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): IdentityEntry.AsObject; - static toObject(includeInstance: boolean, msg: IdentityEntry): IdentityEntry.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: IdentityEntry, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): IdentityEntry; - static deserializeBinaryFromReader(message: IdentityEntry, reader: jspb.BinaryReader): IdentityEntry; - } - - export namespace IdentityEntry { - export type AsObject = { - key: Uint8Array | string, - value?: GetIdentitiesResponse.IdentityValue.AsObject, - } - } - - export class Identities extends jspb.Message { - clearIdentityEntriesList(): void; - getIdentityEntriesList(): Array; - setIdentityEntriesList(value: Array): void; - addIdentityEntries(value?: GetIdentitiesResponse.IdentityEntry, index?: number): GetIdentitiesResponse.IdentityEntry; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Identities.AsObject; - static toObject(includeInstance: boolean, msg: Identities): Identities.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: Identities, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Identities; - static deserializeBinaryFromReader(message: Identities, reader: jspb.BinaryReader): Identities; + v0?: GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.AsObject, } - export namespace Identities { - export type AsObject = { - identityEntriesList: Array, - } - } - - export class GetIdentitiesResponseV0 extends jspb.Message { - hasIdentities(): boolean; - clearIdentities(): void; - getIdentities(): GetIdentitiesResponse.Identities | undefined; - setIdentities(value?: GetIdentitiesResponse.Identities): void; + export class GetIdentityContractNonceResponseV0 extends jspb.Message { + hasIdentityContractNonce(): boolean; + clearIdentityContractNonce(): void; + getIdentityContractNonce(): number; + setIdentityContractNonce(value: number): void; hasProof(): boolean; clearProof(): void; @@ -561,27 +616,27 @@ export namespace GetIdentitiesResponse { getMetadata(): ResponseMetadata | undefined; setMetadata(value?: ResponseMetadata): void; - getResultCase(): GetIdentitiesResponseV0.ResultCase; + getResultCase(): GetIdentityContractNonceResponseV0.ResultCase; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetIdentitiesResponseV0.AsObject; - static toObject(includeInstance: boolean, msg: GetIdentitiesResponseV0): GetIdentitiesResponseV0.AsObject; + toObject(includeInstance?: boolean): GetIdentityContractNonceResponseV0.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentityContractNonceResponseV0): GetIdentityContractNonceResponseV0.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetIdentitiesResponseV0, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetIdentitiesResponseV0; - static deserializeBinaryFromReader(message: GetIdentitiesResponseV0, reader: jspb.BinaryReader): GetIdentitiesResponseV0; + static serializeBinaryToWriter(message: GetIdentityContractNonceResponseV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentityContractNonceResponseV0; + static deserializeBinaryFromReader(message: GetIdentityContractNonceResponseV0, reader: jspb.BinaryReader): GetIdentityContractNonceResponseV0; } - export namespace GetIdentitiesResponseV0 { + export namespace GetIdentityContractNonceResponseV0 { export type AsObject = { - identities?: GetIdentitiesResponse.Identities.AsObject, + identityContractNonce: number, proof?: Proof.AsObject, metadata?: ResponseMetadata.AsObject, } export enum ResultCase { RESULT_NOT_SET = 0, - IDENTITIES = 1, + IDENTITY_CONTRACT_NONCE = 1, PROOF = 2, } } @@ -1044,6 +1099,227 @@ export namespace GetIdentityKeysResponse { } } +export class GetIdentitiesContractKeysRequest extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 | undefined; + setV0(value?: GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0): void; + + getVersionCase(): GetIdentitiesContractKeysRequest.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetIdentitiesContractKeysRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentitiesContractKeysRequest): GetIdentitiesContractKeysRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetIdentitiesContractKeysRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentitiesContractKeysRequest; + static deserializeBinaryFromReader(message: GetIdentitiesContractKeysRequest, reader: jspb.BinaryReader): GetIdentitiesContractKeysRequest; +} + +export namespace GetIdentitiesContractKeysRequest { + export type AsObject = { + v0?: GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.AsObject, + } + + export class GetIdentitiesContractKeysRequestV0 extends jspb.Message { + clearIdentitiesIdsList(): void; + getIdentitiesIdsList(): Array; + getIdentitiesIdsList_asU8(): Array; + getIdentitiesIdsList_asB64(): Array; + setIdentitiesIdsList(value: Array): void; + addIdentitiesIds(value: Uint8Array | string, index?: number): Uint8Array | string; + + getContractId(): Uint8Array | string; + getContractId_asU8(): Uint8Array; + getContractId_asB64(): string; + setContractId(value: Uint8Array | string): void; + + hasDocumentTypeName(): boolean; + clearDocumentTypeName(): void; + getDocumentTypeName(): string; + setDocumentTypeName(value: string): void; + + clearPurposesList(): void; + getPurposesList(): Array; + setPurposesList(value: Array): void; + addPurposes(value: KeyPurposeMap[keyof KeyPurposeMap], index?: number): KeyPurposeMap[keyof KeyPurposeMap]; + + getProve(): boolean; + setProve(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetIdentitiesContractKeysRequestV0.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentitiesContractKeysRequestV0): GetIdentitiesContractKeysRequestV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetIdentitiesContractKeysRequestV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentitiesContractKeysRequestV0; + static deserializeBinaryFromReader(message: GetIdentitiesContractKeysRequestV0, reader: jspb.BinaryReader): GetIdentitiesContractKeysRequestV0; + } + + export namespace GetIdentitiesContractKeysRequestV0 { + export type AsObject = { + identitiesIdsList: Array, + contractId: Uint8Array | string, + documentTypeName: string, + purposesList: Array, + prove: boolean, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetIdentitiesContractKeysResponse extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 | undefined; + setV0(value?: GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0): void; + + getVersionCase(): GetIdentitiesContractKeysResponse.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetIdentitiesContractKeysResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentitiesContractKeysResponse): GetIdentitiesContractKeysResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetIdentitiesContractKeysResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentitiesContractKeysResponse; + static deserializeBinaryFromReader(message: GetIdentitiesContractKeysResponse, reader: jspb.BinaryReader): GetIdentitiesContractKeysResponse; +} + +export namespace GetIdentitiesContractKeysResponse { + export type AsObject = { + v0?: GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.AsObject, + } + + export class GetIdentitiesContractKeysResponseV0 extends jspb.Message { + hasIdentitiesKeys(): boolean; + clearIdentitiesKeys(): void; + getIdentitiesKeys(): GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys | undefined; + setIdentitiesKeys(value?: GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys): void; + + hasProof(): boolean; + clearProof(): void; + getProof(): Proof | undefined; + setProof(value?: Proof): void; + + hasMetadata(): boolean; + clearMetadata(): void; + getMetadata(): ResponseMetadata | undefined; + setMetadata(value?: ResponseMetadata): void; + + getResultCase(): GetIdentitiesContractKeysResponseV0.ResultCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetIdentitiesContractKeysResponseV0.AsObject; + static toObject(includeInstance: boolean, msg: GetIdentitiesContractKeysResponseV0): GetIdentitiesContractKeysResponseV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetIdentitiesContractKeysResponseV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetIdentitiesContractKeysResponseV0; + static deserializeBinaryFromReader(message: GetIdentitiesContractKeysResponseV0, reader: jspb.BinaryReader): GetIdentitiesContractKeysResponseV0; + } + + export namespace GetIdentitiesContractKeysResponseV0 { + export type AsObject = { + identitiesKeys?: GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.AsObject, + proof?: Proof.AsObject, + metadata?: ResponseMetadata.AsObject, + } + + export class PurposeKeys extends jspb.Message { + getPurpose(): KeyPurposeMap[keyof KeyPurposeMap]; + setPurpose(value: KeyPurposeMap[keyof KeyPurposeMap]): void; + + clearKeysBytesList(): void; + getKeysBytesList(): Array; + getKeysBytesList_asU8(): Array; + getKeysBytesList_asB64(): Array; + setKeysBytesList(value: Array): void; + addKeysBytes(value: Uint8Array | string, index?: number): Uint8Array | string; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PurposeKeys.AsObject; + static toObject(includeInstance: boolean, msg: PurposeKeys): PurposeKeys.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PurposeKeys, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PurposeKeys; + static deserializeBinaryFromReader(message: PurposeKeys, reader: jspb.BinaryReader): PurposeKeys; + } + + export namespace PurposeKeys { + export type AsObject = { + purpose: KeyPurposeMap[keyof KeyPurposeMap], + keysBytesList: Array, + } + } + + export class IdentityKeys extends jspb.Message { + getIdentityId(): Uint8Array | string; + getIdentityId_asU8(): Uint8Array; + getIdentityId_asB64(): string; + setIdentityId(value: Uint8Array | string): void; + + clearKeysList(): void; + getKeysList(): Array; + setKeysList(value: Array): void; + addKeys(value?: GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys, index?: number): GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): IdentityKeys.AsObject; + static toObject(includeInstance: boolean, msg: IdentityKeys): IdentityKeys.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: IdentityKeys, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): IdentityKeys; + static deserializeBinaryFromReader(message: IdentityKeys, reader: jspb.BinaryReader): IdentityKeys; + } + + export namespace IdentityKeys { + export type AsObject = { + identityId: Uint8Array | string, + keysList: Array, + } + } + + export class IdentitiesKeys extends jspb.Message { + clearEntriesList(): void; + getEntriesList(): Array; + setEntriesList(value: Array): void; + addEntries(value?: GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys, index?: number): GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): IdentitiesKeys.AsObject; + static toObject(includeInstance: boolean, msg: IdentitiesKeys): IdentitiesKeys.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: IdentitiesKeys, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): IdentitiesKeys; + static deserializeBinaryFromReader(message: IdentitiesKeys, reader: jspb.BinaryReader): IdentitiesKeys; + } + + export namespace IdentitiesKeys { + export type AsObject = { + entriesList: Array, + } + } + + export enum ResultCase { + RESULT_NOT_SET = 0, + IDENTITIES_KEYS = 1, + PROOF = 2, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + export class GetProofsRequest extends jspb.Message { hasV0(): boolean; clearV0(): void; @@ -1164,6 +1440,7 @@ export namespace GetProofsRequest { FULL_IDENTITY: 0; BALANCE: 1; KEYS: 2; + REVISION: 3; } export const Type: TypeMap; @@ -1937,181 +2214,6 @@ export namespace GetDocumentsResponse { } } -export class GetIdentitiesByPublicKeyHashesRequest extends jspb.Message { - hasV0(): boolean; - clearV0(): void; - getV0(): GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 | undefined; - setV0(value?: GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0): void; - - getVersionCase(): GetIdentitiesByPublicKeyHashesRequest.VersionCase; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetIdentitiesByPublicKeyHashesRequest.AsObject; - static toObject(includeInstance: boolean, msg: GetIdentitiesByPublicKeyHashesRequest): GetIdentitiesByPublicKeyHashesRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetIdentitiesByPublicKeyHashesRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetIdentitiesByPublicKeyHashesRequest; - static deserializeBinaryFromReader(message: GetIdentitiesByPublicKeyHashesRequest, reader: jspb.BinaryReader): GetIdentitiesByPublicKeyHashesRequest; -} - -export namespace GetIdentitiesByPublicKeyHashesRequest { - export type AsObject = { - v0?: GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.AsObject, - } - - export class GetIdentitiesByPublicKeyHashesRequestV0 extends jspb.Message { - clearPublicKeyHashesList(): void; - getPublicKeyHashesList(): Array; - getPublicKeyHashesList_asU8(): Array; - getPublicKeyHashesList_asB64(): Array; - setPublicKeyHashesList(value: Array): void; - addPublicKeyHashes(value: Uint8Array | string, index?: number): Uint8Array | string; - - getProve(): boolean; - setProve(value: boolean): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetIdentitiesByPublicKeyHashesRequestV0.AsObject; - static toObject(includeInstance: boolean, msg: GetIdentitiesByPublicKeyHashesRequestV0): GetIdentitiesByPublicKeyHashesRequestV0.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetIdentitiesByPublicKeyHashesRequestV0, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetIdentitiesByPublicKeyHashesRequestV0; - static deserializeBinaryFromReader(message: GetIdentitiesByPublicKeyHashesRequestV0, reader: jspb.BinaryReader): GetIdentitiesByPublicKeyHashesRequestV0; - } - - export namespace GetIdentitiesByPublicKeyHashesRequestV0 { - export type AsObject = { - publicKeyHashesList: Array, - prove: boolean, - } - } - - export enum VersionCase { - VERSION_NOT_SET = 0, - V0 = 1, - } -} - -export class GetIdentitiesByPublicKeyHashesResponse extends jspb.Message { - hasV0(): boolean; - clearV0(): void; - getV0(): GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 | undefined; - setV0(value?: GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0): void; - - getVersionCase(): GetIdentitiesByPublicKeyHashesResponse.VersionCase; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetIdentitiesByPublicKeyHashesResponse.AsObject; - static toObject(includeInstance: boolean, msg: GetIdentitiesByPublicKeyHashesResponse): GetIdentitiesByPublicKeyHashesResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetIdentitiesByPublicKeyHashesResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetIdentitiesByPublicKeyHashesResponse; - static deserializeBinaryFromReader(message: GetIdentitiesByPublicKeyHashesResponse, reader: jspb.BinaryReader): GetIdentitiesByPublicKeyHashesResponse; -} - -export namespace GetIdentitiesByPublicKeyHashesResponse { - export type AsObject = { - v0?: GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.AsObject, - } - - export class PublicKeyHashIdentityEntry extends jspb.Message { - getPublicKeyHash(): Uint8Array | string; - getPublicKeyHash_asU8(): Uint8Array; - getPublicKeyHash_asB64(): string; - setPublicKeyHash(value: Uint8Array | string): void; - - hasValue(): boolean; - clearValue(): void; - getValue(): google_protobuf_wrappers_pb.BytesValue | undefined; - setValue(value?: google_protobuf_wrappers_pb.BytesValue): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): PublicKeyHashIdentityEntry.AsObject; - static toObject(includeInstance: boolean, msg: PublicKeyHashIdentityEntry): PublicKeyHashIdentityEntry.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: PublicKeyHashIdentityEntry, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): PublicKeyHashIdentityEntry; - static deserializeBinaryFromReader(message: PublicKeyHashIdentityEntry, reader: jspb.BinaryReader): PublicKeyHashIdentityEntry; - } - - export namespace PublicKeyHashIdentityEntry { - export type AsObject = { - publicKeyHash: Uint8Array | string, - value?: google_protobuf_wrappers_pb.BytesValue.AsObject, - } - } - - export class IdentitiesByPublicKeyHashes extends jspb.Message { - clearIdentityEntriesList(): void; - getIdentityEntriesList(): Array; - setIdentityEntriesList(value: Array): void; - addIdentityEntries(value?: GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry, index?: number): GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): IdentitiesByPublicKeyHashes.AsObject; - static toObject(includeInstance: boolean, msg: IdentitiesByPublicKeyHashes): IdentitiesByPublicKeyHashes.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: IdentitiesByPublicKeyHashes, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): IdentitiesByPublicKeyHashes; - static deserializeBinaryFromReader(message: IdentitiesByPublicKeyHashes, reader: jspb.BinaryReader): IdentitiesByPublicKeyHashes; - } - - export namespace IdentitiesByPublicKeyHashes { - export type AsObject = { - identityEntriesList: Array, - } - } - - export class GetIdentitiesByPublicKeyHashesResponseV0 extends jspb.Message { - hasIdentities(): boolean; - clearIdentities(): void; - getIdentities(): GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes | undefined; - setIdentities(value?: GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes): void; - - hasProof(): boolean; - clearProof(): void; - getProof(): Proof | undefined; - setProof(value?: Proof): void; - - hasMetadata(): boolean; - clearMetadata(): void; - getMetadata(): ResponseMetadata | undefined; - setMetadata(value?: ResponseMetadata): void; - - getResultCase(): GetIdentitiesByPublicKeyHashesResponseV0.ResultCase; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetIdentitiesByPublicKeyHashesResponseV0.AsObject; - static toObject(includeInstance: boolean, msg: GetIdentitiesByPublicKeyHashesResponseV0): GetIdentitiesByPublicKeyHashesResponseV0.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetIdentitiesByPublicKeyHashesResponseV0, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetIdentitiesByPublicKeyHashesResponseV0; - static deserializeBinaryFromReader(message: GetIdentitiesByPublicKeyHashesResponseV0, reader: jspb.BinaryReader): GetIdentitiesByPublicKeyHashesResponseV0; - } - - export namespace GetIdentitiesByPublicKeyHashesResponseV0 { - export type AsObject = { - identities?: GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.AsObject, - proof?: Proof.AsObject, - metadata?: ResponseMetadata.AsObject, - } - - export enum ResultCase { - RESULT_NOT_SET = 0, - IDENTITIES = 1, - PROOF = 2, - } - } - - export enum VersionCase { - VERSION_NOT_SET = 0, - V0 = 1, - } -} - export class GetIdentityByPublicKeyHashRequest extends jspb.Message { hasV0(): boolean; clearV0(): void; @@ -3018,6 +3120,9 @@ export namespace GetEpochsInfoResponse { getFeeMultiplier(): number; setFeeMultiplier(value: number): void; + getProtocolVersion(): number; + setProtocolVersion(value: number): void; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): EpochInfo.AsObject; static toObject(includeInstance: boolean, msg: EpochInfo): EpochInfo.AsObject; @@ -3035,6 +3140,7 @@ export namespace GetEpochsInfoResponse { firstCoreBlockHeight: number, startTime: number, feeMultiplier: number, + protocolVersion: number, } } @@ -3051,3 +3157,170 @@ export namespace GetEpochsInfoResponse { } } +export class GetPathElementsRequest extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetPathElementsRequest.GetPathElementsRequestV0 | undefined; + setV0(value?: GetPathElementsRequest.GetPathElementsRequestV0): void; + + getVersionCase(): GetPathElementsRequest.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetPathElementsRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetPathElementsRequest): GetPathElementsRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetPathElementsRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetPathElementsRequest; + static deserializeBinaryFromReader(message: GetPathElementsRequest, reader: jspb.BinaryReader): GetPathElementsRequest; +} + +export namespace GetPathElementsRequest { + export type AsObject = { + v0?: GetPathElementsRequest.GetPathElementsRequestV0.AsObject, + } + + export class GetPathElementsRequestV0 extends jspb.Message { + clearPathList(): void; + getPathList(): Array; + getPathList_asU8(): Array; + getPathList_asB64(): Array; + setPathList(value: Array): void; + addPath(value: Uint8Array | string, index?: number): Uint8Array | string; + + clearKeysList(): void; + getKeysList(): Array; + getKeysList_asU8(): Array; + getKeysList_asB64(): Array; + setKeysList(value: Array): void; + addKeys(value: Uint8Array | string, index?: number): Uint8Array | string; + + getProve(): boolean; + setProve(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetPathElementsRequestV0.AsObject; + static toObject(includeInstance: boolean, msg: GetPathElementsRequestV0): GetPathElementsRequestV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetPathElementsRequestV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetPathElementsRequestV0; + static deserializeBinaryFromReader(message: GetPathElementsRequestV0, reader: jspb.BinaryReader): GetPathElementsRequestV0; + } + + export namespace GetPathElementsRequestV0 { + export type AsObject = { + pathList: Array, + keysList: Array, + prove: boolean, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export class GetPathElementsResponse extends jspb.Message { + hasV0(): boolean; + clearV0(): void; + getV0(): GetPathElementsResponse.GetPathElementsResponseV0 | undefined; + setV0(value?: GetPathElementsResponse.GetPathElementsResponseV0): void; + + getVersionCase(): GetPathElementsResponse.VersionCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetPathElementsResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetPathElementsResponse): GetPathElementsResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetPathElementsResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetPathElementsResponse; + static deserializeBinaryFromReader(message: GetPathElementsResponse, reader: jspb.BinaryReader): GetPathElementsResponse; +} + +export namespace GetPathElementsResponse { + export type AsObject = { + v0?: GetPathElementsResponse.GetPathElementsResponseV0.AsObject, + } + + export class GetPathElementsResponseV0 extends jspb.Message { + hasElements(): boolean; + clearElements(): void; + getElements(): GetPathElementsResponse.GetPathElementsResponseV0.Elements | undefined; + setElements(value?: GetPathElementsResponse.GetPathElementsResponseV0.Elements): void; + + hasProof(): boolean; + clearProof(): void; + getProof(): Proof | undefined; + setProof(value?: Proof): void; + + hasMetadata(): boolean; + clearMetadata(): void; + getMetadata(): ResponseMetadata | undefined; + setMetadata(value?: ResponseMetadata): void; + + getResultCase(): GetPathElementsResponseV0.ResultCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetPathElementsResponseV0.AsObject; + static toObject(includeInstance: boolean, msg: GetPathElementsResponseV0): GetPathElementsResponseV0.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetPathElementsResponseV0, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetPathElementsResponseV0; + static deserializeBinaryFromReader(message: GetPathElementsResponseV0, reader: jspb.BinaryReader): GetPathElementsResponseV0; + } + + export namespace GetPathElementsResponseV0 { + export type AsObject = { + elements?: GetPathElementsResponse.GetPathElementsResponseV0.Elements.AsObject, + proof?: Proof.AsObject, + metadata?: ResponseMetadata.AsObject, + } + + export class Elements extends jspb.Message { + clearElementsList(): void; + getElementsList(): Array; + getElementsList_asU8(): Array; + getElementsList_asB64(): Array; + setElementsList(value: Array): void; + addElements(value: Uint8Array | string, index?: number): Uint8Array | string; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Elements.AsObject; + static toObject(includeInstance: boolean, msg: Elements): Elements.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Elements, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Elements; + static deserializeBinaryFromReader(message: Elements, reader: jspb.BinaryReader): Elements; + } + + export namespace Elements { + export type AsObject = { + elementsList: Array, + } + } + + export enum ResultCase { + RESULT_NOT_SET = 0, + ELEMENTS = 1, + PROOF = 2, + } + } + + export enum VersionCase { + VERSION_NOT_SET = 0, + V0 = 1, + } +} + +export interface KeyPurposeMap { + AUTHENTICATION: 0; + ENCRYPTION: 1; + DECRYPTION: 2; + TRANSFER: 3; + VOTING: 5; +} + +export const KeyPurpose: KeyPurposeMap; + diff --git a/packages/dapi-grpc/clients/platform/v0/web/platform_pb.js b/packages/dapi-grpc/clients/platform/v0/web/platform_pb.js index 9d6d3e76cfa..f8609dbd8ba 100644 --- a/packages/dapi-grpc/clients/platform/v0/web/platform_pb.js +++ b/packages/dapi-grpc/clients/platform/v0/web/platform_pb.js @@ -75,25 +75,16 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpoc goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.VersionCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.ResultCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.VersionCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesRequest', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.VersionCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.ResultCase', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue', null, { proto }); -goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase', null, { proto }); @@ -116,6 +107,13 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRes goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase', null, { proto }); @@ -124,6 +122,13 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetId goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityRequest.GetIdentityRequestV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityRequest.VersionCase', null, { proto }); @@ -131,6 +136,14 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityResponse', null, { goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsRequest', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsRequest.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.ResultCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetPathElementsResponse.VersionCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.ContractRequest', null, { proto }); @@ -160,6 +173,7 @@ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVote goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase', null, { proto }); +goog.exportSymbol('proto.org.dash.platform.dapi.v0.KeyPurpose', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.KeyRequestType', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase', null, { proto }); goog.exportSymbol('proto.org.dash.platform.dapi.v0.Proof', null, { proto }); @@ -333,16 +347,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest'; + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest'; } /** * Generated by JsPbCodeGenerator. @@ -354,16 +368,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0'; + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -375,16 +389,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest'; + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest'; } /** * Generated by JsPbCodeGenerator. @@ -396,16 +410,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0'; + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -417,16 +431,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityResponse'; + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest'; } /** * Generated by JsPbCodeGenerator. @@ -438,16 +452,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0'; + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -459,16 +473,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesRequest'; + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest'; } /** * Generated by JsPbCodeGenerator. @@ -480,16 +494,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0'; + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -501,16 +515,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse'; + proto.org.dash.platform.dapi.v0.GetIdentityResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityResponse'; } /** * Generated by JsPbCodeGenerator. @@ -522,16 +536,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue'; + proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -543,16 +557,37 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry'; + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -564,16 +599,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities'; + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse'; } /** * Generated by JsPbCodeGenerator. @@ -585,16 +620,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0'; + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -911,6 +946,153 @@ if (goog.DEBUG && !COMPILED) { */ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.repeatedFields_, null); +}; +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -1509,16 +1691,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest'; + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1530,16 +1712,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0'; + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1551,16 +1733,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse'; + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1572,16 +1754,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry'; + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -1593,16 +1775,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes'; + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1614,16 +1796,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0'; + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1635,16 +1817,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest'; + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1656,16 +1838,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0'; + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -1677,16 +1859,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1698,16 +1880,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1719,16 +1901,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1740,16 +1922,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock'; } /** * Generated by JsPbCodeGenerator. @@ -1761,16 +1943,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence'; } /** * Generated by JsPbCodeGenerator. @@ -1782,16 +1964,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0'; + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -1803,16 +1985,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1824,16 +2006,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1845,16 +2027,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1866,16 +2048,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -1887,16 +2069,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions'; } /** * Generated by JsPbCodeGenerator. @@ -1908,16 +2090,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry'; } /** * Generated by JsPbCodeGenerator. @@ -1929,16 +2111,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest'; } /** * Generated by JsPbCodeGenerator. @@ -1950,16 +2132,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -1971,16 +2153,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse'; } /** * Generated by JsPbCodeGenerator. @@ -1992,16 +2174,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -2013,16 +2195,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals'; } /** * Generated by JsPbCodeGenerator. @@ -2034,16 +2216,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry'; + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal'; } /** * Generated by JsPbCodeGenerator. @@ -2055,16 +2237,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest'; } /** * Generated by JsPbCodeGenerator. @@ -2076,16 +2258,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0 = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -2097,16 +2279,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse'; } /** * Generated by JsPbCodeGenerator. @@ -2118,16 +2300,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -2139,16 +2321,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos'; } /** * Generated by JsPbCodeGenerator. @@ -2160,37 +2342,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal = function(opt_data) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.displayName = 'proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_); -}; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest'; + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo'; } /** * Generated by JsPbCodeGenerator. @@ -2202,16 +2363,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0'; + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsRequest'; } /** * Generated by JsPbCodeGenerator. @@ -2223,16 +2384,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse'; + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0'; } /** * Generated by JsPbCodeGenerator. @@ -2244,16 +2405,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0'; + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsResponse'; } /** * Generated by JsPbCodeGenerator. @@ -2265,16 +2426,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.repeatedFields_, null); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos'; + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0'; } /** * Generated by JsPbCodeGenerator. @@ -2286,16 +2447,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.repeatedFields_, null); }; -goog.inherits(proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, jspb.Message); +goog.inherits(proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.displayName = 'proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo'; + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.displayName = 'proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements'; } @@ -3791,21 +3952,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityRequest.prototype.hasV0 = function() * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.oneofGroups_[0])); }; @@ -3823,8 +3984,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.toObject(opt_includeInstance, this); }; @@ -3833,13 +3994,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.toObject = f * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -3853,23 +4014,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject = function(in /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3877,8 +4038,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromR var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -3894,9 +4055,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromR * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3904,18 +4065,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.serializeBin /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.serializeBinaryToWriter ); } }; @@ -3937,8 +4098,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.toObject(opt_includeInstance, this); }; @@ -3947,13 +4108,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - id: msg.getId_asB64(), + identityId: msg.getIdentityId_asB64(), prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; @@ -3968,23 +4129,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3993,7 +4154,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setId(value); + msg.setIdentityId(value); break; case 2: var value = /** @type {boolean} */ (reader.readBool()); @@ -4012,9 +4173,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4022,13 +4183,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getId_asU8(); + f = message.getIdentityId_asU8(); if (f.length > 0) { writer.writeBytes( 1, @@ -4046,43 +4207,43 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ /** - * optional bytes id = 1; + * optional bytes identity_id = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.getIdentityId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes id = 1; - * This is a type-conversion wrapper around `getId()` + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.getIdentityId_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getId())); + this.getIdentityId())); }; /** - * optional bytes id = 1; + * optional bytes identity_id = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getId()` + * This is a type-conversion wrapper around `getIdentityId()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.getIdentityId_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getId())); + this.getIdentityId())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.setId = function(value) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.setIdentityId = function(value) { return jspb.Message.setProto3BytesField(this, 1, value); }; @@ -4091,44 +4252,44 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequ * optional bool prove = 2; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getProve = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.getProve = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.setProve = function(value) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0.prototype.setProve = function(value) { return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional GetIdentityBalanceRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} + * optional GetIdentityNonceRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.GetIdentityNonceRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -4137,7 +4298,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.clearV0 = fu * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -4151,21 +4312,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.hasV0 = func * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.oneofGroups_[0])); }; @@ -4183,8 +4344,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.toObject(opt_includeInstance, this); }; @@ -4193,13 +4354,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.t * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -4213,23 +4374,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -4237,8 +4398,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserialize var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -4254,9 +4415,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserialize * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4264,18 +4425,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.s /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.serializeBinaryToWriter ); } }; @@ -4297,8 +4458,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.toObject(opt_includeInstance, this); }; @@ -4307,14 +4468,15 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - id: msg.getId_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + identityId: msg.getIdentityId_asB64(), + contractId: msg.getContractId_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) }; if (includeInstance) { @@ -4328,23 +4490,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -4353,9 +4515,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setId(value); + msg.setIdentityId(value); break; case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); + break; + case 3: var value = /** @type {boolean} */ (reader.readBool()); msg.setProve(value); break; @@ -4372,9 +4538,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4382,23 +4548,30 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getId_asU8(); + f = message.getIdentityId_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } f = message.getProve(); if (f) { writer.writeBool( - 2, + 3, f ); } @@ -4406,89 +4579,131 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentity /** - * optional bytes id = 1; + * optional bytes identity_id = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getIdentityId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes id = 1; - * This is a type-conversion wrapper around `getId()` + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getIdentityId_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getId())); + this.getIdentityId())); }; /** - * optional bytes id = 1; + * optional bytes identity_id = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getId()` + * This is a type-conversion wrapper around `getIdentityId()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getIdentityId_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getId())); + this.getIdentityId())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.setId = function(value) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.setIdentityId = function(value) { return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional bool prove = 2; + * optional bytes contract_id = 2; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes contract_id = 2; + * This is a type-conversion wrapper around `getContractId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getContractId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractId())); +}; + + +/** + * optional bytes contract_id = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getContractId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional bool prove = 3; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); }; /** - * optional GetIdentityBalanceAndRevisionRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} + * optional GetIdentityContractNonceRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.GetIdentityContractNonceRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -4497,7 +4712,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.c * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -4511,21 +4726,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.h * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_[0])); }; @@ -4543,8 +4758,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject(opt_includeInstance, this); }; @@ -4553,13 +4768,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.toObject = functio * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -4573,23 +4788,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject = function(includeI /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -4597,8 +4812,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -4614,9 +4829,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4624,50 +4839,24 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.serializeBinary = /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter ); } }; -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - IDENTITY: 1, - PROOF: 2 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase} - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0])); -}; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -4683,8 +4872,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject(opt_includeInstance, this); }; @@ -4693,15 +4882,14 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.protot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - identity: msg.getIdentity_asB64(), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + id: msg.getId_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -4715,23 +4903,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObje /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -4740,17 +4928,11 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deseri switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setIdentity(value); + msg.setId(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -4765,9 +4947,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deseri * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4775,196 +4957,113 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.protot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); - if (f != null) { + f = message.getId_asU8(); + if (f.length > 0) { writer.writeBytes( 1, f ); } - f = message.getProof(); - if (f != null) { - writer.writeMessage( + f = message.getProve(); + if (f) { + writer.writeBool( 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f ); } }; /** - * optional bytes identity = 1; + * optional bytes id = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes identity = 1; - * This is a type-conversion wrapper around `getIdentity()` + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getIdentity())); + this.getId())); }; /** - * optional bytes identity = 1; + * optional bytes id = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdentity()` + * This is a type-conversion wrapper around `getId()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getId_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getIdentity())); + this.getId())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setIdentity = function(value) { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], value); -}; - - -/** - * Clears the field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearIdentity = function() { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasIdentity = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * Returns whether this field is set. + * optional bool prove = 2; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional GetIdentityResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} + * optional GetIdentityBalanceRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.GetIdentityBalanceRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -4973,7 +5072,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.clearV0 = function * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -4987,21 +5086,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.hasV0 = function() * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_[0])); }; @@ -5019,8 +5118,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject(opt_includeInstance, this); }; @@ -5029,13 +5128,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.toObject = functi * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -5049,23 +5148,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.toObject = function(include /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesRequest; - return proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5073,8 +5172,8 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinaryFromReader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -5090,9 +5189,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.deserializeBinaryFromReader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5100,31 +5199,24 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.serializeBinary = /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter ); } }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.repeatedFields_ = [1]; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -5140,8 +5232,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject(opt_includeInstance, this); }; @@ -5150,13 +5242,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - idsList: msg.getIdsList_asB64(), + id: msg.getId_asB64(), prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; @@ -5171,23 +5263,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.toOb /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5196,7 +5288,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.dese switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addIds(value); + msg.setId(value); break; case 2: var value = /** @type {boolean} */ (reader.readBool()); @@ -5215,9 +5307,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.dese * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5225,15 +5317,15 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdsList_asU8(); + f = message.getId_asU8(); if (f.length > 0) { - writer.writeRepeatedBytes( + writer.writeBytes( 1, f ); @@ -5249,63 +5341,44 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.seri /** - * repeated bytes ids = 1; - * @return {!Array} + * optional bytes id = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.getIdsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * repeated bytes ids = 1; - * This is a type-conversion wrapper around `getIdsList()` - * @return {!Array} + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.getIdsList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getIdsList())); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getId())); }; /** - * repeated bytes ids = 1; + * optional bytes id = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdsList()` - * @return {!Array} + * This is a type-conversion wrapper around `getId()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.getIdsList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getIdsList())); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getId())); }; /** - * @param {!(Array|Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} returns this + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.setIdsList = function(value) { - return jspb.Message.setField(this, 1, value || []); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.addIds = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.clearIdsList = function() { - return this.setIdsList([]); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; @@ -5313,44 +5386,44 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prot * optional bool prove = 2; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.getProve = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.getProve = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0.prototype.setProve = function(value) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0.prototype.setProve = function(value) { return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional GetIdentitiesRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} + * optional GetIdentityBalanceAndRevisionRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.GetIdentitiesRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.GetIdentityBalanceAndRevisionRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -5359,7 +5432,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.clearV0 = functio * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -5373,21 +5446,21 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesRequest.prototype.hasV0 = function( * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_[0])); }; @@ -5405,8 +5478,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject(opt_includeInstance, this); }; @@ -5415,13 +5488,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.toObject = funct * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -5435,23 +5508,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.toObject = function(includ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5459,8 +5532,8 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinaryFromReade var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -5476,9 +5549,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.deserializeBinaryFromReade * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5486,24 +5559,50 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter ); } }; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + IDENTITY: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0])); +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -5519,8 +5618,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject(opt_includeInstance, this); }; @@ -5529,13 +5628,15 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.to * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - value: msg.getValue_asB64() + identity: msg.getIdentity_asB64(), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -5549,23 +5650,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.toObject = f /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5574,7 +5675,17 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeB switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setValue(value); + msg.setIdentity(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -5589,9 +5700,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeB * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5599,257 +5710,197 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.se /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getValue_asU8(); - if (f.length > 0) { + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); + if (f != null) { writer.writeBytes( 1, f ); } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } }; /** - * optional bytes value = 1; + * optional bytes identity = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.getValue = function() { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes value = 1; - * This is a type-conversion wrapper around `getValue()` + * optional bytes identity = 1; + * This is a type-conversion wrapper around `getIdentity()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.getValue_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getValue())); + this.getIdentity())); }; /** - * optional bytes value = 1; + * optional bytes identity = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getValue()` + * This is a type-conversion wrapper around `getIdentity()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.getValue_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getIdentity_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getValue())); + this.getIdentity())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.prototype.setValue = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setIdentity = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], value); }; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearIdentity = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], undefined); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.toObject = function(includeInstance, msg) { - var f, obj = { - key: msg.getKey_asB64(), - value: (f = msg.getValue()) && proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasIdentity = function() { + return jspb.Message.getField(this, 1) != null; }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setKey(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.deserializeBinaryFromReader); - msg.setValue(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.oneofGroups_[0], value); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getKey_asU8(); - if (f.length > 0) { - writer.writeBytes( - 1, - f - ); - } - f = message.getValue(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue.serializeBinaryToWriter - ); - } +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * optional bytes key = 1; - * @return {string} + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.getKey = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; /** - * optional bytes key = 1; - * This is a type-conversion wrapper around `getKey()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.getKey_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getKey())); + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; /** - * optional bytes key = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getKey()` - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.getKey_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getKey())); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.setKey = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; }; /** - * optional IdentityValue value = 2; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} + * optional GetIdentityResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.getValue = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue, 2)); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityValue|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityResponse.GetIdentityResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.setValue = function(value) { - return jspb.Message.setWrapperField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.clearValue = function() { - return this.setValue(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.clearV0 = function() { + return this.setV0(undefined); }; @@ -5857,18 +5908,36 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.cl * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.prototype.hasValue = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetIdentityResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * List of repeated fields within this message type. - * @private {!Array} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.oneofGroups_[0])); +}; @@ -5885,8 +5954,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.toObject(opt_includeInstance, this); }; @@ -5895,14 +5964,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.toObj * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.toObject = function(includeInstance, msg) { var f, obj = { - identityEntriesList: jspb.Message.toObjectList(msg.getIdentityEntriesList(), - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.toObject, includeInstance) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -5916,23 +5984,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.toObject = func /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5940,9 +6008,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBina var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.deserializeBinaryFromReader); - msg.addIdentityEntries(value); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -5957,9 +6025,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBina * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5967,61 +6035,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.seria /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdentityEntriesList(); - if (f.length > 0) { - writer.writeRepeatedMessage( + f = message.getV0(); + if (f != null) { + writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.serializeBinaryToWriter ); } }; -/** - * repeated IdentityEntry identity_entries = 1; - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.getIdentityEntriesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.setIdentityEntriesList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.addIdentityEntries = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.IdentityEntry, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.clearIdentityEntriesList = function() { - return this.setIdentityEntriesList([]); -}; - - /** * Oneof group definitions for this message. Each group defines the field @@ -6031,22 +6061,22 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.prototype.clear * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.ResultCase = { RESULT_NOT_SET: 0, - IDENTITIES: 1, + IDENTITY_NONCE: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_[0])); }; @@ -6064,8 +6094,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.toObject(opt_includeInstance, this); }; @@ -6074,13 +6104,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - identities: (f = msg.getIdentities()) && proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.toObject(includeInstance, f), + identityNonce: jspb.Message.getFieldWithDefault(msg, 1, 0), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -6096,23 +6126,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.to /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6120,9 +6150,8 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.de var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.deserializeBinaryFromReader); - msg.setIdentities(value); + var value = /** @type {number} */ (reader.readUint64()); + msg.setIdentityNonce(value); break; case 2: var value = new proto.org.dash.platform.dapi.v0.Proof; @@ -6147,9 +6176,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.de * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6157,18 +6186,17 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdentities(); + f = /** @type {number} */ (jspb.Message.getField(message, 1)); if (f != null) { - writer.writeMessage( + writer.writeUint64( 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities.serializeBinaryToWriter + f ); } f = message.getProof(); @@ -6191,30 +6219,29 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.se /** - * optional Identities identities = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} + * optional uint64 identity_nonce = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.getIdentities = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.getIdentityNonce = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.Identities|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.setIdentities = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_[0], value); + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.setIdentityNonce = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_[0], value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.clearIdentities = function() { - return this.setIdentities(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.clearIdentityNonce = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_[0], undefined); }; @@ -6222,7 +6249,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.hasIdentities = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.hasIdentityNonce = function() { return jspb.Message.getField(this, 1) != null; }; @@ -6231,7 +6258,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -6239,18 +6266,18 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -6259,7 +6286,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -6268,7 +6295,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -6276,18 +6303,18 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -6296,35 +6323,35 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetIdentitiesResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} + * optional GetIdentityNonceResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.GetIdentitiesResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.GetIdentityNonceResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -6333,7 +6360,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.clearV0 = functi * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityNonceResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -6347,21 +6374,21 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesResponse.prototype.hasV0 = function * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.oneofGroups_[0])); }; @@ -6379,8 +6406,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.toObject(opt_includeInstance, this); }; @@ -6389,13 +6416,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.toObject = * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -6409,23 +6436,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject = function(i /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6433,8 +6460,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFrom var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -6450,9 +6477,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFrom * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6460,18 +6487,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.serializeBi /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.serializeBinaryToWriter ); } }; @@ -6486,22 +6513,22 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWrit * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.ResultCase = { RESULT_NOT_SET: 0, - BALANCE: 1, + IDENTITY_CONTRACT_NONCE: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_[0])); }; @@ -6519,8 +6546,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.toObject(opt_includeInstance, this); }; @@ -6529,13 +6556,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - balance: jspb.Message.getFieldWithDefault(msg, 1, 0), + identityContractNonce: jspb.Message.getFieldWithDefault(msg, 1, 0), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -6551,23 +6578,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6576,7 +6603,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes switch (field) { case 1: var value = /** @type {number} */ (reader.readUint64()); - msg.setBalance(value); + msg.setIdentityContractNonce(value); break; case 2: var value = new proto.org.dash.platform.dapi.v0.Proof; @@ -6601,9 +6628,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6611,11 +6638,11 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {number} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -6644,29 +6671,29 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes /** - * optional uint64 balance = 1; + * optional uint64 identity_contract_nonce = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getBalance = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.getIdentityContractNonce = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setBalance = function(value) { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.setIdentityContractNonce = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_[0], value); }; /** * Clears the field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearBalance = function() { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], undefined); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.clearIdentityContractNonce = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_[0], undefined); }; @@ -6674,7 +6701,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasBalance = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.hasIdentityContractNonce = function() { return jspb.Message.getField(this, 1) != null; }; @@ -6683,7 +6710,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -6691,18 +6718,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -6711,7 +6738,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -6720,7 +6747,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -6728,18 +6755,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -6748,35 +6775,35 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceRes * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetIdentityBalanceResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} + * optional GetIdentityContractNonceResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.GetIdentityContractNonceResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -6785,7 +6812,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.clearV0 = f * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityContractNonceResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -6799,21 +6826,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.hasV0 = fun * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_[0])); }; @@ -6831,8 +6858,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject(opt_includeInstance, this); }; @@ -6841,13 +6868,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -6861,23 +6888,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6885,8 +6912,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -6902,9 +6929,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6912,18 +6939,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter ); } }; @@ -6938,22 +6965,22 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeB * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase = { RESULT_NOT_SET: 0, - BALANCE_AND_REVISION: 1, + BALANCE: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0])); }; @@ -6971,8 +6998,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject(opt_includeInstance, this); }; @@ -6981,13 +7008,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - balanceAndRevision: (f = msg.getBalanceAndRevision()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject(includeInstance, f), + balance: jspb.Message.getFieldWithDefault(msg, 1, 0), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -7003,23 +7030,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -7027,9 +7054,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader); - msg.setBalanceAndRevision(value); + var value = /** @type {number} */ (reader.readUint64()); + msg.setBalance(value); break; case 2: var value = new proto.org.dash.platform.dapi.v0.Proof; @@ -7054,9 +7080,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7064,18 +7090,17 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getBalanceAndRevision(); + f = /** @type {number} */ (jspb.Message.getField(message, 1)); if (f != null) { - writer.writeMessage( + writer.writeUint64( 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter + f ); } f = message.getProof(); @@ -7097,191 +7122,30 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit }; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject = function(includeInstance, msg) { - var f, obj = { - balance: jspb.Message.getFieldWithDefault(msg, 1, 0), - revision: jspb.Message.getFieldWithDefault(msg, 2, 0) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision; - return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readUint64()); - msg.setBalance(value); - break; - case 2: - var value = /** @type {number} */ (reader.readUint64()); - msg.setRevision(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getBalance(); - if (f !== 0) { - writer.writeUint64( - 1, - f - ); - } - f = message.getRevision(); - if (f !== 0) { - writer.writeUint64( - 2, - f - ); - } -}; - - /** * optional uint64 balance = 1; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.getBalance = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getBalance = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.setBalance = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional uint64 revision = 2; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.getRevision = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.setRevision = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * optional BalanceAndRevision balance_and_revision = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getBalanceAndRevision = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setBalanceAndRevision = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setBalance = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearBalanceAndRevision = function() { - return this.setBalanceAndRevision(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearBalance = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], undefined); }; @@ -7289,7 +7153,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasBalanceAndRevision = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasBalance = function() { return jspb.Message.getField(this, 1) != null; }; @@ -7298,7 +7162,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -7306,18 +7170,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -7326,7 +7190,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -7335,7 +7199,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -7343,18 +7207,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -7363,35 +7227,35 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentit * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetIdentityBalanceAndRevisionResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} + * optional GetIdentityBalanceResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.GetIdentityBalanceResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -7400,7 +7264,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype. * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -7414,23 +7278,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype. * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_ = [[1,2,3]]; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase = { - REQUEST_NOT_SET: 0, - ALL_KEYS: 1, - SPECIFIC_KEYS: 2, - SEARCH_KEY: 3 +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getRequestCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_[0])); }; @@ -7448,8 +7310,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.KeyRequestType.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.toObject(opt_includeInstance, this); }; @@ -7458,15 +7320,13 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.toObject = function(opt * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.KeyRequestType.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.toObject = function(includeInstance, msg) { var f, obj = { - allKeys: (f = msg.getAllKeys()) && proto.org.dash.platform.dapi.v0.AllKeys.toObject(includeInstance, f), - specificKeys: (f = msg.getSpecificKeys()) && proto.org.dash.platform.dapi.v0.SpecificKeys.toObject(includeInstance, f), - searchKey: (f = msg.getSearchKey()) && proto.org.dash.platform.dapi.v0.SearchKey.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -7480,23 +7340,23 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.toObject = function(includeInstan /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.KeyRequestType; - return proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -7504,19 +7364,9 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader = fun var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.AllKeys; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader); - msg.setAllKeys(value); - break; - case 2: - var value = new proto.org.dash.platform.dapi.v0.SpecificKeys; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader); - msg.setSpecificKeys(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.SearchKey; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader); - msg.setSearchKey(value); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); @@ -7531,9 +7381,9 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader = fun * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7541,153 +7391,52 @@ proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.serializeBinary = funct /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getAllKeys(); + f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter - ); - } - f = message.getSpecificKeys(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter - ); - } - f = message.getSearchKey(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter ); } }; -/** - * optional AllKeys all_keys = 1; - * @return {?proto.org.dash.platform.dapi.v0.AllKeys} - */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getAllKeys = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.AllKeys} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.AllKeys, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.AllKeys|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this -*/ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setAllKeys = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this - */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearAllKeys = function() { - return this.setAllKeys(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasAllKeys = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional SpecificKeys specific_keys = 2; - * @return {?proto.org.dash.platform.dapi.v0.SpecificKeys} - */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getSpecificKeys = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.SpecificKeys} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.SpecificKeys, 2)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.SpecificKeys|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this -*/ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setSpecificKeys = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this - */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSpecificKeys = function() { - return this.setSpecificKeys(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasSpecificKeys = function() { - return jspb.Message.getField(this, 2) != null; -}; - /** - * optional SearchKey search_key = 3; - * @return {?proto.org.dash.platform.dapi.v0.SearchKey} + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getSearchKey = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.SearchKey} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.SearchKey, 3)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.SearchKey|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this -*/ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setSearchKey = function(value) { - return jspb.Message.setOneofWrapperField(this, 3, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); -}; - +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_ = [[1,2]]; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + * @enum {number} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSearchKey = function() { - return this.setSearchKey(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + BALANCE_AND_REVISION: 1, + PROOF: 2 }; - /** - * Returns whether this field is set. - * @return {boolean} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasSearchKey = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0])); }; - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -7701,8 +7450,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.AllKeys.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.AllKeys.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject(opt_includeInstance, this); }; @@ -7711,13 +7460,15 @@ proto.org.dash.platform.dapi.v0.AllKeys.prototype.toObject = function(opt_includ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.AllKeys} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.AllKeys.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - + balanceAndRevision: (f = msg.getBalanceAndRevision()) && proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -7731,29 +7482,44 @@ proto.org.dash.platform.dapi.v0.AllKeys.toObject = function(includeInstance, msg /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.AllKeys} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} */ -proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.AllKeys; - return proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.AllKeys} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.AllKeys} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} */ -proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader); + msg.setBalanceAndRevision(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; default: reader.skipField(); break; @@ -7767,9 +7533,9 @@ proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader = function(m * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.AllKeys.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7777,22 +7543,39 @@ proto.org.dash.platform.dapi.v0.AllKeys.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.AllKeys} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; -}; - + f = message.getBalanceAndRevision(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.org.dash.platform.dapi.v0.SpecificKeys.repeatedFields_ = [1]; @@ -7809,8 +7592,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.SpecificKeys.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject(opt_includeInstance, this); }; @@ -7819,13 +7602,14 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.toObject = function(opt_i * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.SpecificKeys.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.toObject = function(includeInstance, msg) { var f, obj = { - keyIdsList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f + balance: jspb.Message.getFieldWithDefault(msg, 1, 0), + revision: jspb.Message.getFieldWithDefault(msg, 2, 0) }; if (includeInstance) { @@ -7839,23 +7623,23 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.toObject = function(includeInstance /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.SpecificKeys; - return proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision; + return proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -7863,10 +7647,12 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader = funct var field = reader.getFieldNumber(); switch (field) { case 1: - var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint32() : [reader.readUint32()]); - for (var i = 0; i < values.length; i++) { - msg.addKeyIds(values[i]); - } + var value = /** @type {number} */ (reader.readUint64()); + msg.setBalance(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setRevision(value); break; default: reader.skipField(); @@ -7881,9 +7667,9 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader = funct * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7891,333 +7677,213 @@ proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.serializeBinary = functio /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getKeyIdsList(); - if (f.length > 0) { - writer.writePackedUint32( + f = message.getBalance(); + if (f !== 0) { + writer.writeUint64( 1, f ); } + f = message.getRevision(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } }; /** - * repeated uint32 key_ids = 1; - * @return {!Array} + * optional uint64 balance = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.getKeyIdsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.getBalance = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} returns this */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.setKeyIdsList = function(value) { - return jspb.Message.setField(this, 1, value || []); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.setBalance = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; /** - * @param {number} value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + * optional uint64 revision = 2; + * @return {number} */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.addKeyIds = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.getRevision = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} returns this */ -proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.clearKeyIdsList = function() { - return this.setKeyIdsList([]); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision.prototype.setRevision = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); }; +/** + * optional BalanceAndRevision balance_and_revision = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} + */ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getBalanceAndRevision = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision, 1)); +}; + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.BalanceAndRevision|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setBalanceAndRevision = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0], value); +}; -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.SearchKey.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.SearchKey.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearBalanceAndRevision = function() { + return this.setBalanceAndRevision(undefined); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.SearchKey} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.SearchKey.toObject = function(includeInstance, msg) { - var f, obj = { - purposeMapMap: (f = msg.getPurposeMapMap()) ? f.toObject(includeInstance, proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject) : [] - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasBalanceAndRevision = function() { + return jspb.Message.getField(this, 1) != null; }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.SearchKey} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.SearchKey; - return proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.SearchKey} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.SearchKey} - */ -proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = msg.getPurposeMapMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readMessage, proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader, 0, new proto.org.dash.platform.dapi.v0.SecurityLevelMap()); - }); - break; - default: - reader.skipField(); - break; - } - } - return msg; + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.oneofGroups_[0], value); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.SearchKey.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.SearchKey} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getPurposeMapMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeMessage, proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter); - } +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * map purpose_map = 1; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.SearchKey.prototype.getPurposeMapMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 1, opt_noLazyCreate, - proto.org.dash.platform.dapi.v0.SecurityLevelMap)); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; /** - * Clears values from the map. The map will be non-null. - * @return {!proto.org.dash.platform.dapi.v0.SearchKey} returns this - */ -proto.org.dash.platform.dapi.v0.SearchKey.prototype.clearPurposeMapMap = function() { - this.getPurposeMapMap().clear(); - return this;}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject(opt_includeInstance, this); + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject = function(includeInstance, msg) { - var f, obj = { - securityLevelMapMap: (f = msg.getSecurityLevelMapMap()) ? f.toObject(includeInstance, undefined) : [] - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.SecurityLevelMap; - return proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} + * optional GetIdentityBalanceAndRevisionResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = msg.getSecurityLevelMapMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readEnum, null, 0, 0); - }); - break; - default: - reader.skipField(); - break; - } - } - return msg; +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0, 1)); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.GetIdentityBalanceAndRevisionResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.oneofGroups_[0], value); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse} returns this */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getSecurityLevelMapMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeEnum); - } +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.clearV0 = function() { + return this.setV0(undefined); }; /** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.KeyKindRequestType = { - CURRENT_KEY_OF_KIND_REQUEST: 0, - ALL_KEYS_OF_KIND_REQUEST: 1 -}; - -/** - * map security_level_map = 1; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.getSecurityLevelMapMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 1, opt_noLazyCreate, - null)); +proto.org.dash.platform.dapi.v0.GetIdentityBalanceAndRevisionResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; }; -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} returns this - */ -proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.clearSecurityLevelMapMap = function() { - this.getSecurityLevelMapMap().clear(); - return this;}; - - /** * Oneof group definitions for this message. Each group defines the field @@ -8227,21 +7893,23 @@ proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.clearSecurityLevelMap * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_ = [[1,2,3]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 +proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase = { + REQUEST_NOT_SET: 0, + ALL_KEYS: 1, + SPECIFIC_KEYS: 2, + SEARCH_KEY: 3 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getRequestCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.KeyRequestType.RequestCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0])); }; @@ -8259,8 +7927,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.KeyRequestType.toObject(opt_includeInstance, this); }; @@ -8269,13 +7937,15 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.toObject = func * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.KeyRequestType.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject(includeInstance, f) + allKeys: (f = msg.getAllKeys()) && proto.org.dash.platform.dapi.v0.AllKeys.toObject(includeInstance, f), + specificKeys: (f = msg.getSpecificKeys()) && proto.org.dash.platform.dapi.v0.SpecificKeys.toObject(includeInstance, f), + searchKey: (f = msg.getSearchKey()) && proto.org.dash.platform.dapi.v0.SearchKey.toObject(includeInstance, f) }; if (includeInstance) { @@ -8289,23 +7959,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject = function(inclu /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.KeyRequestType; + return proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8313,9 +7983,19 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromRead var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = new proto.org.dash.platform.dapi.v0.AllKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader); + msg.setAllKeys(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.SpecificKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader); + msg.setSpecificKeys(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.SearchKey; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader); + msg.setSearchKey(value); break; default: reader.skipField(); @@ -8330,9 +8010,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromRead * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8340,59 +8020,2013 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} message + * @param {!proto.org.dash.platform.dapi.v0.KeyRequestType} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); + f = message.getAllKeys(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter + ); + } + f = message.getSpecificKeys(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter + ); + } + f = message.getSearchKey(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter ); } }; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * optional AllKeys all_keys = 1; + * @return {?proto.org.dash.platform.dapi.v0.AllKeys} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getAllKeys = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.AllKeys} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.AllKeys, 1)); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: + * @param {?proto.org.dash.platform.dapi.v0.AllKeys|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this +*/ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setAllKeys = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearAllKeys = function() { + return this.setAllKeys(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasAllKeys = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional SpecificKeys specific_keys = 2; + * @return {?proto.org.dash.platform.dapi.v0.SpecificKeys} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getSpecificKeys = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.SpecificKeys} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.SpecificKeys, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.SpecificKeys|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this +*/ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setSpecificKeys = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSpecificKeys = function() { + return this.setSpecificKeys(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasSpecificKeys = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional SearchKey search_key = 3; + * @return {?proto.org.dash.platform.dapi.v0.SearchKey} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.getSearchKey = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.SearchKey} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.SearchKey, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.SearchKey|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this +*/ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.setSearchKey = function(value) { + return jspb.Message.setOneofWrapperField(this, 3, proto.org.dash.platform.dapi.v0.KeyRequestType.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.KeyRequestType} returns this + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.clearSearchKey = function() { + return this.setSearchKey(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.KeyRequestType.prototype.hasSearchKey = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.AllKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.AllKeys.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.AllKeys} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.AllKeys.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.AllKeys} + */ +proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.AllKeys; + return proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.AllKeys} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.AllKeys} + */ +proto.org.dash.platform.dapi.v0.AllKeys.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.AllKeys.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.AllKeys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.AllKeys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.SpecificKeys.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.toObject = function(includeInstance, msg) { + var f, obj = { + keyIdsList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.SpecificKeys; + return proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint32() : [reader.readUint32()]); + for (var i = 0; i < values.length; i++) { + msg.addKeyIds(values[i]); + } + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.SpecificKeys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKeyIdsList(); + if (f.length > 0) { + writer.writePackedUint32( + 1, + f + ); + } +}; + + +/** + * repeated uint32 key_ids = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.getKeyIdsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.setKeyIdsList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.addKeyIds = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.SpecificKeys} returns this + */ +proto.org.dash.platform.dapi.v0.SpecificKeys.prototype.clearKeyIdsList = function() { + return this.setKeyIdsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.SearchKey.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.SearchKey.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.SearchKey} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SearchKey.toObject = function(includeInstance, msg) { + var f, obj = { + purposeMapMap: (f = msg.getPurposeMapMap()) ? f.toObject(includeInstance, proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject) : [] + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.SearchKey} + */ +proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.SearchKey; + return proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.SearchKey} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.SearchKey} + */ +proto.org.dash.platform.dapi.v0.SearchKey.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = msg.getPurposeMapMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readMessage, proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader, 0, new proto.org.dash.platform.dapi.v0.SecurityLevelMap()); + }); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.SearchKey.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.SearchKey} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SearchKey.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPurposeMapMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeMessage, proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter); + } +}; + + +/** + * map purpose_map = 1; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.org.dash.platform.dapi.v0.SearchKey.prototype.getPurposeMapMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 1, opt_noLazyCreate, + proto.org.dash.platform.dapi.v0.SecurityLevelMap)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.org.dash.platform.dapi.v0.SearchKey} returns this + */ +proto.org.dash.platform.dapi.v0.SearchKey.prototype.clearPurposeMapMap = function() { + this.getPurposeMapMap().clear(); + return this;}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.toObject = function(includeInstance, msg) { + var f, obj = { + securityLevelMapMap: (f = msg.getSecurityLevelMapMap()) ? f.toObject(includeInstance, undefined) : [] + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.SecurityLevelMap; + return proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = msg.getSecurityLevelMapMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readEnum, null, 0, 0); + }); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSecurityLevelMapMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeEnum); + } +}; + + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.KeyKindRequestType = { + CURRENT_KEY_OF_KIND_REQUEST: 0, + ALL_KEYS_OF_KIND_REQUEST: 1 +}; + +/** + * map security_level_map = 1; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.getSecurityLevelMapMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 1, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.org.dash.platform.dapi.v0.SecurityLevelMap} returns this + */ +proto.org.dash.platform.dapi.v0.SecurityLevelMap.prototype.clearSecurityLevelMapMap = function() { + this.getSecurityLevelMapMap().clear(); + return this;}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject = function(includeInstance, msg) { + var f, obj = { + identityId: msg.getIdentityId_asB64(), + requestType: (f = msg.getRequestType()) && proto.org.dash.platform.dapi.v0.KeyRequestType.toObject(includeInstance, f), + limit: (f = msg.getLimit()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + offset: (f = msg.getOffset()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 5, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentityId(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.KeyRequestType; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader); + msg.setRequestType(value); + break; + case 3: + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setLimit(value); + break; + case 4: + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setOffset(value); + break; + case 5: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentityId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getRequestType(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter + ); + } + f = message.getLimit(); + if (f != null) { + writer.writeMessage( + 3, + f, + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + ); + } + f = message.getOffset(); + if (f != null) { + writer.writeMessage( + 4, + f, + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 5, + f + ); + } +}; + + +/** + * optional bytes identity_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentityId())); +}; + + +/** + * optional bytes identity_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentityId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentityId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setIdentityId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional KeyRequestType request_type = 2; + * @return {?proto.org.dash.platform.dapi.v0.KeyRequestType} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getRequestType = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.KeyRequestType} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.KeyRequestType, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.KeyRequestType|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setRequestType = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearRequestType = function() { + return this.setRequestType(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasRequestType = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional google.protobuf.UInt32Value limit = 3; + * @return {?proto.google.protobuf.UInt32Value} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getLimit = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 3)); +}; + + +/** + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setLimit = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearLimit = function() { + return this.setLimit(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasLimit = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional google.protobuf.UInt32Value offset = 4; + * @return {?proto.google.protobuf.UInt32Value} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getOffset = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 4)); +}; + + +/** + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setOffset = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearOffset = function() { + return this.setOffset(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasOffset = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional bool prove = 5; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 5, value); +}; + + +/** + * optional GetIdentityKeysRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + KEYS: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + keys: (f = msg.getKeys()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader); + msg.setKeys(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKeys(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject = function(includeInstance, msg) { + var f, obj = { + keysBytesList: msg.getKeysBytesList_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys; + return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addKeysBytes(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKeysBytesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 1, + f + ); + } +}; + + +/** + * repeated bytes keys_bytes = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * repeated bytes keys_bytes = 1; + * This is a type-conversion wrapper around `getKeysBytesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getKeysBytesList())); +}; + + +/** + * repeated bytes keys_bytes = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKeysBytesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getKeysBytesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.setKeysBytesList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.addKeysBytes = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.clearKeysBytesList = function() { + return this.setKeysBytesList([]); +}; + + +/** + * optional Keys keys = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getKeys = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setKeys = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearKeys = function() { + return this.setKeys(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasKeys = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetIdentityKeysResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.repeatedFields_ = [1,4]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} msg The msg instance to transform. + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - identityId: msg.getIdentityId_asB64(), - requestType: (f = msg.getRequestType()) && proto.org.dash.platform.dapi.v0.KeyRequestType.toObject(includeInstance, f), - limit: (f = msg.getLimit()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), - offset: (f = msg.getOffset()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), + identitiesIdsList: msg.getIdentitiesIdsList_asB64(), + contractId: msg.getContractId_asB64(), + documentTypeName: jspb.Message.getFieldWithDefault(msg, 3, ""), + purposesList: (f = jspb.Message.getRepeatedField(msg, 4)) == null ? undefined : f, prove: jspb.Message.getBooleanFieldWithDefault(msg, 5, false) }; @@ -8407,23 +10041,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8432,22 +10066,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setIdentityId(value); + msg.addIdentitiesIds(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.KeyRequestType; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.KeyRequestType.deserializeBinaryFromReader); - msg.setRequestType(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractId(value); break; case 3: - var value = new google_protobuf_wrappers_pb.UInt32Value; - reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); - msg.setLimit(value); + var value = /** @type {string} */ (reader.readString()); + msg.setDocumentTypeName(value); break; case 4: - var value = new google_protobuf_wrappers_pb.UInt32Value; - reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); - msg.setOffset(value); + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedEnum() : [reader.readEnum()]); + for (var i = 0; i < values.length; i++) { + msg.addPurposes(values[i]); + } break; case 5: var value = /** @type {boolean} */ (reader.readBool()); @@ -8466,9 +10099,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8476,41 +10109,38 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdentityId_asU8(); + f = message.getIdentitiesIdsList_asU8(); if (f.length > 0) { - writer.writeBytes( + writer.writeRepeatedBytes( 1, f ); } - f = message.getRequestType(); - if (f != null) { - writer.writeMessage( + f = message.getContractId_asU8(); + if (f.length > 0) { + writer.writeBytes( 2, - f, - proto.org.dash.platform.dapi.v0.KeyRequestType.serializeBinaryToWriter + f ); } - f = message.getLimit(); + f = /** @type {string} */ (jspb.Message.getField(message, 3)); if (f != null) { - writer.writeMessage( + writer.writeString( 3, - f, - google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + f ); } - f = message.getOffset(); - if (f != null) { - writer.writeMessage( + f = message.getPurposesList(); + if (f.length > 0) { + writer.writePackedEnum( 4, - f, - google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter + f ); } f = message.getProve(); @@ -8524,72 +10154,224 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. /** - * optional bytes identity_id = 1; + * repeated bytes identities_ids = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getIdentitiesIdsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * repeated bytes identities_ids = 1; + * This is a type-conversion wrapper around `getIdentitiesIdsList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getIdentitiesIdsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getIdentitiesIdsList())); +}; + + +/** + * repeated bytes identities_ids = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentitiesIdsList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getIdentitiesIdsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getIdentitiesIdsList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setIdentitiesIdsList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.addIdentitiesIds = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.clearIdentitiesIdsList = function() { + return this.setIdentitiesIdsList([]); +}; + + +/** + * optional bytes contract_id = 2; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getContractId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * optional bytes identity_id = 1; - * This is a type-conversion wrapper around `getIdentityId()` + * optional bytes contract_id = 2; + * This is a type-conversion wrapper around `getContractId()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getContractId_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getIdentityId())); + this.getContractId())); }; /** - * optional bytes identity_id = 1; + * optional bytes contract_id = 2; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdentityId()` + * This is a type-conversion wrapper around `getContractId()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getIdentityId_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getContractId_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getIdentityId())); + this.getContractId())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setIdentityId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setContractId = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); }; /** - * optional KeyRequestType request_type = 2; - * @return {?proto.org.dash.platform.dapi.v0.KeyRequestType} + * optional string document_type_name = 3; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getRequestType = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.KeyRequestType} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.KeyRequestType, 2)); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getDocumentTypeName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** - * @param {?proto.org.dash.platform.dapi.v0.KeyRequestType|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setDocumentTypeName = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.clearDocumentTypeName = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.hasDocumentTypeName = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * repeated KeyPurpose purposes = 4; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getPurposesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setPurposesList = function(value) { + return jspb.Message.setField(this, 4, value || []); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.KeyPurpose} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.addPurposes = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 4, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.clearPurposesList = function() { + return this.setPurposesList([]); +}; + + +/** + * optional bool prove = 5; + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 5, value); +}; + + +/** + * optional GetIdentitiesContractKeysRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.GetIdentitiesContractKeysRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setRequestType = function(value) { - return jspb.Message.setWrapperField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearRequestType = function() { - return this.setRequestType(undefined); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.clearV0 = function() { + return this.setV0(undefined); }; @@ -8597,165 +10379,325 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0. * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasRequestType = function() { - return jspb.Message.getField(this, 2) != null; +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysRequest.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.VersionCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.toObject(opt_includeInstance, this); }; /** - * optional google.protobuf.UInt32Value limit = 3; - * @return {?proto.google.protobuf.UInt32Value} + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getLimit = function() { - return /** @type{?proto.google.protobuf.UInt32Value} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 3)); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.toObject = function(includeInstance, msg) { + var f, obj = { + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * @param {?proto.google.protobuf.UInt32Value|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setLimit = function(value) { - return jspb.Message.setWrapperField(this, 3, value); + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.deserializeBinaryFromReader(msg, reader); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearLimit = function() { - return this.setLimit(undefined); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.deserializeBinaryFromReader); + msg.setV0(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * Returns whether this field is set. - * @return {boolean} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasLimit = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * optional google.protobuf.UInt32Value offset = 4; - * @return {?proto.google.protobuf.UInt32Value} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getOffset = function() { - return /** @type{?proto.google.protobuf.UInt32Value} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 4)); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.serializeBinaryToWriter + ); + } }; -/** - * @param {?proto.google.protobuf.UInt32Value|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setOffset = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_ = [[1,2]]; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.clearOffset = function() { - return this.setOffset(undefined); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + IDENTITIES_KEYS: 1, + PROOF: 2 }; - /** - * Returns whether this field is set. - * @return {boolean} + * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.hasOffset = function() { - return jspb.Message.getField(this, 4) != null; +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_[0])); }; + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional bool prove = 5; - * @return {boolean} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.toObject(opt_includeInstance, this); }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 5, value); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.toObject = function(includeInstance, msg) { + var f, obj = { + identitiesKeys: (f = msg.getIdentitiesKeys()) && proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional GetIdentityKeysRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.deserializeBinaryFromReader(msg, reader); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.GetIdentityKeysRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.oneofGroups_[0], value); + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.deserializeBinaryFromReader); + msg.setIdentitiesKeys(value); + break; + case 2: + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest} returns this + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * Returns whether this field is set. - * @return {boolean} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIdentitiesKeys(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + ); + } }; /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} + * List of repeated fields within this message type. + * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_ = [[1]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_[0])); -}; +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.repeatedFields_ = [2]; @@ -8772,8 +10714,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.toObject(opt_includeInstance, this); }; @@ -8782,13 +10724,14 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.toObject = fun * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject(includeInstance, f) + purpose: jspb.Message.getFieldWithDefault(msg, 1, 0), + keysBytesList: msg.getKeysBytesList_asB64() }; if (includeInstance) { @@ -8802,23 +10745,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.toObject = function(incl /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8826,9 +10769,12 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromRea var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = /** @type {!proto.org.dash.platform.dapi.v0.KeyPurpose} */ (reader.readEnum()); + msg.setPurpose(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addKeysBytes(value); break; default: reader.skipField(); @@ -8843,9 +10789,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.deserializeBinaryFromRea * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8853,51 +10799,117 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.serializeBinar /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( + f = message.getPurpose(); + if (f !== 0.0) { + writer.writeEnum( 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter + f + ); + } + f = message.getKeysBytesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 2, + f ); } }; +/** + * optional KeyPurpose purpose = 1; + * @return {!proto.org.dash.platform.dapi.v0.KeyPurpose} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.getPurpose = function() { + return /** @type {!proto.org.dash.platform.dapi.v0.KeyPurpose} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const + * @param {!proto.org.dash.platform.dapi.v0.KeyPurpose} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.setPurpose = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + /** - * @enum {number} + * repeated bytes keys_bytes = 2; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - KEYS: 1, - PROOF: 2 +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.getKeysBytesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase} + * repeated bytes keys_bytes = 2; + * This is a type-conversion wrapper around `getKeysBytesList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.getKeysBytesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getKeysBytesList())); +}; + + +/** + * repeated bytes keys_bytes = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKeysBytesList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.getKeysBytesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getKeysBytesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.setKeysBytesList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.addKeysBytes = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); }; +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.prototype.clearKeysBytesList = function() { + return this.setKeysBytesList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.repeatedFields_ = [2]; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** @@ -8912,8 +10924,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.toObject(opt_includeInstance, this); }; @@ -8922,15 +10934,15 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.toObject = function(includeInstance, msg) { var f, obj = { - keys: (f = msg.getKeys()) && proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + identityId: msg.getIdentityId_asB64(), + keysList: jspb.Message.toObjectList(msg.getKeysList(), + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.toObject, includeInstance) }; if (includeInstance) { @@ -8944,23 +10956,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8968,19 +10980,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader); - msg.setKeys(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentityId(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.deserializeBinaryFromReader); + msg.addKeys(value); break; default: reader.skipField(); @@ -8995,9 +11001,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9005,46 +11011,117 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getKeys(); - if (f != null) { - writer.writeMessage( + f = message.getIdentityId_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter + f ); } - f = message.getProof(); - if (f != null) { - writer.writeMessage( + f = message.getKeysList(); + if (f.length > 0) { + writer.writeRepeatedMessage( 2, f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys.serializeBinaryToWriter ); } }; +/** + * optional bytes identity_id = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.getIdentityId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes identity_id = 1; + * This is a type-conversion wrapper around `getIdentityId()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.getIdentityId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentityId())); +}; + + +/** + * optional bytes identity_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentityId()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.getIdentityId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentityId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.setIdentityId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * repeated PurposeKeys keys = 2; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.getKeysList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.setKeysList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys} + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.addKeys = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.PurposeKeys, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.prototype.clearKeysList = function() { + return this.setKeysList([]); +}; + + /** * List of repeated fields within this message type. * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.repeatedFields_ = [1]; @@ -9061,8 +11138,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.toObject(opt_includeInstance, this); }; @@ -9071,13 +11148,14 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.toObject = function(includeInstance, msg) { var f, obj = { - keysBytesList: msg.getKeysBytesList_asB64() + entriesList: jspb.Message.toObjectList(msg.getEntriesList(), + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.toObject, includeInstance) }; if (includeInstance) { @@ -9091,23 +11169,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys; - return proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys; + return proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9115,8 +11193,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addKeysBytes(value); + var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.deserializeBinaryFromReader); + msg.addEntries(value); break; default: reader.skipField(); @@ -9131,118 +11210,96 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getKeysBytesList_asU8(); - if (f.length > 0) { - writer.writeRepeatedBytes( - 1, - f - ); - } -}; - - -/** - * repeated bytes keys_bytes = 1; - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * repeated bytes keys_bytes = 1; - * This is a type-conversion wrapper around `getKeysBytesList()` - * @return {!Array} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getKeysBytesList())); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEntriesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys.serializeBinaryToWriter + ); + } }; /** - * repeated bytes keys_bytes = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getKeysBytesList()` - * @return {!Array} + * repeated IdentityKeys entries = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.getKeysBytesList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getKeysBytesList())); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.getEntriesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys, 1)); }; /** - * @param {!(Array|Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.setKeysBytesList = function(value) { - return jspb.Message.setField(this, 1, value || []); + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.setEntriesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * @param {!(string|Uint8Array)} value + * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys=} opt_value * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.addKeysBytes = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.addEntries = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentityKeys, opt_index); }; /** * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys.prototype.clearKeysBytesList = function() { - return this.setKeysBytesList([]); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys.prototype.clearEntriesList = function() { + return this.setEntriesList([]); }; /** - * optional Keys keys = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} + * optional IdentitiesKeys identities_keys = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getKeys = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys, 1)); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.getIdentitiesKeys = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.Keys|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.IdentitiesKeys|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setKeys = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.setIdentitiesKeys = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearKeys = function() { - return this.setKeys(undefined); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.clearIdentitiesKeys = function() { + return this.setIdentitiesKeys(undefined); }; @@ -9250,7 +11307,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasKeys = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.hasIdentitiesKeys = function() { return jspb.Message.getField(this, 1) != null; }; @@ -9259,7 +11316,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -9267,18 +11324,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -9287,7 +11344,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -9296,7 +11353,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -9304,18 +11361,18 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -9324,35 +11381,35 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetIdentityKeysResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} + * optional GetIdentitiesContractKeysResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.GetIdentityKeysResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.GetIdentitiesContractKeysResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -9361,7 +11418,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.clearV0 = func * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityKeysResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentitiesContractKeysResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -10055,7 +12112,8 @@ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequ proto.org.dash.platform.dapi.v0.GetProofsRequest.GetProofsRequestV0.IdentityRequest.Type = { FULL_IDENTITY: 0, BALANCE: 1, - KEYS: 2 + KEYS: 2, + REVISION: 3 }; /** @@ -15501,21 +17559,21 @@ proto.org.dash.platform.dapi.v0.GetDocumentsResponse.prototype.hasV0 = function( * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_[0])); }; @@ -15533,8 +17591,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.toObject(opt_includeInstance, this); }; @@ -15543,13 +17601,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -15563,23 +17621,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest; + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -15587,8 +17645,8 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -15604,9 +17662,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.deserializ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -15614,31 +17672,24 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter ); } }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.repeatedFields_ = [1]; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -15654,8 +17705,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(opt_includeInstance, this); }; @@ -15664,13 +17715,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - publicKeyHashesList: msg.getPublicKeyHashesList_asB64(), + publicKeyHash: msg.getPublicKeyHash_asB64(), prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; @@ -15685,23 +17736,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0; + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -15710,7 +17761,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addPublicKeyHashes(value); + msg.setPublicKeyHash(value); break; case 2: var value = /** @type {boolean} */ (reader.readBool()); @@ -15729,9 +17780,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -15739,15 +17790,15 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getPublicKeyHashesList_asU8(); + f = message.getPublicKeyHash_asU8(); if (f.length > 0) { - writer.writeRepeatedBytes( + writer.writeBytes( 1, f ); @@ -15763,63 +17814,44 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit /** - * repeated bytes public_key_hashes = 1; - * @return {!Array} + * optional bytes public_key_hash = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.getPublicKeyHashesList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * repeated bytes public_key_hashes = 1; - * This is a type-conversion wrapper around `getPublicKeyHashesList()` - * @return {!Array} + * optional bytes public_key_hash = 1; + * This is a type-conversion wrapper around `getPublicKeyHash()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.getPublicKeyHashesList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getPublicKeyHashesList())); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getPublicKeyHash())); }; /** - * repeated bytes public_key_hashes = 1; + * optional bytes public_key_hash = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPublicKeyHashesList()` - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.getPublicKeyHashesList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getPublicKeyHashesList())); -}; - - -/** - * @param {!(Array|Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} returns this + * This is a type-conversion wrapper around `getPublicKeyHash()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.setPublicKeyHashesList = function(value) { - return jspb.Message.setField(this, 1, value || []); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getPublicKeyHash())); }; /** * @param {!(string|Uint8Array)} value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.addPublicKeyHashes = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.clearPublicKeyHashesList = function() { - return this.setPublicKeyHashesList([]); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.setPublicKeyHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; @@ -15827,44 +17859,44 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentit * optional bool prove = 2; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.getProve = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getProve = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0.prototype.setProve = function(value) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.setProve = function(value) { return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional GetIdentitiesByPublicKeyHashesRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} + * optional GetIdentityByPublicKeyHashRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.GetIdentitiesByPublicKeyHashesRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -15873,7 +17905,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype. * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -15887,21 +17919,21 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest.prototype. * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_[0])); }; @@ -15919,8 +17951,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject(opt_includeInstance, this); }; @@ -15929,13 +17961,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -15949,23 +17981,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.toObject /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse; + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -15973,8 +18005,8 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deseriali var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -15990,9 +18022,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.deseriali * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16000,24 +18032,50 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter ); } }; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + IDENTITY: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0])); +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -16033,8 +18091,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(opt_includeInstance, this); }; @@ -16043,14 +18101,15 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - publicKeyHash: msg.getPublicKeyHash_asB64(), - value: (f = msg.getValue()) && google_protobuf_wrappers_pb.BytesValue.toObject(includeInstance, f) + identity: msg.getIdentity_asB64(), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -16064,23 +18123,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0; + return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -16089,12 +18148,17 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setPublicKeyHash(value); + msg.setIdentity(value); break; case 2: - var value = new google_protobuf_wrappers_pb.BytesValue; - reader.readMessage(value,google_protobuf_wrappers_pb.BytesValue.deserializeBinaryFromReader); - msg.setValue(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -16109,9 +18173,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16119,97 +18183,123 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} message + * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getPublicKeyHash_asU8(); - if (f.length > 0) { + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); + if (f != null) { writer.writeBytes( 1, f ); } - f = message.getValue(); + f = message.getProof(); if (f != null) { writer.writeMessage( 2, f, - google_protobuf_wrappers_pb.BytesValue.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; /** - * optional bytes public_key_hash = 1; + * optional bytes identity = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.getPublicKeyHash = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes public_key_hash = 1; - * This is a type-conversion wrapper around `getPublicKeyHash()` + * optional bytes identity = 1; + * This is a type-conversion wrapper around `getIdentity()` * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.getPublicKeyHash_asB64 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getPublicKeyHash())); + this.getIdentity())); }; /** - * optional bytes public_key_hash = 1; + * optional bytes identity = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPublicKeyHash()` + * This is a type-conversion wrapper around `getIdentity()` * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.getPublicKeyHash_asU8 = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getPublicKeyHash())); + this.getIdentity())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.setPublicKeyHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setIdentity = function(value) { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], value); }; /** - * optional google.protobuf.BytesValue value = 2; - * @return {?proto.google.protobuf.BytesValue} + * Clears the field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.getValue = function() { - return /** @type{?proto.google.protobuf.BytesValue} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.BytesValue, 2)); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearIdentity = function() { + return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], undefined); }; /** - * @param {?proto.google.protobuf.BytesValue|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} returns this + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasIdentity = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.setValue = function(value) { - return jspb.Message.setWrapperField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.clearValue = function() { - return this.setValue(undefined); +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; @@ -16217,18 +18307,110 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKey * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.prototype.hasValue = function() { +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; +/** + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); +}; + /** - * List of repeated fields within this message type. - * @private {!Array} + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetIdentityByPublicKeyHashResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.clearV0 = function() { + return this.setV0(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.hasV0 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase = { + VERSION_NOT_SET: 0, + V0: 1 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_[0])); +}; @@ -16245,8 +18427,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.toObject(opt_includeInstance, this); }; @@ -16255,14 +18437,13 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.Identitie * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.toObject = function(includeInstance, msg) { var f, obj = { - identityEntriesList: jspb.Message.toObjectList(msg.getIdentityEntriesList(), - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.toObject, includeInstance) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -16276,23 +18457,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.Identitie /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest; + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -16300,117 +18481,53 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.Identitie var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.deserializeBinaryFromReader); - msg.addIdentityEntries(value); + var value = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader); + msg.setV0(value); break; default: reader.skipField(); break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getIdentityEntriesList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry.serializeBinaryToWriter - ); - } -}; - - -/** - * repeated PublicKeyHashIdentityEntry identity_entries = 1; - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.getIdentityEntriesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.setIdentityEntriesList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.addIdentityEntries = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.PublicKeyHashIdentityEntry, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.prototype.clearIdentityEntriesList = function() { - return this.setIdentityEntriesList([]); -}; - - - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_ = [[1,2]]; + } + } + return msg; +}; + /** - * @enum {number} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - IDENTITIES: 1, - PROOF: 2 +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; + /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.ResultCase} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV0(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter + ); + } }; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -16424,8 +18541,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(opt_includeInstance, this); }; @@ -16434,15 +18551,14 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - identities: (f = msg.getIdentities()) && proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + stateTransitionHash: msg.getStateTransitionHash_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -16456,23 +18572,23 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0; + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -16480,19 +18596,12 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.deserializeBinaryFromReader); - msg.setIdentities(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStateTransitionHash(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -16507,9 +18616,9 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16517,174 +18626,113 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdenti /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getIdentities(); - if (f != null) { - writer.writeMessage( + f = message.getStateTransitionHash_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, - f, - proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes.serializeBinaryToWriter + f ); } - f = message.getProof(); - if (f != null) { - writer.writeMessage( + f = message.getProve(); + if (f) { + writer.writeBool( 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f ); } }; /** - * optional IdentitiesByPublicKeyHashes identities = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.getIdentities = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.IdentitiesByPublicKeyHashes|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.setIdentities = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this + * optional bytes state_transition_hash = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.clearIdentities = function() { - return this.setIdentities(undefined); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * Returns whether this field is set. - * @return {boolean} + * optional bytes state_transition_hash = 1; + * This is a type-conversion wrapper around `getStateTransitionHash()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.hasIdentities = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStateTransitionHash())); }; /** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * optional bytes state_transition_hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStateTransitionHash()` + * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStateTransitionHash())); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.setStateTransitionHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * Returns whether this field is set. + * optional bool prove = 2; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional GetIdentitiesByPublicKeyHashesResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} + * optional WaitForStateTransitionResultRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0, 1)); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.GetIdentitiesByPublicKeyHashesResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -16693,7 +18741,7 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -16707,21 +18755,21 @@ proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse.prototype * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_[0])); }; @@ -16739,8 +18787,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject(opt_includeInstance, this); }; @@ -16749,13 +18797,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.toOb * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -16769,23 +18817,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.toObject = fun /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest; - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse; + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -16793,8 +18841,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBin var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -16810,9 +18858,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.deserializeBin * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16820,26 +18868,52 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.seri /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} message + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter ); } }; - - +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + ERROR: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0])); +}; + + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -16853,8 +18927,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(opt_includeInstance, this); }; @@ -16863,14 +18937,15 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - publicKeyHash: msg.getPublicKeyHash_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + error: (f = msg.getError()) && proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -16884,23 +18959,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0; - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0; + return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -16908,12 +18983,19 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setPublicKeyHash(value); + var value = new proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryFromReader); + msg.setError(value); break; case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -16928,9 +19010,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -16938,113 +19020,174 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByP /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getPublicKeyHash_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getError(); + if (f != null) { + writer.writeMessage( 1, - f + f, + proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.serializeBinaryToWriter ); } - f = message.getProve(); - if (f) { - writer.writeBool( + f = message.getProof(); + if (f != null) { + writer.writeMessage( 2, - f + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; /** - * optional bytes public_key_hash = 1; - * @return {string} + * optional StateTransitionBroadcastError error = 1; + * @return {?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getError = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError, 1)); }; /** - * optional bytes public_key_hash = 1; - * This is a type-conversion wrapper around `getPublicKeyHash()` - * @return {string} + * @param {?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setError = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getPublicKeyHash())); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearError = function() { + return this.setError(undefined); }; /** - * optional bytes public_key_hash = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPublicKeyHash()` - * @return {!Uint8Array} + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getPublicKeyHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getPublicKeyHash())); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasError = function() { + return jspb.Message.getField(this, 1) != null; }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} returns this + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.setPublicKeyHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * optional bool prove = 2; + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} returns this + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; /** - * optional GetIdentityByPublicKeyHashRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this +*/ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0, 1)); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.GetIdentityByPublicKeyHashRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} returns this + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional WaitForStateTransitionResultResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} + */ +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -17053,7 +19196,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.clea * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -17067,21 +19210,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashRequest.prototype.hasV * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_[0])); }; @@ -17099,8 +19242,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject(opt_includeInstance, this); }; @@ -17109,13 +19252,13 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.toO * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -17129,23 +19272,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.toObject = fu /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse; - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -17153,8 +19296,8 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBi var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -17170,9 +19313,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.deserializeBi * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -17180,50 +19323,24 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.ser /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter ); } }; -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - IDENTITY: 1, - PROOF: 2 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0])); -}; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -17239,8 +19356,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(opt_includeInstance, this); }; @@ -17249,15 +19366,14 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityBy * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - identity: msg.getIdentity_asB64(), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { @@ -17271,23 +19387,23 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityBy /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0; - return proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -17295,18 +19411,12 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityBy var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setIdentity(value); + var value = /** @type {number} */ (reader.readInt32()); + msg.setHeight(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); break; default: reader.skipField(); @@ -17321,9 +19431,9 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityBy * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -17331,196 +19441,89 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityBy /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeBytes( + f = message.getHeight(); + if (f !== 0) { + writer.writeInt32( 1, f ); } - f = message.getProof(); - if (f != null) { - writer.writeMessage( + f = message.getProve(); + if (f) { + writer.writeBool( 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + f ); } }; /** - * optional bytes identity = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes identity = 1; - * This is a type-conversion wrapper around `getIdentity()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getIdentity())); -}; - - -/** - * optional bytes identity = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdentity()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getIdentity_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getIdentity())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setIdentity = function(value) { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], value); -}; - - -/** - * Clears the field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearIdentity = function() { - return jspb.Message.setOneofField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasIdentity = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * optional int32 height = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; /** - * Returns whether this field is set. + * optional bool prove = 2; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasProof = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; /** - * optional GetIdentityByPublicKeyHashResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} + * optional GetConsensusParamsRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.GetIdentityByPublicKeyHashResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -17529,7 +19532,7 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.cle * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -17543,21 +19546,21 @@ proto.org.dash.platform.dapi.v0.GetIdentityByPublicKeyHashResponse.prototype.has * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_[0])); }; @@ -17575,8 +19578,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.toObject(opt_includeInstance, this); }; @@ -17585,13 +19588,13 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.to * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -17605,23 +19608,23 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.toObject = f /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest; - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -17629,8 +19632,8 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeB var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -17646,9 +19649,9 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.deserializeB * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -17656,18 +19659,18 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.se /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter ); } }; @@ -17689,8 +19692,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(opt_includeInstance, this); }; @@ -17699,14 +19702,15 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject = function(includeInstance, msg) { var f, obj = { - stateTransitionHash: msg.getStateTransitionHash_asB64(), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + maxBytes: jspb.Message.getFieldWithDefault(msg, 1, ""), + maxGas: jspb.Message.getFieldWithDefault(msg, 2, ""), + timeIotaMs: jspb.Message.getFieldWithDefault(msg, 3, "") }; if (includeInstance) { @@ -17720,23 +19724,23 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0; - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -17744,12 +19748,16 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setStateTransitionHash(value); + var value = /** @type {string} */ (reader.readString()); + msg.setMaxBytes(value); break; case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setProve(value); + var value = /** @type {string} */ (reader.readString()); + msg.setMaxGas(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setTimeIotaMs(value); break; default: reader.skipField(); @@ -17764,9 +19772,9 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -17774,152 +19782,91 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForState /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getStateTransitionHash_asU8(); + f = message.getMaxBytes(); if (f.length > 0) { - writer.writeBytes( + writer.writeString( 1, f ); } - f = message.getProve(); - if (f) { - writer.writeBool( + f = message.getMaxGas(); + if (f.length > 0) { + writer.writeString( 2, f ); } + f = message.getTimeIotaMs(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } }; /** - * optional bytes state_transition_hash = 1; + * optional string max_bytes = 1; * @return {string} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getMaxBytes = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes state_transition_hash = 1; - * This is a type-conversion wrapper around `getStateTransitionHash()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getStateTransitionHash())); -}; - - -/** - * optional bytes state_transition_hash = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getStateTransitionHash()` - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getStateTransitionHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getStateTransitionHash())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.setStateTransitionHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; - - -/** - * optional bool prove = 2; - * @return {boolean} + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setMaxBytes = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} returns this + * optional string max_gas = 2; + * @return {string} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getMaxGas = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * optional WaitForStateTransitionResultRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0, 1)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} returns this -*/ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setMaxGas = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest} returns this + * optional string time_iota_ms = 3; + * @return {string} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.clearV0 = function() { - return this.setV0(undefined); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getTimeIotaMs = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.prototype.hasV0 = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setTimeIotaMs = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); }; -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_ = [[1]]; - -/** - * @enum {number} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase = { - VERSION_NOT_SET: 0, - V0: 1 -}; - -/** - * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_[0])); -}; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -17935,8 +19882,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(opt_includeInstance, this); }; @@ -17945,13 +19892,15 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.t * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(includeInstance, f) + maxAgeNumBlocks: jspb.Message.getFieldWithDefault(msg, 1, ""), + maxAgeDuration: jspb.Message.getFieldWithDefault(msg, 2, ""), + maxBytes: jspb.Message.getFieldWithDefault(msg, 3, "") }; if (includeInstance) { @@ -17965,23 +19914,23 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse; - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -17989,9 +19938,16 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserialize var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader); - msg.setV0(value); + var value = /** @type {string} */ (reader.readString()); + msg.setMaxAgeNumBlocks(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setMaxAgeDuration(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setMaxBytes(value); break; default: reader.skipField(); @@ -18006,9 +19962,9 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.deserialize * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18016,52 +19972,93 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.s /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getV0(); - if (f != null) { - writer.writeMessage( + f = message.getMaxAgeNumBlocks(); + if (f.length > 0) { + writer.writeString( 1, - f, - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter + f + ); + } + f = message.getMaxAgeDuration(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getMaxBytes(); + if (f.length > 0) { + writer.writeString( + 3, + f ); } }; +/** + * optional string max_age_num_blocks = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxAgeNumBlocks = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxAgeNumBlocks = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + /** - * @enum {number} + * optional string max_age_duration = 2; + * @return {string} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase = { - RESULT_NOT_SET: 0, - ERROR: 1, - PROOF: 2 +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxAgeDuration = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; + /** - * @return {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase} + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxAgeDuration = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string max_bytes = 3; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxBytes = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this + */ +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxBytes = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); }; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -18075,8 +20072,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(opt_includeInstance, this); }; @@ -18085,15 +20082,14 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - error: (f = msg.getError()) && proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.toObject(includeInstance, f), - proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), - metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) + block: (f = msg.getBlock()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(includeInstance, f), + evidence: (f = msg.getEvidence()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(includeInstance, f) }; if (includeInstance) { @@ -18107,23 +20103,23 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0; - return proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0; + return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -18131,19 +20127,14 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.deserializeBinaryFromReader); - msg.setError(value); + var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader); + msg.setBlock(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.Proof; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); - msg.setProof(value); - break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); + var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader); + msg.setEvidence(value); break; default: reader.skipField(); @@ -18158,9 +20149,9 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18168,64 +20159,56 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getError(); + f = message.getBlock(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter ); } - f = message.getProof(); + f = message.getEvidence(); if (f != null) { writer.writeMessage( 2, f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter ); } }; /** - * optional StateTransitionBroadcastError error = 1; - * @return {?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} + * optional ConsensusParamsBlock block = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getError = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError, 1)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.getBlock = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setError = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.setBlock = function(value) { + return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearError = function() { - return this.setError(undefined); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.clearBlock = function() { + return this.setBlock(undefined); }; @@ -18233,36 +20216,36 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasError = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.hasBlock = function() { return jspb.Message.getField(this, 1) != null; }; /** - * optional Proof proof = 2; - * @return {?proto.org.dash.platform.dapi.v0.Proof} + * optional ConsensusParamsEvidence evidence = 2; + * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getProof = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.getEvidence = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence, 2)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.setEvidence = function(value) { + return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearProof = function() { - return this.setProof(undefined); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.clearEvidence = function() { + return this.setEvidence(undefined); }; @@ -18270,72 +20253,35 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStat * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.hasEvidence = function() { return jspb.Message.getField(this, 2) != null; }; /** - * optional ResponseMetadata metadata = 3; - * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.getMetadata = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); -}; - - -/** - * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this -*/ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.setMetadata = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} returns this - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.clearMetadata = function() { - return this.setMetadata(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0.prototype.hasMetadata = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional WaitForStateTransitionResultResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} + * optional GetConsensusParamsResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} returns this */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -18344,7 +20290,7 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.c * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -18358,21 +20304,21 @@ proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.prototype.h * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_[0])); }; @@ -18390,8 +20336,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject(opt_includeInstance, this); }; @@ -18400,13 +20346,13 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.toObject = f * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -18420,23 +20366,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.toObject = function(in /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -18444,8 +20390,8 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromR var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -18461,9 +20407,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.deserializeBinaryFromR * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18471,18 +20417,18 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.serializeBin /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter ); } }; @@ -18504,8 +20450,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(opt_includeInstance, this); }; @@ -18514,14 +20460,13 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - height: jspb.Message.getFieldWithDefault(msg, 1, 0), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + prove: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) }; if (includeInstance) { @@ -18535,23 +20480,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -18559,10 +20504,6 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readInt32()); - msg.setHeight(value); - break; - case 2: var value = /** @type {boolean} */ (reader.readBool()); msg.setProve(value); break; @@ -18579,9 +20520,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18589,23 +20530,16 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getHeight(); - if (f !== 0) { - writer.writeInt32( - 1, - f - ); - } f = message.getProve(); if (f) { writer.writeBool( - 2, + 1, f ); } @@ -18613,65 +20547,47 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequ /** - * optional int32 height = 1; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.getHeight = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.setHeight = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional bool prove = 2; + * optional bool prove = 1; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 1, value); }; /** - * optional GetConsensusParamsRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} + * optional GetProtocolVersionUpgradeStateRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.GetConsensusParamsRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -18680,7 +20596,7 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.clearV0 = fu * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -18694,21 +20610,21 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest.prototype.hasV0 = func * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_[0])); }; @@ -18726,8 +20642,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.toObject(opt_includeInstance, this); }; @@ -18736,13 +20652,13 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.toObject = * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -18756,23 +20672,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.toObject = function(i /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -18780,8 +20696,8 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFrom var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -18797,9 +20713,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.deserializeBinaryFrom * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18807,24 +20723,50 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.serializeBi /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter ); } }; +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase = { + RESULT_NOT_SET: 0, + VERSIONS: 1, + PROOF: 2 +}; + +/** + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0])); +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -18840,8 +20782,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(opt_includeInstance, this); }; @@ -18850,15 +20792,15 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - maxBytes: jspb.Message.getFieldWithDefault(msg, 1, ""), - maxGas: jspb.Message.getFieldWithDefault(msg, 2, ""), - timeIotaMs: jspb.Message.getFieldWithDefault(msg, 3, "") + versions: (f = msg.getVersions()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(includeInstance, f), + proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), + metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; if (includeInstance) { @@ -18872,23 +20814,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -18896,16 +20838,19 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxBytes(value); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader); + msg.setVersions(value); break; case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxGas(value); + var value = new proto.org.dash.platform.dapi.v0.Proof; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); + msg.setProof(value); break; case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setTimeIotaMs(value); + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -18920,9 +20865,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -18930,90 +20875,46 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getMaxBytes(); - if (f.length > 0) { - writer.writeString( + f = message.getVersions(); + if (f != null) { + writer.writeMessage( 1, - f + f, + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter ); } - f = message.getMaxGas(); - if (f.length > 0) { - writer.writeString( + f = message.getProof(); + if (f != null) { + writer.writeMessage( 2, - f + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter ); } - f = message.getTimeIotaMs(); - if (f.length > 0) { - writer.writeString( + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( 3, - f + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; -/** - * optional string max_bytes = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getMaxBytes = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setMaxBytes = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string max_gas = 2; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getMaxGas = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setMaxGas = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional string time_iota_ms = 3; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.getTimeIotaMs = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - /** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} returns this + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.prototype.setTimeIotaMs = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); -}; - - +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.repeatedFields_ = [1]; @@ -19030,8 +20931,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(opt_includeInstance, this); }; @@ -19040,15 +20941,14 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject = function(includeInstance, msg) { var f, obj = { - maxAgeNumBlocks: jspb.Message.getFieldWithDefault(msg, 1, ""), - maxAgeDuration: jspb.Message.getFieldWithDefault(msg, 2, ""), - maxBytes: jspb.Message.getFieldWithDefault(msg, 3, "") + versionsList: jspb.Message.toObjectList(msg.getVersionsList(), + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject, includeInstance) }; if (includeInstance) { @@ -19062,23 +20962,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19086,16 +20986,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxAgeNumBlocks(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxAgeDuration(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setMaxBytes(value); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader); + msg.addVersions(value); break; default: reader.skipField(); @@ -19110,9 +21003,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -19120,87 +21013,58 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEviden /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getMaxAgeNumBlocks(); + f = message.getVersionsList(); if (f.length > 0) { - writer.writeString( + writer.writeRepeatedMessage( 1, - f - ); - } - f = message.getMaxAgeDuration(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getMaxBytes(); - if (f.length > 0) { - writer.writeString( - 3, - f + f, + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter ); } }; /** - * optional string max_age_num_blocks = 1; - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxAgeNumBlocks = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxAgeNumBlocks = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string max_age_duration = 2; - * @return {string} + * repeated VersionEntry versions = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxAgeDuration = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.getVersionsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, 1)); }; /** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this - */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxAgeDuration = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.setVersionsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * optional string max_bytes = 3; - * @return {string} + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry=} opt_value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.getMaxBytes = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.addVersions = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, opt_index); }; /** - * @param {string} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} returns this + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.prototype.setMaxBytes = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.clearVersionsList = function() { + return this.setVersionsList([]); }; @@ -19220,8 +21084,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject(opt_includeInstance, this); }; @@ -19230,14 +21094,14 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject = function(includeInstance, msg) { var f, obj = { - block: (f = msg.getBlock()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.toObject(includeInstance, f), - evidence: (f = msg.getEvidence()) && proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.toObject(includeInstance, f) + versionNumber: jspb.Message.getFieldWithDefault(msg, 1, 0), + voteCount: jspb.Message.getFieldWithDefault(msg, 2, 0) }; if (includeInstance) { @@ -19251,23 +21115,23 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0; - return proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19275,14 +21139,12 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.deserializeBinaryFromReader); - msg.setBlock(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setVersionNumber(value); break; case 2: - var value = new proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.deserializeBinaryFromReader); - msg.setEvidence(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setVoteCount(value); break; default: reader.skipField(); @@ -19297,9 +21159,9 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -19307,56 +21169,90 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getBlock(); - if (f != null) { - writer.writeMessage( + f = message.getVersionNumber(); + if (f !== 0) { + writer.writeUint32( 1, - f, - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock.serializeBinaryToWriter + f ); } - f = message.getEvidence(); - if (f != null) { - writer.writeMessage( + f = message.getVoteCount(); + if (f !== 0) { + writer.writeUint32( 2, - f, - proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence.serializeBinaryToWriter + f ); } }; /** - * optional ConsensusParamsBlock block = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} + * optional uint32 version_number = 1; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.getBlock = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.getVersionNumber = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsBlock|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.setVersionNumber = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint32 vote_count = 2; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.getVoteCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.setVoteCount = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional Versions versions = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getVersions = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.setBlock = function(value) { - return jspb.Message.setWrapperField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setVersions = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.clearBlock = function() { - return this.setBlock(undefined); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearVersions = function() { + return this.setVersions(undefined); }; @@ -19364,36 +21260,36 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.hasBlock = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasVersions = function() { return jspb.Message.getField(this, 1) != null; }; /** - * optional ConsensusParamsEvidence evidence = 2; - * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} + * optional Proof proof = 2; + * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.getEvidence = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence, 2)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getProof = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.ConsensusParamsEvidence|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.setEvidence = function(value) { - return jspb.Message.setWrapperField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.clearEvidence = function() { - return this.setEvidence(undefined); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearProof = function() { + return this.setProof(undefined); }; @@ -19401,35 +21297,72 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsRes * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0.prototype.hasEvidence = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; /** - * optional GetConsensusParamsResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} + * optional ResponseMetadata metadata = 3; + * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getMetadata = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.GetConsensusParamsResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setMetadata = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearMetadata = function() { + return this.setMetadata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasMetadata = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional GetProtocolVersionUpgradeStateResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} returns this +*/ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -19438,7 +21371,7 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.clearV0 = f * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -19452,21 +21385,21 @@ proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse.prototype.hasV0 = fun * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_[0])); }; @@ -19484,8 +21417,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObject(opt_includeInstance, this); }; @@ -19494,13 +21427,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -19514,23 +21447,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.toObject = /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19538,8 +21471,8 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializ var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -19555,9 +21488,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.deserializ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -19565,18 +21498,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype. /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter ); } }; @@ -19598,8 +21531,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(opt_includeInstance, this); }; @@ -19608,13 +21541,15 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - prove: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) + startProTxHash: msg.getStartProTxHash_asB64(), + count: jspb.Message.getFieldWithDefault(msg, 2, 0), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) }; if (includeInstance) { @@ -19628,23 +21563,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19652,6 +21587,14 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco var field = reader.getFieldNumber(); switch (field) { case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStartProTxHash(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCount(value); + break; + case 3: var value = /** @type {boolean} */ (reader.readBool()); msg.setProve(value); break; @@ -19668,9 +21611,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -19678,16 +21621,30 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; + f = message.getStartProTxHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getCount(); + if (f !== 0) { + writer.writeUint32( + 2, + f + ); + } f = message.getProve(); if (f) { writer.writeBool( - 1, + 3, f ); } @@ -19695,47 +21652,107 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtoco /** - * optional bool prove = 1; + * optional bytes start_pro_tx_hash = 1; + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes start_pro_tx_hash = 1; + * This is a type-conversion wrapper around `getStartProTxHash()` + * @return {string} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStartProTxHash())); +}; + + +/** + * optional bytes start_pro_tx_hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStartProTxHash()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStartProTxHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setStartProTxHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional uint32 count = 2; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setCount = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional bool prove = 3; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); }; /** - * optional GetProtocolVersionUpgradeStateRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} + * optional GetProtocolVersionUpgradeVoteStatusRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.GetProtocolVersionUpgradeStateRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -19744,7 +21761,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype. * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -19758,21 +21775,21 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateRequest.prototype. * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_[0])); }; @@ -19790,8 +21807,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toObject(opt_includeInstance, this); }; @@ -19800,13 +21817,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -19820,23 +21837,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.toObject /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19844,8 +21861,8 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deseriali var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -19861,9 +21878,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.deseriali * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -19871,18 +21888,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter ); } }; @@ -19897,22 +21914,22 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.serialize * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase = { RESULT_NOT_SET: 0, VERSIONS: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0])); }; @@ -19930,8 +21947,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(opt_includeInstance, this); }; @@ -19940,13 +21957,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - versions: (f = msg.getVersions()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(includeInstance, f), + versions: (f = msg.getVersions()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(includeInstance, f), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -19962,23 +21979,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -19986,8 +22003,8 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader); msg.setVersions(value); break; case 2: @@ -20013,9 +22030,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -20023,18 +22040,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getVersions(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter ); } f = message.getProof(); @@ -20062,7 +22079,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.repeatedFields_ = [1]; @@ -20079,8 +22096,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(opt_includeInstance, this); }; @@ -20089,14 +22106,14 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject = function(includeInstance, msg) { var f, obj = { - versionsList: jspb.Message.toObjectList(msg.getVersionsList(), - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject, includeInstance) + versionSignalsList: jspb.Message.toObjectList(msg.getVersionSignalsList(), + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject, includeInstance) }; if (includeInstance) { @@ -20110,23 +22127,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -20134,9 +22151,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader); - msg.addVersions(value); + var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader); + msg.addVersionSignals(value); break; default: reader.skipField(); @@ -20151,9 +22168,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -20161,58 +22178,58 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getVersionsList(); + f = message.getVersionSignalsList(); if (f.length > 0) { writer.writeRepeatedMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter ); } }; /** - * repeated VersionEntry versions = 1; - * @return {!Array} + * repeated VersionSignal version_signals = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.getVersionsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.getVersionSignalsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, 1)); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} returns this + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.setVersionsList = function(value) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.setVersionSignalsList = function(value) { return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry=} opt_value + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal=} opt_value * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.addVersions = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry, opt_index); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.addVersionSignals = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, opt_index); }; /** * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions.prototype.clearVersionsList = function() { - return this.setVersionsList([]); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.clearVersionSignalsList = function() { + return this.setVersionSignalsList([]); }; @@ -20232,8 +22249,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject(opt_includeInstance, this); }; @@ -20242,14 +22259,14 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject = function(includeInstance, msg) { var f, obj = { - versionNumber: jspb.Message.getFieldWithDefault(msg, 1, 0), - voteCount: jspb.Message.getFieldWithDefault(msg, 2, 0) + proTxHash: msg.getProTxHash_asB64(), + version: jspb.Message.getFieldWithDefault(msg, 2, 0) }; if (includeInstance) { @@ -20263,23 +22280,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal; + return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -20287,12 +22304,12 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readUint32()); - msg.setVersionNumber(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setProTxHash(value); break; case 2: var value = /** @type {number} */ (reader.readUint32()); - msg.setVoteCount(value); + msg.setVersion(value); break; default: reader.skipField(); @@ -20307,9 +22324,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -20317,20 +22334,20 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} message + * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getVersionNumber(); - if (f !== 0) { - writer.writeUint32( + f = message.getProTxHash_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, f ); } - f = message.getVoteCount(); + f = message.getVersion(); if (f !== 0) { writer.writeUint32( 2, @@ -20341,65 +22358,89 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** - * optional uint32 version_number = 1; - * @return {number} + * optional bytes pro_tx_hash = 1; + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.getVersionNumber = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} returns this + * optional bytes pro_tx_hash = 1; + * This is a type-conversion wrapper around `getProTxHash()` + * @return {string} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.setVersionNumber = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getProTxHash())); }; /** - * optional uint32 vote_count = 2; + * optional bytes pro_tx_hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getProTxHash()` + * @return {!Uint8Array} + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getProTxHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} returns this + */ +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.setProTxHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional uint32 version = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.getVoteCount = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getVersion = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.VersionEntry.prototype.setVoteCount = function(value) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.setVersion = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; /** - * optional Versions versions = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} + * optional VersionSignals versions = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getVersions = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getVersions = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.Versions|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setVersions = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setVersions = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearVersions = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearVersions = function() { return this.setVersions(undefined); }; @@ -20408,7 +22449,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasVersions = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasVersions = function() { return jspb.Message.getField(this, 1) != null; }; @@ -20417,7 +22458,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -20425,18 +22466,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -20445,7 +22486,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -20454,7 +22495,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -20462,18 +22503,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -20482,35 +22523,35 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtoc * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetProtocolVersionUpgradeStateResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} + * optional GetProtocolVersionUpgradeVoteStatusResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.GetProtocolVersionUpgradeStateResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -20519,7 +22560,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -20533,21 +22574,21 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeStateResponse.prototype * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_[0])); }; @@ -20565,8 +22606,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject(opt_includeInstance, this); }; @@ -20575,13 +22616,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.proto * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -20595,23 +22636,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.toObj /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinaryFromReader(msg, reader); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -20619,8 +22660,8 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deser var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -20636,9 +22677,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.deser * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -20646,18 +22687,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.proto /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter ); } }; @@ -20679,8 +22720,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(opt_includeInstance, this); }; @@ -20689,15 +22730,16 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - startProTxHash: msg.getStartProTxHash_asB64(), + startEpoch: (f = msg.getStartEpoch()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), count: jspb.Message.getFieldWithDefault(msg, 2, 0), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) + ascending: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 4, false) }; if (includeInstance) { @@ -20711,23 +22753,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -20735,14 +22777,19 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setStartProTxHash(value); + var value = new google_protobuf_wrappers_pb.UInt32Value; + reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); + msg.setStartEpoch(value); break; case 2: var value = /** @type {number} */ (reader.readUint32()); msg.setCount(value); break; case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setAscending(value); + break; + case 4: var value = /** @type {boolean} */ (reader.readBool()); msg.setProve(value); break; @@ -20759,9 +22806,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -20769,17 +22816,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getStartProTxHash_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getStartEpoch(); + if (f != null) { + writer.writeMessage( 1, - f + f, + google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter ); } f = message.getCount(); @@ -20789,55 +22837,57 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr f ); } - f = message.getProve(); + f = message.getAscending(); if (f) { writer.writeBool( 3, f ); } + f = message.getProve(); + if (f) { + writer.writeBool( + 4, + f + ); + } }; /** - * optional bytes start_pro_tx_hash = 1; - * @return {string} + * optional google.protobuf.UInt32Value start_epoch = 1; + * @return {?proto.google.protobuf.UInt32Value} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getStartEpoch = function() { + return /** @type{?proto.google.protobuf.UInt32Value} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 1)); }; /** - * optional bytes start_pro_tx_hash = 1; - * This is a type-conversion wrapper around `getStartProTxHash()` - * @return {string} - */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getStartProTxHash())); + * @param {?proto.google.protobuf.UInt32Value|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this +*/ +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setStartEpoch = function(value) { + return jspb.Message.setWrapperField(this, 1, value); }; /** - * optional bytes start_pro_tx_hash = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getStartProTxHash()` - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getStartProTxHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getStartProTxHash())); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.clearStartEpoch = function() { + return this.setStartEpoch(undefined); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setStartProTxHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.hasStartEpoch = function() { + return jspb.Message.getField(this, 1) != null; }; @@ -20845,62 +22895,80 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetPr * optional uint32 count = 2; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getCount = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getCount = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setCount = function(value) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setCount = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; /** - * optional bool prove = 3; + * optional bool ascending = 3; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.getProve = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getAscending = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0.prototype.setProve = function(value) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setAscending = function(value) { return jspb.Message.setProto3BooleanField(this, 3, value); }; /** - * optional GetProtocolVersionUpgradeVoteStatusRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} + * optional bool prove = 4; + * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.GetProtocolVersionUpgradeVoteStatusRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} returns this + * @param {boolean} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 4, value); +}; + + +/** + * optional GetEpochsInfoRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0, 1)); +}; + + +/** + * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -20909,7 +22977,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.proto * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -20923,21 +22991,21 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusRequest.proto * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_[0])); }; @@ -20955,8 +23023,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject(opt_includeInstance, this); }; @@ -20965,13 +23033,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -20985,23 +23053,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.toOb /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21009,8 +23077,8 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.dese var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -21026,9 +23094,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.dese * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21036,18 +23104,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter ); } }; @@ -21062,22 +23130,22 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.seri * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase = { RESULT_NOT_SET: 0, - VERSIONS: 1, + EPOCHS: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0])); }; @@ -21095,8 +23163,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(opt_includeInstance, this); }; @@ -21105,13 +23173,13 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - versions: (f = msg.getVersions()) && proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(includeInstance, f), + epochs: (f = msg.getEpochs()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(includeInstance, f), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -21127,23 +23195,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21151,9 +23219,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader); - msg.setVersions(value); + var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader); + msg.setEpochs(value); break; case 2: var value = new proto.org.dash.platform.dapi.v0.Proof; @@ -21178,9 +23246,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21188,18 +23256,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getVersions(); + f = message.getEpochs(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter ); } f = message.getProof(); @@ -21227,7 +23295,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * @private {!Array} * @const */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.repeatedFields_ = [1]; +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.repeatedFields_ = [1]; @@ -21244,8 +23312,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(opt_includeInstance, this); }; @@ -21254,14 +23322,14 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject = function(includeInstance, msg) { var f, obj = { - versionSignalsList: jspb.Message.toObjectList(msg.getVersionSignalsList(), - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject, includeInstance) + epochInfosList: jspb.Message.toObjectList(msg.getEpochInfosList(), + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject, includeInstance) }; if (includeInstance) { @@ -21275,23 +23343,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21299,9 +23367,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader); - msg.addVersionSignals(value); + var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader); + msg.addEpochInfos(value); break; default: reader.skipField(); @@ -21316,9 +23384,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21326,58 +23394,58 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getVersionSignalsList(); + f = message.getEpochInfosList(); if (f.length > 0) { writer.writeRepeatedMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter ); } }; /** - * repeated VersionSignal version_signals = 1; - * @return {!Array} + * repeated EpochInfo epoch_infos = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.getVersionSignalsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, 1)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.getEpochInfosList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, 1)); }; /** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} returns this + * @param {!Array} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.setVersionSignalsList = function(value) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.setEpochInfosList = function(value) { return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal=} opt_value + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo=} opt_value * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.addVersionSignals = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal, opt_index); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.addEpochInfos = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, opt_index); }; /** * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals.prototype.clearVersionSignalsList = function() { - return this.setVersionSignalsList([]); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.clearEpochInfosList = function() { + return this.setEpochInfosList([]); }; @@ -21397,8 +23465,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject(opt_includeInstance, this); }; @@ -21407,14 +23475,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject = function(includeInstance, msg) { var f, obj = { - proTxHash: msg.getProTxHash_asB64(), - version: jspb.Message.getFieldWithDefault(msg, 2, 0) + number: jspb.Message.getFieldWithDefault(msg, 1, 0), + firstBlockHeight: jspb.Message.getFieldWithDefault(msg, 2, 0), + firstCoreBlockHeight: jspb.Message.getFieldWithDefault(msg, 3, 0), + startTime: jspb.Message.getFieldWithDefault(msg, 4, 0), + feeMultiplier: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0), + protocolVersion: jspb.Message.getFieldWithDefault(msg, 6, 0) }; if (includeInstance) { @@ -21428,23 +23500,23 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal; - return proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo; + return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21452,12 +23524,28 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setProTxHash(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setNumber(value); break; case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setFirstBlockHeight(value); + break; + case 3: var value = /** @type {number} */ (reader.readUint32()); - msg.setVersion(value); + msg.setFirstCoreBlockHeight(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint64()); + msg.setStartTime(value); + break; + case 5: + var value = /** @type {number} */ (reader.readDouble()); + msg.setFeeMultiplier(value); + break; + case 6: + var value = /** @type {number} */ (reader.readUint32()); + msg.setProtocolVersion(value); break; default: reader.skipField(); @@ -21472,9 +23560,9 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21482,114 +23570,190 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} message + * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getProTxHash_asU8(); - if (f.length > 0) { - writer.writeBytes( - 1, - f - ); - } - f = message.getVersion(); - if (f !== 0) { - writer.writeUint32( - 2, - f - ); - } +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getNumber(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getFirstBlockHeight(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } + f = message.getFirstCoreBlockHeight(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } + f = message.getStartTime(); + if (f !== 0) { + writer.writeUint64( + 4, + f + ); + } + f = message.getFeeMultiplier(); + if (f !== 0.0) { + writer.writeDouble( + 5, + f + ); + } + f = message.getProtocolVersion(); + if (f !== 0) { + writer.writeUint32( + 6, + f + ); + } +}; + + +/** + * optional uint32 number = 1; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getNumber = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setNumber = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint64 first_block_height = 2; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFirstBlockHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFirstBlockHeight = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional uint32 first_core_block_height = 3; + * @return {number} + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFirstCoreBlockHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + */ +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFirstCoreBlockHeight = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); }; /** - * optional bytes pro_tx_hash = 1; - * @return {string} + * optional uint64 start_time = 4; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getStartTime = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); }; /** - * optional bytes pro_tx_hash = 1; - * This is a type-conversion wrapper around `getProTxHash()` - * @return {string} + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getProTxHash())); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setStartTime = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); }; /** - * optional bytes pro_tx_hash = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getProTxHash()` - * @return {!Uint8Array} + * optional double fee_multiplier = 5; + * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getProTxHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getProTxHash())); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFeeMultiplier = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} returns this + * @param {number} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.setProTxHash = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFeeMultiplier = function(value) { + return jspb.Message.setProto3FloatField(this, 5, value); }; /** - * optional uint32 version = 2; + * optional uint32 protocol_version = 6; * @return {number} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.getVersion = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getProtocolVersion = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); }; /** * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignal.prototype.setVersion = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setProtocolVersion = function(value) { + return jspb.Message.setProto3IntField(this, 6, value); }; /** - * optional VersionSignals versions = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} + * optional EpochInfos epochs = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getVersions = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals, 1)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getEpochs = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.VersionSignals|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setVersions = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setEpochs = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearVersions = function() { - return this.setVersions(undefined); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearEpochs = function() { + return this.setEpochs(undefined); }; @@ -21597,7 +23761,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasVersions = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasEpochs = function() { return jspb.Message.getField(this, 1) != null; }; @@ -21606,7 +23770,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -21614,18 +23778,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -21634,7 +23798,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -21643,7 +23807,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -21651,18 +23815,18 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -21671,35 +23835,35 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetP * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetProtocolVersionUpgradeVoteStatusResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} + * optional GetEpochsInfoResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.GetProtocolVersionUpgradeVoteStatusResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -21708,7 +23872,7 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prot * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -21722,21 +23886,21 @@ proto.org.dash.platform.dapi.v0.GetProtocolVersionUpgradeVoteStatusResponse.prot * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase = { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetPathElementsRequest.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetPathElementsRequest.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.oneofGroups_[0])); }; @@ -21754,8 +23918,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsRequest.toObject(opt_includeInstance, this); }; @@ -21764,13 +23928,13 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.toObject = functi * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -21784,23 +23948,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.toObject = function(include /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsRequest; + return proto.org.dash.platform.dapi.v0.GetPathElementsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21808,8 +23972,8 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -21825,9 +23989,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.deserializeBinaryFromReader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21835,24 +23999,31 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.serializeBinary = /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.serializeBinaryToWriter ); } }; +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.repeatedFields_ = [1,2]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -21868,8 +24039,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.toObject(opt_includeInstance, this); }; @@ -21878,16 +24049,15 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prot * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.toObject = function(includeInstance, msg) { var f, obj = { - startEpoch: (f = msg.getStartEpoch()) && google_protobuf_wrappers_pb.UInt32Value.toObject(includeInstance, f), - count: jspb.Message.getFieldWithDefault(msg, 2, 0), - ascending: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), - prove: jspb.Message.getBooleanFieldWithDefault(msg, 4, false) + pathList: msg.getPathList_asB64(), + keysList: msg.getKeysList_asB64(), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) }; if (includeInstance) { @@ -21901,23 +24071,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.toOb /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0; + return proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -21925,19 +24095,14 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.dese var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new google_protobuf_wrappers_pb.UInt32Value; - reader.readMessage(value,google_protobuf_wrappers_pb.UInt32Value.deserializeBinaryFromReader); - msg.setStartEpoch(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addPath(value); break; case 2: - var value = /** @type {number} */ (reader.readUint32()); - msg.setCount(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addKeys(value); break; case 3: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setAscending(value); - break; - case 4: var value = /** @type {boolean} */ (reader.readBool()); msg.setProve(value); break; @@ -21954,9 +24119,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.dese * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -21964,38 +24129,30 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prot /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getStartEpoch(); - if (f != null) { - writer.writeMessage( + f = message.getPathList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( 1, - f, - google_protobuf_wrappers_pb.UInt32Value.serializeBinaryToWriter - ); - } - f = message.getCount(); - if (f !== 0) { - writer.writeUint32( - 2, f ); } - f = message.getAscending(); - if (f) { - writer.writeBool( - 3, + f = message.getKeysList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 2, f ); } f = message.getProve(); if (f) { writer.writeBool( - 4, + 3, f ); } @@ -22003,120 +24160,169 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.seri /** - * optional google.protobuf.UInt32Value start_epoch = 1; - * @return {?proto.google.protobuf.UInt32Value} + * repeated bytes path = 1; + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getPathList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * repeated bytes path = 1; + * This is a type-conversion wrapper around `getPathList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getPathList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getPathList())); +}; + + +/** + * repeated bytes path = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPathList()` + * @return {!Array} + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getPathList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getPathList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.setPathList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getStartEpoch = function() { - return /** @type{?proto.google.protobuf.UInt32Value} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt32Value, 1)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.addPath = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; /** - * @param {?proto.google.protobuf.UInt32Value|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this -*/ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setStartEpoch = function(value) { - return jspb.Message.setWrapperField(this, 1, value); + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this + */ +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.clearPathList = function() { + return this.setPathList([]); }; /** - * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + * repeated bytes keys = 2; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.clearStartEpoch = function() { - return this.setStartEpoch(undefined); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getKeysList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); }; /** - * Returns whether this field is set. - * @return {boolean} + * repeated bytes keys = 2; + * This is a type-conversion wrapper around `getKeysList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.hasStartEpoch = function() { - return jspb.Message.getField(this, 1) != null; +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getKeysList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getKeysList())); }; /** - * optional uint32 count = 2; - * @return {number} + * repeated bytes keys = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKeysList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getCount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getKeysList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getKeysList())); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setCount = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.setKeysList = function(value) { + return jspb.Message.setField(this, 2, value || []); }; /** - * optional bool ascending = 3; - * @return {boolean} + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getAscending = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.addKeys = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); }; /** - * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setAscending = function(value) { - return jspb.Message.setProto3BooleanField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.clearKeysList = function() { + return this.setKeysList([]); }; /** - * optional bool prove = 4; + * optional bool prove = 3; * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.getProve = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); }; /** * @param {boolean} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0.prototype.setProve = function(value) { - return jspb.Message.setProto3BooleanField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); }; /** - * optional GetEpochsInfoRequestV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} + * optional GetPathElementsRequestV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0, 1)); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.GetEpochsInfoRequestV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetPathElementsRequest.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsRequest} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -22125,7 +24331,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.clearV0 = functio * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsRequest.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -22139,21 +24345,21 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoRequest.prototype.hasV0 = function( * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_ = [[1]]; +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.oneofGroups_ = [[1]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase = { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.VersionCase = { VERSION_NOT_SET: 0, V0: 1 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase} + * @return {proto.org.dash.platform.dapi.v0.GetPathElementsResponse.VersionCase} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.getVersionCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.getVersionCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetPathElementsResponse.VersionCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.oneofGroups_[0])); }; @@ -22171,8 +24377,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.toObject(opt_includeInstance, this); }; @@ -22181,13 +24387,13 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.toObject = funct * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.toObject = function(includeInstance, msg) { var f, obj = { - v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(includeInstance, f) + v0: (f = msg.getV0()) && proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.toObject(includeInstance, f) }; if (includeInstance) { @@ -22201,23 +24407,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.toObject = function(includ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse; + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -22225,8 +24431,8 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReade var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader); + var value = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.deserializeBinaryFromReader); msg.setV0(value); break; default: @@ -22242,9 +24448,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.deserializeBinaryFromReade * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -22252,18 +24458,18 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getV0(); if (f != null) { writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.serializeBinaryToWriter ); } }; @@ -22278,22 +24484,22 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.serializeBinaryToWriter = * @private {!Array>} * @const */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_ = [[1,2]]; +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_ = [[1,2]]; /** * @enum {number} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase = { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.ResultCase = { RESULT_NOT_SET: 0, - EPOCHS: 1, + ELEMENTS: 1, PROOF: 2 }; /** - * @return {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase} + * @return {proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.ResultCase} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getResultCase = function() { - return /** @type {proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0])); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.getResultCase = function() { + return /** @type {proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.ResultCase} */(jspb.Message.computeOneofCase(this, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_[0])); }; @@ -22311,8 +24517,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.toObject(opt_includeInstance, this); }; @@ -22321,13 +24527,13 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.toObject = function(includeInstance, msg) { var f, obj = { - epochs: (f = msg.getEpochs()) && proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(includeInstance, f), + elements: (f = msg.getElements()) && proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.toObject(includeInstance, f), proof: (f = msg.getProof()) && proto.org.dash.platform.dapi.v0.Proof.toObject(includeInstance, f), metadata: (f = msg.getMetadata()) && proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject(includeInstance, f) }; @@ -22343,23 +24549,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.to /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0; + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -22367,157 +24573,19 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.de var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader); - msg.setEpochs(value); + var value = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.deserializeBinaryFromReader); + msg.setElements(value); break; case 2: var value = new proto.org.dash.platform.dapi.v0.Proof; reader.readMessage(value,proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader); msg.setProof(value); break; - case 3: - var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); - msg.setMetadata(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getEpochs(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter - ); - } - f = message.getProof(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter - ); - } - f = message.getMetadata(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter - ); - } -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.repeatedFields_ = [1]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.toObject = function(includeInstance, msg) { - var f, obj = { - epochInfosList: jspb.Message.toObjectList(msg.getEpochInfosList(), - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject, includeInstance) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo; - reader.readMessage(value,proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader); - msg.addEpochInfos(value); + case 3: + var value = new proto.org.dash.platform.dapi.v0.ResponseMetadata; + reader.readMessage(value,proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader); + msg.setMetadata(value); break; default: reader.skipField(); @@ -22532,9 +24600,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -22542,61 +24610,46 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getEpochInfosList(); - if (f.length > 0) { - writer.writeRepeatedMessage( + f = message.getElements(); + if (f != null) { + writer.writeMessage( 1, f, - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.serializeBinaryToWriter + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter + ); + } + f = message.getMetadata(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter ); } }; -/** - * repeated EpochInfo epoch_infos = 1; - * @return {!Array} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.getEpochInfosList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} returns this -*/ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.setEpochInfosList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo=} opt_value - * @param {number=} opt_index - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.addEpochInfos = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo, opt_index); -}; - /** - * Clears the list making it empty but non-null. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} returns this + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos.prototype.clearEpochInfosList = function() { - return this.setEpochInfosList([]); -}; - - +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.repeatedFields_ = [1]; @@ -22613,8 +24666,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.toObject = function(opt_includeInstance) { - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject(opt_includeInstance, this); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.toObject = function(opt_includeInstance) { + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.toObject(opt_includeInstance, this); }; @@ -22623,17 +24676,13 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} msg The msg instance to transform. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.toObject = function(includeInstance, msg) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.toObject = function(includeInstance, msg) { var f, obj = { - number: jspb.Message.getFieldWithDefault(msg, 1, 0), - firstBlockHeight: jspb.Message.getFieldWithDefault(msg, 2, 0), - firstCoreBlockHeight: jspb.Message.getFieldWithDefault(msg, 3, 0), - startTime: jspb.Message.getFieldWithDefault(msg, 4, 0), - feeMultiplier: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0) + elementsList: msg.getElementsList_asB64() }; if (includeInstance) { @@ -22647,23 +24696,23 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinary = function(bytes) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo; - return proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader(msg, reader); + var msg = new proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements; + return proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} msg The message object to deserialize into. + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.deserializeBinaryFromReader = function(msg, reader) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -22671,24 +24720,8 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {number} */ (reader.readUint32()); - msg.setNumber(value); - break; - case 2: - var value = /** @type {number} */ (reader.readUint64()); - msg.setFirstBlockHeight(value); - break; - case 3: - var value = /** @type {number} */ (reader.readUint32()); - msg.setFirstCoreBlockHeight(value); - break; - case 4: - var value = /** @type {number} */ (reader.readUint64()); - msg.setStartTime(value); - break; - case 5: - var value = /** @type {number} */ (reader.readDouble()); - msg.setFeeMultiplier(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addElements(value); break; default: reader.skipField(); @@ -22703,9 +24736,9 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.serializeBinary = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter(this, writer); + proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -22713,165 +24746,108 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.Ep /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} message + * @param {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.serializeBinaryToWriter = function(message, writer) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getNumber(); - if (f !== 0) { - writer.writeUint32( + f = message.getElementsList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( 1, f ); } - f = message.getFirstBlockHeight(); - if (f !== 0) { - writer.writeUint64( - 2, - f - ); - } - f = message.getFirstCoreBlockHeight(); - if (f !== 0) { - writer.writeUint32( - 3, - f - ); - } - f = message.getStartTime(); - if (f !== 0) { - writer.writeUint64( - 4, - f - ); - } - f = message.getFeeMultiplier(); - if (f !== 0.0) { - writer.writeDouble( - 5, - f - ); - } -}; - - -/** - * optional uint32 number = 1; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getNumber = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setNumber = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional uint64 first_block_height = 2; - * @return {number} - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFirstBlockHeight = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this - */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFirstBlockHeight = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); }; /** - * optional uint32 first_core_block_height = 3; - * @return {number} + * repeated bytes elements = 1; + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFirstCoreBlockHeight = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.getElementsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + * repeated bytes elements = 1; + * This is a type-conversion wrapper around `getElementsList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFirstCoreBlockHeight = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.getElementsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getElementsList())); }; /** - * optional uint64 start_time = 4; - * @return {number} + * repeated bytes elements = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getElementsList()` + * @return {!Array} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getStartTime = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.getElementsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getElementsList())); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + * @param {!(Array|Array)} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setStartTime = function(value) { - return jspb.Message.setProto3IntField(this, 4, value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.setElementsList = function(value) { + return jspb.Message.setField(this, 1, value || []); }; /** - * optional double fee_multiplier = 5; - * @return {number} + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.getFeeMultiplier = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.addElements = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; /** - * @param {number} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo} returns this + * Clears the list making it empty but non-null. + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfo.prototype.setFeeMultiplier = function(value) { - return jspb.Message.setProto3FloatField(this, 5, value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements.prototype.clearElementsList = function() { + return this.setElementsList([]); }; /** - * optional EpochInfos epochs = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} + * optional Elements elements = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getEpochs = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos, 1)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.getElements = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.EpochInfos|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setEpochs = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.setElements = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearEpochs = function() { - return this.setEpochs(undefined); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.clearElements = function() { + return this.setElements(undefined); }; @@ -22879,7 +24855,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasEpochs = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.hasElements = function() { return jspb.Message.getField(this, 1) != null; }; @@ -22888,7 +24864,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * optional Proof proof = 2; * @return {?proto.org.dash.platform.dapi.v0.Proof} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getProof = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.getProof = function() { return /** @type{?proto.org.dash.platform.dapi.v0.Proof} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.Proof, 2)); }; @@ -22896,18 +24872,18 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr /** * @param {?proto.org.dash.platform.dapi.v0.Proof|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setProof = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.setProof = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearProof = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.clearProof = function() { return this.setProof(undefined); }; @@ -22916,7 +24892,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasProof = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.hasProof = function() { return jspb.Message.getField(this, 2) != null; }; @@ -22925,7 +24901,7 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * optional ResponseMetadata metadata = 3; * @return {?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.getMetadata = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.getMetadata = function() { return /** @type{?proto.org.dash.platform.dapi.v0.ResponseMetadata} */ ( jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.ResponseMetadata, 3)); }; @@ -22933,18 +24909,18 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr /** * @param {?proto.org.dash.platform.dapi.v0.ResponseMetadata|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.setMetadata = function(value) { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.setMetadata = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.clearMetadata = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.clearMetadata = function() { return this.setMetadata(undefined); }; @@ -22953,35 +24929,35 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.pr * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0.prototype.hasMetadata = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.prototype.hasMetadata = function() { return jspb.Message.getField(this, 3) != null; }; /** - * optional GetEpochsInfoResponseV0 v0 = 1; - * @return {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} + * optional GetPathElementsResponseV0 v0 = 1; + * @return {?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.getV0 = function() { - return /** @type{?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0} */ ( - jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0, 1)); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.getV0 = function() { + return /** @type{?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0} */ ( + jspb.Message.getWrapperField(this, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0, 1)); }; /** - * @param {?proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.GetEpochsInfoResponseV0|undefined} value - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} returns this + * @param {?proto.org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0|undefined} value + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.setV0 = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.oneofGroups_[0], value); +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.setV0 = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.org.dash.platform.dapi.v0.GetPathElementsResponse.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. - * @return {!proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse} returns this + * @return {!proto.org.dash.platform.dapi.v0.GetPathElementsResponse} returns this */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.clearV0 = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.clearV0 = function() { return this.setV0(undefined); }; @@ -22990,9 +24966,20 @@ proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.clearV0 = functi * Returns whether this field is set. * @return {boolean} */ -proto.org.dash.platform.dapi.v0.GetEpochsInfoResponse.prototype.hasV0 = function() { +proto.org.dash.platform.dapi.v0.GetPathElementsResponse.prototype.hasV0 = function() { return jspb.Message.getField(this, 1) != null; }; +/** + * @enum {number} + */ +proto.org.dash.platform.dapi.v0.KeyPurpose = { + AUTHENTICATION: 0, + ENCRYPTION: 1, + DECRYPTION: 2, + TRANSFER: 3, + VOTING: 5 +}; + goog.object.extend(exports, proto.org.dash.platform.dapi.v0); diff --git a/packages/dapi-grpc/clients/platform/v0/web/platform_pb_service.d.ts b/packages/dapi-grpc/clients/platform/v0/web/platform_pb_service.d.ts index eb5810b9258..c172c02896d 100644 --- a/packages/dapi-grpc/clients/platform/v0/web/platform_pb_service.d.ts +++ b/packages/dapi-grpc/clients/platform/v0/web/platform_pb_service.d.ts @@ -22,22 +22,40 @@ type PlatformgetIdentity = { readonly responseType: typeof platform_pb.GetIdentityResponse; }; -type PlatformgetIdentities = { +type PlatformgetIdentityKeys = { readonly methodName: string; readonly service: typeof Platform; readonly requestStream: false; readonly responseStream: false; - readonly requestType: typeof platform_pb.GetIdentitiesRequest; - readonly responseType: typeof platform_pb.GetIdentitiesResponse; + readonly requestType: typeof platform_pb.GetIdentityKeysRequest; + readonly responseType: typeof platform_pb.GetIdentityKeysResponse; }; -type PlatformgetIdentityKeys = { +type PlatformgetIdentitiesContractKeys = { readonly methodName: string; readonly service: typeof Platform; readonly requestStream: false; readonly responseStream: false; - readonly requestType: typeof platform_pb.GetIdentityKeysRequest; - readonly responseType: typeof platform_pb.GetIdentityKeysResponse; + readonly requestType: typeof platform_pb.GetIdentitiesContractKeysRequest; + readonly responseType: typeof platform_pb.GetIdentitiesContractKeysResponse; +}; + +type PlatformgetIdentityNonce = { + readonly methodName: string; + readonly service: typeof Platform; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof platform_pb.GetIdentityNonceRequest; + readonly responseType: typeof platform_pb.GetIdentityNonceResponse; +}; + +type PlatformgetIdentityContractNonce = { + readonly methodName: string; + readonly service: typeof Platform; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof platform_pb.GetIdentityContractNonceRequest; + readonly responseType: typeof platform_pb.GetIdentityContractNonceResponse; }; type PlatformgetIdentityBalance = { @@ -103,15 +121,6 @@ type PlatformgetDocuments = { readonly responseType: typeof platform_pb.GetDocumentsResponse; }; -type PlatformgetIdentitiesByPublicKeyHashes = { - readonly methodName: string; - readonly service: typeof Platform; - readonly requestStream: false; - readonly responseStream: false; - readonly requestType: typeof platform_pb.GetIdentitiesByPublicKeyHashesRequest; - readonly responseType: typeof platform_pb.GetIdentitiesByPublicKeyHashesResponse; -}; - type PlatformgetIdentityByPublicKeyHash = { readonly methodName: string; readonly service: typeof Platform; @@ -166,12 +175,23 @@ type PlatformgetEpochsInfo = { readonly responseType: typeof platform_pb.GetEpochsInfoResponse; }; +type PlatformgetPathElements = { + readonly methodName: string; + readonly service: typeof Platform; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof platform_pb.GetPathElementsRequest; + readonly responseType: typeof platform_pb.GetPathElementsResponse; +}; + export class Platform { static readonly serviceName: string; static readonly broadcastStateTransition: PlatformbroadcastStateTransition; static readonly getIdentity: PlatformgetIdentity; - static readonly getIdentities: PlatformgetIdentities; static readonly getIdentityKeys: PlatformgetIdentityKeys; + static readonly getIdentitiesContractKeys: PlatformgetIdentitiesContractKeys; + static readonly getIdentityNonce: PlatformgetIdentityNonce; + static readonly getIdentityContractNonce: PlatformgetIdentityContractNonce; static readonly getIdentityBalance: PlatformgetIdentityBalance; static readonly getIdentityBalanceAndRevision: PlatformgetIdentityBalanceAndRevision; static readonly getProofs: PlatformgetProofs; @@ -179,13 +199,13 @@ export class Platform { static readonly getDataContractHistory: PlatformgetDataContractHistory; static readonly getDataContracts: PlatformgetDataContracts; static readonly getDocuments: PlatformgetDocuments; - static readonly getIdentitiesByPublicKeyHashes: PlatformgetIdentitiesByPublicKeyHashes; static readonly getIdentityByPublicKeyHash: PlatformgetIdentityByPublicKeyHash; static readonly waitForStateTransitionResult: PlatformwaitForStateTransitionResult; static readonly getConsensusParams: PlatformgetConsensusParams; static readonly getProtocolVersionUpgradeState: PlatformgetProtocolVersionUpgradeState; static readonly getProtocolVersionUpgradeVoteStatus: PlatformgetProtocolVersionUpgradeVoteStatus; static readonly getEpochsInfo: PlatformgetEpochsInfo; + static readonly getPathElements: PlatformgetPathElements; } export type ServiceError = { message: string, code: number; metadata: grpc.Metadata } @@ -238,15 +258,6 @@ export class PlatformClient { requestMessage: platform_pb.GetIdentityRequest, callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentityResponse|null) => void ): UnaryResponse; - getIdentities( - requestMessage: platform_pb.GetIdentitiesRequest, - metadata: grpc.Metadata, - callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentitiesResponse|null) => void - ): UnaryResponse; - getIdentities( - requestMessage: platform_pb.GetIdentitiesRequest, - callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentitiesResponse|null) => void - ): UnaryResponse; getIdentityKeys( requestMessage: platform_pb.GetIdentityKeysRequest, metadata: grpc.Metadata, @@ -256,6 +267,33 @@ export class PlatformClient { requestMessage: platform_pb.GetIdentityKeysRequest, callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentityKeysResponse|null) => void ): UnaryResponse; + getIdentitiesContractKeys( + requestMessage: platform_pb.GetIdentitiesContractKeysRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentitiesContractKeysResponse|null) => void + ): UnaryResponse; + getIdentitiesContractKeys( + requestMessage: platform_pb.GetIdentitiesContractKeysRequest, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentitiesContractKeysResponse|null) => void + ): UnaryResponse; + getIdentityNonce( + requestMessage: platform_pb.GetIdentityNonceRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentityNonceResponse|null) => void + ): UnaryResponse; + getIdentityNonce( + requestMessage: platform_pb.GetIdentityNonceRequest, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentityNonceResponse|null) => void + ): UnaryResponse; + getIdentityContractNonce( + requestMessage: platform_pb.GetIdentityContractNonceRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentityContractNonceResponse|null) => void + ): UnaryResponse; + getIdentityContractNonce( + requestMessage: platform_pb.GetIdentityContractNonceRequest, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentityContractNonceResponse|null) => void + ): UnaryResponse; getIdentityBalance( requestMessage: platform_pb.GetIdentityBalanceRequest, metadata: grpc.Metadata, @@ -319,15 +357,6 @@ export class PlatformClient { requestMessage: platform_pb.GetDocumentsRequest, callback: (error: ServiceError|null, responseMessage: platform_pb.GetDocumentsResponse|null) => void ): UnaryResponse; - getIdentitiesByPublicKeyHashes( - requestMessage: platform_pb.GetIdentitiesByPublicKeyHashesRequest, - metadata: grpc.Metadata, - callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentitiesByPublicKeyHashesResponse|null) => void - ): UnaryResponse; - getIdentitiesByPublicKeyHashes( - requestMessage: platform_pb.GetIdentitiesByPublicKeyHashesRequest, - callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentitiesByPublicKeyHashesResponse|null) => void - ): UnaryResponse; getIdentityByPublicKeyHash( requestMessage: platform_pb.GetIdentityByPublicKeyHashRequest, metadata: grpc.Metadata, @@ -382,5 +411,14 @@ export class PlatformClient { requestMessage: platform_pb.GetEpochsInfoRequest, callback: (error: ServiceError|null, responseMessage: platform_pb.GetEpochsInfoResponse|null) => void ): UnaryResponse; + getPathElements( + requestMessage: platform_pb.GetPathElementsRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetPathElementsResponse|null) => void + ): UnaryResponse; + getPathElements( + requestMessage: platform_pb.GetPathElementsRequest, + callback: (error: ServiceError|null, responseMessage: platform_pb.GetPathElementsResponse|null) => void + ): UnaryResponse; } diff --git a/packages/dapi-grpc/clients/platform/v0/web/platform_pb_service.js b/packages/dapi-grpc/clients/platform/v0/web/platform_pb_service.js index f0857a73bce..c25b97c0595 100644 --- a/packages/dapi-grpc/clients/platform/v0/web/platform_pb_service.js +++ b/packages/dapi-grpc/clients/platform/v0/web/platform_pb_service.js @@ -28,22 +28,40 @@ Platform.getIdentity = { responseType: platform_pb.GetIdentityResponse }; -Platform.getIdentities = { - methodName: "getIdentities", +Platform.getIdentityKeys = { + methodName: "getIdentityKeys", service: Platform, requestStream: false, responseStream: false, - requestType: platform_pb.GetIdentitiesRequest, - responseType: platform_pb.GetIdentitiesResponse + requestType: platform_pb.GetIdentityKeysRequest, + responseType: platform_pb.GetIdentityKeysResponse }; -Platform.getIdentityKeys = { - methodName: "getIdentityKeys", +Platform.getIdentitiesContractKeys = { + methodName: "getIdentitiesContractKeys", service: Platform, requestStream: false, responseStream: false, - requestType: platform_pb.GetIdentityKeysRequest, - responseType: platform_pb.GetIdentityKeysResponse + requestType: platform_pb.GetIdentitiesContractKeysRequest, + responseType: platform_pb.GetIdentitiesContractKeysResponse +}; + +Platform.getIdentityNonce = { + methodName: "getIdentityNonce", + service: Platform, + requestStream: false, + responseStream: false, + requestType: platform_pb.GetIdentityNonceRequest, + responseType: platform_pb.GetIdentityNonceResponse +}; + +Platform.getIdentityContractNonce = { + methodName: "getIdentityContractNonce", + service: Platform, + requestStream: false, + responseStream: false, + requestType: platform_pb.GetIdentityContractNonceRequest, + responseType: platform_pb.GetIdentityContractNonceResponse }; Platform.getIdentityBalance = { @@ -109,15 +127,6 @@ Platform.getDocuments = { responseType: platform_pb.GetDocumentsResponse }; -Platform.getIdentitiesByPublicKeyHashes = { - methodName: "getIdentitiesByPublicKeyHashes", - service: Platform, - requestStream: false, - responseStream: false, - requestType: platform_pb.GetIdentitiesByPublicKeyHashesRequest, - responseType: platform_pb.GetIdentitiesByPublicKeyHashesResponse -}; - Platform.getIdentityByPublicKeyHash = { methodName: "getIdentityByPublicKeyHash", service: Platform, @@ -172,6 +181,15 @@ Platform.getEpochsInfo = { responseType: platform_pb.GetEpochsInfoResponse }; +Platform.getPathElements = { + methodName: "getPathElements", + service: Platform, + requestStream: false, + responseStream: false, + requestType: platform_pb.GetPathElementsRequest, + responseType: platform_pb.GetPathElementsResponse +}; + exports.Platform = Platform; function PlatformClient(serviceHost, options) { @@ -241,11 +259,11 @@ PlatformClient.prototype.getIdentity = function getIdentity(requestMessage, meta }; }; -PlatformClient.prototype.getIdentities = function getIdentities(requestMessage, metadata, callback) { +PlatformClient.prototype.getIdentityKeys = function getIdentityKeys(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Platform.getIdentities, { + var client = grpc.unary(Platform.getIdentityKeys, { request: requestMessage, host: this.serviceHost, metadata: metadata, @@ -272,11 +290,73 @@ PlatformClient.prototype.getIdentities = function getIdentities(requestMessage, }; }; -PlatformClient.prototype.getIdentityKeys = function getIdentityKeys(requestMessage, metadata, callback) { +PlatformClient.prototype.getIdentitiesContractKeys = function getIdentitiesContractKeys(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Platform.getIdentityKeys, { + var client = grpc.unary(Platform.getIdentitiesContractKeys, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +PlatformClient.prototype.getIdentityNonce = function getIdentityNonce(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(Platform.getIdentityNonce, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +PlatformClient.prototype.getIdentityContractNonce = function getIdentityContractNonce(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(Platform.getIdentityContractNonce, { request: requestMessage, host: this.serviceHost, metadata: metadata, @@ -520,11 +600,11 @@ PlatformClient.prototype.getDocuments = function getDocuments(requestMessage, me }; }; -PlatformClient.prototype.getIdentitiesByPublicKeyHashes = function getIdentitiesByPublicKeyHashes(requestMessage, metadata, callback) { +PlatformClient.prototype.getIdentityByPublicKeyHash = function getIdentityByPublicKeyHash(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Platform.getIdentitiesByPublicKeyHashes, { + var client = grpc.unary(Platform.getIdentityByPublicKeyHash, { request: requestMessage, host: this.serviceHost, metadata: metadata, @@ -551,11 +631,11 @@ PlatformClient.prototype.getIdentitiesByPublicKeyHashes = function getIdentities }; }; -PlatformClient.prototype.getIdentityByPublicKeyHash = function getIdentityByPublicKeyHash(requestMessage, metadata, callback) { +PlatformClient.prototype.waitForStateTransitionResult = function waitForStateTransitionResult(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Platform.getIdentityByPublicKeyHash, { + var client = grpc.unary(Platform.waitForStateTransitionResult, { request: requestMessage, host: this.serviceHost, metadata: metadata, @@ -582,11 +662,11 @@ PlatformClient.prototype.getIdentityByPublicKeyHash = function getIdentityByPubl }; }; -PlatformClient.prototype.waitForStateTransitionResult = function waitForStateTransitionResult(requestMessage, metadata, callback) { +PlatformClient.prototype.getConsensusParams = function getConsensusParams(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Platform.waitForStateTransitionResult, { + var client = grpc.unary(Platform.getConsensusParams, { request: requestMessage, host: this.serviceHost, metadata: metadata, @@ -613,11 +693,11 @@ PlatformClient.prototype.waitForStateTransitionResult = function waitForStateTra }; }; -PlatformClient.prototype.getConsensusParams = function getConsensusParams(requestMessage, metadata, callback) { +PlatformClient.prototype.getProtocolVersionUpgradeState = function getProtocolVersionUpgradeState(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Platform.getConsensusParams, { + var client = grpc.unary(Platform.getProtocolVersionUpgradeState, { request: requestMessage, host: this.serviceHost, metadata: metadata, @@ -644,11 +724,11 @@ PlatformClient.prototype.getConsensusParams = function getConsensusParams(reques }; }; -PlatformClient.prototype.getProtocolVersionUpgradeState = function getProtocolVersionUpgradeState(requestMessage, metadata, callback) { +PlatformClient.prototype.getProtocolVersionUpgradeVoteStatus = function getProtocolVersionUpgradeVoteStatus(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Platform.getProtocolVersionUpgradeState, { + var client = grpc.unary(Platform.getProtocolVersionUpgradeVoteStatus, { request: requestMessage, host: this.serviceHost, metadata: metadata, @@ -675,11 +755,11 @@ PlatformClient.prototype.getProtocolVersionUpgradeState = function getProtocolVe }; }; -PlatformClient.prototype.getProtocolVersionUpgradeVoteStatus = function getProtocolVersionUpgradeVoteStatus(requestMessage, metadata, callback) { +PlatformClient.prototype.getEpochsInfo = function getEpochsInfo(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Platform.getProtocolVersionUpgradeVoteStatus, { + var client = grpc.unary(Platform.getEpochsInfo, { request: requestMessage, host: this.serviceHost, metadata: metadata, @@ -706,11 +786,11 @@ PlatformClient.prototype.getProtocolVersionUpgradeVoteStatus = function getProto }; }; -PlatformClient.prototype.getEpochsInfo = function getEpochsInfo(requestMessage, metadata, callback) { +PlatformClient.prototype.getPathElements = function getPathElements(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } - var client = grpc.unary(Platform.getEpochsInfo, { + var client = grpc.unary(Platform.getPathElements, { request: requestMessage, host: this.serviceHost, metadata: metadata, diff --git a/packages/dapi-grpc/package.json b/packages/dapi-grpc/package.json index 1af84023709..511bd177a77 100644 --- a/packages/dapi-grpc/package.json +++ b/packages/dapi-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-grpc", - "version": "0.25.21", + "version": "1.0.0-dev.15", "description": "DAPI GRPC definition file and generated clients", "browser": "browser.js", "main": "node.js", diff --git a/packages/dapi-grpc/protos/core/v0/core.proto b/packages/dapi-grpc/protos/core/v0/core.proto index 2ba33d19534..1bc206dc3d5 100644 --- a/packages/dapi-grpc/protos/core/v0/core.proto +++ b/packages/dapi-grpc/protos/core/v0/core.proto @@ -3,20 +3,23 @@ syntax = "proto3"; package org.dash.platform.dapi.v0; service Core { - rpc getStatus (GetStatusRequest) returns (GetStatusResponse); + rpc getBlockchainStatus (GetBlockchainStatusRequest) returns (GetBlockchainStatusResponse); + rpc getMasternodeStatus (GetMasternodeStatusRequest) returns (GetMasternodeStatusResponse); rpc getBlock (GetBlockRequest) returns (GetBlockResponse); + rpc getBestBlockHeight (GetBestBlockHeightRequest) returns (GetBestBlockHeightResponse); rpc broadcastTransaction (BroadcastTransactionRequest) returns (BroadcastTransactionResponse); rpc getTransaction (GetTransactionRequest) returns (GetTransactionResponse); rpc getEstimatedTransactionFee (GetEstimatedTransactionFeeRequest) returns (GetEstimatedTransactionFeeResponse); rpc subscribeToBlockHeadersWithChainLocks (BlockHeadersWithChainLocksRequest) returns (stream BlockHeadersWithChainLocksResponse); rpc subscribeToTransactionsWithProofs (TransactionsWithProofsRequest) returns (stream TransactionsWithProofsResponse); + rpc subscribeToMasternodeList (MasternodeListRequest) returns (stream MasternodeListResponse); } -message GetStatusRequest { +message GetBlockchainStatusRequest { } -message GetStatusResponse { +message GetBlockchainStatusResponse { message Version { uint32 protocol = 1; uint32 software = 2; @@ -47,25 +50,6 @@ message GetStatusResponse { double sync_progress = 8; } - message Masternode { - enum Status { - UNKNOWN = 0; - WAITING_FOR_PROTX = 1; - POSE_BANNED = 2; - REMOVED = 3; - OPERATOR_KEY_CHANGED = 4; - PROTX_IP_CHANGED = 5; - READY = 6; - ERROR = 7; - } - - Status status = 1; - bytes pro_tx_hash = 2; - uint32 pose_penalty = 3; - bool is_synced = 4; - double sync_progress = 5; - } - message NetworkFee { double relay = 1; double incremental = 2; @@ -81,10 +65,32 @@ message GetStatusResponse { Status status = 3; double sync_progress = 4; Chain chain = 5; - Masternode masternode = 6; Network network = 7; } +message GetMasternodeStatusRequest { + +} + +message GetMasternodeStatusResponse { + enum Status { + UNKNOWN = 0; + WAITING_FOR_PROTX = 1; + POSE_BANNED = 2; + REMOVED = 3; + OPERATOR_KEY_CHANGED = 4; + PROTX_IP_CHANGED = 5; + READY = 6; + ERROR = 7; + } + + Status status = 1; + bytes pro_tx_hash = 2; + uint32 pose_penalty = 3; + bool is_synced = 4; + double sync_progress = 5; +} + message GetBlockRequest { oneof block { uint32 height = 1; @@ -96,6 +102,14 @@ message GetBlockResponse { bytes block = 1; } +message GetBestBlockHeightRequest { + +} + +message GetBestBlockHeightResponse { + uint32 height = 1; +} + message BroadcastTransactionRequest { bytes transaction = 1; bool allow_high_fees = 2; @@ -182,3 +196,11 @@ message RawTransactions { message InstantSendLockMessages { repeated bytes messages = 1; } + +message MasternodeListRequest { + +} + +message MasternodeListResponse { + bytes masternode_list_diff = 1; +} diff --git a/packages/dapi-grpc/protos/platform/v0/platform.proto b/packages/dapi-grpc/protos/platform/v0/platform.proto index 5407772dc0c..2c11696570e 100644 --- a/packages/dapi-grpc/protos/platform/v0/platform.proto +++ b/packages/dapi-grpc/protos/platform/v0/platform.proto @@ -10,8 +10,10 @@ service Platform { rpc broadcastStateTransition(BroadcastStateTransitionRequest) returns (BroadcastStateTransitionResponse); rpc getIdentity(GetIdentityRequest) returns (GetIdentityResponse); - rpc getIdentities(GetIdentitiesRequest) returns (GetIdentitiesResponse); rpc getIdentityKeys(GetIdentityKeysRequest) returns (GetIdentityKeysResponse); + rpc getIdentitiesContractKeys(GetIdentitiesContractKeysRequest) returns (GetIdentitiesContractKeysResponse); + rpc getIdentityNonce(GetIdentityNonceRequest) returns (GetIdentityNonceResponse); + rpc getIdentityContractNonce(GetIdentityContractNonceRequest) returns (GetIdentityContractNonceResponse); rpc getIdentityBalance(GetIdentityBalanceRequest) returns (GetIdentityBalanceResponse); rpc getIdentityBalanceAndRevision(GetIdentityBalanceAndRevisionRequest) @@ -23,8 +25,6 @@ service Platform { rpc getDataContracts(GetDataContractsRequest) returns (GetDataContractsResponse); rpc getDocuments(GetDocumentsRequest) returns (GetDocumentsResponse); - rpc getIdentitiesByPublicKeyHashes(GetIdentitiesByPublicKeyHashesRequest) - returns (GetIdentitiesByPublicKeyHashesResponse); rpc getIdentityByPublicKeyHash(GetIdentityByPublicKeyHashRequest) returns (GetIdentityByPublicKeyHashResponse); rpc waitForStateTransitionResult(WaitForStateTransitionResultRequest) @@ -34,6 +34,7 @@ service Platform { rpc getProtocolVersionUpgradeState(GetProtocolVersionUpgradeStateRequest) returns (GetProtocolVersionUpgradeStateResponse); rpc getProtocolVersionUpgradeVoteStatus(GetProtocolVersionUpgradeVoteStatusRequest) returns (GetProtocolVersionUpgradeVoteStatusResponse); rpc getEpochsInfo(GetEpochsInfoRequest) returns (GetEpochsInfoResponse); + rpc getPathElements(GetPathElementsRequest) returns (GetPathElementsResponse); } message Proof { @@ -60,6 +61,14 @@ message StateTransitionBroadcastError { bytes data = 3; } +enum KeyPurpose { + AUTHENTICATION = 0; + ENCRYPTION = 1; + DECRYPTION = 2; + TRANSFER = 3; + VOTING = 5; +} + message BroadcastStateTransitionRequest { bytes state_transition = 1; } message BroadcastStateTransitionResponse {} @@ -74,6 +83,28 @@ message GetIdentityRequest { oneof version { GetIdentityRequestV0 v0 = 1; } } +message GetIdentityNonceRequest { + + message GetIdentityNonceRequestV0 { + bytes identity_id = 1; + bool prove = 2; + } + + oneof version { GetIdentityNonceRequestV0 v0 = 1; } +} + + +message GetIdentityContractNonceRequest { + + message GetIdentityContractNonceRequestV0 { + bytes identity_id = 1; + bytes contract_id = 2; + bool prove = 3; + } + + oneof version { GetIdentityContractNonceRequestV0 v0 = 1; } +} + message GetIdentityBalanceRequest { message GetIdentityBalanceRequestV0 { @@ -107,36 +138,30 @@ message GetIdentityResponse { oneof version { GetIdentityResponseV0 v0 = 1; } } -message GetIdentitiesRequest { +message GetIdentityNonceResponse { - message GetIdentitiesRequestV0 { - repeated bytes ids = 1; - bool prove = 2; + message GetIdentityNonceResponseV0 { + oneof result { + uint64 identity_nonce = 1; + Proof proof = 2; + } + ResponseMetadata metadata = 3; } - oneof version { GetIdentitiesRequestV0 v0 = 1; } + oneof version { GetIdentityNonceResponseV0 v0 = 1; } } -message GetIdentitiesResponse { - - message IdentityValue { bytes value = 1; } - - message IdentityEntry { - bytes key = 1; - IdentityValue value = 2; - } - - message Identities { repeated IdentityEntry identity_entries = 1; } +message GetIdentityContractNonceResponse { - message GetIdentitiesResponseV0 { + message GetIdentityContractNonceResponseV0 { oneof result { - Identities identities = 1; + uint64 identity_contract_nonce = 1; Proof proof = 2; } ResponseMetadata metadata = 3; } - oneof version { GetIdentitiesResponseV0 v0 = 1; } + oneof version { GetIdentityContractNonceResponseV0 v0 = 1; } } message GetIdentityBalanceResponse { @@ -220,6 +245,46 @@ message GetIdentityKeysResponse { oneof version { GetIdentityKeysResponseV0 v0 = 1; } } +message GetIdentitiesContractKeysRequest { + message GetIdentitiesContractKeysRequestV0 { + repeated bytes identities_ids = 1; + bytes contract_id = 2; + optional string document_type_name = 3; + repeated KeyPurpose purposes = 4; + bool prove = 5; + } + + oneof version { + GetIdentitiesContractKeysRequestV0 v0 = 1; + } +} + +message GetIdentitiesContractKeysResponse { + message GetIdentitiesContractKeysResponseV0 { + message PurposeKeys { + KeyPurpose purpose = 1; + repeated bytes keys_bytes = 2; + } + + message IdentityKeys { + bytes identity_id = 1; + repeated PurposeKeys keys = 2; + } + + message IdentitiesKeys { + repeated IdentityKeys entries = 1; + }; + + oneof result { + IdentitiesKeys identities_keys = 1; + Proof proof = 2; + } + ResponseMetadata metadata = 3; + } + + oneof version { GetIdentitiesContractKeysResponseV0 v0 = 1; } +} + message GetProofsRequest { message GetProofsRequestV0 { message DocumentRequest { @@ -234,6 +299,7 @@ message GetProofsRequest { FULL_IDENTITY = 0; BALANCE = 1; KEYS = 2; + REVISION = 3; } bytes identity_id = 1; Type request_type = 2; @@ -365,35 +431,6 @@ message GetDocumentsResponse { oneof version { GetDocumentsResponseV0 v0 = 1; } } -message GetIdentitiesByPublicKeyHashesRequest { - message GetIdentitiesByPublicKeyHashesRequestV0 { - repeated bytes public_key_hashes = 1; - bool prove = 2; - } - oneof version { GetIdentitiesByPublicKeyHashesRequestV0 v0 = 1; } -} - -message GetIdentitiesByPublicKeyHashesResponse { - message PublicKeyHashIdentityEntry { - bytes public_key_hash = 1; - google.protobuf.BytesValue value = 2; - } - - message IdentitiesByPublicKeyHashes { - repeated PublicKeyHashIdentityEntry identity_entries = 1; - } - - message GetIdentitiesByPublicKeyHashesResponseV0 { - oneof result { - IdentitiesByPublicKeyHashes identities = 1; - Proof proof = 2; - } - - ResponseMetadata metadata = 3; - } - oneof version { GetIdentitiesByPublicKeyHashesResponseV0 v0 = 1; } -} - message GetIdentityByPublicKeyHashRequest { message GetIdentityByPublicKeyHashRequestV0 { bytes public_key_hash = 1; @@ -555,6 +592,7 @@ message GetEpochsInfoResponse { uint32 first_core_block_height = 3; uint64 start_time = 4; double fee_multiplier = 5; + uint32 protocol_version = 6; } oneof result { @@ -568,3 +606,34 @@ message GetEpochsInfoResponse { GetEpochsInfoResponseV0 v0 = 1; } } + +message GetPathElementsRequest { + message GetPathElementsRequestV0 { + repeated bytes path = 1; + repeated bytes keys = 2; + bool prove = 3; + } + + oneof version { + GetPathElementsRequestV0 v0 = 1; + } +} + +message GetPathElementsResponse { + message GetPathElementsResponseV0 { + message Elements { + repeated bytes elements = 1; + } + + oneof result { + Elements elements = 1; + Proof proof = 2; + } + ResponseMetadata metadata = 3; + } + + oneof version { + GetPathElementsResponseV0 v0 = 1; + } +} + diff --git a/packages/dapi-grpc/src/core/proto/org.dash.platform.dapi.v0.rs b/packages/dapi-grpc/src/core/proto/org.dash.platform.dapi.v0.rs deleted file mode 100644 index 322464c7958..00000000000 --- a/packages/dapi-grpc/src/core/proto/org.dash.platform.dapi.v0.rs +++ /dev/null @@ -1,666 +0,0 @@ -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetStatusRequest {} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetStatusResponse { - #[prost(message, optional, tag = "1")] - pub version: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub time: ::core::option::Option, - #[prost(enumeration = "get_status_response::Status", tag = "3")] - pub status: i32, - #[prost(double, tag = "4")] - pub sync_progress: f64, - #[prost(message, optional, tag = "5")] - pub chain: ::core::option::Option, - #[prost(message, optional, tag = "6")] - pub masternode: ::core::option::Option, - #[prost(message, optional, tag = "7")] - pub network: ::core::option::Option, -} -/// Nested message and enum types in `GetStatusResponse`. -pub mod get_status_response { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Version { - #[prost(uint32, tag = "1")] - pub protocol: u32, - #[prost(uint32, tag = "2")] - pub software: u32, - #[prost(string, tag = "3")] - pub agent: ::prost::alloc::string::String, - } - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Time { - #[prost(uint32, tag = "1")] - pub now: u32, - #[prost(int32, tag = "2")] - pub offset: i32, - #[prost(uint32, tag = "3")] - pub median: u32, - } - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Chain { - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, - #[prost(uint32, tag = "2")] - pub headers_count: u32, - #[prost(uint32, tag = "3")] - pub blocks_count: u32, - #[prost(bytes = "vec", tag = "4")] - pub best_block_hash: ::prost::alloc::vec::Vec, - #[prost(double, tag = "5")] - pub difficulty: f64, - #[prost(bytes = "vec", tag = "6")] - pub chain_work: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "7")] - pub is_synced: bool, - #[prost(double, tag = "8")] - pub sync_progress: f64, - } - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Masternode { - #[prost(enumeration = "masternode::Status", tag = "1")] - pub status: i32, - #[prost(bytes = "vec", tag = "2")] - pub pro_tx_hash: ::prost::alloc::vec::Vec, - #[prost(uint32, tag = "3")] - pub pose_penalty: u32, - #[prost(bool, tag = "4")] - pub is_synced: bool, - #[prost(double, tag = "5")] - pub sync_progress: f64, - } - /// Nested message and enum types in `Masternode`. - pub mod masternode { - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum Status { - Unknown = 0, - WaitingForProtx = 1, - PoseBanned = 2, - Removed = 3, - OperatorKeyChanged = 4, - ProtxIpChanged = 5, - Ready = 6, - Error = 7, - } - impl Status { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Status::Unknown => "UNKNOWN", - Status::WaitingForProtx => "WAITING_FOR_PROTX", - Status::PoseBanned => "POSE_BANNED", - Status::Removed => "REMOVED", - Status::OperatorKeyChanged => "OPERATOR_KEY_CHANGED", - Status::ProtxIpChanged => "PROTX_IP_CHANGED", - Status::Ready => "READY", - Status::Error => "ERROR", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UNKNOWN" => Some(Self::Unknown), - "WAITING_FOR_PROTX" => Some(Self::WaitingForProtx), - "POSE_BANNED" => Some(Self::PoseBanned), - "REMOVED" => Some(Self::Removed), - "OPERATOR_KEY_CHANGED" => Some(Self::OperatorKeyChanged), - "PROTX_IP_CHANGED" => Some(Self::ProtxIpChanged), - "READY" => Some(Self::Ready), - "ERROR" => Some(Self::Error), - _ => None, - } - } - } - } - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct NetworkFee { - #[prost(double, tag = "1")] - pub relay: f64, - #[prost(double, tag = "2")] - pub incremental: f64, - } - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Network { - #[prost(uint32, tag = "1")] - pub peers_count: u32, - #[prost(message, optional, tag = "2")] - pub fee: ::core::option::Option, - } - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum Status { - NotStarted = 0, - Syncing = 1, - Ready = 2, - Error = 3, - } - impl Status { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Status::NotStarted => "NOT_STARTED", - Status::Syncing => "SYNCING", - Status::Ready => "READY", - Status::Error => "ERROR", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "NOT_STARTED" => Some(Self::NotStarted), - "SYNCING" => Some(Self::Syncing), - "READY" => Some(Self::Ready), - "ERROR" => Some(Self::Error), - _ => None, - } - } - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetBlockRequest { - #[prost(oneof = "get_block_request::Block", tags = "1, 2")] - pub block: ::core::option::Option, -} -/// Nested message and enum types in `GetBlockRequest`. -pub mod get_block_request { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Block { - #[prost(uint32, tag = "1")] - Height(u32), - #[prost(string, tag = "2")] - Hash(::prost::alloc::string::String), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetBlockResponse { - #[prost(bytes = "vec", tag = "1")] - pub block: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BroadcastTransactionRequest { - #[prost(bytes = "vec", tag = "1")] - pub transaction: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "2")] - pub allow_high_fees: bool, - #[prost(bool, tag = "3")] - pub bypass_limits: bool, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BroadcastTransactionResponse { - #[prost(string, tag = "1")] - pub transaction_id: ::prost::alloc::string::String, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetTransactionRequest { - #[prost(string, tag = "1")] - pub id: ::prost::alloc::string::String, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetTransactionResponse { - #[prost(bytes = "vec", tag = "1")] - pub transaction: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "2")] - pub block_hash: ::prost::alloc::vec::Vec, - #[prost(uint32, tag = "3")] - pub height: u32, - #[prost(uint32, tag = "4")] - pub confirmations: u32, - #[prost(bool, tag = "5")] - pub is_instant_locked: bool, - #[prost(bool, tag = "6")] - pub is_chain_locked: bool, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BlockHeadersWithChainLocksRequest { - #[prost(uint32, tag = "3")] - pub count: u32, - #[prost(oneof = "block_headers_with_chain_locks_request::FromBlock", tags = "1, 2")] - pub from_block: ::core::option::Option< - block_headers_with_chain_locks_request::FromBlock, - >, -} -/// Nested message and enum types in `BlockHeadersWithChainLocksRequest`. -pub mod block_headers_with_chain_locks_request { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum FromBlock { - #[prost(bytes, tag = "1")] - FromBlockHash(::prost::alloc::vec::Vec), - #[prost(uint32, tag = "2")] - FromBlockHeight(u32), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BlockHeadersWithChainLocksResponse { - #[prost(oneof = "block_headers_with_chain_locks_response::Responses", tags = "1, 2")] - pub responses: ::core::option::Option< - block_headers_with_chain_locks_response::Responses, - >, -} -/// Nested message and enum types in `BlockHeadersWithChainLocksResponse`. -pub mod block_headers_with_chain_locks_response { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Responses { - #[prost(message, tag = "1")] - BlockHeaders(super::BlockHeaders), - #[prost(bytes, tag = "2")] - ChainLock(::prost::alloc::vec::Vec), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BlockHeaders { - #[prost(bytes = "vec", repeated, tag = "1")] - pub headers: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetEstimatedTransactionFeeRequest { - #[prost(uint32, tag = "1")] - pub blocks: u32, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetEstimatedTransactionFeeResponse { - #[prost(double, tag = "1")] - pub fee: f64, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct TransactionsWithProofsRequest { - #[prost(message, optional, tag = "1")] - pub bloom_filter: ::core::option::Option, - #[prost(uint32, tag = "4")] - pub count: u32, - #[prost(bool, tag = "5")] - pub send_transaction_hashes: bool, - #[prost(oneof = "transactions_with_proofs_request::FromBlock", tags = "2, 3")] - pub from_block: ::core::option::Option, -} -/// Nested message and enum types in `TransactionsWithProofsRequest`. -pub mod transactions_with_proofs_request { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum FromBlock { - #[prost(bytes, tag = "2")] - FromBlockHash(::prost::alloc::vec::Vec), - #[prost(uint32, tag = "3")] - FromBlockHeight(u32), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BloomFilter { - #[prost(bytes = "vec", tag = "1")] - pub v_data: ::prost::alloc::vec::Vec, - #[prost(uint32, tag = "2")] - pub n_hash_funcs: u32, - #[prost(uint32, tag = "3")] - pub n_tweak: u32, - #[prost(uint32, tag = "4")] - pub n_flags: u32, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct TransactionsWithProofsResponse { - #[prost(oneof = "transactions_with_proofs_response::Responses", tags = "1, 2, 3")] - pub responses: ::core::option::Option, -} -/// Nested message and enum types in `TransactionsWithProofsResponse`. -pub mod transactions_with_proofs_response { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Responses { - #[prost(message, tag = "1")] - RawTransactions(super::RawTransactions), - #[prost(message, tag = "2")] - InstantSendLockMessages(super::InstantSendLockMessages), - #[prost(bytes, tag = "3")] - RawMerkleBlock(::prost::alloc::vec::Vec), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct RawTransactions { - #[prost(bytes = "vec", repeated, tag = "1")] - pub transactions: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct InstantSendLockMessages { - #[prost(bytes = "vec", repeated, tag = "1")] - pub messages: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -/// Generated client implementations. -pub mod core_client { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::*; - use tonic::codegen::http::Uri; - #[derive(Debug, Clone)] - pub struct CoreClient { - inner: tonic::client::Grpc, - } - impl CoreClient { - /// Attempt to create a new client by connecting to a given endpoint. - pub async fn connect(dst: D) -> Result - where - D: TryInto, - D::Error: Into, - { - let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; - Ok(Self::new(conn)) - } - } - impl CoreClient - where - T: tonic::client::GrpcService, - T::Error: Into, - T::ResponseBody: Body + Send + 'static, - ::Error: Into + Send, - { - pub fn new(inner: T) -> Self { - let inner = tonic::client::Grpc::new(inner); - Self { inner } - } - pub fn with_origin(inner: T, origin: Uri) -> Self { - let inner = tonic::client::Grpc::with_origin(inner, origin); - Self { inner } - } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> CoreClient> - where - F: tonic::service::Interceptor, - T::ResponseBody: Default, - T: tonic::codegen::Service< - http::Request, - Response = http::Response< - >::ResponseBody, - >, - >, - , - >>::Error: Into + Send + Sync, - { - CoreClient::new(InterceptedService::new(inner, interceptor)) - } - /// Compress requests with the given encoding. - /// - /// This requires the server to support it otherwise it might respond with an - /// error. - #[must_use] - pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.send_compressed(encoding); - self - } - /// Enable decompressing responses. - #[must_use] - pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.accept_compressed(encoding); - self - } - /// Limits the maximum size of a decoded message. - /// - /// Default: `4MB` - #[must_use] - pub fn max_decoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_decoding_message_size(limit); - self - } - /// Limits the maximum size of an encoded message. - /// - /// Default: `usize::MAX` - #[must_use] - pub fn max_encoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_encoding_message_size(limit); - self - } - pub async fn get_status( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Core/getStatus", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert(GrpcMethod::new("org.dash.platform.dapi.v0.Core", "getStatus")); - self.inner.unary(req, path, codec).await - } - pub async fn get_block( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Core/getBlock", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert(GrpcMethod::new("org.dash.platform.dapi.v0.Core", "getBlock")); - self.inner.unary(req, path, codec).await - } - pub async fn broadcast_transaction( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Core/broadcastTransaction", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Core", - "broadcastTransaction", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_transaction( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Core/getTransaction", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new("org.dash.platform.dapi.v0.Core", "getTransaction"), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_estimated_transaction_fee( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Core/getEstimatedTransactionFee", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Core", - "getEstimatedTransactionFee", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn subscribe_to_block_headers_with_chain_locks( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response< - tonic::codec::Streaming, - >, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Core/subscribeToBlockHeadersWithChainLocks", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Core", - "subscribeToBlockHeadersWithChainLocks", - ), - ); - self.inner.server_streaming(req, path, codec).await - } - pub async fn subscribe_to_transactions_with_proofs( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response< - tonic::codec::Streaming, - >, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Core/subscribeToTransactionsWithProofs", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Core", - "subscribeToTransactionsWithProofs", - ), - ); - self.inner.server_streaming(req, path, codec).await - } - } -} diff --git a/packages/dapi-grpc/src/lib.rs b/packages/dapi-grpc/src/lib.rs index 32d1a1ac5d3..486ba8f3fce 100644 --- a/packages/dapi-grpc/src/lib.rs +++ b/packages/dapi-grpc/src/lib.rs @@ -2,23 +2,47 @@ pub use prost::Message; #[cfg(feature = "core")] pub mod core { + #![allow(non_camel_case_types)] pub mod v0 { - include!("core/proto/org.dash.platform.dapi.v0.rs"); + #[cfg(all(feature = "server", not(feature = "client")))] + include!("core/server/org.dash.platform.dapi.v0.rs"); + + #[cfg(all(feature = "client", not(feature = "server")))] + include!("core/client/org.dash.platform.dapi.v0.rs"); + + #[cfg(all(feature = "server", feature = "client"))] + include!("core/client_server/org.dash.platform.dapi.v0.rs"); } } #[cfg(feature = "platform")] pub mod platform { pub mod v0 { - include!("platform/proto/org.dash.platform.dapi.v0.rs"); + #[cfg(all(feature = "server", not(feature = "client")))] + include!("platform/server/org.dash.platform.dapi.v0.rs"); + + #[cfg(all(feature = "client", not(feature = "server")))] + include!("platform/client/org.dash.platform.dapi.v0.rs"); + + #[cfg(all(feature = "server", feature = "client"))] + include!("platform/client_server/org.dash.platform.dapi.v0.rs"); } + #[cfg(feature = "tenderdash-proto")] pub use tenderdash_proto as proto; + #[cfg(any(feature = "server", feature = "client"))] mod versioning; + #[cfg(any(feature = "server", feature = "client"))] pub use versioning::{VersionedGrpcMessage, VersionedGrpcResponse}; } #[cfg(feature = "serde")] // Serde deserialization logic pub mod deserialization; + +// We need mock module even if the feature is disabled +pub mod mock; + +// Re-export tonic to ensure everyone uses the same version +pub use tonic; diff --git a/packages/dapi-grpc/src/mock.rs b/packages/dapi-grpc/src/mock.rs new file mode 100644 index 00000000000..3ff7972b32e --- /dev/null +++ b/packages/dapi-grpc/src/mock.rs @@ -0,0 +1,68 @@ +//! Mocking support for messages. +//! +//! Contains [Mockable] trait that should be implemented by any object that can be used in the DAPI. +//! +//! Note that this trait is defined even if mocks are not supported, but it should always return `None` on serialization. +use tonic::Streaming; + +/// Mocking support for messages. +/// +/// This trait should be implemented by any object that can be used in the DAPI. +/// +/// We use serde_json to serialize/deserialize messages. +// TODO: Move to a different crate where it can be easily shared by dapi-grpc, dash-platform-sdk, and rs-dapi-client. +pub trait Mockable +where + Self: std::marker::Sized, +{ + /// Serialize the message to bytes for mocking purposes. + /// + /// Returns None if the message is not serializable or mocking is disabled. + /// + /// # Panics + /// + /// Panics on any error. + fn mock_serialize(&self) -> Option> { + None + } + /// Deserialize the message serialized with [mock_serialize()]. + /// + /// Returns None if the message is not serializable or mocking is disabled. + /// + /// # Panics + /// + /// Panics on any error. + fn mock_deserialize(_data: &[u8]) -> Option { + None + } +} + +impl Mockable for Option { + #[cfg(feature = "mocks")] + fn mock_serialize(&self) -> Option> { + self.as_ref().and_then(|value| value.mock_serialize()) + } + + #[cfg(feature = "mocks")] + fn mock_deserialize(data: &[u8]) -> Option { + T::mock_deserialize(data).map(Some) + } +} + +impl Mockable for Vec { + #[cfg(feature = "mocks")] + fn mock_serialize(&self) -> Option> { + serde_json::to_vec(self).ok() + } + + #[cfg(feature = "mocks")] + fn mock_deserialize(data: &[u8]) -> Option { + serde_json::from_slice(data).ok() + } +} + +/// Mocking of gRPC streaming responses is not supported. +/// +/// This will return `None` on serialization, +/// effectively disabling mocking of streaming responses. +impl Mockable for Streaming {} diff --git a/packages/dapi-grpc/src/platform/proto/org.dash.platform.dapi.v0.rs b/packages/dapi-grpc/src/platform/proto/org.dash.platform.dapi.v0.rs deleted file mode 100644 index eb8b1b91236..00000000000 --- a/packages/dapi-grpc/src/platform/proto/org.dash.platform.dapi.v0.rs +++ /dev/null @@ -1,2481 +0,0 @@ -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Proof { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub grovedb_proof: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "2")] - #[serde(with = "serde_bytes")] - pub quorum_hash: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "3")] - #[serde(with = "serde_bytes")] - pub signature: ::prost::alloc::vec::Vec, - #[prost(uint32, tag = "4")] - pub round: u32, - #[prost(bytes = "vec", tag = "5")] - #[serde(with = "serde_bytes")] - pub block_id_hash: ::prost::alloc::vec::Vec, - #[prost(uint32, tag = "6")] - pub quorum_type: u32, -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ResponseMetadata { - #[prost(uint64, tag = "1")] - #[serde(with = "crate::deserialization::from_to_string")] - pub height: u64, - #[prost(uint32, tag = "2")] - pub core_chain_locked_height: u32, - #[prost(uint32, tag = "3")] - pub epoch: u32, - #[prost(uint64, tag = "4")] - #[serde(with = "crate::deserialization::from_to_string")] - pub time_ms: u64, - #[prost(uint32, tag = "5")] - pub protocol_version: u32, - #[prost(string, tag = "6")] - pub chain_id: ::prost::alloc::string::String, -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct StateTransitionBroadcastError { - #[prost(uint32, tag = "1")] - pub code: u32, - #[prost(string, tag = "2")] - pub message: ::prost::alloc::string::String, - #[prost(bytes = "vec", tag = "3")] - pub data: ::prost::alloc::vec::Vec, -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BroadcastStateTransitionRequest { - #[prost(bytes = "vec", tag = "1")] - pub state_transition: ::prost::alloc::vec::Vec, -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BroadcastStateTransitionResponse {} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityRequest { - #[prost(oneof = "get_identity_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetIdentityRequest`. -pub mod get_identity_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityRequestV0 { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub id: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityBalanceRequest { - #[prost(oneof = "get_identity_balance_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetIdentityBalanceRequest`. -pub mod get_identity_balance_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityBalanceRequestV0 { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub id: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityBalanceRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityBalanceAndRevisionRequest { - #[prost(oneof = "get_identity_balance_and_revision_request::Version", tags = "1")] - pub version: ::core::option::Option< - get_identity_balance_and_revision_request::Version, - >, -} -/// Nested message and enum types in `GetIdentityBalanceAndRevisionRequest`. -pub mod get_identity_balance_and_revision_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityBalanceAndRevisionRequestV0 { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub id: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityBalanceAndRevisionRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityResponse { - #[prost(oneof = "get_identity_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetIdentityResponse`. -pub mod get_identity_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_identity_response_v0::Result", tags = "1, 2")] - pub result: ::core::option::Option, - } - /// Nested message and enum types in `GetIdentityResponseV0`. - pub mod get_identity_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(bytes, tag = "1")] - Identity(::prost::alloc::vec::Vec), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentitiesRequest { - #[prost(oneof = "get_identities_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetIdentitiesRequest`. -pub mod get_identities_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentitiesRequestV0 { - #[prost(bytes = "vec", repeated, tag = "1")] - #[serde(with = "crate::deserialization::vec_base64string")] - pub ids: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentitiesRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentitiesResponse { - #[prost(oneof = "get_identities_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetIdentitiesResponse`. -pub mod get_identities_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct IdentityValue { - #[prost(bytes = "vec", tag = "1")] - pub value: ::prost::alloc::vec::Vec, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct IdentityEntry { - #[prost(bytes = "vec", tag = "1")] - pub key: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub value: ::core::option::Option, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Identities { - #[prost(message, repeated, tag = "1")] - pub identity_entries: ::prost::alloc::vec::Vec, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentitiesResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_identities_response_v0::Result", tags = "1, 2")] - pub result: ::core::option::Option, - } - /// Nested message and enum types in `GetIdentitiesResponseV0`. - pub mod get_identities_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - Identities(super::Identities), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentitiesResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityBalanceResponse { - #[prost(oneof = "get_identity_balance_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetIdentityBalanceResponse`. -pub mod get_identity_balance_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityBalanceResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_identity_balance_response_v0::Result", tags = "1, 2")] - pub result: ::core::option::Option, - } - /// Nested message and enum types in `GetIdentityBalanceResponseV0`. - pub mod get_identity_balance_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(uint64, tag = "1")] - Balance(u64), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityBalanceResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityBalanceAndRevisionResponse { - #[prost(oneof = "get_identity_balance_and_revision_response::Version", tags = "1")] - pub version: ::core::option::Option< - get_identity_balance_and_revision_response::Version, - >, -} -/// Nested message and enum types in `GetIdentityBalanceAndRevisionResponse`. -pub mod get_identity_balance_and_revision_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityBalanceAndRevisionResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost( - oneof = "get_identity_balance_and_revision_response_v0::Result", - tags = "1, 2" - )] - pub result: ::core::option::Option< - get_identity_balance_and_revision_response_v0::Result, - >, - } - /// Nested message and enum types in `GetIdentityBalanceAndRevisionResponseV0`. - pub mod get_identity_balance_and_revision_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct BalanceAndRevision { - #[prost(uint64, tag = "1")] - pub balance: u64, - #[prost(uint64, tag = "2")] - pub revision: u64, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - BalanceAndRevision(BalanceAndRevision), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityBalanceAndRevisionResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct KeyRequestType { - #[prost(oneof = "key_request_type::Request", tags = "1, 2, 3")] - pub request: ::core::option::Option, -} -/// Nested message and enum types in `KeyRequestType`. -pub mod key_request_type { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Request { - #[prost(message, tag = "1")] - AllKeys(super::AllKeys), - #[prost(message, tag = "2")] - SpecificKeys(super::SpecificKeys), - #[prost(message, tag = "3")] - SearchKey(super::SearchKey), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct AllKeys {} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct SpecificKeys { - #[prost(uint32, repeated, tag = "1")] - pub key_ids: ::prost::alloc::vec::Vec, -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct SearchKey { - #[prost(map = "uint32, message", tag = "1")] - pub purpose_map: ::std::collections::HashMap, -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct SecurityLevelMap { - #[prost( - map = "uint32, enumeration(security_level_map::KeyKindRequestType)", - tag = "1" - )] - pub security_level_map: ::std::collections::HashMap, -} -/// Nested message and enum types in `SecurityLevelMap`. -pub mod security_level_map { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum KeyKindRequestType { - CurrentKeyOfKindRequest = 0, - AllKeysOfKindRequest = 1, - } - impl KeyKindRequestType { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - KeyKindRequestType::CurrentKeyOfKindRequest => { - "CURRENT_KEY_OF_KIND_REQUEST" - } - KeyKindRequestType::AllKeysOfKindRequest => "ALL_KEYS_OF_KIND_REQUEST", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "CURRENT_KEY_OF_KIND_REQUEST" => Some(Self::CurrentKeyOfKindRequest), - "ALL_KEYS_OF_KIND_REQUEST" => Some(Self::AllKeysOfKindRequest), - _ => None, - } - } - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityKeysRequest { - #[prost(oneof = "get_identity_keys_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetIdentityKeysRequest`. -pub mod get_identity_keys_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityKeysRequestV0 { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub identity_id: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub request_type: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub limit: ::core::option::Option, - #[prost(message, optional, tag = "4")] - pub offset: ::core::option::Option, - #[prost(bool, tag = "5")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityKeysRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityKeysResponse { - #[prost(oneof = "get_identity_keys_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetIdentityKeysResponse`. -pub mod get_identity_keys_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityKeysResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_identity_keys_response_v0::Result", tags = "1, 2")] - pub result: ::core::option::Option, - } - /// Nested message and enum types in `GetIdentityKeysResponseV0`. - pub mod get_identity_keys_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Keys { - #[prost(bytes = "vec", repeated, tag = "1")] - pub keys_bytes: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - Keys(Keys), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityKeysResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetProofsRequest { - #[prost(oneof = "get_proofs_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetProofsRequest`. -pub mod get_proofs_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetProofsRequestV0 { - #[prost(message, repeated, tag = "1")] - pub identities: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "2")] - pub contracts: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "3")] - pub documents: ::prost::alloc::vec::Vec, - } - /// Nested message and enum types in `GetProofsRequestV0`. - pub mod get_proofs_request_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct DocumentRequest { - #[prost(bytes = "vec", tag = "1")] - pub contract_id: ::prost::alloc::vec::Vec, - #[prost(string, tag = "2")] - pub document_type: ::prost::alloc::string::String, - #[prost(bool, tag = "3")] - pub document_type_keeps_history: bool, - #[prost(bytes = "vec", tag = "4")] - pub document_id: ::prost::alloc::vec::Vec, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct IdentityRequest { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub identity_id: ::prost::alloc::vec::Vec, - #[prost(enumeration = "identity_request::Type", tag = "2")] - pub request_type: i32, - } - /// Nested message and enum types in `IdentityRequest`. - pub mod identity_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum Type { - FullIdentity = 0, - Balance = 1, - Keys = 2, - } - impl Type { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Type::FullIdentity => "FULL_IDENTITY", - Type::Balance => "BALANCE", - Type::Keys => "KEYS", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "FULL_IDENTITY" => Some(Self::FullIdentity), - "BALANCE" => Some(Self::Balance), - "KEYS" => Some(Self::Keys), - _ => None, - } - } - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct ContractRequest { - #[prost(bytes = "vec", tag = "1")] - pub contract_id: ::prost::alloc::vec::Vec, - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetProofsRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetProofsResponse { - #[prost(oneof = "get_proofs_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetProofsResponse`. -pub mod get_proofs_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetProofsResponseV0 { - #[prost(message, optional, tag = "2")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_proofs_response_v0::Result", tags = "1")] - pub result: ::core::option::Option, - } - /// Nested message and enum types in `GetProofsResponseV0`. - pub mod get_proofs_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetProofsResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetDataContractRequest { - #[prost(oneof = "get_data_contract_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetDataContractRequest`. -pub mod get_data_contract_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetDataContractRequestV0 { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub id: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetDataContractRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetDataContractResponse { - #[prost(oneof = "get_data_contract_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetDataContractResponse`. -pub mod get_data_contract_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetDataContractResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_data_contract_response_v0::Result", tags = "1, 2")] - pub result: ::core::option::Option, - } - /// Nested message and enum types in `GetDataContractResponseV0`. - pub mod get_data_contract_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(bytes, tag = "1")] - DataContract(::prost::alloc::vec::Vec), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetDataContractResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetDataContractsRequest { - #[prost(oneof = "get_data_contracts_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetDataContractsRequest`. -pub mod get_data_contracts_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetDataContractsRequestV0 { - #[prost(bytes = "vec", repeated, tag = "1")] - #[serde(with = "crate::deserialization::vec_base64string")] - pub ids: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetDataContractsRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetDataContractsResponse { - #[prost(oneof = "get_data_contracts_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetDataContractsResponse`. -pub mod get_data_contracts_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct DataContractEntry { - #[prost(bytes = "vec", tag = "1")] - pub identifier: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub data_contract: ::core::option::Option<::prost::alloc::vec::Vec>, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct DataContracts { - #[prost(message, repeated, tag = "1")] - pub data_contract_entries: ::prost::alloc::vec::Vec, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetDataContractsResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_data_contracts_response_v0::Result", tags = "1, 2")] - pub result: ::core::option::Option, - } - /// Nested message and enum types in `GetDataContractsResponseV0`. - pub mod get_data_contracts_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - DataContracts(super::DataContracts), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetDataContractsResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetDataContractHistoryRequest { - #[prost(oneof = "get_data_contract_history_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetDataContractHistoryRequest`. -pub mod get_data_contract_history_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetDataContractHistoryRequestV0 { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub id: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub limit: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub offset: ::core::option::Option, - #[prost(uint64, tag = "4")] - #[serde(with = "crate::deserialization::from_to_string")] - pub start_at_ms: u64, - #[prost(bool, tag = "5")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetDataContractHistoryRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetDataContractHistoryResponse { - #[prost(oneof = "get_data_contract_history_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetDataContractHistoryResponse`. -pub mod get_data_contract_history_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetDataContractHistoryResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_data_contract_history_response_v0::Result", tags = "1, 2")] - pub result: ::core::option::Option< - get_data_contract_history_response_v0::Result, - >, - } - /// Nested message and enum types in `GetDataContractHistoryResponseV0`. - pub mod get_data_contract_history_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct DataContractHistoryEntry { - #[prost(uint64, tag = "1")] - pub date: u64, - #[prost(bytes = "vec", tag = "2")] - pub value: ::prost::alloc::vec::Vec, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct DataContractHistory { - #[prost(message, repeated, tag = "1")] - pub data_contract_entries: ::prost::alloc::vec::Vec< - DataContractHistoryEntry, - >, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - DataContractHistory(DataContractHistory), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetDataContractHistoryResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetDocumentsRequest { - #[prost(oneof = "get_documents_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetDocumentsRequest`. -pub mod get_documents_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetDocumentsRequestV0 { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub data_contract_id: ::prost::alloc::vec::Vec, - #[prost(string, tag = "2")] - pub document_type: ::prost::alloc::string::String, - #[prost(bytes = "vec", tag = "3")] - #[serde(with = "serde_bytes")] - pub r#where: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "4")] - #[serde(with = "serde_bytes")] - pub order_by: ::prost::alloc::vec::Vec, - #[prost(uint32, tag = "5")] - pub limit: u32, - #[prost(bool, tag = "8")] - pub prove: bool, - #[prost(oneof = "get_documents_request_v0::Start", tags = "6, 7")] - pub start: ::core::option::Option, - } - /// Nested message and enum types in `GetDocumentsRequestV0`. - pub mod get_documents_request_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Start { - #[prost(bytes, tag = "6")] - StartAfter(::prost::alloc::vec::Vec), - #[prost(bytes, tag = "7")] - StartAt(::prost::alloc::vec::Vec), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetDocumentsRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetDocumentsResponse { - #[prost(oneof = "get_documents_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetDocumentsResponse`. -pub mod get_documents_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetDocumentsResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_documents_response_v0::Result", tags = "1, 2")] - pub result: ::core::option::Option, - } - /// Nested message and enum types in `GetDocumentsResponseV0`. - pub mod get_documents_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Documents { - #[prost(bytes = "vec", repeated, tag = "1")] - pub documents: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - Documents(Documents), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetDocumentsResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentitiesByPublicKeyHashesRequest { - #[prost(oneof = "get_identities_by_public_key_hashes_request::Version", tags = "1")] - pub version: ::core::option::Option< - get_identities_by_public_key_hashes_request::Version, - >, -} -/// Nested message and enum types in `GetIdentitiesByPublicKeyHashesRequest`. -pub mod get_identities_by_public_key_hashes_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentitiesByPublicKeyHashesRequestV0 { - #[prost(bytes = "vec", repeated, tag = "1")] - #[serde(with = "crate::deserialization::vec_base64string")] - pub public_key_hashes: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentitiesByPublicKeyHashesRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentitiesByPublicKeyHashesResponse { - #[prost(oneof = "get_identities_by_public_key_hashes_response::Version", tags = "1")] - pub version: ::core::option::Option< - get_identities_by_public_key_hashes_response::Version, - >, -} -/// Nested message and enum types in `GetIdentitiesByPublicKeyHashesResponse`. -pub mod get_identities_by_public_key_hashes_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct PublicKeyHashIdentityEntry { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub public_key_hash: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub value: ::core::option::Option<::prost::alloc::vec::Vec>, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct IdentitiesByPublicKeyHashes { - #[prost(message, repeated, tag = "1")] - pub identity_entries: ::prost::alloc::vec::Vec, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentitiesByPublicKeyHashesResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost( - oneof = "get_identities_by_public_key_hashes_response_v0::Result", - tags = "1, 2" - )] - pub result: ::core::option::Option< - get_identities_by_public_key_hashes_response_v0::Result, - >, - } - /// Nested message and enum types in `GetIdentitiesByPublicKeyHashesResponseV0`. - pub mod get_identities_by_public_key_hashes_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - Identities(super::IdentitiesByPublicKeyHashes), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentitiesByPublicKeyHashesResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityByPublicKeyHashRequest { - #[prost(oneof = "get_identity_by_public_key_hash_request::Version", tags = "1")] - pub version: ::core::option::Option< - get_identity_by_public_key_hash_request::Version, - >, -} -/// Nested message and enum types in `GetIdentityByPublicKeyHashRequest`. -pub mod get_identity_by_public_key_hash_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityByPublicKeyHashRequestV0 { - #[prost(bytes = "vec", tag = "1")] - #[serde(with = "serde_bytes")] - pub public_key_hash: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityByPublicKeyHashRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetIdentityByPublicKeyHashResponse { - #[prost(oneof = "get_identity_by_public_key_hash_response::Version", tags = "1")] - pub version: ::core::option::Option< - get_identity_by_public_key_hash_response::Version, - >, -} -/// Nested message and enum types in `GetIdentityByPublicKeyHashResponse`. -pub mod get_identity_by_public_key_hash_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetIdentityByPublicKeyHashResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost( - oneof = "get_identity_by_public_key_hash_response_v0::Result", - tags = "1, 2" - )] - pub result: ::core::option::Option< - get_identity_by_public_key_hash_response_v0::Result, - >, - } - /// Nested message and enum types in `GetIdentityByPublicKeyHashResponseV0`. - pub mod get_identity_by_public_key_hash_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(bytes, tag = "1")] - Identity(::prost::alloc::vec::Vec), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetIdentityByPublicKeyHashResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct WaitForStateTransitionResultRequest { - #[prost(oneof = "wait_for_state_transition_result_request::Version", tags = "1")] - pub version: ::core::option::Option< - wait_for_state_transition_result_request::Version, - >, -} -/// Nested message and enum types in `WaitForStateTransitionResultRequest`. -pub mod wait_for_state_transition_result_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct WaitForStateTransitionResultRequestV0 { - #[prost(bytes = "vec", tag = "1")] - pub state_transition_hash: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(WaitForStateTransitionResultRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct WaitForStateTransitionResultResponse { - #[prost(oneof = "wait_for_state_transition_result_response::Version", tags = "1")] - pub version: ::core::option::Option< - wait_for_state_transition_result_response::Version, - >, -} -/// Nested message and enum types in `WaitForStateTransitionResultResponse`. -pub mod wait_for_state_transition_result_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct WaitForStateTransitionResultResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost( - oneof = "wait_for_state_transition_result_response_v0::Result", - tags = "1, 2" - )] - pub result: ::core::option::Option< - wait_for_state_transition_result_response_v0::Result, - >, - } - /// Nested message and enum types in `WaitForStateTransitionResultResponseV0`. - pub mod wait_for_state_transition_result_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - Error(super::super::StateTransitionBroadcastError), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(WaitForStateTransitionResultResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetConsensusParamsRequest { - #[prost(oneof = "get_consensus_params_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetConsensusParamsRequest`. -pub mod get_consensus_params_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetConsensusParamsRequestV0 { - #[prost(int32, tag = "1")] - pub height: i32, - #[prost(bool, tag = "2")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetConsensusParamsRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetConsensusParamsResponse { - #[prost(oneof = "get_consensus_params_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetConsensusParamsResponse`. -pub mod get_consensus_params_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct ConsensusParamsBlock { - #[prost(string, tag = "1")] - pub max_bytes: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub max_gas: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub time_iota_ms: ::prost::alloc::string::String, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct ConsensusParamsEvidence { - #[prost(string, tag = "1")] - pub max_age_num_blocks: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub max_age_duration: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub max_bytes: ::prost::alloc::string::String, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetConsensusParamsResponseV0 { - #[prost(message, optional, tag = "1")] - pub block: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub evidence: ::core::option::Option, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetConsensusParamsResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetProtocolVersionUpgradeStateRequest { - #[prost(oneof = "get_protocol_version_upgrade_state_request::Version", tags = "1")] - pub version: ::core::option::Option< - get_protocol_version_upgrade_state_request::Version, - >, -} -/// Nested message and enum types in `GetProtocolVersionUpgradeStateRequest`. -pub mod get_protocol_version_upgrade_state_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetProtocolVersionUpgradeStateRequestV0 { - #[prost(bool, tag = "1")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetProtocolVersionUpgradeStateRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetProtocolVersionUpgradeStateResponse { - #[prost(oneof = "get_protocol_version_upgrade_state_response::Version", tags = "1")] - pub version: ::core::option::Option< - get_protocol_version_upgrade_state_response::Version, - >, -} -/// Nested message and enum types in `GetProtocolVersionUpgradeStateResponse`. -pub mod get_protocol_version_upgrade_state_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetProtocolVersionUpgradeStateResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost( - oneof = "get_protocol_version_upgrade_state_response_v0::Result", - tags = "1, 2" - )] - pub result: ::core::option::Option< - get_protocol_version_upgrade_state_response_v0::Result, - >, - } - /// Nested message and enum types in `GetProtocolVersionUpgradeStateResponseV0`. - pub mod get_protocol_version_upgrade_state_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Versions { - #[prost(message, repeated, tag = "1")] - pub versions: ::prost::alloc::vec::Vec, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct VersionEntry { - #[prost(uint32, tag = "1")] - pub version_number: u32, - #[prost(uint32, tag = "2")] - pub vote_count: u32, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - Versions(Versions), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetProtocolVersionUpgradeStateResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive(::dapi_grpc_macros::VersionedGrpcMessage)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetProtocolVersionUpgradeVoteStatusRequest { - #[prost( - oneof = "get_protocol_version_upgrade_vote_status_request::Version", - tags = "1" - )] - pub version: ::core::option::Option< - get_protocol_version_upgrade_vote_status_request::Version, - >, -} -/// Nested message and enum types in `GetProtocolVersionUpgradeVoteStatusRequest`. -pub mod get_protocol_version_upgrade_vote_status_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetProtocolVersionUpgradeVoteStatusRequestV0 { - #[prost(bytes = "vec", tag = "1")] - pub start_pro_tx_hash: ::prost::alloc::vec::Vec, - #[prost(uint32, tag = "2")] - pub count: u32, - #[prost(bool, tag = "3")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetProtocolVersionUpgradeVoteStatusRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetProtocolVersionUpgradeVoteStatusResponse { - #[prost( - oneof = "get_protocol_version_upgrade_vote_status_response::Version", - tags = "1" - )] - pub version: ::core::option::Option< - get_protocol_version_upgrade_vote_status_response::Version, - >, -} -/// Nested message and enum types in `GetProtocolVersionUpgradeVoteStatusResponse`. -pub mod get_protocol_version_upgrade_vote_status_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetProtocolVersionUpgradeVoteStatusResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost( - oneof = "get_protocol_version_upgrade_vote_status_response_v0::Result", - tags = "1, 2" - )] - pub result: ::core::option::Option< - get_protocol_version_upgrade_vote_status_response_v0::Result, - >, - } - /// Nested message and enum types in `GetProtocolVersionUpgradeVoteStatusResponseV0`. - pub mod get_protocol_version_upgrade_vote_status_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct VersionSignals { - #[prost(message, repeated, tag = "1")] - pub version_signals: ::prost::alloc::vec::Vec, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct VersionSignal { - #[prost(bytes = "vec", tag = "1")] - pub pro_tx_hash: ::prost::alloc::vec::Vec, - #[prost(uint32, tag = "2")] - pub version: u32, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - Versions(VersionSignals), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetProtocolVersionUpgradeVoteStatusResponseV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetEpochsInfoRequest { - #[prost(oneof = "get_epochs_info_request::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetEpochsInfoRequest`. -pub mod get_epochs_info_request { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetEpochsInfoRequestV0 { - #[prost(message, optional, tag = "1")] - pub start_epoch: ::core::option::Option, - #[prost(uint32, tag = "2")] - pub count: u32, - #[prost(bool, tag = "3")] - pub ascending: bool, - #[prost(bool, tag = "4")] - pub prove: bool, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetEpochsInfoRequestV0), - } -} -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(rename_all = "snake_case")] -#[derive( - ::dapi_grpc_macros::VersionedGrpcMessage, - ::dapi_grpc_macros::VersionedGrpcResponse -)] -#[grpc_versions(0)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetEpochsInfoResponse { - #[prost(oneof = "get_epochs_info_response::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `GetEpochsInfoResponse`. -pub mod get_epochs_info_response { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct GetEpochsInfoResponseV0 { - #[prost(message, optional, tag = "3")] - pub metadata: ::core::option::Option, - #[prost(oneof = "get_epochs_info_response_v0::Result", tags = "1, 2")] - pub result: ::core::option::Option, - } - /// Nested message and enum types in `GetEpochsInfoResponseV0`. - pub mod get_epochs_info_response_v0 { - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct EpochInfos { - #[prost(message, repeated, tag = "1")] - pub epoch_infos: ::prost::alloc::vec::Vec, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct EpochInfo { - #[prost(uint32, tag = "1")] - pub number: u32, - #[prost(uint64, tag = "2")] - pub first_block_height: u64, - #[prost(uint32, tag = "3")] - pub first_core_block_height: u32, - #[prost(uint64, tag = "4")] - pub start_time: u64, - #[prost(double, tag = "5")] - pub fee_multiplier: f64, - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Result { - #[prost(message, tag = "1")] - Epochs(EpochInfos), - #[prost(message, tag = "2")] - Proof(super::super::Proof), - } - } - #[derive(::serde::Serialize, ::serde::Deserialize)] - #[serde(rename_all = "snake_case")] - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V0(GetEpochsInfoResponseV0), - } -} -/// Generated client implementations. -pub mod platform_client { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::*; - use tonic::codegen::http::Uri; - #[derive(Debug, Clone)] - pub struct PlatformClient { - inner: tonic::client::Grpc, - } - impl PlatformClient { - /// Attempt to create a new client by connecting to a given endpoint. - pub async fn connect(dst: D) -> Result - where - D: TryInto, - D::Error: Into, - { - let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; - Ok(Self::new(conn)) - } - } - impl PlatformClient - where - T: tonic::client::GrpcService, - T::Error: Into, - T::ResponseBody: Body + Send + 'static, - ::Error: Into + Send, - { - pub fn new(inner: T) -> Self { - let inner = tonic::client::Grpc::new(inner); - Self { inner } - } - pub fn with_origin(inner: T, origin: Uri) -> Self { - let inner = tonic::client::Grpc::with_origin(inner, origin); - Self { inner } - } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> PlatformClient> - where - F: tonic::service::Interceptor, - T::ResponseBody: Default, - T: tonic::codegen::Service< - http::Request, - Response = http::Response< - >::ResponseBody, - >, - >, - , - >>::Error: Into + Send + Sync, - { - PlatformClient::new(InterceptedService::new(inner, interceptor)) - } - /// Compress requests with the given encoding. - /// - /// This requires the server to support it otherwise it might respond with an - /// error. - #[must_use] - pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.send_compressed(encoding); - self - } - /// Enable decompressing responses. - #[must_use] - pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.accept_compressed(encoding); - self - } - /// Limits the maximum size of a decoded message. - /// - /// Default: `4MB` - #[must_use] - pub fn max_decoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_decoding_message_size(limit); - self - } - /// Limits the maximum size of an encoded message. - /// - /// Default: `usize::MAX` - #[must_use] - pub fn max_encoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_encoding_message_size(limit); - self - } - pub async fn broadcast_state_transition( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/broadcastStateTransition", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "broadcastStateTransition", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_identity( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getIdentity", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new("org.dash.platform.dapi.v0.Platform", "getIdentity"), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_identities( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getIdentities", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getIdentities", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_identity_keys( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getIdentityKeys", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getIdentityKeys", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_identity_balance( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getIdentityBalance", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getIdentityBalance", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_identity_balance_and_revision( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getIdentityBalanceAndRevision", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getIdentityBalanceAndRevision", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_proofs( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getProofs", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new("org.dash.platform.dapi.v0.Platform", "getProofs"), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_data_contract( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getDataContract", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getDataContract", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_data_contract_history( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getDataContractHistory", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getDataContractHistory", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_data_contracts( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getDataContracts", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getDataContracts", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_documents( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getDocuments", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new("org.dash.platform.dapi.v0.Platform", "getDocuments"), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_identities_by_public_key_hashes( - &mut self, - request: impl tonic::IntoRequest< - super::GetIdentitiesByPublicKeyHashesRequest, - >, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getIdentitiesByPublicKeyHashes", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getIdentitiesByPublicKeyHashes", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_identity_by_public_key_hash( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getIdentityByPublicKeyHash", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getIdentityByPublicKeyHash", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn wait_for_state_transition_result( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/waitForStateTransitionResult", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "waitForStateTransitionResult", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_consensus_params( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getConsensusParams", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getConsensusParams", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_protocol_version_upgrade_state( - &mut self, - request: impl tonic::IntoRequest< - super::GetProtocolVersionUpgradeStateRequest, - >, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getProtocolVersionUpgradeState", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getProtocolVersionUpgradeState", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_protocol_version_upgrade_vote_status( - &mut self, - request: impl tonic::IntoRequest< - super::GetProtocolVersionUpgradeVoteStatusRequest, - >, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getProtocolVersionUpgradeVoteStatus", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getProtocolVersionUpgradeVoteStatus", - ), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_epochs_info( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/org.dash.platform.dapi.v0.Platform/getEpochsInfo", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "org.dash.platform.dapi.v0.Platform", - "getEpochsInfo", - ), - ); - self.inner.unary(req, path, codec).await - } - } -} diff --git a/packages/dapi-grpc/test/unit/clients/core/v0/nodejs/CorePromiseClient.spec.js b/packages/dapi-grpc/test/unit/clients/core/v0/nodejs/CorePromiseClient.spec.js index 7710a63e2c2..3ee9ce6e2a9 100644 --- a/packages/dapi-grpc/test/unit/clients/core/v0/nodejs/CorePromiseClient.spec.js +++ b/packages/dapi-grpc/test/unit/clients/core/v0/nodejs/CorePromiseClient.spec.js @@ -11,7 +11,8 @@ describe('CorePromiseClient', () => { corePromiseClient = new CorePromiseClient('https://localhost/'); corePromiseClient.client = { - getStatus: this.sinon.stub().resolves(response), + getBlockchainStatus: this.sinon.stub().resolves(response), + getMasternodeStatus: this.sinon.stub().resolves(response), getBlock: this.sinon.stub().resolves(response), broadcastTransaction: this.sinon.stub().resolves(response), getTransaction: this.sinon.stub().resolves(response), @@ -20,17 +21,37 @@ describe('CorePromiseClient', () => { }; }); - describe('#getStatus', () => { - it('should return status', async () => { - const result = await corePromiseClient.getStatus(request); + describe('#getBlockchainStatus', () => { + it('should return core chain status', async () => { + const result = await corePromiseClient.getBlockchainStatus(request); + + expect(result).to.equal(response); + expect(corePromiseClient.client.getBlockchainStatus).to.be.calledOnceWith(request); + }); + + it('should throw an error when metadata is not an object', async () => { + try { + corePromiseClient.getBlockchainStatus({}, 'metadata'); + + expect.fail('Error was not thrown'); + } catch (e) { + expect(e.message).to.equal('metadata must be an object'); + } + }); + }); + + describe('#getMasternodeStatus', () => { + it('should return masternode status', async () => { + const result = await corePromiseClient.getMasternodeStatus(request); expect(result).to.equal(response); - expect(corePromiseClient.client.getStatus).to.be.calledOnceWith(request); + expect(corePromiseClient.client.getMasternodeStatus) + .to.be.calledOnceWith(request); }); it('should throw an error when metadata is not an object', async () => { try { - corePromiseClient.getStatus({}, 'metadata'); + corePromiseClient.getMasternodeStatus({}, 'metadata'); expect.fail('Error was not thrown'); } catch (e) { diff --git a/packages/dapi-grpc/test/unit/clients/platform/v0/nodejs/PlatformPromiseClient.spec.js b/packages/dapi-grpc/test/unit/clients/platform/v0/nodejs/PlatformPromiseClient.spec.js index 084d444b510..86332675448 100644 --- a/packages/dapi-grpc/test/unit/clients/platform/v0/nodejs/PlatformPromiseClient.spec.js +++ b/packages/dapi-grpc/test/unit/clients/platform/v0/nodejs/PlatformPromiseClient.spec.js @@ -13,11 +13,15 @@ describe('PlatformPromiseClient', () => { platformPromiseClient.client = { broadcastStateTransition: this.sinon.stub().resolves(response), getIdentity: this.sinon.stub().resolves(response), + getIdentitiesContractKeys: this.sinon.stub().resolves(response), getDataContract: this.sinon.stub().resolves(response), getDocuments: this.sinon.stub().resolves(response), getEpochsInfo: this.sinon.stub().resolves(response), getProtocolVersionUpgradeVoteStatus: this.sinon.stub().resolves(response), getProtocolVersionUpgradeState: this.sinon.stub().resolves(response), + getIdentityContractNonce: this.sinon.stub().resolves(response), + getIdentityNonce: this.sinon.stub().resolves(response), + getIdentityKeys: this.sinon.stub().resolves(response), }; }); @@ -60,6 +64,26 @@ describe('PlatformPromiseClient', () => { }); }); + describe('#getIdentitiesContractKeys', () => { + it('should get identities', async () => { + const result = await platformPromiseClient.getIdentitiesContractKeys(request); + + expect(result).to.equal(response); + expect(platformPromiseClient.client.getIdentitiesContractKeys) + .to.be.calledOnceWith(request); + }); + + it('should throw an error when metadata is not an object', async () => { + try { + platformPromiseClient.getIdentitiesContractKeys({}, 'metadata'); + + expect.fail('Error was not thrown'); + } catch (e) { + expect(e.message).to.equal('metadata must be an object'); + } + }); + }); + describe('#getDataContract', () => { it('should get data contract', async () => { const result = await platformPromiseClient.getDataContract(request); @@ -116,4 +140,34 @@ describe('PlatformPromiseClient', () => { .to.be.calledOnceWith(request); }); }); + + describe('#getIdentityContractNonce', () => { + it('should get identity contract nonce', async () => { + const result = await platformPromiseClient.getIdentityContractNonce(request); + + expect(result).to.equal(response); + expect(platformPromiseClient.client.getIdentityContractNonce) + .to.be.calledOnceWith(request); + }); + }); + + describe('#getIdentityNonce', () => { + it('should get identity nonce', async () => { + const result = await platformPromiseClient.getIdentityNonce(request); + + expect(result).to.equal(response); + expect(platformPromiseClient.client.getIdentityNonce) + .to.be.calledOnceWith(request); + }); + }); + + describe('#getIdentityKeys', () => { + it('should get identity keys', async () => { + const result = await platformPromiseClient.getIdentityKeys(request); + + expect(result).to.equal(response); + expect(platformPromiseClient.client.getIdentityKeys) + .to.be.calledOnceWith(request); + }); + }); }); diff --git a/packages/dapi-grpc/test/unit/getCoreDefinition.spec.js b/packages/dapi-grpc/test/unit/getCoreDefinition.spec.js index d0dbdc78e09..c40fc73d4c9 100644 --- a/packages/dapi-grpc/test/unit/getCoreDefinition.spec.js +++ b/packages/dapi-grpc/test/unit/getCoreDefinition.spec.js @@ -14,8 +14,11 @@ describe('getCoreDefinition', () => { expect(coreDefinition.service).to.have.property('getTransaction'); expect(coreDefinition.service.getTransaction.path).to.equal('/org.dash.platform.dapi.v0.Core/getTransaction'); - expect(coreDefinition.service).to.have.property('getStatus'); - expect(coreDefinition.service.getStatus.path).to.equal('/org.dash.platform.dapi.v0.Core/getStatus'); + expect(coreDefinition.service).to.have.property('getBlockchainStatus'); + expect(coreDefinition.service.getBlockchainStatus.path).to.equal('/org.dash.platform.dapi.v0.Core/getBlockchainStatus'); + + expect(coreDefinition.service).to.have.property('getMasternodeStatus'); + expect(coreDefinition.service.getMasternodeStatus.path).to.equal('/org.dash.platform.dapi.v0.Core/getMasternodeStatus'); expect(coreDefinition.service).to.have.property('getBlock'); expect(coreDefinition.service.getBlock.path).to.equal('/org.dash.platform.dapi.v0.Core/getBlock'); diff --git a/packages/dapi/.env.example b/packages/dapi/.env.example index be5c19be43c..376ec250008 100644 --- a/packages/dapi/.env.example +++ b/packages/dapi/.env.example @@ -20,9 +20,6 @@ DASHCORE_RPC_HOST=127.0.0.1 DASHCORE_RPC_PORT=30002 DASHCORE_ZMQ_HOST=127.0.0.1 DASHCORE_ZMQ_PORT=30003 -DASHCORE_P2P_HOST=127.0.0.1 -DASHCORE_P2P_PORT=30001 -DASHCORE_P2P_NETWORK=testnet # Can be `testnet`, `regtest` and `livenet` NETWORK=testnet @@ -35,6 +32,9 @@ BLOCK_HEADERS_CACHE_SIZE=500 TENDERMINT_RPC_HOST=localhost TENDERMINT_RPC_PORT=26657 +DRIVE_RPC_HOST=localhost +DRIVE_RPC_PORT=26670 + # SERVICE_IMAGE_DRIVE= # Drive image name, if omitted dashpay/dashrive is used # SERVICE_IMAGE_DAPI= # DAPI image name, if omitted dashpay/dapi is used # SERVICE_IMAGE_CORE= # Dash Core image name, if omitted dashpay/dashcore is used diff --git a/packages/dapi/.eslintrc b/packages/dapi/.eslintrc index 7777fe3afec..7eb94b2144b 100644 --- a/packages/dapi/.eslintrc +++ b/packages/dapi/.eslintrc @@ -1,10 +1,22 @@ { "extends": "airbnb-base", + "parserOptions": { + // Required for certain syntax usages + "ecmaVersion": 2022, + "requireConfigFile": false + }, + "parser": "@babel/eslint-parser", "env": { "node": true }, "rules": { "no-plusplus": 0, + "eol-last": [ + "error", + "always" + ], + "no-continue": "off", + "class-methods-use-this": "off", "no-await-in-loop": "off", "no-restricted-syntax": [ "error", @@ -16,6 +28,10 @@ "selector": "WithStatement", "message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize." } + ], + "curly": [ + "error", + "all" ] } } diff --git a/packages/dapi/doc/REFERENCE.md b/packages/dapi/doc/REFERENCE.md index c3411afc8aa..fb814322ffa 100644 --- a/packages/dapi/doc/REFERENCE.md +++ b/packages/dapi/doc/REFERENCE.md @@ -9,41 +9,34 @@ - [generate](#generate) - [getBestBlockHash](#getbestblockhash) - [getBlockHash](#getblockhash) - - [getMnListDiff](#getmnlistdiff) ## Layer 1 endpoints -### generate - -Note: regtest only - -Generates blocks on demand for regression tests. +### getBestBlockHash -##### Params +Returns best block hash (hash of the chaintip) -| name | type | description | -|---------|--------|----------------------------------------| -| args.amount | number | Amount of blocks to generate | +*takes no arguments* ##### Response -| name | type | description | -|--------------|------------------------|------------------------------------------------------------| -| blockHashes | promise (string array) | Returns a promise containing strings of block hashes | +| name | type | description | +|--------------|------------------|----------------------------------------| +| blockHash | promise (string) | hash of chaintip | --- -### getBestBlockHash +### getBestBlockHeight -Returns best block hash (hash of the chaintip) +Returns best block height (height of the chaintip) *takes no arguments* ##### Response -| name | type | description | -|--------------|------------------|----------------------------------------| -| blockHash | promise (string) | hash of chaintip | +| name | type | description | +|--------|------------------|--------------------| +| height | promise (string) | height of chaintip | --- @@ -62,21 +55,3 @@ Returns block hash for a given height. | name | type | description | |------------|------------------|---------------------------------------------| | blockHash | promise (string) | promise containing a string of a block hash | - ---- - -### getMnListDiff - -*needs definition* - -##### Params - -| name | type | description | -|---------|--------|----------------------------------------| -| packet | string | ST Packet object serialized using CBOR | - -##### Response - -| name | type | description | -|---------|--------|----------------------------------------| -| packet | string | ST Packet object serialized using CBOR | diff --git a/packages/dapi/lib/MasternodeListSync.js b/packages/dapi/lib/MasternodeListSync.js new file mode 100644 index 00000000000..c951c9714c8 --- /dev/null +++ b/packages/dapi/lib/MasternodeListSync.js @@ -0,0 +1,196 @@ +const EventEmitter = require('events'); +const { SimplifiedMNListDiff } = require('@dashevo/dashcore-lib'); +const logger = require('./logger'); + +const NULL_HASH = '0000000000000000000000000000000000000000000000000000000000000000'; + +/** + * @param {ChainLock} chainLock + * @return {string} + */ +function chainLockToBlockHashHex(chainLock) { + return chainLock.blockHash.toString('hex'); +} + +class MasternodeListSync extends EventEmitter { + /** + * @type {Buffer} + */ + fullDiffBuffer; + + /** + * @type {number} + */ + blockHeight = 0; + + /** + * @type {string} + */ + blockHash; + + /** + * @type {CoreRpcClient} + */ + coreRpc; + + /** + * @type {ChainDataProvider} + */ + chainDataProvider; + + /** + * @type {string} + */ + network; + + /** + * @param {CoreRpcClient} coreRpc + * @param {ChainDataProvider} chainDataProvider + * @param {string} network + */ + constructor(coreRpc, chainDataProvider, network) { + super(); + + this.coreRpc = coreRpc; + this.chainDataProvider = chainDataProvider; + this.network = network; + this.logger = logger.child({ + service: 'MasternodeListSync', + }); + + this.setMaxListeners(1000); + } + + /** + * @param {string} blockHash + * @param {number} blockHeight + * @return {Promise} + */ + async sync(blockHash, blockHeight) { + const fullDiffObject = await this.coreRpc.getMnListDiff(NULL_HASH, blockHash); + + // TODO: It's a dirty hack to fix serialisation issue, introduced by reverting version of the + // diff from 2 to 1. So now version 1 of diff contains entries of version 1 and 2 and + // we don't know how to parse it since version field is introduced in version 2. + fullDiffObject.nVersion = 2; + + const previousBlockHash = this.blockHash; + const previousBlockHeight = this.blockHeight; + + const fullDiff = new SimplifiedMNListDiff(fullDiffObject, this.network); + + this.fullDiffBuffer = fullDiff.toBuffer(); + this.blockHeight = blockHeight; + this.blockHash = blockHash; + + this.logger.debug( + { + blockHash, + blockHeight, + network: this.network, + }, + `Full masternode list updated to block ${blockHeight}`, + ); + + if (previousBlockHash) { + const diffObject = await this.coreRpc.getMnListDiff(previousBlockHash, blockHash); + + // TODO: It's a dirty hack to fix serialisation issue, introduced by reverting version of the + // diff from 2 to 1. So now version 1 of diff contains entries of version 1 and 2 and we + // don't know how to parse it since version field is introduced in version 2. + diffObject.nVersion = 2; + + const diff = new SimplifiedMNListDiff(diffObject, this.network); + const diffBuffer = diff.toBuffer(); + + this.logger.debug({ + previousBlockHash, + blockHash, + previousBlockHeight, + blockHeight, + network: this.network, + }, `New diff from block ${previousBlockHeight} to ${blockHeight} received`); + + this.emit(MasternodeListSync.EVENT_DIFF, diffBuffer, blockHeight, blockHash); + } + + this.blockHash = blockHash; + } + + /** + * @return {Promise} + */ + async init() { + // Init makes sure, that we have full diff, so we need to use the existing best chain lock + // or wait for the first one + + let resolved = false; + + return new Promise((resolve, reject) => { + const bestChainLock = this.chainDataProvider.getBestChainLock(); + + this.chainDataProvider.on(this.chainDataProvider.events.NEW_CHAIN_LOCK, (chainLock) => { + const blockHash = chainLockToBlockHashHex(chainLock); + + this.sync(blockHash, chainLock.height).then(() => { + // Resolve the promise when chain lock is arrive we don't have any yet + if (!bestChainLock && !resolved) { + resolve(); + resolved = true; + } + }).catch((error) => { + this.logger.error({ err: error }, `Failed to sync masternode list: ${error.message}`); + + if (!resolved) { + reject(error); + resolved = true; + } + }); + }); + + if (bestChainLock) { + const bestBlockHash = chainLockToBlockHashHex(bestChainLock); + + // Resolve promise when we have the best chain lock + this.sync(bestBlockHash, bestChainLock.height).then(() => { + if (!resolved) { + resolve(); + resolved = true; + } + }).catch((error) => { + this.logger.error({ err: error }, `Failed to sync masternode list: ${error.message}`); + + if (!resolved) { + reject(error); + resolved = true; + } + }); + } + }); + } + + /** + * @return {Buffer} + */ + getFullDiffBuffer() { + return this.fullDiffBuffer; + } + + /** + * @return {number} + */ + getBlockHeight() { + return this.blockHeight; + } + + /** + * @return {string} + */ + getBlockHash() { + return this.blockHash; + } +} + +MasternodeListSync.EVENT_DIFF = 'diff'; + +module.exports = MasternodeListSync; diff --git a/packages/dapi/lib/chainDataProvider/ChainDataProvider.js b/packages/dapi/lib/chainDataProvider/ChainDataProvider.js index d4336622f43..fa83155239b 100644 --- a/packages/dapi/lib/chainDataProvider/ChainDataProvider.js +++ b/packages/dapi/lib/chainDataProvider/ChainDataProvider.js @@ -11,9 +11,9 @@ const REORG_SAFE_DEPTH = 6; class ChainDataProvider extends EventEmitter { /** * - * @param coreRpcClient {CoreRpcClient} - * @param zmqClient {ZmqClient} - * @param blockHeadersCache {BlockHeadersCache} + * @param {CoreRpcClient} coreRpcClient + * @param {ZmqClient} zmqClient + * @param {BlockHeadersCache} blockHeadersCache */ constructor(coreRpcClient, zmqClient, blockHeadersCache) { super(); @@ -23,7 +23,7 @@ class ChainDataProvider extends EventEmitter { this.blockHeadersCache = blockHeadersCache; this.chainLock = null; - this.chainHeight = -1; + this.chainHeight = 0; } /** @@ -52,7 +52,7 @@ class ChainDataProvider extends EventEmitter { } /** - * + * @private * @param {Buffer} rawChainLockSigBuffer */ rawChainLockSigHandler(rawChainLockSigBuffer) { @@ -216,6 +216,15 @@ class ChainDataProvider extends EventEmitter { getBestChainLock() { return this.chainLock; } + + /** + * Return chain height + * + * @return {number} + */ + getChainHeight() { + return this.chainHeight; + } } ChainDataProvider.REORG_SAFE_DEPTH = REORG_SAFE_DEPTH; diff --git a/packages/dapi/lib/config/index.js b/packages/dapi/lib/config/index.js index 2bbf4945fa7..507b9f2ed2f 100644 --- a/packages/dapi/lib/config/index.js +++ b/packages/dapi/lib/config/index.js @@ -92,6 +92,10 @@ module.exports = { host: config[OPTIONS.TENDERMINT_RPC_HOST], port: parseInt(config[OPTIONS.TENDERMINT_RPC_PORT], 10), }, + driveRpc: { + host: config[OPTIONS.DRIVE_RPC_HOST], + port: parseInt(config[OPTIONS.DRIVE_RPC_PORT], 10), + }, blockHeaders: { cache: { maxSize: Number(config[OPTIONS.BLOCK_HEADERS_CACHE_SIZE]), diff --git a/packages/dapi/lib/config/validator.js b/packages/dapi/lib/config/validator.js index e35a8d7cb24..68554f2bf1b 100644 --- a/packages/dapi/lib/config/validator.js +++ b/packages/dapi/lib/config/validator.js @@ -38,8 +38,6 @@ function validatePort(port, parameterName) { */ function validateConfig(config) { const validationResults = []; - validationResults.push(validateHost(config.dashcore.p2p.host, 'DASHCORE_P2P_HOST')); - validationResults.push(validatePort(config.dashcore.p2p.port, 'DASHCORE_P2P_PORT')); validationResults.push(validateHost(config.dashcore.rpc.host, 'DASHCORE_RPC_HOST')); validationResults.push(validatePort(config.dashcore.rpc.port, 'DASHCORE_RPC_PORT')); validationResults.push(validateHost(config.dashcore.zmq.host, 'DASHCORE_ZMQ_HOST')); diff --git a/packages/dapi/lib/externalApis/dashcore/rpc.js b/packages/dapi/lib/externalApis/dashcore/rpc.js index d0c59c326b9..a0ba7722bdc 100644 --- a/packages/dapi/lib/externalApis/dashcore/rpc.js +++ b/packages/dapi/lib/externalApis/dashcore/rpc.js @@ -1,4 +1,5 @@ const RpcClient = require('@dashevo/dashd-rpc'); +const lodash = require('lodash'); const DashCoreRpcError = require('../../errors/DashCoreRpcError'); const constants = require('./constants'); const config = require('../../config'); @@ -169,6 +170,22 @@ const getRawTransaction = (txid, verboseMode = 0) => new Promise((resolve, rejec }); }); +const getRawTransactionMulti = async (txids, verboseMode = 0) => { + const promises = lodash.chunk(txids, 100) + .map((chunk) => new Promise((resolve, reject) => { + client.getRawTransactionMulti({ 0: chunk }, verboseMode, (err, r) => { + if (err) { + reject(new DashCoreRpcError(err.message, null, err.code)); + } else { + resolve(r.result); + } + }); + })); + + return (await Promise.all(promises)) + .reduce((accumulator, object) => ({ ...accumulator, ...object }), {}); +}; + const getRawBlock = (blockhash) => getBlock(blockhash, false); // This is only for in-wallet transaction @@ -357,6 +374,7 @@ module.exports = { sendRawTransaction, sendRawIxTransaction, getRawTransaction, + getRawTransactionMulti, getRawBlock, getTransaction, getTransactionFirstInputAddress, diff --git a/packages/dapi/lib/externalApis/drive/DriveClient.js b/packages/dapi/lib/externalApis/drive/DriveClient.js deleted file mode 100644 index 3c1de0dfede..00000000000 --- a/packages/dapi/lib/externalApis/drive/DriveClient.js +++ /dev/null @@ -1,259 +0,0 @@ -const jayson = require('jayson/promise'); - -const RPCError = require('../../rpcServer/RPCError'); -const createGrpcErrorFromDriveResponse = require('../../grpcServer/handlers/createGrpcErrorFromDriveResponse'); - -class DriveClient { - /** - * @param options - * @param {string} options.host - * @param {number} options.port - */ - constructor({ host, port }) { - this.client = jayson.client.http({ host, port }); - } - - /** - * Makes request to Drive and handle response - * - * @param {string} path - * @param {Uint8Array} data - * - * @return {Promise} - */ - async request(path, data) { - const requestOptions = { - path, - data: Buffer.from(data).toString('hex'), - }; - - const { result, error } = await this.client.request( - 'abci_query', - requestOptions, - ); - - // Handle JSON RPC error - if (error) { - throw new RPCError(error.code || -32602, error.message || 'Internal error', error.data); - } - - // Check and handle ABCI errors - const { response } = result; - - if (response.code === undefined || response.code === 0) { - // no errors found return the serialized response value - return Buffer.from(response.value, 'base64'); - } - - throw await createGrpcErrorFromDriveResponse(response.code, response.info); - } - - /** - * Fetch serialized data contract - * - * @param {GetDataContractRequest} request - * - * @return {Promise} - */ - async fetchDataContract(request) { - return this.request( - '/dataContract', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized data contracts - * - * @param {GetDataContractsRequest} request - * - * @return {Promise} - */ - async fetchDataContracts(request) { - return this.request( - '/dataContracts', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized data contract - * - * @param {GetDataContractHistoryRequest} request - * - * @return {Promise} - */ - async fetchDataContractHistory(request) { - return this.request( - '/dataContractHistory', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized documents - * - * @param {GetDocumentsRequest} request - * - * @return {Promise} - */ - async fetchDocuments(request) { - return this.request( - '/dataContract/documents', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized identity - * - * @param {GetIdentityRequest} request - * - * @return {Promise} - */ - async fetchIdentity(request) { - return this.request( - '/identity', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized identities - * - * @param {GetIdentitiesRequest} request - * - * @return {Promise} - */ - async fetchIdentities(request) { - return this.request( - '/identities', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized identity balance - * - * @param {GetIdentityBalanceRequest} request - * - * @return {Promise} - */ - async fetchIdentityBalance(request) { - return this.request( - '/identity/balance', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized identity balance and revision - * - * @param {GetIdentityBalanceAndRevisionRequest} request - * - * @return {Promise} - */ - async fetchIdentityBalanceAndRevision(request) { - return this.request( - '/identity/balanceAndRevision', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized identity keys - * - * @param {GetIdentityKeysRequest} request - * - * @return {Promise} - */ - async fetchIdentityKeys(request) { - return this.request( - '/identity/keys', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized identity by its public key hash - * - * @param {GetIdentityByPublicKeyHashRequest} request - * - * @return {Promise} - */ - async fetchIdentityByPublicKeyHash(request) { - return this.request( - '/identity/by-public-key-hash', - request.serializeBinary(), - ); - } - - /** - * Fetch serialized identities by its public key hashes - * - * @param {GetIdentitiesByPublicKeyHashesRequest} request - * - * @return {Promise} - */ - async fetchIdentitiesByPublicKeyHashes(request) { - return this.request( - '/identities/by-public-key-hash', - request.serializeBinary(), - ); - } - - /** - * Fetch proofs by ids - * - * @param {GetProofsRequest} request - - * @return {Promise<{data: Buffer}>} - */ - async fetchProofs(request) { - return this.request( - '/proofs', - request.serializeBinary(), - ); - } - - /** - * Fetch epoch infos - * - * @param {GetEpochsInfoRequest} request - * @return {Promise} - */ - async fetchEpochsInfo(request) { - return this.request( - '/epochInfos', - request.serializeBinary(), - ); - } - - /** - * Fetch version upgrade vote status - * - * @param {GetProtocolVersionUpgradeVoteStatusRequest} request - * @return {Promise} - */ - async fetchVersionUpgradeVoteStatus(request) { - return this.request( - '/versionUpgrade/voteStatus', - request.serializeBinary(), - ); - } - - /** - * Fetch version upgrade state - * - * @param {GetProtocolVersionUpgradeStateRequest} request - * @return {Promise} - */ - async fetchVersionUpgradeState(request) { - return this.request( - '/versionUpgrade/state', - request.serializeBinary(), - ); - } -} - -module.exports = DriveClient; diff --git a/packages/dapi/lib/externalApis/drive/fetchProofForStateTransitionFactory.js b/packages/dapi/lib/externalApis/drive/fetchProofForStateTransitionFactory.js index 2153807a4e6..a14108e58d2 100644 --- a/packages/dapi/lib/externalApis/drive/fetchProofForStateTransitionFactory.js +++ b/packages/dapi/lib/externalApis/drive/fetchProofForStateTransitionFactory.js @@ -1,13 +1,12 @@ const { v0: { GetProofsRequest, - GetProofsResponse, }, } = require('@dashevo/dapi-grpc'); const { StateTransitionTypes } = require('@dashevo/wasm-dpp'); /** - * @param {DriveClient} driveClient + * @param {PlatformPromiseClient} driveClient * @return {fetchProofForStateTransition} */ function fetchProofForStateTransitionFactory(driveClient) { @@ -17,12 +16,12 @@ function fetchProofForStateTransitionFactory(driveClient) { * @return {Promise} */ async function fetchProofForStateTransition(stateTransition) { - const getProofsRequest = new GetProofsRequest(); - const modifiedIds = stateTransition.getModifiedDataIds(); const { GetProofsRequestV0 } = GetProofsRequest; + const requestV0 = new GetProofsRequestV0(); + if (stateTransition.isDocumentStateTransition()) { const { DocumentRequest } = GetProofsRequestV0; @@ -34,21 +33,38 @@ function fetchProofForStateTransitionFactory(driveClient) { return documentRequest; }); - getProofsRequest.setV0(new GetProofsRequestV0().setDocumentsList(documentsList)); + requestV0.setDocumentsList(documentsList); } if (stateTransition.isIdentityStateTransition()) { const { IdentityRequest } = GetProofsRequestV0; - const identitiesList = modifiedIds.map((id) => { - const identityRequest = new IdentityRequest(); - identityRequest.setIdentityId(id.toBuffer()); - identityRequest.setRequestType( - stateTransition.getType() === StateTransitionTypes.IdentityCreditTransfer - ? IdentityRequest.Type.BALANCE : IdentityRequest.Type.FULL_IDENTITY, - ); - return identityRequest; + const identitiesList = modifiedIds.flatMap((id) => { + const stType = stateTransition.getType(); + let proofRequests; + + if (stType === StateTransitionTypes.IdentityCreditTransfer) { + proofRequests = new IdentityRequest(); + proofRequests.setIdentityId(id.toBuffer()); + proofRequests.setRequestType(IdentityRequest.Type.BALANCE); + } else if (stType === StateTransitionTypes.IdentityTopUp) { + const proofRequestsBalance = new IdentityRequest(); + proofRequestsBalance.setIdentityId(id.toBuffer()); + proofRequestsBalance.setRequestType(IdentityRequest.Type.BALANCE); + + const proofRequestsRevision = new IdentityRequest(); + proofRequestsRevision.setIdentityId(id.toBuffer()); + proofRequestsRevision.setRequestType(IdentityRequest.Type.REVISION); + + proofRequests = [proofRequestsBalance, proofRequestsRevision]; + } else { + proofRequests = new IdentityRequest(); + proofRequests.setIdentityId(id.toBuffer()); + proofRequests.setRequestType(IdentityRequest.Type.FULL_IDENTITY); + } + + return proofRequests; }); - getProofsRequest.setV0(new GetProofsRequestV0().setIdentitiesList(identitiesList)); + requestV0.setIdentitiesList(identitiesList); } if (stateTransition.isDataContractStateTransition()) { const { ContractRequest } = GetProofsRequestV0; @@ -58,12 +74,13 @@ function fetchProofForStateTransitionFactory(driveClient) { return identityRequest; }); - getProofsRequest.setV0(new GetProofsRequestV0() - .setContractsList(contractsList)); + requestV0.setContractsList(contractsList); } - const responseBytes = await driveClient.fetchProofs(getProofsRequest); - return GetProofsResponse.deserializeBinary(responseBytes); + const request = new GetProofsRequest(); + request.setV0(requestV0); + + return driveClient.getProofs(request); } return fetchProofForStateTransition; diff --git a/packages/dapi/lib/externalApis/tenderdash/WsClient.js b/packages/dapi/lib/externalApis/tenderdash/WsClient.js index 1bf9e260bc5..f886483bf26 100644 --- a/packages/dapi/lib/externalApis/tenderdash/WsClient.js +++ b/packages/dapi/lib/externalApis/tenderdash/WsClient.js @@ -43,6 +43,11 @@ class WsClient extends EventEmitter { this.emit(event.type, event); + this.ws.removeAllListeners(); + this.ws.terminate(); + this.ws = null; + this.isConnected = false; + setTimeout(this.open.bind(this), this.autoReconnectInterval); } else { const event = { @@ -82,12 +87,6 @@ class WsClient extends EventEmitter { this.emit(event.type, event); - if (e.code === 1000) { // close normal - this.disconnect(); - - return; - } - reconnect(); }; @@ -100,16 +99,7 @@ class WsClient extends EventEmitter { this.emit(event.type, event); - switch (e.code) { - case 'ENOTFOUND': - case 'EAI_AGAIN': - case 'ECONNREFUSED': - reconnect(); - break; - default: - this.disconnect(); - break; - } + reconnect(); }; const onMessageListener = (rawData) => { diff --git a/packages/dapi/lib/grpcServer/handlers/blockheaders-stream/subscribeToBlockHeadersWithChainLocksHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/blockheaders-stream/subscribeToBlockHeadersWithChainLocksHandlerFactory.js index f952c4deb17..08449dbaa9d 100644 --- a/packages/dapi/lib/grpcServer/handlers/blockheaders-stream/subscribeToBlockHeadersWithChainLocksHandlerFactory.js +++ b/packages/dapi/lib/grpcServer/handlers/blockheaders-stream/subscribeToBlockHeadersWithChainLocksHandlerFactory.js @@ -121,7 +121,7 @@ function subscribeToBlockHeadersWithChainLocksHandlerFactory( throw e; } - const bestBlockHeight = await coreAPI.getBestBlockHeight(); + const bestBlockHeight = chainDataProvider.getChainHeight(); const historicalCount = count === 0 ? bestBlockHeight - fromBlock.height + 1 : count; diff --git a/packages/dapi/lib/grpcServer/handlers/core/coreHandlersFactory.js b/packages/dapi/lib/grpcServer/handlers/core/coreHandlersFactory.js index b2a597a7534..e9a780d0981 100644 --- a/packages/dapi/lib/grpcServer/handlers/core/coreHandlersFactory.js +++ b/packages/dapi/lib/grpcServer/handlers/core/coreHandlersFactory.js @@ -17,29 +17,41 @@ const { v0: { BroadcastTransactionRequest, GetTransactionRequest, - GetStatusRequest, - GetBlockRequest, + GetBlockchainStatusRequest, + // GetMasternodeStatusRequest, + // GetBlockRequest, + GetBestBlockHeightRequest, pbjs: { BroadcastTransactionRequest: PBJSBroadcastTransactionRequest, BroadcastTransactionResponse: PBJSBroadcastTransactionResponse, GetTransactionRequest: PBJSGetTransactionRequest, GetTransactionResponse: PBJSGetTransactionResponse, - GetStatusRequest: PBJSGetStatusRequest, - GetStatusResponse: PBJSGetStatusResponse, - GetBlockRequest: PBJSGetBlockRequest, - GetBlockResponse: PBJSGetBlockResponse, + GetBlockchainStatusRequest: PBJSGetBlockchainStatusRequest, + GetBlockchainStatusResponse: PBJSGetBlockchainStatusResponse, + // GetMasternodeStatusRequest: PBJSGetMasternodeStatusRequest, + // GetMasternodeStatusResponse: PBJSGetMasternodeStatusResponse, + // GetBlockRequest: PBJSGetBlockRequest, + // GetBlockResponse: PBJSGetBlockResponse, + GetBestBlockHeightRequest: PBJSGetBestBlockHeightRequest, + GetBestBlockHeightResponse: PBJSGetBestBlockHeightResponse, }, }, } = require('@dashevo/dapi-grpc'); const logger = require('../../../logger'); -const getBlockHandlerFactory = require( - './getBlockHandlerFactory', +// const getBlockHandlerFactory = require( +// './getBlockHandlerFactory', +// ); +const getBestBlockHeightHandlerFactory = require( + './getBestBlockHeightHandlerFactory', ); -const getStatusHandlerFactory = require( - './getStatusHandlerFactory', +const getBlockchainStatusHandlerFactory = require( + './getBlockchainStatusHandlerFactory', ); +// const getMasternodeStatusHandlerFactory = require( +// './getMasternodeStatusHandlerFactory', +// ); const getTransactionHandlerFactory = require( './getTransactionHandlerFactory', ); @@ -50,37 +62,67 @@ const broadcastTransactionHandlerFactory = require( /** * @param {CoreRpcClient} coreRPCClient * @param {boolean} isProductionEnvironment + * @param {ZmqClient} coreZmqClient * @returns {Object} */ -function coreHandlersFactory(coreRPCClient, isProductionEnvironment) { +function coreHandlersFactory(coreRPCClient, isProductionEnvironment, coreZmqClient) { const wrapInErrorHandler = wrapInErrorHandlerFactory(logger, isProductionEnvironment); // getBlock - const getBlockHandler = getBlockHandlerFactory(coreRPCClient); - const wrappedGetBlock = jsonToProtobufHandlerWrapper( + // const getBlockHandler = getBlockHandlerFactory(coreRPCClient); + // const wrappedGetBlock = jsonToProtobufHandlerWrapper( + // jsonToProtobufFactory( + // GetBlockRequest, + // PBJSGetBlockRequest, + // ), + // protobufToJsonFactory( + // PBJSGetBlockResponse, + // ), + // wrapInErrorHandler(getBlockHandler), + // ); + + // getBestBlockHeight + const getBestBlockHeightHandler = getBestBlockHeightHandlerFactory(coreRPCClient, coreZmqClient); + const wrappedGetBestBlockHeightHandler = jsonToProtobufHandlerWrapper( jsonToProtobufFactory( - GetBlockRequest, - PBJSGetBlockRequest, + GetBestBlockHeightRequest, + PBJSGetBestBlockHeightRequest, ), protobufToJsonFactory( - PBJSGetBlockResponse, + PBJSGetBestBlockHeightResponse, ), - wrapInErrorHandler(getBlockHandler), + wrapInErrorHandler(getBestBlockHeightHandler), ); - // getStatus - const getStatusHandler = getStatusHandlerFactory(coreRPCClient); - const wrappedGetStatus = jsonToProtobufHandlerWrapper( + // getBlockchainStatus + const getBlockchainStatusHandler = getBlockchainStatusHandlerFactory( + coreRPCClient, + coreZmqClient, + ); + const wrappedGetBlockchainStatus = jsonToProtobufHandlerWrapper( jsonToProtobufFactory( - GetStatusRequest, - PBJSGetStatusRequest, + GetBlockchainStatusRequest, + PBJSGetBlockchainStatusRequest, ), protobufToJsonFactory( - PBJSGetStatusResponse, + PBJSGetBlockchainStatusResponse, ), - wrapInErrorHandler(getStatusHandler), + wrapInErrorHandler(getBlockchainStatusHandler), ); + // getMasternodeStatus + // const getMasternodeStatusHandler = getMasternodeStatusHandlerFactory(coreRPCClient); + // const wrappedGetMasternodeStatus = jsonToProtobufHandlerWrapper( + // jsonToProtobufFactory( + // GetMasternodeStatusRequest, + // PBJSGetMasternodeStatusRequest, + // ), + // protobufToJsonFactory( + // PBJSGetMasternodeStatusResponse, + // ), + // wrapInErrorHandler(getMasternodeStatusHandler), + // ); + // getTransaction const getTransactionHandler = getTransactionHandlerFactory(coreRPCClient); const wrappedGetTransaction = jsonToProtobufHandlerWrapper( @@ -108,8 +150,11 @@ function coreHandlersFactory(coreRPCClient, isProductionEnvironment) { ); return { - getBlock: wrappedGetBlock, - getStatus: wrappedGetStatus, + // TODO: Enable when an attack resistance is proved + // getBlock: wrappedGetBlock, + getBestBlockHeight: wrappedGetBestBlockHeightHandler, + getBlockchainStatus: wrappedGetBlockchainStatus, + // getMasternodeStatus: wrappedGetMasternodeStatus, getTransaction: wrappedGetTransaction, broadcastTransaction: wrappedBroadcastTransaction, }; diff --git a/packages/dapi/lib/grpcServer/handlers/core/getBestBlockHeightHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/core/getBestBlockHeightHandlerFactory.js new file mode 100644 index 00000000000..ba2e19a4f9f --- /dev/null +++ b/packages/dapi/lib/grpcServer/handlers/core/getBestBlockHeightHandlerFactory.js @@ -0,0 +1,57 @@ +const { + v0: { + GetBestBlockHeightResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const logger = require('../../../logger'); + +/** + * @param {CoreRpcClient} coreRPCClient + * @param {ZmqClient} coreZmqClient + * @returns {getBestBlockHeightHandler} + */ +function getBestBlockHeightHandlerFactory(coreRPCClient, coreZmqClient) { + let height = null; + + // Reset height on a new block, so it will be obtained again on a user request + coreZmqClient.on( + coreZmqClient.topics.hashblock, + () => { + height = null; + + logger.trace({ endpoint: 'getBestBlockHeight' }, 'cleanup best block height cache'); + }, + ); + + /** + * @typedef getBestBlockHeightHandler + * @return {Promise} + */ + async function getBestBlockHeightHandler() { + if (height === null) { + const start = Date.now(); + + height = await coreRPCClient.getBestBlockHeight(); + + const elapsedTime = Date.now() - start; + + logger.trace({ + endpoint: 'getBestBlockHeight', + }, `cached best block height ${height}. took ${elapsedTime}ms`); + } + + logger.trace({ + endpoint: 'getBestBlockHeight', + }, `responded with cached best block height ${height}`); + + const response = new GetBestBlockHeightResponse(); + response.setHeight(height); + + return response; + } + + return getBestBlockHeightHandler; +} + +module.exports = getBestBlockHeightHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/core/getBlockchainStatusHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/core/getBlockchainStatusHandlerFactory.js new file mode 100644 index 00000000000..b07955d77b0 --- /dev/null +++ b/packages/dapi/lib/grpcServer/handlers/core/getBlockchainStatusHandlerFactory.js @@ -0,0 +1,90 @@ +const { + v0: { + GetBlockchainStatusResponse, + }, +} = require('@dashevo/dapi-grpc'); + +/** + * @param {CoreRpcClient} coreRPCClient + * @param {ZmqClient} coreZmqClient + * @returns {getBlockchainStatusHandler} + */ +function getBlockchainStatusHandlerFactory(coreRPCClient, coreZmqClient) { + let response = null; + + // Reset height on a new block, so it will be obtained again on a user request + coreZmqClient.on( + coreZmqClient.topics.hashblock, + () => { + response = null; + }, + ); + + /** + * @typedef getBlockchainStatusHandler + * @return {Promise} + */ + async function getBlockchainStatusHandler() { + if (response === null) { + const [ + blockchainInfoResponse, + networkInfoResponse, + ] = await Promise.all([ + coreRPCClient.getBlockchainInfo(), + coreRPCClient.getNetworkInfo(), + ]); + + response = new GetBlockchainStatusResponse(); + + const version = new GetBlockchainStatusResponse.Version(); + version.setProtocol(networkInfoResponse.protocolversion); + version.setSoftware(networkInfoResponse.version); + version.setAgent(networkInfoResponse.subversion); + + const time = new GetBlockchainStatusResponse.Time(); + time.setOffset(networkInfoResponse.timeoffset); + time.setMedian(blockchainInfoResponse.mediantime); + + const chain = new GetBlockchainStatusResponse.Chain(); + chain.setName(blockchainInfoResponse.chain); + chain.setBlocksCount(blockchainInfoResponse.blocks); + chain.setHeadersCount(blockchainInfoResponse.headers); + chain.setBestBlockHash(Buffer.from(blockchainInfoResponse.bestblockhash, 'hex')); + chain.setDifficulty(blockchainInfoResponse.difficulty); + chain.setChainWork(Buffer.from(blockchainInfoResponse.chainwork, 'hex')); + chain.setIsSynced(blockchainInfoResponse.verificationprogress === 1); + chain.setSyncProgress(blockchainInfoResponse.verificationprogress); + + const network = new GetBlockchainStatusResponse.Network(); + network.setPeersCount(networkInfoResponse.connections); + + const networkFee = new GetBlockchainStatusResponse.NetworkFee(); + networkFee.setRelay(networkInfoResponse.relayfee); + networkFee.setIncremental(networkInfoResponse.incrementalfee); + + network.setFee(networkFee); + + response.setVersion(version); + response.setTime(time); + response.setSyncProgress(blockchainInfoResponse.verificationprogress); + response.setChain(chain); + response.setNetwork(network); + + let status = GetBlockchainStatusResponse.Status.SYNCING; + if (blockchainInfoResponse.verificationprogress === 1) { + status = GetBlockchainStatusResponse.Status.READY; + } + + response.setStatus(status); + } + + // Set now to current time + response.getTime().setNow(Math.floor(Date.now() / 1000)); + + return response; + } + + return getBlockchainStatusHandler; +} + +module.exports = getBlockchainStatusHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/core/getMasternodeStatusHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/core/getMasternodeStatusHandlerFactory.js new file mode 100644 index 00000000000..abfc0782008 --- /dev/null +++ b/packages/dapi/lib/grpcServer/handlers/core/getMasternodeStatusHandlerFactory.js @@ -0,0 +1,67 @@ +const { + v0: { + GetMasternodeStatusResponse, + }, +} = require('@dashevo/dapi-grpc'); + +/** + * @param {CoreRpcClient} coreRPCClient + * @returns {getMasternodeStatusHandler} + */ +function getMasternodeStatusHandlerFactory(coreRPCClient) { + /** + * @typedef getMasternodeStatusHandler + * @return {Promise} + */ + async function getMasternodeStatusHandler() { + const [ + mnSyncStatusResponse, + masternodeStatusResponse, + ] = await Promise.all([ + coreRPCClient.getMnSync('status'), + coreRPCClient.getMasternode('status'), + ]); + + const response = new GetMasternodeStatusResponse(); + + const masternodeStatus = GetMasternodeStatusResponse.Status[masternodeStatusResponse.state]; + + response.setStatus(masternodeStatus); + + if (masternodeStatusResponse.proTxHash) { + response.setProTxHash(Buffer.from(masternodeStatusResponse.proTxHash, 'hex')); + } + + if (masternodeStatusResponse.dmnState) { + response.setPosePenalty(masternodeStatusResponse.dmnState.PoSePenalty); + } + + response.setIsSynced(mnSyncStatusResponse.IsSynced); + + let syncProgress; + switch (mnSyncStatusResponse.AssetID) { + case 999: + syncProgress = 1; + break; + case 0: + syncProgress = 0; + break; + case 1: + syncProgress = 1 / 3; + break; + case 4: + syncProgress = 2 / 3; + break; + default: + syncProgress = 0; + } + + response.setSyncProgress(syncProgress); + + return response; + } + + return getMasternodeStatusHandler; +} + +module.exports = getMasternodeStatusHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/core/getStatusHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/core/getStatusHandlerFactory.js deleted file mode 100644 index 3f76cfa63d8..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/core/getStatusHandlerFactory.js +++ /dev/null @@ -1,118 +0,0 @@ -const { - v0: { - GetStatusResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {CoreRpcClient} coreRPCClient - * @returns {getStatusHandler} - */ -function getStatusHandlerFactory(coreRPCClient) { - /** - * @typedef getStatusHandler - * @return {Promise} - */ - async function getStatusHandler() { - const [ - blockchainInfoResponse, - networkInfoResponse, - mnSyncStatusResponse, - masternodeStatusResponse, - ] = await Promise.all([ - coreRPCClient.getBlockchainInfo(), - coreRPCClient.getNetworkInfo(), - coreRPCClient.getMnSync('status'), - coreRPCClient.getMasternode('status'), - ]); - - const response = new GetStatusResponse(); - - const version = new GetStatusResponse.Version(); - version.setProtocol(networkInfoResponse.protocolversion); - version.setSoftware(networkInfoResponse.version); - version.setAgent(networkInfoResponse.subversion); - - const time = new GetStatusResponse.Time(); - time.setNow(Math.floor(Date.now() / 1000)); - time.setOffset(networkInfoResponse.timeoffset); - time.setMedian(blockchainInfoResponse.mediantime); - - const chain = new GetStatusResponse.Chain(); - chain.setName(blockchainInfoResponse.chain); - chain.setBlocksCount(blockchainInfoResponse.blocks); - chain.setHeadersCount(blockchainInfoResponse.headers); - chain.setBestBlockHash(Buffer.from(blockchainInfoResponse.bestblockhash, 'hex')); - chain.setDifficulty(blockchainInfoResponse.difficulty); - chain.setChainWork(Buffer.from(blockchainInfoResponse.chainwork, 'hex')); - chain.setIsSynced(mnSyncStatusResponse.IsBlockchainSynced); - chain.setSyncProgress(blockchainInfoResponse.verificationprogress); - - const masternode = new GetStatusResponse.Masternode(); - - const masternodeStatus = GetStatusResponse.Masternode.Status[masternodeStatusResponse.state]; - - masternode.setStatus(masternodeStatus); - - if (masternodeStatusResponse.proTxHash) { - masternode.setProTxHash(Buffer.from(masternodeStatusResponse.proTxHash, 'hex')); - } - - if (masternodeStatusResponse.dmnState) { - masternode.setPosePenalty(masternodeStatusResponse.dmnState.PoSePenalty); - } - - masternode.setIsSynced(mnSyncStatusResponse.IsSynced); - - let syncProgress; - switch (mnSyncStatusResponse.AssetID) { - case 999: - syncProgress = 1; - break; - case 0: - syncProgress = 0; - break; - case 1: - syncProgress = 1 / 3; - break; - case 4: - syncProgress = 2 / 3; - break; - default: - syncProgress = 0; - } - - masternode.setSyncProgress(syncProgress); - - const network = new GetStatusResponse.Network(); - network.setPeersCount(networkInfoResponse.connections); - - const networkFee = new GetStatusResponse.NetworkFee(); - networkFee.setRelay(networkInfoResponse.relayfee); - networkFee.setIncremental(networkInfoResponse.incrementalfee); - - network.setFee(networkFee); - - response.setVersion(version); - response.setTime(time); - response.setSyncProgress(blockchainInfoResponse.verificationprogress); - response.setChain(chain); - response.setMasternode(masternode); - response.setNetwork(network); - - let status = GetStatusResponse.Status.NOT_STARTED; - if (mnSyncStatusResponse.IsBlockchainSynced && mnSyncStatusResponse.IsSynced) { - status = GetStatusResponse.Status.READY; - } else if (blockchainInfoResponse.verificationprogress > 0) { - status = GetStatusResponse.Status.SYNCING; - } - - response.setStatus(status); - - return response; - } - - return getStatusHandler; -} - -module.exports = getStatusHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/core/subscribeToMasternodeListHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/core/subscribeToMasternodeListHandlerFactory.js new file mode 100644 index 00000000000..dce332f9ff0 --- /dev/null +++ b/packages/dapi/lib/grpcServer/handlers/core/subscribeToMasternodeListHandlerFactory.js @@ -0,0 +1,71 @@ +const { + v0: { + MasternodeListResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const MasternodeListSync = require('../../../MasternodeListSync'); +const logger = require('../../../logger'); + +/** + * @param {MasternodeListSync} masternodeListSync + */ +function subscribeToMasternodeListHandlerFactory(masternodeListSync) { + /** + * @param {grpc.ServerWriteableStream} call + * @return {Promise} + */ + async function subscribeToMasternodeListHandler(call) { + const requestLogger = logger.child({ + endpoint: 'subscribeToMasternodeListHandler', + request: Math.floor(Math.random() * 1000), + }); + + requestLogger.debug('Start stream'); + + // We create a closure here to have an independent listener for each call, + // so we can easily remove it when the call ends + const sendDiff = (diffBuffer, blockHeight, blockHash, full) => { + const response = new MasternodeListResponse(); + + response.setMasternodeListDiff(diffBuffer); + + let message = 'Masternode list diff sent'; + if (full) { + message = 'Full masternode list sent'; + } + + requestLogger.trace({ + blockHeight, + blockHash, + }, message); + + call.write(response); + }; + + const shutdown = () => { + call.end(); + + requestLogger.trace('Shutdown stream'); + + masternodeListSync.removeListener(MasternodeListSync.EVENT_DIFF, sendDiff); + }; + + call.on('end', shutdown); + call.on('cancelled', shutdown); + + masternodeListSync.on(MasternodeListSync.EVENT_DIFF, sendDiff); + + // Send full masternode list on subscribe + sendDiff( + masternodeListSync.getFullDiffBuffer(), + masternodeListSync.getBlockHeight(), + masternodeListSync.getBlockHash(), + true, + ); + } + + return subscribeToMasternodeListHandler; +} + +module.exports = subscribeToMasternodeListHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/createGrpcErrorFromDriveResponse.js b/packages/dapi/lib/grpcServer/handlers/createGrpcErrorFromDriveResponse.js index 1d190d63bfd..b6e7032f850 100644 --- a/packages/dapi/lib/grpcServer/handlers/createGrpcErrorFromDriveResponse.js +++ b/packages/dapi/lib/grpcServer/handlers/createGrpcErrorFromDriveResponse.js @@ -19,6 +19,7 @@ const { default: loadWasmDpp, deserializeConsensusError } = require('@dashevo/wa const GrpcErrorCodes = require('@dashevo/grpc-common/lib/server/error/GrpcErrorCodes'); const AlreadyExistsGrpcError = require('@dashevo/grpc-common/lib/server/error/AlreadyExistsGrpcError'); +const logger = require('../../logger'); /** * @param {Object} data @@ -100,7 +101,7 @@ async function createGrpcErrorFromDriveResponse(code, info) { } // Undefined Drive and DAPI errors - if (code >= 17 && code < 1000) { + if (code >= 17 && code < 10000) { return new GrpcError( GrpcErrorCodes.UNKNOWN, message, @@ -109,11 +110,22 @@ async function createGrpcErrorFromDriveResponse(code, info) { } // DPP errors - if (code >= 1000 && code < 5000) { - const consensusError = deserializeConsensusError(data.serializedError || []); + if (code >= 10000 && code < 50000) { + let consensusError; + try { + consensusError = deserializeConsensusError(data.serializedError || []); + } catch (e) { + logger.error({ + err: e, + data: data.serializedError, + code, + }, `Failed to deserialize consensus error with code ${code}: ${e.message}`); + + throw e; + } // Basic - if (code >= 1000 && code < 2000) { + if (code >= 10000 && code < 20000) { return new InvalidArgumentGrpcError( consensusError.message, { code, ...createRawMetadata(data) }, @@ -121,7 +133,7 @@ async function createGrpcErrorFromDriveResponse(code, info) { } // Signature - if (code >= 2000 && code < 3000) { + if (code >= 20000 && code < 30000) { return new GrpcError( GrpcErrorCodes.UNAUTHENTICATED, consensusError.message, @@ -130,7 +142,7 @@ async function createGrpcErrorFromDriveResponse(code, info) { } // Fee - if (code >= 3000 && code < 4000) { + if (code >= 30000 && code < 40000) { return new FailedPreconditionGrpcError( consensusError.message, { code, ...createRawMetadata(data) }, @@ -138,7 +150,7 @@ async function createGrpcErrorFromDriveResponse(code, info) { } // State - if (code >= 4000 && code < 5000) { + if (code >= 40000 && code < 50000) { return new InvalidArgumentGrpcError( consensusError.message, { code, ...createRawMetadata(data) }, diff --git a/packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js index 15e369f9ce5..ad772760427 100644 --- a/packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js +++ b/packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js @@ -3,6 +3,8 @@ const { error: { InvalidArgumentGrpcError, AlreadyExistsGrpcError, + ResourceExhaustedGrpcError, + UnavailableGrpcError, }, }, } = require('@dashevo/grpc-common'); @@ -12,6 +14,7 @@ const { BroadcastStateTransitionResponse, }, } = require('@dashevo/dapi-grpc'); +const logger = require('../../../logger'); /** * @param {jaysonClient} rpcClient @@ -35,18 +38,64 @@ function broadcastStateTransitionHandlerFactory(rpcClient, createGrpcErrorFromDr throw new InvalidArgumentGrpcError('State Transition is not specified'); } - const tx = Buffer.from(stByteArray).toString('base64'); + const tx = Buffer.from(stByteArray) + .toString('base64'); - const { result, error: jsonRpcError } = await rpcClient.request('broadcast_tx_sync', { tx }); + let response; + + try { + response = await rpcClient.request('broadcast_tx', { tx }); + } catch (e) { + if (e.message === 'socket hang up') { + throw new UnavailableGrpcError('Tenderdash is not available'); + } + + e.message = `Failed broadcasting state transition: ${e.message}`; + + throw e; + } + + const { + result, + error: jsonRpcError, + } = response; if (jsonRpcError) { - if (jsonRpcError.data === 'tx already exists in cache') { - throw new AlreadyExistsGrpcError('State transition already in chain'); + if (typeof jsonRpcError.data === 'string') { + if (jsonRpcError.data === 'tx already exists in cache') { + throw new AlreadyExistsGrpcError('state transition already in chain'); + } + + if (jsonRpcError.data.startsWith('Tx too large.')) { + const message = jsonRpcError.data.replace('Tx too large. ', ''); + throw new InvalidArgumentGrpcError(`state transition is too large. ${message}`); + } + + if (jsonRpcError.data.startsWith('mempool is full')) { + throw new ResourceExhaustedGrpcError(jsonRpcError.data); + } + + // broadcasting is timed out + if (jsonRpcError.data.includes('context deadline exceeded')) { + throw new ResourceExhaustedGrpcError('broadcasting state transition is timed out'); + } + + if (jsonRpcError.data.includes('too_many_resets')) { + throw new ResourceExhaustedGrpcError('tenderdash is not responding: too many requests'); + } + + if (jsonRpcError.data.startsWith('broadcast confirmation not received:')) { + logger.error(`Failed broadcasting state transition: ${jsonRpcError.data}`); + + throw new UnavailableGrpcError(jsonRpcError.data); + } } const error = new Error(); Object.assign(error, jsonRpcError); + logger.error(error, `Unexpected JSON RPC error during broadcasting state transition: ${JSON.stringify(jsonRpcError)}`); + throw error; } diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getDataContractHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getDataContractHandlerFactory.js deleted file mode 100644 index 8d3c8a567a0..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getDataContractHandlerFactory.js +++ /dev/null @@ -1,43 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetDataContractResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @returns {getDataContractHandler} - */ -function getDataContractHandlerFactory(driveClient) { - /** - * @typedef getDataContractHandler - * - * @param {Object} call - * - * @returns {Promise} - */ - async function getDataContractHandler(call) { - const { request } = call; - - if (request.getV0().getId() === null) { - throw new InvalidArgumentGrpcError('id is not specified'); - } - - const dataContractResponseBuffer = await driveClient.fetchDataContract(request); - - return GetDataContractResponse.deserializeBinary(dataContractResponseBuffer); - } - - return getDataContractHandler; -} - -module.exports = getDataContractHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getDataContractHistoryHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getDataContractHistoryHandlerFactory.js deleted file mode 100644 index 40f607a935e..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getDataContractHistoryHandlerFactory.js +++ /dev/null @@ -1,43 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetDataContractHistoryResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @returns {getDataContractHistoryHandler} - */ -function getDataContractHistoryHandlerFactory(driveClient) { - /** - * @typedef getDataContractHistoryHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getDataContractHistoryHandler(call) { - const { request } = call; - - if (request.getV0().getId() === null) { - throw new InvalidArgumentGrpcError('id is not specified'); - } - - const dataContractHistoryResponseBuffer = await driveClient.fetchDataContractHistory(request); - - return GetDataContractHistoryResponse.deserializeBinary(dataContractHistoryResponseBuffer); - } - - return getDataContractHistoryHandler; -} - -module.exports = getDataContractHistoryHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getDataContractsHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getDataContractsHandlerFactory.js deleted file mode 100644 index 5a2136e90e6..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getDataContractsHandlerFactory.js +++ /dev/null @@ -1,45 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetDataContractsResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @return {getDataContractsHandler} - */ -function getDataContractsHandlerFactory(driveClient) { - /** - * @typedef getDataContractsHandler - * - * @param {Object} call - * - * @returns {Promise} - */ - async function getDocumentsHandler(call) { - const { request } = call; - - if (!request.getV0().getDataContractId()) { - throw new InvalidArgumentGrpcError('dataContractId is not specified'); - } - - if (!request.getV0().getDocumentType()) { - throw new InvalidArgumentGrpcError('documentType is not specified'); - } - - const documentResponseBuffer = await driveClient.fetchDocuments( - request, - ); - - return GetDocumentsResponse.deserializeBinary(documentResponseBuffer); - } - - return getDocumentsHandler; -} - -module.exports = getDocumentsHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getEpochsInfoHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getEpochsInfoHandlerFactory.js deleted file mode 100644 index 240fa429690..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getEpochsInfoHandlerFactory.js +++ /dev/null @@ -1,32 +0,0 @@ -const { - v0: { - GetEpochsInfoResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @returns {getEpochsInfoHandler} - */ -function getEpochsInfoHandlerFactory(driveClient) { - /** - * @typedef getEpochsInfoHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getEpochsInfoHandler(call) { - const { request } = call; - - const epochsInfoBuffer = await driveClient - .fetchEpochsInfo(request); - - return GetEpochsInfoResponse.deserializeBinary(epochsInfoBuffer); - } - - return getEpochsInfoHandler; -} - -module.exports = getEpochsInfoHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getIdentitiesByPublicKeyHashesHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getIdentitiesByPublicKeyHashesHandlerFactory.js deleted file mode 100644 index e0d31d6244d..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getIdentitiesByPublicKeyHashesHandlerFactory.js +++ /dev/null @@ -1,44 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentitiesByPublicKeyHashesResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * - * @param {DriveClient} driveClient - * @return {getIdentitiesByPublicKeyHashesHandler} - */ -function getIdentitiesByPublicKeyHashesHandlerFactory( - driveClient, -) { - /** - * @typedef getIdentitiesByPublicKeyHashesHandler - * @param {Object} call - * @return {Promise} - */ - async function getIdentitiesByPublicKeyHashesHandler(call) { - const { request } = call; - - if (request.getV0().getPublicKeyHashesList().length === 0) { - throw new InvalidArgumentGrpcError('No public key hashes were provided'); - } - - const identitiesResponseBuffer = await driveClient - .fetchIdentitiesByPublicKeyHashes(request); - - return GetIdentitiesByPublicKeyHashesResponse.deserializeBinary(identitiesResponseBuffer); - } - - return getIdentitiesByPublicKeyHashesHandler; -} - -module.exports = getIdentitiesByPublicKeyHashesHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getIdentitiesHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getIdentitiesHandlerFactory.js deleted file mode 100644 index c2d12621e40..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getIdentitiesHandlerFactory.js +++ /dev/null @@ -1,45 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentitiesResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @return {getIdentitiesHandler} - */ -function getIdentitiesHandlerFactory(driveClient) { - /** - * @typedef getIdentitiesHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getIdentitiesHandler(call) { - const { request } = call; - - const identitiIds = request.getV0().getIdsList(); - - if (identitiIds === null) { - throw new InvalidArgumentGrpcError('identity ids are not specified'); - } - - const identitiesResponseBuffer = await driveClient.fetchIdentities(request); - - return GetIdentitiesResponse.deserializeBinary(identitiesResponseBuffer); - } - - return getIdentitiesHandler; -} - -module.exports = getIdentitiesHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityBalanceAndRevisionHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getIdentityBalanceAndRevisionHandlerFactory.js deleted file mode 100644 index 064fc3033b2..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityBalanceAndRevisionHandlerFactory.js +++ /dev/null @@ -1,44 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityBalanceAndRevisionResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @return {getIdentityBalanceAndRevisionHandler} - */ -function getIdentityBalanceAndRevisionHandlerFactory(driveClient) { - /** - * @typedef getIdentityBalanceAndRevisionHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getIdentityBalanceAndRevisionHandler(call) { - const { request } = call; - - if (!request.getV0().getId()) { - throw new InvalidArgumentGrpcError('identity id is not specified'); - } - - const identityResponseBuffer = await driveClient - .fetchIdentityBalanceAndRevision(request); - - return GetIdentityBalanceAndRevisionResponse.deserializeBinary(identityResponseBuffer); - } - - return getIdentityBalanceAndRevisionHandler; -} - -module.exports = getIdentityBalanceAndRevisionHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityBalanceHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getIdentityBalanceHandlerFactory.js deleted file mode 100644 index 300290e9907..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityBalanceHandlerFactory.js +++ /dev/null @@ -1,44 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityBalanceResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @return {getIdentityBalanceHandler} - */ -function getIdentityBalanceHandlerFactory(driveClient) { - /** - * @typedef getIdentityBalanceHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getIdentityBalanceHandler(call) { - const { request } = call; - - if (!request.getV0().getId()) { - throw new InvalidArgumentGrpcError('identity id is not specified'); - } - - const identityResponseBuffer = await driveClient - .fetchIdentityBalance(request); - - return GetIdentityBalanceResponse.deserializeBinary(identityResponseBuffer); - } - - return getIdentityBalanceHandler; -} - -module.exports = getIdentityBalanceHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityByPublicKeyHashHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getIdentityByPublicKeyHashHandlerFactory.js deleted file mode 100644 index 720181b237b..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityByPublicKeyHashHandlerFactory.js +++ /dev/null @@ -1,44 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityByPublicKeyHashResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * - * @param {DriveClient} driveClient - * @return {getIdentityByPublicKeyHashHandler} - */ -function getIdentityByPublicKeyHashHandlerFactory( - driveClient, -) { - /** - * @typedef getIdentityByPublicKeyHashHandler - * @param {Object} call - * @return {Promise} - */ - async function getIdentityByPublicKeyHashHandler(call) { - const { request } = call; - - if (request.getV0().getPublicKeyHash().length === 0) { - throw new InvalidArgumentGrpcError('No public key hash is provided'); - } - - const identitiesResponseBuffer = await driveClient - .fetchIdentityByPublicKeyHash(request); - - return GetIdentityByPublicKeyHashResponse.deserializeBinary(identitiesResponseBuffer); - } - - return getIdentityByPublicKeyHashHandler; -} - -module.exports = getIdentityByPublicKeyHashHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityContractNonceHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getIdentityContractNonceHandlerFactory.js new file mode 100644 index 00000000000..3109022c925 --- /dev/null +++ b/packages/dapi/lib/grpcServer/handlers/platform/getIdentityContractNonceHandlerFactory.js @@ -0,0 +1,33 @@ +const { + v0: { + GetIdentityContractNonceResponse, + }, +} = require('@dashevo/dapi-grpc'); + +/** + * @param {DriveClient} driveClient + * + * @returns {getIdentityContractNonceHandler} + */ +function getIdentityContractNonceHandlerFactory(driveClient) { + /** + * @typedef getIdentityContractNonceHandler + * + * @param {Object} call + * + * @return {Promise} + */ + async function getIdentityContractNonceHandler(call) { + const { request } = call; + + const identityContractNonceBuffer = await driveClient + .fetchIdentityContractNonce(request); + + return GetIdentityContractNonceResponse + .deserializeBinary(identityContractNonceBuffer); + } + + return getIdentityContractNonceHandler; +} + +module.exports = getIdentityContractNonceHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getIdentityHandlerFactory.js deleted file mode 100644 index 1a78a398b6d..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityHandlerFactory.js +++ /dev/null @@ -1,44 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @returns {getIdentityHandler} - */ -function getIdentityHandlerFactory(driveClient) { - /** - * @typedef getIdentityHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getIdentityHandler(call) { - const { request } = call; - - if (!request.getV0().getId()) { - throw new InvalidArgumentGrpcError('id is not specified'); - } - - const identityResponseBuffer = await driveClient - .fetchIdentity(request); - - return GetIdentityResponse.deserializeBinary(identityResponseBuffer); - } - - return getIdentityHandler; -} - -module.exports = getIdentityHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityKeysHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getIdentityKeysHandlerFactory.js deleted file mode 100644 index 2d446eeee73..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityKeysHandlerFactory.js +++ /dev/null @@ -1,44 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityKeysResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @return {getIdentityKeysHandler} - */ -function getIdentityKeysHandlerFactory(driveClient) { - /** - * @typedef getIdentityKeysHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getIdentityKeysHandler(call) { - const { request } = call; - - if (!request.getV0().getIdentityId()) { - throw new InvalidArgumentGrpcError('identity id is not specified'); - } - - const identityResponseBuffer = await driveClient - .fetchIdentityKeys(request); - - return GetIdentityKeysResponse.deserializeBinary(identityResponseBuffer); - } - - return getIdentityKeysHandler; -} - -module.exports = getIdentityKeysHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getIdentityNonceHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getIdentityNonceHandlerFactory.js new file mode 100644 index 00000000000..5d38ca93064 --- /dev/null +++ b/packages/dapi/lib/grpcServer/handlers/platform/getIdentityNonceHandlerFactory.js @@ -0,0 +1,33 @@ +const { + v0: { + GetIdentityNonceResponse, + }, +} = require('@dashevo/dapi-grpc'); + +/** + * @param {DriveClient} driveClient + * + * @returns {getIdentityNonceHandler} + */ +function getIdentityNonceHandlerFactory(driveClient) { + /** + * @typedef getIdentityNonceHandler + * + * @param {Object} call + * + * @return {Promise} + */ + async function getIdentityNonceHandler(call) { + const { request } = call; + + const identityNonceBuffer = await driveClient + .fetchIdentityNonce(request); + + return GetIdentityNonceResponse + .deserializeBinary(identityNonceBuffer); + } + + return getIdentityNonceHandler; +} + +module.exports = getIdentityNonceHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getProofsHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getProofsHandlerFactory.js deleted file mode 100644 index 044c2022dc1..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getProofsHandlerFactory.js +++ /dev/null @@ -1,31 +0,0 @@ -const { - v0: { - GetProofsResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @return {getProofsHandler} - */ -function getProofsHandlerFactory(driveClient) { - /** - * @typedef getProofsHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getProofsHandler(call) { - const { request } = call; - - const proofsResponseBuffer = await driveClient.fetchProofs(request); - - return GetProofsResponse.deserializeBinary(proofsResponseBuffer); - } - - return getProofsHandler; -} - -module.exports = getProofsHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getProtocolVersionUpgradeStateHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getProtocolVersionUpgradeStateHandlerFactory.js deleted file mode 100644 index ab60ab317fd..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getProtocolVersionUpgradeStateHandlerFactory.js +++ /dev/null @@ -1,33 +0,0 @@ -const { - v0: { - GetProtocolVersionUpgradeStateResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @returns {getProtocolVersionUpgradeStateHandler} - */ -function getProtocolVersionUpgradeStateHandlerFactory(driveClient) { - /** - * @typedef getProtocolVersionUpgradeStateHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getProtocolVersionUpgradeStateHandler(call) { - const { request } = call; - - const versionUpgradeStateBuffer = await driveClient - .fetchVersionUpgradeState(request); - - return GetProtocolVersionUpgradeStateResponse - .deserializeBinary(versionUpgradeStateBuffer); - } - - return getProtocolVersionUpgradeStateHandler; -} - -module.exports = getProtocolVersionUpgradeStateHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/getProtocolVersionUpgradeVoteStatusHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/getProtocolVersionUpgradeVoteStatusHandlerFactory.js deleted file mode 100644 index 4695e2193d2..00000000000 --- a/packages/dapi/lib/grpcServer/handlers/platform/getProtocolVersionUpgradeVoteStatusHandlerFactory.js +++ /dev/null @@ -1,33 +0,0 @@ -const { - v0: { - GetProtocolVersionUpgradeVoteStatusResponse, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {DriveClient} driveClient - * - * @returns {getProtocolVersionUpgradeVoteStatusHandler} - */ -function getProtocolVersionUpgradeVoteStatusHandlerFactory(driveClient) { - /** - * @typedef getProtocolVersionUpgradeVoteStatusHandler - * - * @param {Object} call - * - * @return {Promise} - */ - async function getProtocolVersionUpgradeVoteStatusHandler(call) { - const { request } = call; - - const versionUpgradeVoteStatusBuffer = await driveClient - .fetchVersionUpgradeVoteStatus(request); - - return GetProtocolVersionUpgradeVoteStatusResponse - .deserializeBinary(versionUpgradeVoteStatusBuffer); - } - - return getProtocolVersionUpgradeVoteStatusHandler; -} - -module.exports = getProtocolVersionUpgradeVoteStatusHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/platform/platformHandlersFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/platformHandlersFactory.js index 32cbdff8360..91fc8fa9137 100644 --- a/packages/dapi/lib/grpcServer/handlers/platform/platformHandlersFactory.js +++ b/packages/dapi/lib/grpcServer/handlers/platform/platformHandlersFactory.js @@ -16,56 +16,15 @@ const { const { v0: { BroadcastStateTransitionRequest, - GetIdentityRequest, - GetIdentityKeysRequest, - GetDataContractRequest, - GetDataContractsRequest, - GetDataContractHistoryRequest, - GetDocumentsRequest, - GetIdentitiesRequest, - GetIdentitiesByPublicKeyHashesRequest, - GetIdentityByPublicKeyHashRequest, WaitForStateTransitionResultRequest, GetConsensusParamsRequest, - GetProofsRequest, - GetEpochsInfoRequest, - GetProtocolVersionUpgradeVoteStatusRequest, - GetProtocolVersionUpgradeStateRequest, pbjs: { BroadcastStateTransitionRequest: PBJSBroadcastStateTransitionRequest, BroadcastStateTransitionResponse: PBJSBroadcastStateTransitionResponse, - GetIdentityRequest: PBJSGetIdentityRequest, - GetIdentityResponse: PBJSGetIdentityResponse, - GetIdentitiesRequest: PBJSGetIdentitiesRequest, - GetIdentitiesResponse: PBJSGetIdentitiesResponse, - GetIdentityBalanceResponse: PBJSGetIdentityBalanceResponse, - GetIdentityBalanceAndRevisionResponse: PBJSGetIdentityBalanceAndRevisionResponse, - GetIdentityKeysRequest: PBJSGetIdentityKeysRequest, - GetIdentityKeysResponse: PBJSGetIdentityKeysResponse, - GetDataContractRequest: PBJSGetDataContractRequest, - GetDataContractResponse: PBJSGetDataContractResponse, - GetDataContractsRequest: PBJSGetDataContractsRequest, - GetDataContractsResponse: PBJSGetDataContractsResponse, - GetDocumentsRequest: PBJSGetDocumentsRequest, - GetDocumentsResponse: PBJSGetDocumentsResponse, - GetIdentitiesByPublicKeyHashesResponse: PBJSGetIdentitiesByPublicKeyHashesResponse, - GetIdentitiesByPublicKeyHashesRequest: PBJSGetIdentitiesByPublicKeyHashesRequest, - GetIdentityByPublicKeyHashResponse: PBJSGetIdentityByPublicKeyHashResponse, - GetIdentityByPublicKeyHashRequest: PBJSGetIdentityByPublicKeyHashRequest, WaitForStateTransitionResultRequest: PBJSWaitForStateTransitionResultRequest, WaitForStateTransitionResultResponse: PBJSWaitForStateTransitionResultResponse, GetConsensusParamsRequest: PBJSGetConsensusParamsRequest, GetConsensusParamsResponse: PBJSGetConsensusParamsResponse, - GetDataContractHistoryRequest: PBJSGetDataContractHistoryRequest, - GetDataContractHistoryResponse: PBJSGetDataContractHistoryResponse, - GetProofsRequest: PBJSGetProofsRequest, - GetProofsResponse: PBJSGetProofsResponse, - GetEpochsInfoRequest: PBJSGetEpochsInfoRequest, - GetEpochsInfoResponse: PBJSGetEpochsInfoResponse, - GetProtocolVersionUpgradeVoteStatusRequest: PBJSGetProtocolVersionUpgradeVoteStatusRequest, - GetProtocolVersionUpgradeVoteStatusResponse: PBJSGetProtocolVersionUpgradeVoteStatusResponse, - GetProtocolVersionUpgradeStateRequest: PBJSGetProtocolVersionUpgradeStateRequest, - GetProtocolVersionUpgradeStateResponse: PBJSGetProtocolVersionUpgradeStateResponse, }, }, } = require('@dashevo/dapi-grpc'); @@ -74,61 +33,17 @@ const logger = require('../../../logger'); const createGrpcErrorFromDriveResponse = require('../createGrpcErrorFromDriveResponse'); -const getIdentityHandlerFactory = require( - './getIdentityHandlerFactory', -); -const getIdentitiesHandlerFactory = require( - './getIdentitiesHandlerFactory', -); -const getIdentityBalanceHandlerFactory = require( - './getIdentityBalanceHandlerFactory', -); -const getIdentityKeysHandlerFactory = require( - './getIdentityKeysHandlerFactory', -); -const getIdentityBalanceAndRevisionHandlerFactory = require( - './getIdentityBalanceAndRevisionHandlerFactory', -); const broadcastStateTransitionHandlerFactory = require( './broadcastStateTransitionHandlerFactory', ); -const getDocumentsHandlerFactory = require( - './getDocumentsHandlerFactory', -); -const getDataContractHandlerFactory = require( - './getDataContractHandlerFactory', -); -const getDataContractsHandlerFactory = require( - './getDataContractsHandlerFactory', -); -const getDataContractHistoryHandlerFactory = require( - './getDataContractHistoryHandlerFactory', -); -const getIdentityByPublicKeyHashHandlerFactory = require( - './getIdentityByPublicKeyHashHandlerFactory', -); -const getIdentitiesByPublicKeyHashesHandlerFactory = require( - './getIdentitiesByPublicKeyHashesHandlerFactory', -); const waitForStateTransitionResultHandlerFactory = require( './waitForStateTransitionResultHandlerFactory', ); const getConsensusParamsHandlerFactory = require( './getConsensusParamsHandlerFactory', ); -const getProofsHandlerFactory = require( - './getProofsHandlerFactory', -); -const getEpochsInfoHandlerFactory = require( - './getEpochsInfoHandlerFactory', -); - -const getProtocolVersionUpgradeVoteStatusHandlerFactory = require( - './getProtocolVersionUpgradeVoteStatusHandlerFactory', -); - -const getProtocolVersionUpgradeStateHandlerFactory = require( - './getProtocolVersionUpgradeStateHandlerFactory', +const unimplementedHandlerFactory = require( + './unimplementedHandlerFactory', ); const fetchProofForStateTransitionFactory = require('../../../externalApis/drive/fetchProofForStateTransitionFactory'); @@ -140,7 +55,7 @@ const getConsensusParamsFactory = require('../../../externalApis/tenderdash/getC /** * @param {jaysonClient} rpcClient * @param {BlockchainListener} blockchainListener - * @param {DriveClient} driveClient + * @param {PlatformPromiseClient} driveClient * @param {DashPlatformProtocol} dpp * @param {boolean} isProductionEnvironment * @returns {Object} @@ -171,198 +86,6 @@ function platformHandlersFactory( wrapInErrorHandler(broadcastStateTransitionHandler), ); - // getIdentity - const getIdentityHandler = getIdentityHandlerFactory( - driveClient, - ); - - const wrappedGetIdentity = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetIdentityRequest, - PBJSGetIdentityRequest, - ), - protobufToJsonFactory( - PBJSGetIdentityResponse, - ), - wrapInErrorHandler(getIdentityHandler), - ); - - // getIdentities - const getIdentitiesHandler = getIdentitiesHandlerFactory( - driveClient, - ); - - const wrappedGetIdentities = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetIdentitiesRequest, - PBJSGetIdentitiesRequest, - ), - protobufToJsonFactory( - PBJSGetIdentitiesResponse, - ), - wrapInErrorHandler(getIdentitiesHandler), - ); - - // getIdentityBalance - const getIdentityBalanceHandler = getIdentityBalanceHandlerFactory( - driveClient, - ); - - const wrappedGetIdentityBalance = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetIdentityRequest, - PBJSGetIdentityRequest, - ), - protobufToJsonFactory( - PBJSGetIdentityBalanceResponse, - ), - wrapInErrorHandler(getIdentityBalanceHandler), - ); - - // getIdentityBalanceAndRevision - const getIdentityBalanceAndRevisionHandler = getIdentityBalanceAndRevisionHandlerFactory( - driveClient, - ); - - const wrappedGetIdentityBalanceAndRevision = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetIdentityRequest, - PBJSGetIdentityRequest, - ), - protobufToJsonFactory( - PBJSGetIdentityBalanceAndRevisionResponse, - ), - wrapInErrorHandler(getIdentityBalanceAndRevisionHandler), - ); - - // getIdentityKeys - const getIdentityKeysHandler = getIdentityKeysHandlerFactory( - driveClient, - ); - - const wrappedGetIdentityKeys = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetIdentityKeysRequest, - PBJSGetIdentityKeysRequest, - ), - protobufToJsonFactory( - PBJSGetIdentityKeysResponse, - ), - wrapInErrorHandler(getIdentityKeysHandler), - ); - - // getDocuments - const getDocumentsHandler = getDocumentsHandlerFactory( - driveClient, - ); - - const wrappedGetDocuments = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetDocumentsRequest, - PBJSGetDocumentsRequest, - ), - protobufToJsonFactory( - PBJSGetDocumentsResponse, - ), - wrapInErrorHandler(getDocumentsHandler), - ); - - // getDataContract - const getDataContractHandler = getDataContractHandlerFactory( - driveClient, - ); - - const wrappedGetDataContract = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetDataContractRequest, - PBJSGetDataContractRequest, - ), - protobufToJsonFactory( - PBJSGetDataContractResponse, - ), - wrapInErrorHandler(getDataContractHandler), - ); - - // getDataContracts - const getDataContractsHandler = getDataContractsHandlerFactory( - driveClient, - ); - - const wrappedGetDataContracts = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetDataContractsRequest, - PBJSGetDataContractsRequest, - ), - protobufToJsonFactory( - PBJSGetDataContractsResponse, - ), - wrapInErrorHandler(getDataContractsHandler), - ); - - // getDataContractHistory - const getDataContractHistoryHandler = getDataContractHistoryHandlerFactory( - driveClient, - ); - - const wrappedGetDataContractHistory = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetDataContractHistoryRequest, - PBJSGetDataContractHistoryRequest, - ), - protobufToJsonFactory( - PBJSGetDataContractHistoryResponse, - ), - wrapInErrorHandler(getDataContractHistoryHandler), - ); - - // getIdentityByPublicKeyHash - const getIdentityByPublicKeyHashHandler = getIdentityByPublicKeyHashHandlerFactory( - driveClient, - ); - - const wrappedGetIdentityByPublicKeyHash = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetIdentityByPublicKeyHashRequest, - PBJSGetIdentityByPublicKeyHashRequest, - ), - protobufToJsonFactory( - PBJSGetIdentityByPublicKeyHashResponse, - ), - wrapInErrorHandler(getIdentityByPublicKeyHashHandler), - ); - - // getIdentitiesByPublicKeyHashes - const getIdentitiesByPublicKeyHashesHandler = getIdentitiesByPublicKeyHashesHandlerFactory( - driveClient, - ); - - const wrappedGetIdentitiesByPublicKeyHashes = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetIdentitiesByPublicKeyHashesRequest, - PBJSGetIdentitiesByPublicKeyHashesRequest, - ), - protobufToJsonFactory( - PBJSGetIdentitiesByPublicKeyHashesResponse, - ), - wrapInErrorHandler(getIdentitiesByPublicKeyHashesHandler), - ); - - // getProofs - const getProofsHandler = getProofsHandlerFactory( - driveClient, - ); - - const wrappedGetProofs = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetProofsRequest, - PBJSGetProofsRequest, - ), - protobufToJsonFactory( - PBJSGetProofsResponse, - ), - wrapInErrorHandler(getProofsHandler), - ); - // waitForStateTransitionResult const fetchProofForStateTransition = fetchProofForStateTransitionFactory(driveClient); @@ -409,74 +132,27 @@ function platformHandlersFactory( wrapInErrorHandler(getConsensusParamsHandler), ); - // getEpochsInfo - const getEpochsInfoHandler = getEpochsInfoHandlerFactory( - driveClient, - ); - - const wrappedGetEpochsInfo = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetEpochsInfoRequest, - PBJSGetEpochsInfoRequest, - ), - protobufToJsonFactory( - PBJSGetEpochsInfoResponse, - ), - wrapInErrorHandler(getEpochsInfoHandler), - ); - - // getProtocolVersionUpgradeVoteStatus - // eslint-disable-next-line max-len - const getProtocolVersionUpgradeVoteStatusHandler = getProtocolVersionUpgradeVoteStatusHandlerFactory( - driveClient, - ); - - const wrappedGetProtocolVersionUpgradeVoteStatus = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetProtocolVersionUpgradeVoteStatusRequest, - PBJSGetProtocolVersionUpgradeVoteStatusRequest, - ), - protobufToJsonFactory( - PBJSGetProtocolVersionUpgradeVoteStatusResponse, - ), - wrapInErrorHandler(getProtocolVersionUpgradeVoteStatusHandler), - ); - - // getProtocolVersionUpgradeState - const getProtocolVersionUpgradeStateHandler = getProtocolVersionUpgradeStateHandlerFactory( - driveClient, - ); - - const wrappedGetProtocolVersionUpgradeState = jsonToProtobufHandlerWrapper( - jsonToProtobufFactory( - GetProtocolVersionUpgradeStateRequest, - PBJSGetProtocolVersionUpgradeStateRequest, - ), - protobufToJsonFactory( - PBJSGetProtocolVersionUpgradeStateResponse, - ), - wrapInErrorHandler(getProtocolVersionUpgradeStateHandler), - ); - return { broadcastStateTransition: wrappedBroadcastStateTransition, - getIdentity: wrappedGetIdentity, - getIdentities: wrappedGetIdentities, - getIdentityBalance: wrappedGetIdentityBalance, - getIdentityBalanceAndRevision: wrappedGetIdentityBalanceAndRevision, - getIdentityKeys: wrappedGetIdentityKeys, - getDocuments: wrappedGetDocuments, - getDataContract: wrappedGetDataContract, - getDataContracts: wrappedGetDataContracts, - getDataContractHistory: wrappedGetDataContractHistory, - getIdentityByPublicKeyHash: wrappedGetIdentityByPublicKeyHash, - getIdentitiesByPublicKeyHashes: wrappedGetIdentitiesByPublicKeyHashes, + getIdentity: wrapInErrorHandler(unimplementedHandlerFactory('getIdentity')), + getIdentitiesContractKeys: wrapInErrorHandler(unimplementedHandlerFactory('getIdentitiesContractKeys')), + getIdentityBalance: wrapInErrorHandler(unimplementedHandlerFactory('getIdentityBalance')), + getIdentityBalanceAndRevision: wrapInErrorHandler(unimplementedHandlerFactory('getIdentityBalanceAndRevision')), + getIdentityKeys: wrapInErrorHandler(unimplementedHandlerFactory('getIdentityKeys')), + getDocuments: wrapInErrorHandler(unimplementedHandlerFactory('getDocuments')), + getDataContract: wrapInErrorHandler(unimplementedHandlerFactory('getDataContract')), + getDataContracts: wrapInErrorHandler(unimplementedHandlerFactory('getDataContracts')), + getDataContractHistory: wrapInErrorHandler(unimplementedHandlerFactory('getDataContractHistory')), + getIdentityByPublicKeyHash: wrapInErrorHandler(unimplementedHandlerFactory('getIdentityByPublicKeyHash')), + getIdentitiesByPublicKeyHashes: wrapInErrorHandler(unimplementedHandlerFactory('getIdentitiesByPublicKeyHashes')), waitForStateTransitionResult: wrappedWaitForStateTransitionResult, getConsensusParams: wrappedGetConsensusParams, - getProofs: wrappedGetProofs, - getEpochsInfo: wrappedGetEpochsInfo, - getProtocolVersionUpgradeVoteStatus: wrappedGetProtocolVersionUpgradeVoteStatus, - getProtocolVersionUpgradeState: wrappedGetProtocolVersionUpgradeState, + getProofs: wrapInErrorHandler(unimplementedHandlerFactory('getProofs')), + getEpochsInfo: wrapInErrorHandler(unimplementedHandlerFactory('getEpochsInfo')), + getProtocolVersionUpgradeVoteStatus: wrapInErrorHandler(unimplementedHandlerFactory('getProtocolVersionUpgradeVoteStatus')), + getProtocolVersionUpgradeState: wrapInErrorHandler(unimplementedHandlerFactory('getProtocolVersionUpgradeState')), + getIdentityContractNonce: wrapInErrorHandler(unimplementedHandlerFactory('getIdentityContractNonce')), + getIdentityNonce: wrapInErrorHandler(unimplementedHandlerFactory('getIdentityNonce')), }; } diff --git a/packages/dapi/lib/grpcServer/handlers/platform/unimplementedHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/platform/unimplementedHandlerFactory.js new file mode 100644 index 00000000000..74f916e386e --- /dev/null +++ b/packages/dapi/lib/grpcServer/handlers/platform/unimplementedHandlerFactory.js @@ -0,0 +1,30 @@ +const { + server: { + error: { + UnimplementedGrpcError, + }, + }, +} = require('@dashevo/grpc-common'); + +const logger = require('../../../logger'); + +/** + * @param {string} name + * @returns {broadcastStateTransitionHandler} + */ +function unimplementedHandlerFactory(name) { + /** + * @typedef broadcastStateTransitionHandler + * + * @return {Promise} + */ + async function broadcastStateTransitionHandler() { + logger.error(`unimplemented endpoint '${name}' called`); + + throw new UnimplementedGrpcError('the endpoint is not implemented in DAPI'); + } + + return broadcastStateTransitionHandler; +} + +module.exports = unimplementedHandlerFactory; diff --git a/packages/dapi/lib/grpcServer/handlers/tx-filter-stream/subscribeToTransactionsWithProofsHandlerFactory.js b/packages/dapi/lib/grpcServer/handlers/tx-filter-stream/subscribeToTransactionsWithProofsHandlerFactory.js index 4246616c0c7..8c1988216f3 100644 --- a/packages/dapi/lib/grpcServer/handlers/tx-filter-stream/subscribeToTransactionsWithProofsHandlerFactory.js +++ b/packages/dapi/lib/grpcServer/handlers/tx-filter-stream/subscribeToTransactionsWithProofsHandlerFactory.js @@ -83,6 +83,7 @@ async function sendInstantLockResponse(call, instantLock) { * @param {testFunction} testTransactionAgainstFilter * @param {CoreRpcClient} coreAPI * @param {getMemPoolTransactions} getMemPoolTransactions + * @param {ChainDataProvider} chainDataProvider * @return {subscribeToTransactionsWithProofsHandler} */ function subscribeToTransactionsWithProofsHandlerFactory( @@ -92,6 +93,7 @@ function subscribeToTransactionsWithProofsHandlerFactory( testTransactionAgainstFilter, coreAPI, getMemPoolTransactions, + chainDataProvider, ) { /** * @typedef subscribeToTransactionsWithProofsHandler @@ -159,7 +161,7 @@ function subscribeToTransactionsWithProofsHandlerFactory( mediator.on( ProcessMediator.EVENTS.TRANSACTION, async (tx) => { - requestLogger.debug(`send transaction ${tx.hash}`); + requestLogger.debug(`sent transaction ${tx.hash}`); await sendTransactionsResponse(acknowledgingCall, [tx]); }, @@ -168,7 +170,7 @@ function subscribeToTransactionsWithProofsHandlerFactory( mediator.on( ProcessMediator.EVENTS.MERKLE_BLOCK, async (merkleBlock) => { - requestLogger.debug('send merkle block'); + requestLogger.debug(`sent merkle block ${merkleBlock.header.hash}`); await sendMerkleBlockResponse(acknowledgingCall, merkleBlock); }, @@ -179,7 +181,7 @@ function subscribeToTransactionsWithProofsHandlerFactory( async (instantLock) => { requestLogger.debug({ instantLock, - }, `send instant lock for ${instantLock.txid}`); + }, `sent instant lock for ${instantLock.txid}`); await sendInstantLockResponse(acknowledgingCall, instantLock); }, @@ -208,7 +210,7 @@ function subscribeToTransactionsWithProofsHandlerFactory( throw e; } - const bestBlockHeight = await coreAPI.getBestBlockHeight(); + const bestBlockHeight = chainDataProvider.getChainHeight(); let historicalCount = count; diff --git a/packages/dapi/lib/rpcServer/commands/generateToAddress.js b/packages/dapi/lib/rpcServer/commands/generateToAddress.js deleted file mode 100644 index 743c49a4b80..00000000000 --- a/packages/dapi/lib/rpcServer/commands/generateToAddress.js +++ /dev/null @@ -1,87 +0,0 @@ -const Validator = require('../../utils/Validator'); -const argsSchema = require('../schemas/generateToAddress.json'); - -const validator = new Validator(argsSchema); -/** - * @param coreAPI - * @return {generateToAddress} - */ -const generateToAddressFactory = (coreAPI) => { - /** - * Layer 1 endpoint - * WORKS ONLY IN REGTEST MODE. - * Generates blocks on demand for regression tests. - * @typedef generateToAddress - * @param args - command arguments - * @param {number} args.blocksNumber - Number of blocks to generate - * @param {string} args.address - The address that will receive the newly generated Dash - * - * @return {Promise} - generated block hashes - */ - async function generateToAddress(args) { - validator.validate(args); - - const { blocksNumber, address } = args; - - return coreAPI.generateToAddress(blocksNumber, address); - } - - return generateToAddress; -}; - -/* eslint-disable max-len */ -/** - * @swagger - * /generateToAddress: - * post: - * operationId: generateToAddress - * deprecated: false - * summary: generate - * description: Generates blocks on demand sending funds to address - * tags: - * - L1 - * responses: - * 200: - * description: Successful response. Promise (string array) containing strings of block hashes. - * requestBody: - * content: - * application/json: - * schema: - * type: object - * required: - * - method - * - id - * - jsonrpc - * - params - * properties: - * method: - * type: string - * default: generate - * description: Method name - * id: - * type: integer - * default: 1 - * format: int32 - * description: Request ID - * jsonrpc: - * type: string - * default: '2.0' - * description: JSON-RPC Version (2.0) - * params: - * title: Parameters - * type: object - * required: - * - blocksNumber - * - address - * properties: - * blocksNumber: - * type: integer - * default: 1 - * description: Number of blocks to generate - * address: - * type: string - * description: Address to sends funds to - */ -/* eslint-enable max-len */ - -module.exports = generateToAddressFactory; diff --git a/packages/dapi/lib/rpcServer/commands/getBestBlockHash.js b/packages/dapi/lib/rpcServer/commands/getBestBlockHash.js index 397c779fd9c..4c610f8a032 100644 --- a/packages/dapi/lib/rpcServer/commands/getBestBlockHash.js +++ b/packages/dapi/lib/rpcServer/commands/getBestBlockHash.js @@ -1,8 +1,19 @@ /** * @param {Object} coreAPI + * @param {ZmqClient} coreZmqClient * @return {getBestBlockHash} */ -const getBestBlockHashFactory = (coreAPI) => { +const getBestBlockHashFactory = (coreAPI, coreZmqClient) => { + let hash = null; + + // Reset height on a new block, so it will be obtain again on a user request + coreZmqClient.on( + coreZmqClient.topics.hashblock, + () => { + hash = null; + }, + ); + /** * Layer 1 endpoint * Returns block hash of the chaintip @@ -10,7 +21,11 @@ const getBestBlockHashFactory = (coreAPI) => { * @return {Promise} - latest block hash */ async function getBestBlockHash() { - return coreAPI.getBestBlockHash(); + if (hash === null) { + hash = await coreAPI.getBestBlockHash(); + } + + return hash; } return getBestBlockHash; diff --git a/packages/dapi/lib/rpcServer/commands/getMnListDiff.js b/packages/dapi/lib/rpcServer/commands/getMnListDiff.js deleted file mode 100644 index fbbe1d28560..00000000000 --- a/packages/dapi/lib/rpcServer/commands/getMnListDiff.js +++ /dev/null @@ -1,86 +0,0 @@ -const Validator = require('../../utils/Validator'); -const argsSchema = require('../schemas/getMnListDiff.json'); - -const validator = new Validator(argsSchema); -/** - * Returns getMnListDiff function - * @param coreAPI - * @return {getMnListDiff} - */ -const getMnListDiffFactory = (coreAPI) => { - /** - * Layer 1 endpoint - * Returns calculated balance for the address - * @typedef getMnListDiff - * @param args - command arguments - * @param baseBlockHash {string} - * @param blockHash {string} - * @return {Promise} - */ - async function getMnListDiff(args) { - validator.validate(args); - const { baseBlockHash, blockHash } = args; - - return coreAPI.getMnListDiff(baseBlockHash, blockHash); - } - - return getMnListDiff; -}; - -/* eslint-disable max-len */ -/** - * @swagger - * /getMnListDiff: - * post: - * operationId: getMnListDiff - * deprecated: false - * summary: getMnListDiff - * description: "Returns masternode list diff for the provided block hashes" - * tags: - * - L1 - * responses: - * 200: - * description: Successful response. Promise (object array) containing a diff of the masternode list based on the provided block hashes. - * requestBody: - * content: - * application/json: - * schema: - * type: object - * required: - * - method - * - id - * - jsonrpc - * - params - * properties: - * method: - * type: string - * default: getMnListDiff - * description: Method name - * id: - * type: integer - * default: 1 - * format: int32 - * description: Request ID - * jsonrpc: - * type: string - * default: '2.0' - * description: JSON-RPC Version (2.0) - * params: - * title: Parameters - * type: object - * required: - * - baseBlockHash - * - blockHash - * properties: - * baseBlockHash: - * type: string - * default: '0000000000000000000000000000000000000000000000000000000000000000' - * description: Block hash - * blockHash: - * type: string - * default: '0000000000000000000000000000000000000000000000000000000000000000' - * description: Block hash - */ -/* eslint-enable max-len */ - -module.exports = getMnListDiffFactory; diff --git a/packages/dapi/lib/rpcServer/server.js b/packages/dapi/lib/rpcServer/server.js index 8477a521dd8..5a1d037c5b1 100644 --- a/packages/dapi/lib/rpcServer/server.js +++ b/packages/dapi/lib/rpcServer/server.js @@ -1,61 +1,44 @@ const jayson = require('jayson/promise'); -const { isRegtest, isDevnet } = require('../utils'); const errorHandlerDecorator = require('./errorHandlerDecorator'); const getBestBlockHash = require('./commands/getBestBlockHash'); const getBlockHash = require('./commands/getBlockHash'); -const getMnListDiff = require('./commands/getMnListDiff'); -const generateToAddress = require('./commands/generateToAddress'); // Following commands are not implemented yet: // const getVersion = require('./commands/getVersion'); -const createCommands = (dashcoreAPI) => ({ - getBestBlockHash: getBestBlockHash(dashcoreAPI), +const createCommands = (dashcoreAPI, coreZmqClient) => ({ + getBestBlockHash: getBestBlockHash(dashcoreAPI, coreZmqClient), getBlockHash: getBlockHash(dashcoreAPI), - getMnListDiff: getMnListDiff(dashcoreAPI), -}); - -const createRegtestCommands = (dashcoreAPI) => ({ - generateToAddress: generateToAddress(dashcoreAPI), }); /** * Starts RPC server * @param options * @param {number} options.port - port to listen for incoming RPC connections - * @param {string} options.networkType * @param {object} options.dashcoreAPI - * @param {AbstractDriveAdapter} options.driveAPI - Drive api adapter - * @param {object} options.tendermintRpcClient - * @param {DashPlatformProtocol} options.dpp - * @param {object} options.log + * @param {Logger} options.logger + * @param {ZmqClient} options.coreZmqClient */ const start = ({ port, - networkType, dashcoreAPI, logger, + coreZmqClient, }) => { const commands = createCommands( dashcoreAPI, + coreZmqClient, ); - - const areRegtestCommandsEnabled = isRegtest(networkType) || isDevnet(networkType); - - const allCommands = areRegtestCommandsEnabled - ? Object.assign(commands, createRegtestCommands(dashcoreAPI)) - : commands; - /* Decorate all commands with decorator that will intercept errors and format them before passing to user. */ - Object.keys(allCommands).forEach((commandName) => { - allCommands[commandName] = errorHandlerDecorator(allCommands[commandName], logger); + Object.keys(commands).forEach((commandName) => { + commands[commandName] = errorHandlerDecorator(commands[commandName], logger); }); - const server = jayson.server(allCommands); + const server = jayson.server(commands); server.http().listen(port); }; diff --git a/packages/dapi/lib/transactionsFilter/emitInstantLockToFilterCollectionFactory.js b/packages/dapi/lib/transactionsFilter/emitInstantLockToFilterCollectionFactory.js index 8958bad1f83..6c60898f8fe 100644 --- a/packages/dapi/lib/transactionsFilter/emitInstantLockToFilterCollectionFactory.js +++ b/packages/dapi/lib/transactionsFilter/emitInstantLockToFilterCollectionFactory.js @@ -19,9 +19,7 @@ function emitInstantLockToFilterCollectionFactory(bloomFilterEmitterCollection) const instantLock = new InstantLock(txLockBuffer); - logger.debug({ - instantLock, - }, `instant lock received for ${transaction.hash}`); + logger.debug(`instant lock received for ${transaction.hash}`); bloomFilterEmitterCollection.emit('instantLock', { transaction, diff --git a/packages/dapi/lib/transactionsFilter/getHistoricalTransactionsIteratorFactory.js b/packages/dapi/lib/transactionsFilter/getHistoricalTransactionsIteratorFactory.js index c528c0bb0b3..fc68a90650e 100644 --- a/packages/dapi/lib/transactionsFilter/getHistoricalTransactionsIteratorFactory.js +++ b/packages/dapi/lib/transactionsFilter/getHistoricalTransactionsIteratorFactory.js @@ -1,22 +1,11 @@ const { MerkleBlock, - Transaction, util: { buffer: BufferUtils }, } = require('@dashevo/dashcore-lib'); -const MAX_HEADERS_PER_REQUEST = 2000; +const getTransactions = require('./getTransactions'); -/** - * @param {CoreRpcClient} coreRpcApi - * @param {string[]} transactionHashes - * @return {Promise} - */ -async function getTransactions(coreRpcApi, transactionHashes) { - const rawTransactions = await Promise.all(transactionHashes.map( - (transactionHash) => coreRpcApi.getRawTransaction(transactionHash), - )); - return rawTransactions.map((tx) => new Transaction(tx)); -} +const MAX_HEADERS_PER_REQUEST = 2000; /** * @param {number} batchIndex diff --git a/packages/dapi/lib/transactionsFilter/getMemPoolTransactionsFactory.js b/packages/dapi/lib/transactionsFilter/getMemPoolTransactionsFactory.js index 95f89017e44..6912580dc2a 100644 --- a/packages/dapi/lib/transactionsFilter/getMemPoolTransactionsFactory.js +++ b/packages/dapi/lib/transactionsFilter/getMemPoolTransactionsFactory.js @@ -1,4 +1,4 @@ -const { Transaction } = require('@dashevo/dashcore-lib'); +const getTransactions = require('./getTransactions'); /** * @param {CoreRpcClient} coreAPI @@ -10,17 +10,8 @@ function getMemPoolTransactionsFactory(coreAPI) { * @returns {Promise} */ async function getMemPoolTransactions() { - const result = []; const memPoolTransactionIds = await coreAPI.getRawMemPool(false); - - for (const txId of memPoolTransactionIds) { - const rawTransaction = await coreAPI.getRawTransaction(txId); - - const transaction = new Transaction(rawTransaction); - result.push(transaction); - } - - return result; + return getTransactions(coreAPI, memPoolTransactionIds); } return getMemPoolTransactions; diff --git a/packages/dapi/lib/transactionsFilter/getTransactions.js b/packages/dapi/lib/transactionsFilter/getTransactions.js new file mode 100644 index 00000000000..5ec44c34c05 --- /dev/null +++ b/packages/dapi/lib/transactionsFilter/getTransactions.js @@ -0,0 +1,20 @@ +const { + Transaction, +} = require('@dashevo/dashcore-lib'); + +/** + * @param {CoreRpcClient} coreRpcApi + * @param {string[]} transactionHashes + * @return {Promise} + */ +async function getTransactions(coreRpcApi, transactionHashes) { + if (transactionHashes.length === 0) { + return []; + } + + const rawTransactions = await coreRpcApi.getRawTransactionMulti(transactionHashes); + return Object.values(rawTransactions) + .map((rawTransaction) => new Transaction(rawTransaction)); +} + +module.exports = getTransactions; diff --git a/packages/dapi/package.json b/packages/dapi/package.json index aef9e46b0c9..c812f89db99 100644 --- a/packages/dapi/package.json +++ b/packages/dapi/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/dapi", "private": true, - "version": "0.25.21", + "version": "1.0.0-dev.15", "description": "A decentralized API for the Dash network", "scripts": { "api": "node scripts/api.js", @@ -35,8 +35,8 @@ "dependencies": { "@dashevo/bls": "~1.2.9", "@dashevo/dapi-grpc": "workspace:*", - "@dashevo/dashcore-lib": "~0.21.0", - "@dashevo/dashd-rpc": "^18.2.0", + "@dashevo/dashcore-lib": "~0.21.1", + "@dashevo/dashd-rpc": "^18.3.0", "@dashevo/grpc-common": "workspace:*", "@dashevo/wasm-dpp": "workspace:*", "@grpc/grpc-js": "1.4.4", @@ -53,9 +53,11 @@ "lru-cache": "^5.1.1", "pino": "^8.16.2", "pino-pretty": "^10.2.3", - "ws": "^7.5.3" + "ws": "^8.17.1" }, "devDependencies": { + "@babel/core": "^7.23.3", + "@babel/eslint-parser": "^7.23.3", "@dashevo/dapi-client": "workspace:*", "@dashevo/dp-services-ctl": "github:dashevo/js-dp-services-ctl#v0.19-dev", "chai": "^4.3.10", diff --git a/packages/dapi/pm2.yml b/packages/dapi/pm2.yml deleted file mode 100644 index df8f450e3af..00000000000 --- a/packages/dapi/pm2.yml +++ /dev/null @@ -1,24 +0,0 @@ -- script: scripts/api.js - name: api - exec_mode: cluster - watch: false - instances: 2 - source_map_support: false - merge_logs: true - autorestart: true - out_file: "/dev/null" - error_file: "/dev/null" - vizion: false - wait_ready: true -- script: scripts/core-streams.js - name: core-streams - exec_mode: cluster - watch: false - instances: 2 - source_map_support: false - merge_logs: true - autorestart: true - out_file: "/dev/null" - error_file: "/dev/null" - vizion: false - wait_ready: true diff --git a/packages/dapi/scripts/api.js b/packages/dapi/scripts/api.js index 5339ed977a3..6577f973bfa 100644 --- a/packages/dapi/scripts/api.js +++ b/packages/dapi/scripts/api.js @@ -1,7 +1,6 @@ // Entry point for DAPI. const dotenv = require('dotenv'); const grpc = require('@grpc/grpc-js'); -// const loadBLS = require('@dashevo/bls'); const { server: { @@ -12,6 +11,9 @@ const { const { getCoreDefinition, getPlatformDefinition, + v0: { + PlatformPromiseClient, + }, } = require('@dashevo/dapi-grpc'); const { default: loadWasmDpp, DashPlatformProtocol } = require('@dashevo/wasm-dpp'); @@ -27,10 +29,8 @@ const config = require('../lib/config'); const { validateConfig } = require('../lib/config/validator'); const logger = require('../lib/logger'); const rpcServer = require('../lib/rpcServer/server'); -const DriveClient = require('../lib/externalApis/drive/DriveClient'); const dashCoreRpcClient = require('../lib/externalApis/dashcore/rpc'); const BlockchainListener = require('../lib/externalApis/tenderdash/BlockchainListener'); -// const DriveStateRepository = require('../lib/dpp/DriveStateRepository'); const coreHandlersFactory = require( '../lib/grpcServer/handlers/core/coreHandlersFactory', @@ -38,6 +38,7 @@ const coreHandlersFactory = require( const platformHandlersFactory = require( '../lib/grpcServer/handlers/platform/platformHandlersFactory', ); +const ZmqClient = require('../lib/externalApis/dashcore/ZmqClient'); async function main() { await loadWasmDpp(); @@ -53,11 +54,22 @@ async function main() { const isProductionEnvironment = process.env.NODE_ENV === 'production'; - logger.info('Connecting to Drive'); - const driveClient = new DriveClient({ - host: config.tendermintCore.host, - port: config.tendermintCore.port, - }); + // Subscribe to events from Dash Core + const coreZmqClient = new ZmqClient(config.dashcore.zmq.host, config.dashcore.zmq.port); + + // Bind logs on ZMQ connection events + coreZmqClient.on(ZmqClient.events.DISCONNECTED, logger.warn.bind(logger)); + coreZmqClient.on(ZmqClient.events.CONNECTION_DELAY, logger.warn.bind(logger)); + coreZmqClient.on(ZmqClient.events.MONITOR_ERROR, logger.warn.bind(logger)); + + // Wait until zmq connection is established + logger.info(`Connecting to Core ZMQ on ${coreZmqClient.connectionString}`); + + await coreZmqClient.start(); + + logger.info('Connection to ZMQ established.'); + + const driveClient = new PlatformPromiseClient(`http://${config.driveRpc.host}:${config.driveRpc.port}`, undefined); const rpcClient = RpcClient.http({ host: config.tendermintCore.host, @@ -110,9 +122,9 @@ async function main() { logger.info('Starting JSON RPC server'); rpcServer.start({ port: config.rpcServer.port, - networkType: config.network, dashcoreAPI: dashCoreRpcClient, logger, + coreZmqClient, }); logger.info(`JSON RPC server is listening on port ${config.rpcServer.port}`); @@ -124,6 +136,7 @@ async function main() { const coreHandlers = coreHandlersFactory( dashCoreRpcClient, isProductionEnvironment, + coreZmqClient, ); const platformHandlers = platformHandlersFactory( rpcClient, @@ -170,6 +183,3 @@ process.on('SIGINT', () => { process.exit(); }); - -// Tell PM2 that process ready to receive connections -process.send('ready'); diff --git a/packages/dapi/scripts/core-streams.js b/packages/dapi/scripts/core-streams.js index 7c3620781f7..9051b2e916b 100644 --- a/packages/dapi/scripts/core-streams.js +++ b/packages/dapi/scripts/core-streams.js @@ -19,9 +19,12 @@ const { const { v0: { + MasternodeListRequest, TransactionsWithProofsRequest, BlockHeadersWithChainLocksRequest, pbjs: { + MasternodeListRequest: PBJSMasternodeListRequest, + MasternodeListResponse: PBJSMasternodeListResponse, TransactionsWithProofsRequest: PBJSTransactionsWithProofsRequest, TransactionsWithProofsResponse: PBJSTransactionsWithProofsResponse, BlockHeadersWithChainLocksRequest: PBJSBlockHeadersWithChainLocksRequest, @@ -58,6 +61,8 @@ const subscribeToNewBlockHeaders = require('../lib/grpcServer/handlers/blockhead const subscribeToNewTransactions = require('../lib/transactionsFilter/subscribeToNewTransactions'); const getHistoricalTransactionsIteratorFactory = require('../lib/transactionsFilter/getHistoricalTransactionsIteratorFactory'); const getMemPoolTransactionsFactory = require('../lib/transactionsFilter/getMemPoolTransactionsFactory'); +const MasternodeListSync = require('../lib/MasternodeListSync'); +const subscribeToMasternodeListHandlerFactory = require('../lib/grpcServer/handlers/core/subscribeToMasternodeListHandlerFactory'); async function main() { // Validate config @@ -110,7 +115,7 @@ async function main() { ); // TODO: check if we can receive this event before 'rawtx', and if we can, - // we need to test tx in this message first before emitng lock to the bloom + // we need to test tx in this message first before emitting lock to the bloom // filter collection // Send transaction instant locks via `subscribeToTransactionsWithProofs` stream dashCoreZmqClient.on( @@ -125,8 +130,17 @@ async function main() { dashCoreZmqClient, blockHeadersCache, ); + await chainDataProvider.init(); + const masternodeListSync = new MasternodeListSync( + dashCoreRpcClient, + chainDataProvider, + config.network, + ); + + await masternodeListSync.init(); + // Start GRPC server logger.info('Starting GRPC server'); @@ -152,6 +166,7 @@ async function main() { testTransactionsAgainstFilter, dashCoreRpcClient, getMemPoolTransactions, + chainDataProvider, ); const wrappedSubscribeToTransactionsWithProofs = jsonToProtobufHandlerWrapper( @@ -186,11 +201,27 @@ async function main() { wrapInErrorHandler(subscribeToBlockHeadersWithChainLocksHandler), ); + const subscribeToMasternodeListHandler = subscribeToMasternodeListHandlerFactory( + masternodeListSync, + ); + + const wrappedSubscribeToMasternodeListHandler = jsonToProtobufHandlerWrapper( + jsonToProtobufFactory( + MasternodeListRequest, + PBJSMasternodeListRequest, + ), + protobufToJsonFactory( + PBJSMasternodeListResponse, + ), + wrapInErrorHandler(subscribeToMasternodeListHandler), + ); + const grpcServer = createServer( getCoreDefinition(0), { subscribeToTransactionsWithProofs: wrappedSubscribeToTransactionsWithProofs, subscribeToBlockHeadersWithChainLocks: wrappedSubscribeToBlockHeadersWithChainLocks, + subscribeToMasternodeList: wrappedSubscribeToMasternodeListHandler, }, ); @@ -219,6 +250,3 @@ process.on('SIGINT', () => { process.exit(); }); - -// Tell PM2 that process ready to receive connections -process.send('ready'); diff --git a/packages/dapi/test/integration/grpcServer/handlers/platform/waitForStateTransitionResultHandlerFactory.spec.js b/packages/dapi/test/integration/grpcServer/handlers/platform/waitForStateTransitionResultHandlerFactory.spec.js index 2eac560cd17..7f748d91c4b 100644 --- a/packages/dapi/test/integration/grpcServer/handlers/platform/waitForStateTransitionResultHandlerFactory.spec.js +++ b/packages/dapi/test/integration/grpcServer/handlers/platform/waitForStateTransitionResultHandlerFactory.spec.js @@ -194,7 +194,7 @@ describe('waitForStateTransitionResultHandlerFactory', () => { ); driveClientMock = { - fetchProofs: this.sinon.stub().resolves(response.serializeBinary()), + getProofs: this.sinon.stub().resolves(response), }; blockchainListener = new BlockchainListener(tenderDashWsClientMock); @@ -298,7 +298,7 @@ describe('waitForStateTransitionResultHandlerFactory', () => { .setIdentitiesList(identitiesList), ); - expect(driveClientMock.fetchProofs).to.be.calledOnceWithExactly(getProofsRequest); + expect(driveClientMock.getProofs).to.be.calledOnceWithExactly(getProofsRequest); }); it('should wait for state transition and return result with error', (done) => { diff --git a/packages/dapi/test/mocks/config.js b/packages/dapi/test/mocks/config.js index a2bf8360cdd..51d05a05f40 100644 --- a/packages/dapi/test/mocks/config.js +++ b/packages/dapi/test/mocks/config.js @@ -2,10 +2,6 @@ module.exports = { getConfigFixture() { return { dashcore: { - p2p: { - host: '123', - port: '123', - }, rpc: { host: '123', port: '123', diff --git a/packages/dapi/test/unit/config/index.spec.js b/packages/dapi/test/unit/config/index.spec.js index 1579893c842..dce63d7cf3f 100644 --- a/packages/dapi/test/unit/config/index.spec.js +++ b/packages/dapi/test/unit/config/index.spec.js @@ -31,8 +31,8 @@ describe('config/validator', () => { it('Should return errors in array if there are invalid fields in the config', () => { const config = getConfigFixture(); - config.dashcore.p2p.host = 1; - config.dashcore.p2p.port = '$/*'; + config.dashcore.rpc.host = 1; + config.dashcore.rpc.port = '$/*'; const validationResult = validateConfig(config); expect(validationResult.isValid).to.be.false; diff --git a/packages/dapi/test/unit/externalApis/drive/DriveClient.spec.js b/packages/dapi/test/unit/externalApis/drive/DriveClient.spec.js deleted file mode 100644 index 45f2ea3bcb3..00000000000 --- a/packages/dapi/test/unit/externalApis/drive/DriveClient.spec.js +++ /dev/null @@ -1,475 +0,0 @@ -const chai = require('chai'); -const sinon = require('sinon'); -const cbor = require('cbor'); - -const chaiAsPromised = require('chai-as-promised'); -const dirtyChai = require('dirty-chai'); - -const { BytesValue, UInt32Value } = require('google-protobuf/google/protobuf/wrappers_pb'); - -const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); -const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); -const GrpcErrorCodes = require('@dashevo/grpc-common/lib/server/error/GrpcErrorCodes'); -const { - v0: { - GetIdentitiesByPublicKeyHashesRequest, - GetIdentitiesByPublicKeyHashesResponse, - GetDataContractRequest, - GetDataContractResponse, - GetDocumentsRequest, - GetDocumentsResponse, - GetEpochsInfoRequest, - GetEpochsInfoResponse, - GetIdentityRequest, - GetIdentityResponse, - GetProofsRequest, - GetProofsResponse, - GetProtocolVersionUpgradeStateRequest, - GetProtocolVersionUpgradeStateResponse, - GetProtocolVersionUpgradeVoteStatusRequest, - GetProtocolVersionUpgradeVoteStatusResponse, - Proof, - ResponseMetadata, - }, -} = require('@dashevo/dapi-grpc'); - -const DriveClient = require('../../../../lib/externalApis/drive/DriveClient'); - -const RPCError = require('../../../../lib/rpcServer/RPCError'); - -chai.use(chaiAsPromised); -chai.use(dirtyChai); - -const { expect } = chai; - -describe('DriveClient', () => { - describe('constructor', () => { - it('Should create drive client with given options', () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - expect(drive.client.options.host).to.be.equal('127.0.0.1'); - expect(drive.client.options.port).to.be.equal(3000); - }); - }); - - it('should throw RPCError if JSON RPC call failed', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - const error = new Error('Some RPC error'); - - sinon.stub(drive.client, 'request') - .resolves({ error }); - - try { - await drive.fetchDataContract(new GetDataContractRequest()); - } catch (e) { - expect(e).to.be.an.instanceOf(RPCError); - expect(e.message).to.be.equal(error.message); - expect(e.code).to.be.equal(-32602); - } - }); - - it('should throw ABCI error if response have one', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - sinon.stub(drive.client, 'request') - .resolves({ - result: { - response: { - code: GrpcErrorCodes.INVALID_ARGUMENT, - info: cbor.encode({ - data: { - name: 'someData', - }, - message: 'some message', - }).toString('base64'), - }, - }, - }); - - try { - await drive.fetchDataContract(new GetDataContractRequest()); - } catch (e) { - expect(e).to.be.an.instanceOf(InvalidArgumentGrpcError); - expect(e.getCode()).to.equal(3); - expect(e.getMessage()).to.equal('some message'); - expect(e.getRawMetadata()).to.deep.equal({ - 'drive-error-data-bin': cbor.encode({ - name: 'someData', - }), - }); - } - }); - - describe('#fetchDataContract', () => { - it('Should call \'fetchContract\' RPC with the given parameters', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - const contractId = 'someId'; - const data = Buffer.from('someData'); - - const { GetDataContractRequestV0 } = GetDataContractRequest; - const request = new GetDataContractRequest(); - request.setV0( - new GetDataContractRequestV0() - .setId(contractId) - .setProve(false), - ); - - const { GetDataContractResponseV0 } = GetDataContractResponse; - const response = new GetDataContractResponse(); - response.setV0( - new GetDataContractResponseV0() - .setDataContract(data), - ); - const responseBytes = response.serializeBinary(); - - sinon.stub(drive.client, 'request') - .resolves({ - result: { - response: { code: 0, value: responseBytes }, - }, - }); - - const result = await drive.fetchDataContract(request); - - expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', { - path: '/dataContract', - data: Buffer.from(request.serializeBinary()).toString('hex'), - }); - expect(result).to.be.deep.equal(responseBytes); - }); - }); - - describe('#fetchDocuments', () => { - it('Should call \'fetchDocuments\' RPC with the given parameters', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - const contractId = 'someId'; - const type = 'object'; - const options = { - where: 'id === someId', - }; - - const { GetDocumentsRequestV0 } = GetDocumentsRequest; - const request = new GetDocumentsRequest(); - request.setV0( - new GetDocumentsRequestV0() - .setDataContractId(contractId) - .setDocumentType(type) - .setWhere(cbor.encode({ where: options.where })), - ); - - const { GetDocumentsResponseV0 } = GetDocumentsResponse; - const response = new GetDocumentsResponse(); - response.setV0( - new GetDocumentsResponseV0() - .setDocuments(new GetDocumentsResponseV0.Documents().setDocumentsList([])), - ); - - const responseBytes = response.serializeBinary(); - - sinon.stub(drive.client, 'request') - .resolves({ - result: { - response: { code: 0, value: responseBytes }, - }, - }); - - const result = await drive.fetchDocuments(request); - - expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', { - path: '/dataContract/documents', - data: Buffer.from(request.serializeBinary()).toString('hex'), // cbor encoded empty object - }); - expect(result).to.be.deep.equal(responseBytes); - }); - }); - - describe('#fetchIdentity', () => { - it('Should call \'fetchIdentity\' RPC with the given parameters', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - const identityId = 'someId'; - const data = Buffer.from('someData'); - - const { GetIdentityRequestV0 } = GetIdentityRequest; - const request = new GetIdentityRequest(); - request.setV0( - new GetIdentityRequestV0() - .setId(identityId), - ); - - const { GetIdentityResponseV0 } = GetIdentityResponse; - const response = new GetIdentityResponse(); - response.setV0( - new GetIdentityResponseV0() - .setIdentity(data), - ); - const responseBytes = response.serializeBinary(); - - sinon.stub(drive.client, 'request') - .resolves({ - result: { - response: { code: 0, value: responseBytes }, - }, - }); - - const result = await drive.fetchIdentity(request); - - expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', { - path: '/identity', - data: Buffer.from(request.serializeBinary()).toString('hex'), - }); - expect(result).to.be.deep.equal(responseBytes); - }); - }); - - describe('#fetchIdentitiesByPublicKeyHashes', () => { - it('Should call \'fetchIdentitiesByPublicKeyHashes\' RPC with the given parameters', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - const identity = await getIdentityFixture(); - - const publicKeyHashes = [Buffer.alloc(1)]; - - const { GetIdentitiesByPublicKeyHashesRequestV0 } = GetIdentitiesByPublicKeyHashesRequest; - const request = new GetIdentitiesByPublicKeyHashesRequest(); - request.setV0( - new GetIdentitiesByPublicKeyHashesRequestV0() - .setPublicKeyHashesList(publicKeyHashes) - .setProve(false), - ); - - const { - IdentitiesByPublicKeyHashes, - PublicKeyHashIdentityEntry, - GetIdentitiesByPublicKeyHashesResponseV0, - } = GetIdentitiesByPublicKeyHashesResponse; - - const response = new GetIdentitiesByPublicKeyHashesResponse(); - response.setV0( - new GetIdentitiesByPublicKeyHashesResponseV0().setIdentities( - new IdentitiesByPublicKeyHashes() - .setIdentityEntriesList([ - new PublicKeyHashIdentityEntry() - .setPublicKeyHash(publicKeyHashes[0]) - .setValue(new BytesValue().setValue(identity.toBuffer())), - ]), - ), - ); - const responseBytes = response.serializeBinary(); - - sinon.stub(drive.client, 'request') - .resolves({ - result: { - response: { code: 0, value: responseBytes }, - }, - }); - - const result = await drive.fetchIdentitiesByPublicKeyHashes(request); - - expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', { - path: '/identities/by-public-key-hash', - data: Buffer.from(request.serializeBinary()).toString('hex'), - }); - expect(result).to.be.deep.equal(responseBytes); - }); - }); - - describe('#fetchProofs', () => { - it('should call \'fetchProofs\' RPC with the given parameters', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - const identityIds = [Buffer.from('id')]; - - const request = new GetProofsRequest(); - const { GetProofsRequestV0 } = GetProofsRequest; - request.setV0( - new GetProofsRequestV0() - .setIdentitiesList(identityIds.map((id) => { - const { IdentityRequest } = GetProofsRequestV0; - const identityRequest = new IdentityRequest(); - identityRequest.setIdentityId(id); - identityRequest.setRequestType(IdentityRequest.Type.FULL_IDENTITY); - return identityRequest; - })), - ); - - const { GetProofsResponseV0 } = GetProofsResponse; - const response = new GetProofsResponse(); - response.setV0( - new GetProofsResponseV0() - .setProof(new Proof()) - .setMetadata(new ResponseMetadata()), - ); - - const responseBytes = response.serializeBinary(); - - sinon.stub(drive.client, 'request') - .resolves({ - result: { - response: { code: 0, value: responseBytes }, - }, - }); - - const result = await drive.fetchProofs(request); - - expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', { - path: '/proofs', - data: Buffer.from(request.serializeBinary()).toString('hex'), - }); - - expect(result).to.be.deep.equal( - responseBytes, - ); - }); - }); - - describe('#fetchEpochsInfo', () => { - it('should call \'fetchEpochsInfo\' RPC with the given parameters', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - const { GetEpochsInfoRequestV0 } = GetEpochsInfoRequest; - const request = new GetEpochsInfoRequest(); - request.setV0( - new GetEpochsInfoRequestV0() - .setStartEpoch(new UInt32Value([1])) - .setCount(1), - ); - - const { GetEpochsInfoResponseV0 } = GetEpochsInfoResponse; - const response = new GetEpochsInfoResponse(); - const { EpochInfo, EpochInfos } = GetEpochsInfoResponseV0; - response.setV0( - new GetEpochsInfoResponseV0() - .setEpochs(new EpochInfos() - .setEpochInfosList([new EpochInfo() - .setNumber(1) - .setFirstBlockHeight(1) - .setFirstCoreBlockHeight(1) - .setStartTime(Date.now()) - .setFeeMultiplier(1.1)])), - ); - - const responseBytes = response.serializeBinary(); - - sinon.stub(drive.client, 'request') - .resolves({ - result: { - response: { code: 0, value: responseBytes }, - }, - }); - - const result = await drive.fetchEpochsInfo(request); - - expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', { - path: '/epochInfos', - data: Buffer.from(request.serializeBinary()).toString('hex'), - }); - - expect(result).to.be.deep.equal( - responseBytes, - ); - }); - }); - - describe('#fetchVersionUpgradeVoteStatus', () => { - it('should call \'fetchEpochsInfo\' RPC with the given parameters', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - const { - GetProtocolVersionUpgradeVoteStatusRequestV0, - } = GetProtocolVersionUpgradeVoteStatusRequest; - const request = new GetProtocolVersionUpgradeVoteStatusRequest(); - request.setV0( - new GetProtocolVersionUpgradeVoteStatusRequestV0() - .setStartProTxHash(Buffer.alloc(32)) - .setCount(1), - ); - - const { - GetProtocolVersionUpgradeVoteStatusResponseV0, - } = GetProtocolVersionUpgradeVoteStatusResponse; - const response = new GetProtocolVersionUpgradeVoteStatusResponse(); - const { VersionSignal, VersionSignals } = GetProtocolVersionUpgradeVoteStatusResponseV0; - response.setV0( - new GetProtocolVersionUpgradeVoteStatusResponseV0() - .setVersions( - new VersionSignals() - .setVersionSignalsList([ - new VersionSignal() - .setProTxHash(Buffer.alloc(32)) - .setVersion(10), - ]), - - ), - ); - - const responseBytes = response.serializeBinary(); - - sinon.stub(drive.client, 'request') - .resolves({ - result: { - response: { code: 0, value: responseBytes }, - }, - }); - - const result = await drive.fetchVersionUpgradeVoteStatus(request); - - expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', { - path: '/versionUpgrade/voteStatus', - data: Buffer.from(request.serializeBinary()).toString('hex'), - }); - - expect(result).to.be.deep.equal( - responseBytes, - ); - }); - }); - - describe('#fetchVersionUpgradeState', () => { - it('should call \'fetchEpochsInfo\' RPC with the given parameters', async () => { - const drive = new DriveClient({ host: '127.0.0.1', port: 3000 }); - - const { GetProtocolVersionUpgradeStateRequestV0 } = GetProtocolVersionUpgradeStateRequest; - const request = new GetProtocolVersionUpgradeStateRequest(); - request.setV0(new GetProtocolVersionUpgradeStateRequestV0()); - - const { GetProtocolVersionUpgradeStateResponseV0 } = GetProtocolVersionUpgradeStateResponse; - const response = new GetProtocolVersionUpgradeStateResponse(); - const { Versions, VersionEntry } = GetProtocolVersionUpgradeStateResponseV0; - response.setV0( - new GetProtocolVersionUpgradeStateResponseV0() - .setVersions( - new Versions() - .setVersionsList([ - new VersionEntry() - .setVersionNumber(1) - .setVoteCount(10), - ]), - ), - ); - - const responseBytes = response.serializeBinary(); - - sinon.stub(drive.client, 'request') - .resolves({ - result: { - response: { code: 0, value: responseBytes }, - }, - }); - - const result = await drive.fetchVersionUpgradeState(request); - - expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', { - path: '/versionUpgrade/state', - data: Buffer.from(request.serializeBinary()).toString('hex'), - }); - - expect(result).to.be.deep.equal( - responseBytes, - ); - }); - }); -}); diff --git a/packages/dapi/test/unit/externalApis/drive/fetchProofForStateTransitionFactory.spec.js b/packages/dapi/test/unit/externalApis/drive/fetchProofForStateTransitionFactory.spec.js index d23051fcc40..91c277b8fd3 100644 --- a/packages/dapi/test/unit/externalApis/drive/fetchProofForStateTransitionFactory.spec.js +++ b/packages/dapi/test/unit/externalApis/drive/fetchProofForStateTransitionFactory.spec.js @@ -30,13 +30,13 @@ describe('fetchProofForStateTransition', () => { identitiesProofResponse.setV0(new GetProofsResponseV0().setProof(new Proof([Buffer.from('identities contracts proof')]))); driveClientMock = { - fetchProofs: this.sinon.stub().callsFake(async (requestProto) => { + getProofs: this.sinon.stub().callsFake(async (requestProto) => { if (requestProto.getV0().getIdentitiesList().length > 0) { - return identitiesProofResponse.serializeBinary(); + return identitiesProofResponse; } if (requestProto.getV0().getDocumentsList().length > 0) { - return documentsProofResponse.serializeBinary(); + return documentsProofResponse; } if (requestProto.getV0().getContractsList().length > 0) { - return dataContractsProofResponse.serializeBinary(); + return dataContractsProofResponse; } return null; diff --git a/packages/dapi/test/unit/grpcServer/handlers/blockheaders-stream/subscribeToBlockHeadersWithChainLocksHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/blockheaders-stream/subscribeToBlockHeadersWithChainLocksHandlerFactory.spec.js index c4fed92c388..dabca29bbce 100644 --- a/packages/dapi/test/unit/grpcServer/handlers/blockheaders-stream/subscribeToBlockHeadersWithChainLocksHandlerFactory.spec.js +++ b/packages/dapi/test/unit/grpcServer/handlers/blockheaders-stream/subscribeToBlockHeadersWithChainLocksHandlerFactory.spec.js @@ -43,7 +43,6 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { getBlock: this.sinon.stub(), getBlockStats: this.sinon.stub(), getBlockHeaders: this.sinon.stub(), - getBestBlockHeight: this.sinon.stub(), getBlockHash: this.sinon.stub(), getBestChainLock: this.sinon.stub(), }; @@ -113,6 +112,7 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { }); coreAPIMock.getBlockStats.resolves({ height: 1 }); + chainDataProvider.chainHeight = 10; await subscribeToBlockHeadersWithChainLocksHandler(call); @@ -165,6 +165,7 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { }); coreAPIMock.getBlockStats.resolves({ height: 1 }); + chainDataProvider.chainHeight = 10; await subscribeToBlockHeadersWithChainLocksHandler(call); @@ -213,7 +214,7 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { coreAPIMock.getBlockStats.resolves({ height: 10 }); - coreAPIMock.getBestBlockHeight.resolves(11); + chainDataProvider.chainHeight = 11; await subscribeToBlockHeadersWithChainLocksHandler(call); diff --git a/packages/dapi/test/unit/grpcServer/handlers/core/getBlockchainStatusHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/core/getBlockchainStatusHandlerFactory.spec.js new file mode 100644 index 00000000000..43c41f24dd7 --- /dev/null +++ b/packages/dapi/test/unit/grpcServer/handlers/core/getBlockchainStatusHandlerFactory.spec.js @@ -0,0 +1,110 @@ +const { + v0: { + GetBlockchainStatusResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const getBlockchainStatusHandlerFactory = require('../../../../../lib/grpcServer/handlers/core/getBlockchainStatusHandlerFactory'); + +const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); + +describe('getBlockchainStatusHandlerFactory', () => { + let call; + let getBlockchainStatusHandler; + let coreRPCClientMock; + let now; + + let blockchainInfo; + let networkInfo; + let coreZmqClientMock; + + beforeEach(function beforeEach() { + blockchainInfo = { + chain: 'test', + blocks: 460991, + headers: 460991, + bestblockhash: '0000007464fd8cae97830d794bf03efbeaa4b8c3258a3def67a89cdbd060f827', + difficulty: 0.002261509525429119, + mediantime: 1615546573, + verificationprogress: 0.9999993798366165, + initialblockdownload: false, + chainwork: '000000000000000000000000000000000000000000000000022f149b98e063dc', + warnings: 'Warning: unknown new rules activated (versionbit 3)', + }; + + networkInfo = { + version: 170000, + subversion: '/Dash Core:0.17.0/', + protocolversion: 70218, + localservices: '0000000000000405', + localrelay: true, + timeoffset: 0, + networkactive: true, + connections: 8, + socketevents: 'select', + relayfee: 0.00001, + incrementalfee: 0.00001, + warnings: 'Warning: unknown new rules activated (versionbit 3)', + }; + + call = new GrpcCallMock(this.sinon); + + coreRPCClientMock = { + getBlockchainInfo: this.sinon.stub().resolves(blockchainInfo), + getNetworkInfo: this.sinon.stub().resolves(networkInfo), + }; + + coreZmqClientMock = { on: this.sinon.stub(), topics: { hashblock: 'fake' } }; + + now = new Date(); + this.sinon.useFakeTimers(now.getTime()); + + getBlockchainStatusHandler = getBlockchainStatusHandlerFactory( + coreRPCClientMock, + coreZmqClientMock, + ); + }); + + it('should return valid result', async () => { + const result = await getBlockchainStatusHandler(call); + + expect(result).to.be.an.instanceOf(GetBlockchainStatusResponse); + + // Validate protobuf object values + result.serializeBinary(); + + const version = result.getVersion(); + expect(version.getProtocol()).to.equal(networkInfo.protocolversion); + expect(version.getSoftware()).to.equal(networkInfo.version); + expect(version.getAgent()).to.equal(networkInfo.subversion); + + const time = result.getTime(); + expect(time.getNow()).to.be.an('number'); + expect(time.getNow()).to.equal(Math.floor(now.getTime() / 1000)); + expect(time.getOffset()).to.be.equal(networkInfo.timeoffset); + expect(time.getMedian()).to.be.equal(blockchainInfo.mediantime); + + const chain = result.getChain(); + expect(chain.getName()).to.be.equal(blockchainInfo.chain); + expect(chain.getBlocksCount()).to.be.equal(blockchainInfo.blocks); + expect(chain.getHeadersCount()).to.be.equal(blockchainInfo.headers); + expect(chain.getBestBlockHash()).to.be.an.instanceOf(Buffer); + expect(chain.getBestBlockHash().toString('hex')).to.be.equal(blockchainInfo.bestblockhash); + expect(chain.getDifficulty()).to.be.equal(blockchainInfo.difficulty); + expect(chain.getChainWork()).to.be.an.instanceOf(Buffer); + expect(chain.getChainWork().toString('hex')).to.be.equal(blockchainInfo.chainwork); + expect(chain.getIsSynced()).to.be.equal(blockchainInfo.verificationprogress === 1); + expect(chain.getSyncProgress()).to.be.equal(blockchainInfo.verificationprogress); + + const network = result.getNetwork(); + expect(network.getPeersCount()).to.be.equal(networkInfo.connections); + + const fee = network.getFee(); + expect(fee.getRelay()).to.be.equal(networkInfo.relayfee); + expect(fee.getIncremental()).to.be.equal(networkInfo.incrementalfee); + + expect(result.getStatus()).to.be.equal(GetBlockchainStatusResponse.Status.SYNCING); + expect(coreRPCClientMock.getBlockchainInfo).to.be.calledOnce(); + expect(coreRPCClientMock.getNetworkInfo).to.be.calledOnce(); + }); +}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/core/getMasternodeStatusHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/core/getMasternodeStatusHandlerFactory.spec.js new file mode 100644 index 00000000000..0465462a086 --- /dev/null +++ b/packages/dapi/test/unit/grpcServer/handlers/core/getMasternodeStatusHandlerFactory.spec.js @@ -0,0 +1,84 @@ +const { + v0: { + GetMasternodeStatusResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const getMasternodeStatusHandlerFactory = require('../../../../../lib/grpcServer/handlers/core/getMasternodeStatusHandlerFactory'); + +const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); + +describe('getMasternodeStatusHandlerFactory', () => { + let call; + let getMasternodeStatusHandler; + let coreRPCClientMock; + let now; + + let mnSyncInfo; + let masternodeStatus; + + beforeEach(function beforeEach() { + mnSyncInfo = { + AssetID: 999, + AssetName: 'MASTERNODE_SYNC_FINISHED', + AssetStartTime: 1615466139, + Attempt: 0, + IsBlockchainSynced: true, + IsSynced: true, + }; + + masternodeStatus = { + outpoint: 'd1be3a1aa0b9516d06ed180607c168724c21d8ccf6c5a3f5983769830724c357-0', + service: '45.32.237.76:19999', + proTxHash: '04d06d16b3eca2f104ef9749d0c1c17d183eb1b4fe3a16808fd70464f03bcd63', + collateralHash: 'd1be3a1aa0b9516d06ed180607c168724c21d8ccf6c5a3f5983769830724c357', + collateralIndex: 0, + dmnState: { + service: '45.32.237.76:19999', + registeredHeight: 7402, + lastPaidHeight: 59721, + PoSePenalty: 0, + PoSeRevivedHeight: 61915, + PoSeBanHeight: -1, + revocationReason: 0, + ownerAddress: 'yT8DDY5NkX4ZtBkUVz7y1RgzbakCnMPogh', + votingAddress: 'yMLrhooXyJtpV3R2ncsxvkrh6wRennNPoG', + payoutAddress: 'yTsGq4wV8WF5GKLaYV2C43zrkr2sfTtysT', + pubKeyOperator: '02a2e2673109a5e204f8a82baf628bb5f09a8dfc671859e84d2661cae03e6c6e198a037e968253e94cd099d07b98e94e', + }, + state: 'READY', + status: 'Ready', + }; + + call = new GrpcCallMock(this.sinon); + + coreRPCClientMock = { + getMnSync: this.sinon.stub().resolves(mnSyncInfo), + getMasternode: this.sinon.stub().resolves(masternodeStatus), + }; + + now = new Date(); + this.sinon.useFakeTimers(now.getTime()); + + getMasternodeStatusHandler = getMasternodeStatusHandlerFactory(coreRPCClientMock); + }); + + it('should return valid result', async () => { + const result = await getMasternodeStatusHandler(call); + + expect(result).to.be.an.instanceOf(GetMasternodeStatusResponse); + + // Validate protobuf object values + result.serializeBinary(); + + expect(result.getStatus()).to.be.equal(GetMasternodeStatusResponse.Status.READY); + expect(result.getProTxHash()).to.be.an.instanceOf(Buffer); + expect(result.getProTxHash().toString('hex')).to.be.equal(masternodeStatus.proTxHash); + expect(result.getPosePenalty()).to.be.equal(masternodeStatus.dmnState.PoSePenalty); + expect(result.getIsSynced()).to.be.equal(mnSyncInfo.IsSynced); + expect(result.getSyncProgress()).to.be.equal(1); + + expect(coreRPCClientMock.getMnSync).to.be.calledOnceWith('status'); + expect(coreRPCClientMock.getMasternode).to.be.calledOnceWith('status'); + }); +}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/core/getStatusHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/core/getStatusHandlerFactory.spec.js deleted file mode 100644 index 1a1558a444c..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/core/getStatusHandlerFactory.spec.js +++ /dev/null @@ -1,150 +0,0 @@ -const { - v0: { - GetStatusResponse, - }, -} = require('@dashevo/dapi-grpc'); - -const getStatusHandlerFactory = require('../../../../../lib/grpcServer/handlers/core/getStatusHandlerFactory'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -describe('getStatusHandlerFactory', () => { - let call; - let getStatusHandler; - let coreRPCClientMock; - let now; - - let blockchainInfo; - let networkInfo; - let mnSyncInfo; - let masternodeStatus; - - beforeEach(function beforeEach() { - mnSyncInfo = { - AssetID: 999, - AssetName: 'MASTERNODE_SYNC_FINISHED', - AssetStartTime: 1615466139, - Attempt: 0, - IsBlockchainSynced: true, - IsSynced: true, - }; - - blockchainInfo = { - chain: 'test', - blocks: 460991, - headers: 460991, - bestblockhash: '0000007464fd8cae97830d794bf03efbeaa4b8c3258a3def67a89cdbd060f827', - difficulty: 0.002261509525429119, - mediantime: 1615546573, - verificationprogress: 0.9999993798366165, - initialblockdownload: false, - chainwork: '000000000000000000000000000000000000000000000000022f149b98e063dc', - warnings: 'Warning: unknown new rules activated (versionbit 3)', - }; - - networkInfo = { - version: 170000, - subversion: '/Dash Core:0.17.0/', - protocolversion: 70218, - localservices: '0000000000000405', - localrelay: true, - timeoffset: 0, - networkactive: true, - connections: 8, - socketevents: 'select', - relayfee: 0.00001, - incrementalfee: 0.00001, - warnings: 'Warning: unknown new rules activated (versionbit 3)', - }; - - masternodeStatus = { - outpoint: 'd1be3a1aa0b9516d06ed180607c168724c21d8ccf6c5a3f5983769830724c357-0', - service: '45.32.237.76:19999', - proTxHash: '04d06d16b3eca2f104ef9749d0c1c17d183eb1b4fe3a16808fd70464f03bcd63', - collateralHash: 'd1be3a1aa0b9516d06ed180607c168724c21d8ccf6c5a3f5983769830724c357', - collateralIndex: 0, - dmnState: { - service: '45.32.237.76:19999', - registeredHeight: 7402, - lastPaidHeight: 59721, - PoSePenalty: 0, - PoSeRevivedHeight: 61915, - PoSeBanHeight: -1, - revocationReason: 0, - ownerAddress: 'yT8DDY5NkX4ZtBkUVz7y1RgzbakCnMPogh', - votingAddress: 'yMLrhooXyJtpV3R2ncsxvkrh6wRennNPoG', - payoutAddress: 'yTsGq4wV8WF5GKLaYV2C43zrkr2sfTtysT', - pubKeyOperator: '02a2e2673109a5e204f8a82baf628bb5f09a8dfc671859e84d2661cae03e6c6e198a037e968253e94cd099d07b98e94e', - }, - state: 'READY', - status: 'Ready', - }; - - call = new GrpcCallMock(this.sinon); - - coreRPCClientMock = { - getBlockchainInfo: this.sinon.stub().resolves(blockchainInfo), - getNetworkInfo: this.sinon.stub().resolves(networkInfo), - getMnSync: this.sinon.stub().resolves(mnSyncInfo), - getMasternode: this.sinon.stub().resolves(masternodeStatus), - }; - - now = new Date(); - this.sinon.useFakeTimers(now.getTime()); - - getStatusHandler = getStatusHandlerFactory(coreRPCClientMock); - }); - - it('should return valid result', async () => { - const result = await getStatusHandler(call); - - expect(result).to.be.an.instanceOf(GetStatusResponse); - - // Validate protobuf object values - result.serializeBinary(); - - const version = result.getVersion(); - expect(version.getProtocol()).to.equal(networkInfo.protocolversion); - expect(version.getSoftware()).to.equal(networkInfo.version); - expect(version.getAgent()).to.equal(networkInfo.subversion); - - const time = result.getTime(); - expect(time.getNow()).to.be.an('number'); - expect(time.getNow()).to.equal(Math.floor(now.getTime() / 1000)); - expect(time.getOffset()).to.be.equal(networkInfo.timeoffset); - expect(time.getMedian()).to.be.equal(blockchainInfo.mediantime); - - const chain = result.getChain(); - expect(chain.getName()).to.be.equal(blockchainInfo.chain); - expect(chain.getBlocksCount()).to.be.equal(blockchainInfo.blocks); - expect(chain.getHeadersCount()).to.be.equal(blockchainInfo.headers); - expect(chain.getBestBlockHash()).to.be.an.instanceOf(Buffer); - expect(chain.getBestBlockHash().toString('hex')).to.be.equal(blockchainInfo.bestblockhash); - expect(chain.getDifficulty()).to.be.equal(blockchainInfo.difficulty); - expect(chain.getChainWork()).to.be.an.instanceOf(Buffer); - expect(chain.getChainWork().toString('hex')).to.be.equal(blockchainInfo.chainwork); - expect(chain.getIsSynced()).to.be.equal(mnSyncInfo.IsBlockchainSynced); - expect(chain.getSyncProgress()).to.be.equal(blockchainInfo.verificationprogress); - - const masternode = result.getMasternode(); - expect(masternode.getStatus()).to.be.equal(GetStatusResponse.Masternode.Status.READY); - expect(masternode.getProTxHash()).to.be.an.instanceOf(Buffer); - expect(masternode.getProTxHash().toString('hex')).to.be.equal(masternodeStatus.proTxHash); - expect(masternode.getPosePenalty()).to.be.equal(masternodeStatus.dmnState.PoSePenalty); - expect(masternode.getIsSynced()).to.be.equal(mnSyncInfo.IsSynced); - expect(masternode.getSyncProgress()).to.be.equal(1); - - const network = result.getNetwork(); - expect(network.getPeersCount()).to.be.equal(networkInfo.connections); - - const fee = network.getFee(); - expect(fee.getRelay()).to.be.equal(networkInfo.relayfee); - expect(fee.getIncremental()).to.be.equal(networkInfo.incrementalfee); - - expect(result.getStatus()).to.be.equal(GetStatusResponse.Status.READY); - expect(coreRPCClientMock.getBlockchainInfo).to.be.calledOnce(); - expect(coreRPCClientMock.getNetworkInfo).to.be.calledOnce(); - expect(coreRPCClientMock.getMnSync).to.be.calledOnceWith('status'); - expect(coreRPCClientMock.getMasternode).to.be.calledOnceWith('status'); - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/createGrpcErrorFromDriveResponse.spec.js b/packages/dapi/test/unit/grpcServer/handlers/createGrpcErrorFromDriveResponse.spec.js index 88420d1f437..48a4c32e78d 100644 --- a/packages/dapi/test/unit/grpcServer/handlers/createGrpcErrorFromDriveResponse.spec.js +++ b/packages/dapi/test/unit/grpcServer/handlers/createGrpcErrorFromDriveResponse.spec.js @@ -66,23 +66,23 @@ describe('createGrpcErrorFromDriveResponse', () => { }); }); - it('should throw basic consensus error if error code = 1000', async () => { + it('should throw basic consensus error if error code = 10000', async () => { const consensusError = new ProtocolVersionParsingError('test'); const data = { serializedError: consensusError.serialize() }; info = { data }; - const error = await createGrpcErrorFromDriveResponse(1000, cbor.encode(info).toString('base64')); + const error = await createGrpcErrorFromDriveResponse(10000, cbor.encode(info).toString('base64')); expect(error).to.be.an.instanceOf(InvalidArgumentGrpcError); expect(error.message).to.be.equals(consensusError.message); expect(error.getRawMetadata()).to.deep.equal({ - code: 1000, + code: 10000, 'drive-error-data-bin': cbor.encode(data), }); }); - it('should throw signature consensus error if error code = 2000', async () => { + it('should throw signature consensus error if error code = 20000', async () => { const id = await generateRandomIdentifierAsync(); const consensusError = new IdentityNotFoundError(id); @@ -91,7 +91,7 @@ describe('createGrpcErrorFromDriveResponse', () => { info = { data }; const error = await createGrpcErrorFromDriveResponse( - 2000, + 20000, cbor.encode(info).toString('base64'), ); @@ -99,27 +99,27 @@ describe('createGrpcErrorFromDriveResponse', () => { expect(error.message).to.be.equals(consensusError.message); expect(error.getCode()).to.equal(GrpcErrorCodes.UNAUTHENTICATED); expect(error.getRawMetadata()).to.deep.equal({ - code: 2000, + code: 20000, 'drive-error-data-bin': cbor.encode(data), }); }); - it('should throw fee consensus error if error code = 3000', async () => { + it('should throw fee consensus error if error code = 30000', async () => { const consensusError = new BalanceIsNotEnoughError(BigInt(20), BigInt(10)); const data = { serializedError: consensusError.serialize() }; info = { data }; - const error = await createGrpcErrorFromDriveResponse(3000, cbor.encode(info).toString('base64')); + const error = await createGrpcErrorFromDriveResponse(30000, cbor.encode(info).toString('base64')); expect(error).to.be.an.instanceOf(FailedPreconditionGrpcError); expect(error.getRawMetadata()).to.deep.equal({ - code: 3000, + code: 30000, 'drive-error-data-bin': cbor.encode(data), }); }); - it('should throw state consensus error if error code = 4000', async () => { + it('should throw state consensus error if error code = 40000', async () => { const dataContractId = await generateRandomIdentifierAsync(); const consensusError = new DataContractAlreadyPresentError(dataContractId); @@ -128,23 +128,23 @@ describe('createGrpcErrorFromDriveResponse', () => { info = { data }; const error = await createGrpcErrorFromDriveResponse( - 4000, + 40000, cbor.encode(info).toString('base64'), ); expect(error).to.be.an.instanceOf(InvalidArgumentGrpcError); expect(error.getRawMetadata()).to.deep.equal({ - code: 4000, + code: 40000, 'drive-error-data-bin': cbor.encode(data), }); }); - it('should throw Unknown error code >= 5000', async () => { - const error = await createGrpcErrorFromDriveResponse(5000, encodedInfo); + it('should throw Unknown error code >= 50000', async () => { + const error = await createGrpcErrorFromDriveResponse(50000, encodedInfo); expect(error).to.be.an.instanceOf(GrpcError); expect(error.getMessage()).to.equal('Internal error'); - expect(error.getError().message).to.deep.equal('Unknown Drive’s error code: 5000'); + expect(error.getError().message).to.deep.equal('Unknown Drive’s error code: 50000'); }); it('should return InternalGrpcError if codes is undefined', async () => { diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.spec.js index 5f5a2cdf257..3dc61b2eb40 100644 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.spec.js +++ b/packages/dapi/test/unit/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.spec.js @@ -3,6 +3,8 @@ const { error: { InvalidArgumentGrpcError, AlreadyExistsGrpcError, + UnavailableGrpcError, + ResourceExhaustedGrpcError, }, }, } = require('@dashevo/grpc-common'); @@ -112,26 +114,75 @@ describe('broadcastStateTransitionHandlerFactory', () => { const tx = stateTransitionFixture.toBuffer().toString('base64'); expect(result).to.be.an.instanceOf(BroadcastStateTransitionResponse); - expect(rpcClientMock.request).to.be.calledOnceWith('broadcast_tx_sync', { tx }); + expect(rpcClientMock.request).to.be.calledOnceWith('broadcast_tx', { tx }); }); - it('should throw an error if transaction broadcast returns error', async () => { - const error = { code: -1, message: "Something didn't work", data: 'Some data' }; + it('should throw a UnavailableGrpcError if tenderdash hands up', async () => { + const error = new Error('socket hang up'); + rpcClientMock.request.throws(error); - response.error = error; + try { + await broadcastStateTransitionHandler(call); + + expect.fail('should throw UnavailableGrpcError'); + } catch (e) { + expect(e).to.be.an.instanceOf(UnavailableGrpcError); + expect(e.getMessage()).to.equal('Tenderdash is not available'); + } + }); + + it('should throw a UnavailableGrpcError if broadcast confirmation not received', async () => { + response.error = { + code: -32603, + message: 'Internal error', + data: 'broadcast confirmation not received: heya', + }; try { await broadcastStateTransitionHandler(call); - expect.fail('should throw an error'); + expect.fail('should throw UnavailableGrpcError'); } catch (e) { - expect(e.message).to.equal(error.message); - expect(e.data).to.equal(error.data); - expect(e.code).to.equal(error.code); + expect(e).to.be.an.instanceOf(UnavailableGrpcError); + expect(e.getMessage()).to.equal(response.error.data); } }); - it('should throw FailedPreconditionGrpcError if transaction was broadcasted twice', async () => { + it('should throw an InvalidArgumentGrpcError if state transition size is too big', async () => { + response.error = { + code: -32603, + message: 'Internal error', + data: 'Tx too large. La la la', + }; + + try { + await broadcastStateTransitionHandler(call); + + expect.fail('should throw UnavailableGrpcError'); + } catch (e) { + expect(e).to.be.an.instanceOf(InvalidArgumentGrpcError); + expect(e.getMessage()).to.equal('state transition is too large. La la la'); + } + }); + + it('should throw a ResourceExhaustedGrpcError if mempool is full', async () => { + response.error = { + code: -32603, + message: 'Internal error', + data: 'mempool is full: heya', + }; + + try { + await broadcastStateTransitionHandler(call); + + expect.fail('should throw UnavailableGrpcError'); + } catch (e) { + expect(e).to.be.an.instanceOf(ResourceExhaustedGrpcError); + expect(e.getMessage()).to.equal(response.error.data); + } + }); + + it('should throw AlreadyExistsGrpcError if transaction was broadcasted twice', async () => { response.error = { code: -32603, message: 'Internal error', @@ -144,11 +195,11 @@ describe('broadcastStateTransitionHandlerFactory', () => { expect.fail('should throw AlreadyExistsGrpcError'); } catch (e) { expect(e).to.be.an.instanceOf(AlreadyExistsGrpcError); - expect(e.getMessage()).to.equal('State transition already in chain'); + expect(e.getMessage()).to.equal('state transition already in chain'); } }); - it('should throw call createGrpcErrorFromDriveResponse if error code is not 0', async () => { + it('should throw a gRPC error based on drive\'s response', async () => { const message = 'not found'; const metadata = { data: 'some data', @@ -176,4 +227,20 @@ describe('broadcastStateTransitionHandlerFactory', () => { ); } }); + + it('should throw an error if transaction broadcast returns unknown error', async () => { + const error = { code: -1, message: "Something didn't work", data: 'Some data' }; + + response.error = error; + + try { + await broadcastStateTransitionHandler(call); + + expect.fail('should throw an error'); + } catch (e) { + expect(e.message).to.equal(error.message); + expect(e.data).to.equal(error.data); + expect(e.code).to.equal(error.code); + } + }); }); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getConsensusParamsHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getConsensusParamsHandlerFactory.spec.js deleted file mode 100644 index f80d580d09e..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getConsensusParamsHandlerFactory.spec.js +++ /dev/null @@ -1,159 +0,0 @@ -const { - v0: { - GetConsensusParamsResponse, - }, -} = require('@dashevo/dapi-grpc'); -const { - server: { - error: { - InternalGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); -const FailedPreconditionGrpcError = require('@dashevo/grpc-common/lib/server/error/FailedPreconditionGrpcError'); -const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); -const getConsensusParamsHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getConsensusParamsHandlerFactory'); -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); -const RPCError = require('../../../../../lib/rpcServer/RPCError'); - -describe('getConsensusParamsHandlerFactory', () => { - let getConsensusParamsHandler; - let getConsensusParamsMock; - let consensusParamsFixture; - let request; - let call; - - beforeEach(function beforeEach() { - request = { - getHeight: this.sinon.stub().returns(0), // gRPC returns 0 if in parameter is empty - getProve: this.sinon.stub().returns(false), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - consensusParamsFixture = { - block: { - max_bytes: '22020096', - max_gas: '1000', - time_iota_ms: '1000', - }, - evidence: { - max_age_num_blocks: '100000', - max_age_duration: '200000', - max_bytes: '22020096', - }, - validator: { - pub_key_types: [ - 'ed25519', - ], - }, - }; - - getConsensusParamsMock = this.sinon.stub().resolves(consensusParamsFixture); - - getConsensusParamsHandler = getConsensusParamsHandlerFactory( - getConsensusParamsMock, - ); - }); - - it('should return valid data', async () => { - const result = await getConsensusParamsHandler(call); - - expect(result).to.be.an.instanceOf(GetConsensusParamsResponse); - - const block = result.getV0().getBlock(); - expect(block).to.be.an.instanceOf(GetConsensusParamsResponse.ConsensusParamsBlock); - expect(block.getMaxBytes()).to.equal(consensusParamsFixture.block.max_bytes); - expect(block.getMaxGas()).to.equal(consensusParamsFixture.block.max_gas); - expect(block.getTimeIotaMs()).to.equal(consensusParamsFixture.block.time_iota_ms); - - const evidence = result.getV0().getEvidence(); - expect(evidence).to.be.an.instanceOf(GetConsensusParamsResponse.ConsensusParamsEvidence); - expect(evidence.getMaxBytes()).to.equal(consensusParamsFixture.evidence.max_bytes); - expect(evidence.getMaxAgeDuration()).to.equal(consensusParamsFixture.evidence.max_age_duration); - expect(evidence.getMaxAgeNumBlocks()) - .to.equal(consensusParamsFixture.evidence.max_age_num_blocks); - - expect(getConsensusParamsMock).to.be.calledOnceWith(undefined); - }); - - it('should throw FailedPreconditionGrpcError', async () => { - const error = new RPCError(-32603, 'invalid height', 'some data'); - getConsensusParamsMock.throws(error); - - try { - await getConsensusParamsHandler(call); - - expect.fail('should throw FailedPreconditionGrpcError'); - } catch (e) { - expect(e).to.be.an.instanceOf(FailedPreconditionGrpcError); - expect(e.getMessage()).to.equal('Invalid height: some data'); - expect(e.getCode()).to.equal(9); - } - }); - - it('should throw InternalGrpcError', async () => { - const error = new RPCError(32602, 'invalid height', 'some data'); - getConsensusParamsMock.throws(error); - - try { - await getConsensusParamsHandler(call); - - expect.fail('should throw InternalGrpcError'); - } catch (e) { - expect(e).to.be.an.instanceOf(InternalGrpcError); - expect(e.getError()).to.equal(e.getError()); - } - }); - - it('should throw InvalidArgumentGrpcError', async () => { - request.getProve.returns(true); - - try { - await getConsensusParamsHandler(call); - - expect.fail('should throw InvalidArgumentGrpcError'); - } catch (e) { - expect(e).to.be.an.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('Prove is not implemented yet'); - } - }); - - it('should throw unknown error', async () => { - const error = new Error('unknown error'); - getConsensusParamsMock.throws(error); - - try { - await getConsensusParamsHandler(call); - - expect.fail('should throw InternalGrpcError'); - } catch (e) { - expect(e).to.equal(e); - } - }); - - it('should return valid data for height', async () => { - request.getHeight.returns(42); - - const result = await getConsensusParamsHandler(call); - - expect(result).to.be.an.instanceOf(GetConsensusParamsResponse); - - const block = result.getV0().getBlock(); - expect(block).to.be.an.instanceOf(GetConsensusParamsResponse.ConsensusParamsBlock); - expect(block.getMaxBytes()).to.equal(consensusParamsFixture.block.max_bytes); - expect(block.getMaxGas()).to.equal(consensusParamsFixture.block.max_gas); - expect(block.getTimeIotaMs()).to.equal(consensusParamsFixture.block.time_iota_ms); - - const evidence = result.getV0().getEvidence(); - expect(evidence).to.be.an.instanceOf(GetConsensusParamsResponse.ConsensusParamsEvidence); - expect(evidence.getMaxBytes()).to.equal(consensusParamsFixture.evidence.max_bytes); - expect(evidence.getMaxAgeDuration()).to.equal(consensusParamsFixture.evidence.max_age_duration); - expect(evidence.getMaxAgeNumBlocks()) - .to.equal(consensusParamsFixture.evidence.max_age_num_blocks); - - expect(getConsensusParamsMock).to.be.calledOnceWith(42); - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getDataContractHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getDataContractHandlerFactory.spec.js deleted file mode 100644 index f7a62f92933..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getDataContractHandlerFactory.spec.js +++ /dev/null @@ -1,163 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetDataContractResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -/* eslint-disable import/no-extraneous-dependencies */ -const generateRandomIdentifierAsync = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); -const getDataContractFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getDataContractFixture'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -const getDataContractHandlerFactory = require( - '../../../../../lib/grpcServer/handlers/platform/getDataContractHandlerFactory', -); - -describe('getDataContractHandlerFactory', () => { - let call; - let getDataContractHandler; - let driveClientMock; - let request; - let id; - let dataContractFixture; - let proofFixture; - let proofMock; - let response; - let proofResponse; - - beforeEach(async function beforeEach() { - id = await generateRandomIdentifierAsync(); - request = { - getId: this.sinon.stub().returns(id), - getProve: this.sinon.stub().returns(true), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - dataContractFixture = await getDataContractFixture(); - proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - response = new GetDataContractResponse(); - response.setV0( - new GetDataContractResponse.GetDataContractResponseV0() - .setDataContract(dataContractFixture.toBuffer()), - ); - - proofResponse = new GetDataContractResponse(); - proofResponse.setV0( - new GetDataContractResponse.GetDataContractResponseV0() - .setProof(proofMock), - ); - - driveClientMock = { - fetchDataContract: this.sinon.stub().resolves(response.serializeBinary()), - }; - - getDataContractHandler = getDataContractHandlerFactory( - driveClientMock, - ); - }); - - it('should return data contract', async () => { - const result = await getDataContractHandler(call); - - expect(result).to.be.an.instanceOf(GetDataContractResponse); - - const contractBinary = result.getV0().getDataContract(); - expect(contractBinary).to.be.an.instanceOf(Uint8Array); - - expect(contractBinary).to.deep.equal(dataContractFixture.toBuffer()); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.undefined(); - }); - - it('should return proof', async function it() { - driveClientMock = { - fetchDataContract: this.sinon.stub().resolves(proofResponse.serializeBinary()), - }; - - getDataContractHandler = getDataContractHandlerFactory( - driveClientMock, - ); - - const result = await getDataContractHandler(call); - - expect(result).to.be.an.instanceOf(GetDataContractResponse); - - const contractBinary = result.getV0().getDataContract(); - expect(contractBinary).to.be.equal(''); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(driveClientMock.fetchDataContract).to.be.calledOnceWith(call.request); - }); - - it('should not include proof', async () => { - request.getProve.returns(false); - response.getV0().setProof(null); - driveClientMock.fetchDataContract.resolves(response.serializeBinary()); - - const result = await getDataContractHandler(call); - - expect(result).to.be.an.instanceOf(GetDataContractResponse); - const proof = result.getV0().getProof(); - - expect(proof).to.be.undefined(); - - expect(driveClientMock.fetchDataContract).to.be.calledOnceWith(call.request); - }); - - it('should throw InvalidArgumentGrpcError error if id is not specified', async () => { - id = null; - request.getId.returns(id); - - try { - await getDataContractHandler(call); - - expect.fail('should thrown InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('id is not specified'); - expect(driveClientMock.fetchDataContract).to.be.not.called(); - } - }); - - it('should throw error if driveStateRepository throws an error', async () => { - const message = 'Some error'; - const abciResponseError = new Error(message); - - driveClientMock.fetchDataContract.throws(abciResponseError); - - try { - await getDataContractHandler(call); - - expect.fail('should throw error'); - } catch (e) { - expect(e).to.equal(abciResponseError); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getDataContractsHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getDataContractsHandlerFactory.spec.js deleted file mode 100644 index 3eee6b5b0a2..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getDataContractsHandlerFactory.spec.js +++ /dev/null @@ -1,144 +0,0 @@ -const { BytesValue } = require('google-protobuf/google/protobuf/wrappers_pb'); - -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetDataContractsResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -/* eslint-disable import/no-extraneous-dependencies */ -const generateRandomIdentifierAsync = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); -const getDataContractFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getDataContractFixture'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -const getDataContractsHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getDataContractsHandlerFactory'); - -const { - DataContractEntry, - DataContracts, - GetDataContractsResponseV0, -} = GetDataContractsResponse; - -describe('getDataContractsHandlerFactory', () => { - let call; - let getDataContractsHandler; - let request; - let id; - let dataContractEntries; - let fetchDataContractsMock; - - beforeEach(async function beforeEach() { - id = await generateRandomIdentifierAsync(); - request = { - getIdsList: this.sinon.stub().returns([id]), - getProve: this.sinon.stub().returns(true), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - fetchDataContractsMock = this.sinon.stub(); - - getDataContractsHandler = getDataContractsHandlerFactory({ - fetchDataContracts: fetchDataContractsMock, - }); - }); - - it('should return data contracts', async () => { - const dataContractFixture = await getDataContractFixture(); - - const dataContractEntry = new DataContractEntry(); - dataContractEntry.setIdentifier(id.toBuffer()); - dataContractEntry.setDataContract(new BytesValue().setValue(dataContractFixture.toBuffer())); - - dataContractEntries = [ - dataContractEntry, - ]; - - const dataContracts = new DataContracts(); - dataContracts.setDataContractEntriesList(dataContractEntries); - - const response = new GetDataContractsResponse().setV0( - new GetDataContractsResponseV0().setDataContracts(dataContracts), - ); - - fetchDataContractsMock.resolves(response.serializeBinary()); - - const result = await getDataContractsHandler(call); - - expect(result).to.be.an.instanceOf(GetDataContractsResponse); - - const contractBinaries = result.getV0().getDataContracts().getDataContractEntriesList(); - - expect(contractBinaries).to.deep.equal(dataContractEntries); - - expect(fetchDataContractsMock).to.be.calledOnceWith(call.request); - }); - - it('should return proof', async () => { - const proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - const proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - const response = new GetDataContractsResponse() - .setV0(new GetDataContractsResponseV0().setProof(proofMock)); - - fetchDataContractsMock.resolves(response.serializeBinary()); - - const result = await getDataContractsHandler(call); - - expect(result).to.be.an.instanceOf(GetDataContractsResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(fetchDataContractsMock).to.be.calledOnceWith(call.request); - }); - - it('should throw InvalidArgumentGrpcError error if ids are not specified', async () => { - request.getIdsList.returns(null); - - try { - await getDataContractsHandler(call); - - expect.fail('should thrown InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('data contract ids are not specified'); - expect(fetchDataContractsMock).to.be.not.called(); - } - }); - - it('should throw error if driveStateRepository throws an error', async () => { - const message = 'Some error'; - const abciResponseError = new Error(message); - - fetchDataContractsMock.throws(abciResponseError); - - try { - await getDataContractsHandler(call); - - expect.fail('should throw error'); - } catch (e) { - expect(e).to.equal(abciResponseError); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getDocumentsHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getDocumentsHandlerFactory.spec.js deleted file mode 100644 index 69aff5ffb0b..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getDocumentsHandlerFactory.spec.js +++ /dev/null @@ -1,193 +0,0 @@ -const cbor = require('cbor'); - -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetDocumentsResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -/* eslint-disable import/no-extraneous-dependencies */ -const generateRandomIdentifierAsync = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); -const getDocumentsFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getDocumentsFixture'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -const getDocumentsHandlerFactory = require( - '../../../../../lib/grpcServer/handlers/platform/getDocumentsHandlerFactory', -); - -describe('getDocumentsHandlerFactory', () => { - let call; - let getDocumentsHandler; - let driveStateRepositoryMock; - let request; - let documentsFixture; - let dataContractId; - let documentType; - let where; - let orderBy; - let limit; - let startAfter; - let startAt; - let documentsSerialized; - let proofFixture; - let response; - let proofMock; - let proofResponse; - - beforeEach(async function beforeEach() { - dataContractId = await generateRandomIdentifierAsync(); - documentType = 'document'; - where = [['name', '==', 'John']]; - orderBy = [{ order: 'asc' }]; - limit = 20; - startAfter = new Uint8Array((await generateRandomIdentifierAsync()).toBuffer()); - startAt = new Uint8Array([]); - - request = { - getDataContractId: this.sinon.stub().returns(dataContractId), - getDocumentType: this.sinon.stub().returns(documentType), - getWhere_asU8: this.sinon.stub().returns(new Uint8Array(cbor.encode(where))), - getOrderBy_asU8: this.sinon.stub().returns(new Uint8Array(cbor.encode(orderBy))), - getLimit: this.sinon.stub().returns(limit), - getStartAfter_asU8: this.sinon.stub().returns(startAfter), - getStartAt_asU8: this.sinon.stub().returns(startAt), - getProve: this.sinon.stub().returns(false), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - const [document] = await getDocumentsFixture(); - - documentsFixture = [document]; - - documentsSerialized = documentsFixture.map((documentItem) => documentItem.toBuffer()); - proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - const { GetDocumentsResponseV0 } = GetDocumentsResponse; - response = new GetDocumentsResponse(); - response.setV0( - new GetDocumentsResponseV0() - .setDocuments( - new GetDocumentsResponseV0.Documents() - .setDocumentsList(documentsSerialized), - ), - ); - - proofResponse = new GetDocumentsResponse(); - proofResponse.setV0( - new GetDocumentsResponseV0().setProof(proofMock), - ); - - driveStateRepositoryMock = { - fetchDocuments: this.sinon.stub().resolves(response.serializeBinary()), - }; - - getDocumentsHandler = getDocumentsHandlerFactory( - driveStateRepositoryMock, - ); - }); - - it('should return valid result', async () => { - response.getV0().setProof(null); - - const result = await getDocumentsHandler(call); - - expect(result).to.be.an.instanceOf(GetDocumentsResponse); - const documents = result.getV0().getDocuments(); - - const documentsBinary = documents.getDocumentsList(); - expect(documentsBinary).to.be.an('array'); - expect(documentsBinary).to.have.lengthOf(documentsFixture.length); - - expect(driveStateRepositoryMock.fetchDocuments).to.be.calledOnceWith( - call.request, - ); - - expect(documentsBinary[0]).to.deep.equal(documentsSerialized[0]); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.undefined(); - }); - - it('should return proof', async () => { - request.getProve.returns(true); - driveStateRepositoryMock.fetchDocuments.resolves(proofResponse.serializeBinary()); - - const result = await getDocumentsHandler(call); - - expect(result).to.be.an.instanceOf(GetDocumentsResponse); - - expect(driveStateRepositoryMock.fetchDocuments).to.be.calledOnceWith( - call.request, - ); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - }); - - it('should throw InvalidArgumentGrpcError if dataContractId is not specified', async () => { - dataContractId = null; - request.getDataContractId.returns(dataContractId); - - try { - await getDocumentsHandler(call); - - expect.fail('should throw InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('dataContractId is not specified'); - expect(driveStateRepositoryMock.fetchDocuments).to.be.not.called(); - } - }); - - it('should throw InvalidArgumentGrpcError if documentType is not specified', async () => { - documentType = null; - request.getDocumentType.returns(documentType); - - try { - await getDocumentsHandler(call); - - expect.fail('should throw InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('documentType is not specified'); - expect(driveStateRepositoryMock.fetchDocuments).to.be.not.called(); - } - }); - - it('should throw error if fetchDocuments throws an error', async () => { - const error = new Error('Some error'); - - driveStateRepositoryMock.fetchDocuments.throws(error); - - try { - await getDocumentsHandler(call); - - expect.fail('should throw InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.equal(error); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getEpochsInfoHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getEpochsInfoHandlerFactory.spec.js deleted file mode 100644 index 151f43b4e87..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getEpochsInfoHandlerFactory.spec.js +++ /dev/null @@ -1,113 +0,0 @@ -const { - v0: { - GetEpochsInfoResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const getEpochsInfoHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getEpochsInfoHandlerFactory'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -describe('getEpochsInfoHandlerFactory', () => { - let call; - let driveStateRepositoryMock; - let getEpochsInfoHandler; - let epochNumber; - let proofFixture; - let proofMock; - let request; - let response; - let proofResponse; - - beforeEach(async function beforeEach() { - request = { - getProve: this.sinon.stub().returns(false), - }; - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - epochNumber = 1; - const { GetEpochsInfoResponseV0 } = GetEpochsInfoResponse; - const { EpochInfos, EpochInfo } = GetEpochsInfoResponseV0; - response = new GetEpochsInfoResponse(); - response.setV0( - new GetEpochsInfoResponseV0() - .setEpochs(new EpochInfos() - .setEpochInfosList([new EpochInfo() - .setNumber(epochNumber) - .setFirstBlockHeight(1) - .setFirstCoreBlockHeight(1) - .setStartTime(Date.now()) - .setFeeMultiplier(1.1)])), - ); - - proofResponse = new GetEpochsInfoResponse(); - proofResponse.setV0( - new GetEpochsInfoResponseV0() - .setProof(proofMock), - ); - - driveStateRepositoryMock = { - fetchEpochsInfo: this.sinon.stub().resolves(response.serializeBinary()), - }; - - getEpochsInfoHandler = getEpochsInfoHandlerFactory( - driveStateRepositoryMock, - ); - }); - - it('should return valid result', async () => { - const result = await getEpochsInfoHandler(call); - - expect(result).to.be.an.instanceOf(GetEpochsInfoResponse); - expect(result.getV0() - .getEpochs().getEpochInfosList()[0].getNumber()).to.equal(epochNumber); - expect(driveStateRepositoryMock.fetchEpochsInfo).to.be.calledOnceWith(call.request); - - const proof = result.getV0().getProof(); - expect(proof).to.be.undefined(); - }); - - it('should return proof', async () => { - request.getProve.returns(true); - - driveStateRepositoryMock.fetchEpochsInfo.resolves(proofResponse.serializeBinary()); - - const result = await getEpochsInfoHandler(call); - - expect(result).to.be.an.instanceOf(GetEpochsInfoResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(driveStateRepositoryMock.fetchEpochsInfo).to.be.calledOnceWith(call.request); - }); - - it('should throw an error when fetchEpochsInfo throws unknown error', async () => { - const error = new Error('Unknown error'); - - driveStateRepositoryMock.fetchEpochsInfo.throws(error); - - try { - await getEpochsInfoHandler(call); - - expect.fail('should throw an error'); - } catch (e) { - expect(e).to.equal(error); - expect(driveStateRepositoryMock.fetchEpochsInfo).to.be.calledOnceWith(call.request); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentitiesByPublicKeyHashesHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentitiesByPublicKeyHashesHandlerFactory.spec.js deleted file mode 100644 index 00388413e2f..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentitiesByPublicKeyHashesHandlerFactory.spec.js +++ /dev/null @@ -1,159 +0,0 @@ -const { BytesValue } = require('google-protobuf/google/protobuf/wrappers_pb'); - -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentitiesByPublicKeyHashesResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); - -const getIdentitiesByPublicKeyHashesHandlerFactory = require( - '../../../../../lib/grpcServer/handlers/platform/getIdentitiesByPublicKeyHashesHandlerFactory', -); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -describe('getIdentitiesByPublicKeyHashesHandlerFactory', () => { - let call; - let driveClientMock; - let getIdentitiesByPublicKeyHashesHandler; - let identity; - let publicKeyHash; - let proofFixture; - let proofMock; - let response; - let proofResponse; - let request; - - beforeEach(async function beforeEach() { - publicKeyHash = Buffer.from('556c2910d46fda2b327ef9d9bda850cc84d30db0', 'hex'); - - request = { - getPublicKeyHashesList: this.sinon.stub().returns( - [publicKeyHash], - ), - getProve: this.sinon.stub().returns(false), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - identity = await getIdentityFixture(); - - proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - const { - IdentitiesByPublicKeyHashes, - PublicKeyHashIdentityEntry, - GetIdentitiesByPublicKeyHashesResponseV0, - } = GetIdentitiesByPublicKeyHashesResponse; - - response = new GetIdentitiesByPublicKeyHashesResponse(); - response.setV0( - new GetIdentitiesByPublicKeyHashesResponseV0().setIdentities( - new IdentitiesByPublicKeyHashes() - .setIdentityEntriesList([ - new PublicKeyHashIdentityEntry() - .setPublicKeyHash(publicKeyHash) - .setValue(new BytesValue().setValue(identity.toBuffer())), - ]), - ), - ); - - proofResponse = new GetIdentitiesByPublicKeyHashesResponse(); - proofResponse.setV0( - new GetIdentitiesByPublicKeyHashesResponseV0().setProof(proofMock), - ); - - driveClientMock = { - fetchIdentitiesByPublicKeyHashes: this.sinon.stub().resolves(response.serializeBinary()), - }; - - getIdentitiesByPublicKeyHashesHandler = getIdentitiesByPublicKeyHashesHandlerFactory( - driveClientMock, - ); - }); - - it('should return identities', async () => { - const result = await getIdentitiesByPublicKeyHashesHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentitiesByPublicKeyHashesResponse); - - expect(result.getV0() - .getIdentities() - .getIdentityEntriesList()[0] - .getValue() - .getValue()).to.deep.equal( - identity.toBuffer(), - ); - - expect(driveClientMock.fetchIdentitiesByPublicKeyHashes) - .to.be.calledOnceWith(call.request); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.undefined(); - }); - - it('should return proof', async () => { - request.getProve.returns(true); - driveClientMock.fetchIdentitiesByPublicKeyHashes.resolves(proofResponse.serializeBinary()); - - const result = await getIdentitiesByPublicKeyHashesHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentitiesByPublicKeyHashesResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - }); - - it('should throw an InvalidArgumentGrpcError if no hashes were submitted', async () => { - request.getPublicKeyHashesList.returns([]); - - try { - await getIdentitiesByPublicKeyHashesHandler(call); - - expect.fail('should throw an error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('No public key hashes were provided'); - expect(driveClientMock.fetchIdentitiesByPublicKeyHashes).to.not.be.called(); - } - }); - - it('should throw an error when fetchIdentity throws an error', async () => { - const error = new Error('Unknown error'); - - driveClientMock.fetchIdentitiesByPublicKeyHashes.throws(error); - - try { - await getIdentitiesByPublicKeyHashesHandler(call); - - expect.fail('should throw an error'); - } catch (e) { - expect(e).to.equal(error); - expect(driveClientMock.fetchIdentitiesByPublicKeyHashes) - .to.be.calledOnceWith(call.request); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentitiesHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentitiesHandlerFactory.spec.js deleted file mode 100644 index c0ae75cbdc8..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentitiesHandlerFactory.spec.js +++ /dev/null @@ -1,142 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentitiesResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const { - IdentityEntry, - IdentityValue, - GetIdentitiesResponseV0, - Identities, -} = GetIdentitiesResponse; - -/* eslint-disable import/no-extraneous-dependencies */ -const generateRandomIdentifierAsync = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); -const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -const getIdentitiesHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getIdentitiesHandlerFactory'); - -describe('getIdentitiesHandlerFactory', () => { - let call; - let getIdentitiesHandler; - let fetchIdentitiesMock; - let request; - let id; - - beforeEach(async function beforeEach() { - id = await generateRandomIdentifierAsync(); - request = { - getIdsList: this.sinon.stub().returns([id]), - getProve: this.sinon.stub().returns(true), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - fetchIdentitiesMock = this.sinon.stub(); - - getIdentitiesHandler = getIdentitiesHandlerFactory({ - fetchIdentities: fetchIdentitiesMock, - }); - }); - - it('should return identities', async () => { - const identityFixture = await getIdentityFixture(); - - const identityValue = new IdentityValue(); - identityValue.setValue(identityFixture.toBuffer()); - - const identityEntry = new IdentityEntry(); - identityEntry.setKey(id.toBuffer()); - identityEntry.setValue(identityValue); - - const identityEntries = [ - identityEntry, - ]; - - const identities = new Identities(); - identities.setIdentityEntriesList(identityEntries); - - const response = new GetIdentitiesResponse() - .setV0(new GetIdentitiesResponseV0().setIdentities(identities)); - - fetchIdentitiesMock.resolves(response.serializeBinary()); - - const result = await getIdentitiesHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentitiesResponse); - - const identityBinaries = result.getV0().getIdentities().getIdentityEntriesList(); - - expect(identityBinaries).to.deep.equal(identityEntries); - }); - - it('should return proof', async () => { - const proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - const proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - const response = new GetIdentitiesResponse() - .setV0(new GetIdentitiesResponseV0().setProof(proofMock)); - - fetchIdentitiesMock.resolves(response.serializeBinary()); - - const result = await getIdentitiesHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentitiesResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(fetchIdentitiesMock).to.be.calledOnceWith(call.request); - }); - - it('should throw InvalidArgumentGrpcError error if ids are not specified', async () => { - request.getIdsList.returns(null); - - try { - await getIdentitiesHandler(call); - - expect.fail('should thrown InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('identity ids are not specified'); - expect(fetchIdentitiesMock).to.be.not.called(); - } - }); - - it('should throw error if driveStateRepository throws an error', async () => { - const message = 'Some error'; - const abciResponseError = new Error(message); - - fetchIdentitiesMock.throws(abciResponseError); - - try { - await getIdentitiesHandler(call); - - expect.fail('should throw error'); - } catch (e) { - expect(e).to.equal(abciResponseError); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityBalanceAndRevisionHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityBalanceAndRevisionHandlerFactory.spec.js deleted file mode 100644 index effbd19d62c..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityBalanceAndRevisionHandlerFactory.spec.js +++ /dev/null @@ -1,137 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityBalanceAndRevisionResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const { - GetIdentityBalanceAndRevisionResponseV0, -} = GetIdentityBalanceAndRevisionResponse; - -const { - BalanceAndRevision, -} = GetIdentityBalanceAndRevisionResponseV0; - -/* eslint-disable import/no-extraneous-dependencies */ -const generateRandomIdentifierAsync = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -const getIdentityBalanceAndRevisionHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getIdentityBalanceAndRevisionHandlerFactory'); - -describe('getIdentityBalanceAndRevisionHandlerFactory', () => { - let call; - let getIdentityBalanceAndRevisionHandler; - let fetchIdentityBalanceAndRevisionMock; - let request; - let id; - - beforeEach(async function beforeEach() { - id = await generateRandomIdentifierAsync(); - - request = { - getId: this.sinon.stub().returns(id), - getProve: this.sinon.stub().returns(true), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - fetchIdentityBalanceAndRevisionMock = this.sinon.stub(); - - getIdentityBalanceAndRevisionHandler = getIdentityBalanceAndRevisionHandlerFactory({ - fetchIdentityBalanceAndRevision: fetchIdentityBalanceAndRevisionMock, - }); - }); - - it('should return identity balance and revision', async () => { - const revisionAndBalance = new BalanceAndRevision(); - - revisionAndBalance.setRevision(1); - revisionAndBalance.setBalance(15); - - const response = new GetIdentityBalanceAndRevisionResponse() - .setV0( - new GetIdentityBalanceAndRevisionResponseV0().setBalanceAndRevision(revisionAndBalance), - ); - - fetchIdentityBalanceAndRevisionMock.resolves(response.serializeBinary()); - - const result = await getIdentityBalanceAndRevisionHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityBalanceAndRevisionResponse); - - const identityRevisionAndBalance = result.getV0().getBalanceAndRevision(); - - expect(identityRevisionAndBalance.getRevision()).to.equals(1); - expect(identityRevisionAndBalance.getBalance()).to.equals(15); - - expect(fetchIdentityBalanceAndRevisionMock).to.be.calledOnceWith(call.request); - }); - - it('should return proof', async () => { - const proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - const proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - const response = new GetIdentityBalanceAndRevisionResponse() - .setV0(new GetIdentityBalanceAndRevisionResponseV0().setProof(proofMock)); - - fetchIdentityBalanceAndRevisionMock.resolves(response.serializeBinary()); - - const result = await getIdentityBalanceAndRevisionHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityBalanceAndRevisionResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(fetchIdentityBalanceAndRevisionMock).to.be.calledOnceWith(call.request); - }); - - it('should throw InvalidArgumentGrpcError error if ids are not specified', async () => { - request.getId.returns(null); - - try { - await getIdentityBalanceAndRevisionHandler(call); - - expect.fail('should thrown InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('identity id is not specified'); - expect(fetchIdentityBalanceAndRevisionMock).to.be.not.called(); - } - }); - - it('should throw error if driveStateRepository throws an error', async () => { - const message = 'Some error'; - const abciResponseError = new Error(message); - - fetchIdentityBalanceAndRevisionMock.throws(abciResponseError); - - try { - await getIdentityBalanceAndRevisionHandler(call); - - expect.fail('should throw error'); - } catch (e) { - expect(e).to.equal(abciResponseError); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityBalanceHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityBalanceHandlerFactory.spec.js deleted file mode 100644 index 841901f649e..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityBalanceHandlerFactory.spec.js +++ /dev/null @@ -1,122 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityBalanceResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const { - GetIdentityBalanceResponseV0, -} = GetIdentityBalanceResponse; - -/* eslint-disable import/no-extraneous-dependencies */ -const generateRandomIdentifierAsync = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -const getIdentityBalanceHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getIdentityBalanceHandlerFactory'); - -describe('getIdentityBalanceHandlerFactory', () => { - let call; - let getIdentityBalanceHandler; - let request; - let id; - let fetchIdentityBalanceMock; - - beforeEach(async function beforeEach() { - id = await generateRandomIdentifierAsync(); - request = { - getId: this.sinon.stub().returns(id), - getProve: this.sinon.stub().returns(true), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - fetchIdentityBalanceMock = this.sinon.stub(); - - getIdentityBalanceHandler = getIdentityBalanceHandlerFactory({ - fetchIdentityBalance: fetchIdentityBalanceMock, - }); - }); - - it('should return identity balance', async () => { - const response = new GetIdentityBalanceResponse() - .setV0(new GetIdentityBalanceResponseV0().setBalance(15)); - - fetchIdentityBalanceMock.resolves(response.serializeBinary()); - - const result = await getIdentityBalanceHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityBalanceResponse); - - const identityBalance = result.getV0().getBalance(); - - expect(identityBalance).to.deep.equal(15); - }); - - it('should return proof', async () => { - const proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - const proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - const response = new GetIdentityBalanceResponse() - .setV0(new GetIdentityBalanceResponseV0().setProof(proofMock)); - - fetchIdentityBalanceMock.resolves(response.serializeBinary()); - - const result = await getIdentityBalanceHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityBalanceResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(fetchIdentityBalanceMock).to.be.calledOnceWith(call.request); - }); - - it('should throw InvalidArgumentGrpcError error if ids are not specified', async () => { - request.getId.returns(null); - - try { - await getIdentityBalanceHandler(call); - - expect.fail('should thrown InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('identity id is not specified'); - expect(fetchIdentityBalanceMock).to.be.not.called(); - } - }); - - it('should throw error if driveStateRepository throws an error', async () => { - const message = 'Some error'; - const abciResponseError = new Error(message); - - fetchIdentityBalanceMock.throws(abciResponseError); - - try { - await getIdentityBalanceHandler(call); - - expect.fail('should throw error'); - } catch (e) { - expect(e).to.equal(abciResponseError); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityByPublicKeyHashHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityByPublicKeyHashHandlerFactory.spec.js deleted file mode 100644 index 9f88a678a53..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityByPublicKeyHashHandlerFactory.spec.js +++ /dev/null @@ -1,132 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityByPublicKeyHashResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const { - GetIdentityByPublicKeyHashResponseV0, -} = GetIdentityByPublicKeyHashResponse; - -/* eslint-disable import/no-extraneous-dependencies */ -const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -const getIdentityByPublicKeyHashHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getIdentityByPublicKeyHashHandlerFactory'); - -describe('getIdentityByPublicKeyHashHandlerFactory', () => { - let call; - let getIdentityByPublicKeyHashHandler; - let request; - let fetchIdentityByPublicKeyHashMock; - - beforeEach(async function beforeEach() { - request = { - getPublicKeyHash: this.sinon.stub().returns( - Buffer.alloc(1, 1), - ), - getProve: this.sinon.stub().returns(true), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - fetchIdentityByPublicKeyHashMock = this.sinon.stub(); - - getIdentityByPublicKeyHashHandler = getIdentityByPublicKeyHashHandlerFactory({ - fetchIdentityByPublicKeyHash: fetchIdentityByPublicKeyHashMock, - }); - }); - - it('should return identity', async () => { - const identityFixture = await getIdentityFixture(); - - const response = new GetIdentityByPublicKeyHashResponse() - .setV0(new GetIdentityByPublicKeyHashResponseV0().setIdentity(identityFixture.toBuffer())); - - fetchIdentityByPublicKeyHashMock.resolves(response.serializeBinary()); - - const result = await getIdentityByPublicKeyHashHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityByPublicKeyHashResponse); - - const identity = result.getV0().getIdentity(); - - expect(identity).to.deep.equal(identityFixture.toBuffer()); - - expect(fetchIdentityByPublicKeyHashMock).to.be.calledOnceWith( - call.request, - ); - }); - - it('should return proof', async () => { - const proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - const proofMock = new Proof(); - - proofMock.setGrovedbProof(proofFixture.merkleProof); - - const response = new GetIdentityByPublicKeyHashResponse().setV0( - new GetIdentityByPublicKeyHashResponseV0().setProof(proofMock), - ); - - fetchIdentityByPublicKeyHashMock.resolves(response.serializeBinary()); - - const result = await getIdentityByPublicKeyHashHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityByPublicKeyHashResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(fetchIdentityByPublicKeyHashMock).to.be.calledOnceWith( - call.request, - ); - }); - - it('should throw InvalidArgumentGrpcError error if ids are not specified', async () => { - request.getPublicKeyHash.returns([]); - - try { - await getIdentityByPublicKeyHashHandler(call); - - expect.fail('should thrown InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('No public key hash is provided'); - expect(fetchIdentityByPublicKeyHashMock).to.be.not.called(); - } - }); - - it('should throw error if driveStateRepository throws an error', async () => { - const message = 'Some error'; - const abciResponseError = new Error(message); - - fetchIdentityByPublicKeyHashMock.throws(abciResponseError); - - try { - await getIdentityByPublicKeyHashHandler(call); - - expect.fail('should throw error'); - } catch (e) { - expect(e).to.equal(abciResponseError); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityContractNonceHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityContractNonceHandlerFactory.spec.js new file mode 100644 index 00000000000..672776bac36 --- /dev/null +++ b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityContractNonceHandlerFactory.spec.js @@ -0,0 +1,110 @@ +const { + v0: { + GetIdentityContractNonceResponse, + Proof, + }, +} = require('@dashevo/dapi-grpc'); + +const getIdentityContractNonceHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getIdentityContractNonceHandlerFactory'); + +const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); + +describe('getIdentityContractNonceHandlerFactory', () => { + let call; + let driveStateRepositoryMock; + let getIdentityContractNonceHandler; + let nonce; + let proofFixture; + let proofMock; + let request; + let response; + let proofResponse; + + beforeEach(async function beforeEach() { + request = { + getProve: this.sinon.stub().returns(false), + }; + call = new GrpcCallMock(this.sinon, { + getV0: () => request, + }); + + proofFixture = { + merkleProof: Buffer.alloc(1, 1), + }; + + proofMock = new Proof(); + proofMock.setGrovedbProof(proofFixture.merkleProof); + + nonce = 1; + const { GetIdentityContractNonceResponseV0 } = GetIdentityContractNonceResponse; + response = new GetIdentityContractNonceResponse(); + response.setV0( + new GetIdentityContractNonceResponseV0() + .setIdentityContractNonce(1), + ); + + proofResponse = new GetIdentityContractNonceResponse(); + proofResponse.setV0( + new GetIdentityContractNonceResponseV0() + .setProof(proofMock), + ); + + driveStateRepositoryMock = { + fetchIdentityContractNonce: this.sinon.stub().resolves(response.serializeBinary()), + }; + + getIdentityContractNonceHandler = getIdentityContractNonceHandlerFactory( + driveStateRepositoryMock, + ); + }); + + it('should return valid result', async () => { + const result = await getIdentityContractNonceHandler(call); + + expect(result).to.be.an.instanceOf(GetIdentityContractNonceResponse); + expect(result.getV0() + .getIdentityContractNonce()).to.deep.equal(nonce); + expect(driveStateRepositoryMock.fetchIdentityContractNonce) + .to.be.calledOnceWith(call.request); + + const proof = result.getV0().getProof(); + expect(proof).to.be.undefined(); + }); + + it('should return proof', async () => { + request.getProve.returns(true); + + driveStateRepositoryMock.fetchIdentityContractNonce + .resolves(proofResponse.serializeBinary()); + + const result = await getIdentityContractNonceHandler(call); + + expect(result).to.be.an.instanceOf(GetIdentityContractNonceResponse); + + const proof = result.getV0().getProof(); + + expect(proof).to.be.an.instanceOf(Proof); + const merkleProof = proof.getGrovedbProof(); + + expect(merkleProof).to.deep.equal(proofFixture.merkleProof); + + expect(driveStateRepositoryMock.fetchIdentityContractNonce) + .to.be.calledOnceWith(call.request); + }); + + it('should throw an error when fetchIdentityContractNonce throws unknown error', async () => { + const error = new Error('Unknown error'); + + driveStateRepositoryMock.fetchIdentityContractNonce.throws(error); + + try { + await getIdentityContractNonceHandler(call); + + expect.fail('should throw an error'); + } catch (e) { + expect(e).to.equal(error); + expect(driveStateRepositoryMock.fetchIdentityContractNonce) + .to.be.calledOnceWith(call.request); + } + }); +}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityHandlerFactory.spec.js deleted file mode 100644 index e3340dfcf5b..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityHandlerFactory.spec.js +++ /dev/null @@ -1,134 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -/* eslint-disable import/no-extraneous-dependencies */ -const generateRandomIdentifierAsync = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); -const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); - -const getIdentityHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getIdentityHandlerFactory'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -describe('getIdentityHandlerFactory', () => { - let call; - let driveStateRepositoryMock; - let id; - let getIdentityHandler; - let identity; - let proofFixture; - let proofMock; - let request; - let response; - let proofResponse; - - beforeEach(async function beforeEach() { - id = await generateRandomIdentifierAsync(); - request = { - getId: this.sinon.stub().returns(id), - getProve: this.sinon.stub().returns(false), - }; - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - identity = await getIdentityFixture(); - - proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - response = new GetIdentityResponse(); - response.setV0( - new GetIdentityResponse.GetIdentityResponseV0() - .setIdentity(identity.toBuffer()), - ); - - proofResponse = new GetIdentityResponse(); - proofResponse.setV0( - new GetIdentityResponse.GetIdentityResponseV0() - .setProof(proofMock), - ); - - driveStateRepositoryMock = { - fetchIdentity: this.sinon.stub().resolves(response.serializeBinary()), - }; - - getIdentityHandler = getIdentityHandlerFactory( - driveStateRepositoryMock, - ); - }); - - it('should return valid result', async () => { - const result = await getIdentityHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityResponse); - expect(result.getV0().getIdentity()).to.deep.equal(identity.toBuffer()); - expect(driveStateRepositoryMock.fetchIdentity).to.be.calledOnceWith(call.request); - - const proof = result.getV0().getProof(); - expect(proof).to.be.undefined(); - }); - - it('should return proof', async () => { - request.getProve.returns(true); - - driveStateRepositoryMock.fetchIdentity.resolves(proofResponse.serializeBinary()); - - const result = await getIdentityHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(driveStateRepositoryMock.fetchIdentity).to.be.calledOnceWith(call.request); - }); - - it('should throw an InvalidArgumentGrpcError if id is not specified', async () => { - request.getId.returns(null); - - try { - await getIdentityHandler(call); - - expect.fail('should throw an error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('id is not specified'); - expect(driveStateRepositoryMock.fetchIdentity).to.not.be.called(); - } - }); - - it('should throw an error when fetchIdentity throws unknown error', async () => { - const error = new Error('Unknown error'); - - driveStateRepositoryMock.fetchIdentity.throws(error); - - try { - await getIdentityHandler(call); - - expect.fail('should throw an error'); - } catch (e) { - expect(e).to.equal(error); - expect(driveStateRepositoryMock.fetchIdentity).to.be.calledOnceWith(call.request); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityKeysHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityKeysHandlerFactory.spec.js deleted file mode 100644 index 38a0cb37b89..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityKeysHandlerFactory.spec.js +++ /dev/null @@ -1,135 +0,0 @@ -const { - server: { - error: { - InvalidArgumentGrpcError, - }, - }, -} = require('@dashevo/grpc-common'); - -const { - v0: { - GetIdentityKeysResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const { - GetIdentityKeysResponseV0, -} = GetIdentityKeysResponse; - -const { - Keys, -} = GetIdentityKeysResponseV0; - -/* eslint-disable import/no-extraneous-dependencies */ -const generateRandomIdentifierAsync = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -const getIdentityKeysHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getIdentityKeysHandlerFactory'); - -describe('getIdentityKeysHandlerFactory', () => { - let call; - let getIdentityKeysHandler; - let fetchIdentityKeysMock; - let request; - let id; - - beforeEach(async function beforeEach() { - id = await generateRandomIdentifierAsync(); - request = { - getIdentityId: this.sinon.stub().returns(id), - getProve: this.sinon.stub().returns(true), - }; - - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - fetchIdentityKeysMock = this.sinon.stub(); - - getIdentityKeysHandler = getIdentityKeysHandlerFactory({ - fetchIdentityKeys: fetchIdentityKeysMock, - }); - }); - - it('should return identity keys', async () => { - const keysBytesList = [ - Buffer.from('key1'), - ]; - - const keys = new Keys(); - keys.setKeysBytesList(keysBytesList); - - const response = new GetIdentityKeysResponse() - .setV0(new GetIdentityKeysResponseV0().setKeys(keys)); - - fetchIdentityKeysMock.resolves(response.serializeBinary()); - - const result = await getIdentityKeysHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityKeysResponse); - - const keysBytes = result.getV0().getKeys().getKeysBytesList(); - - expect(keysBytes).to.deep.equal(keysBytesList); - - expect(fetchIdentityKeysMock).to.be.calledOnceWith(call.request); - }); - - it('should return proof', async () => { - const proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - const proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - const response = new GetIdentityKeysResponse() - .setV0(new GetIdentityKeysResponseV0().setProof(proofMock)); - - fetchIdentityKeysMock.resolves(response.serializeBinary()); - - const result = await getIdentityKeysHandler(call); - - expect(result).to.be.an.instanceOf(GetIdentityKeysResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(fetchIdentityKeysMock).to.be.calledOnceWith(call.request); - }); - - it('should throw InvalidArgumentGrpcError error if ids are not specified', async () => { - request.getIdentityId.returns(null); - - try { - await getIdentityKeysHandler(call); - - expect.fail('should thrown InvalidArgumentGrpcError error'); - } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentGrpcError); - expect(e.getMessage()).to.equal('identity id is not specified'); - expect(fetchIdentityKeysMock).to.be.not.called(); - } - }); - - it('should throw error if driveStateRepository throws an error', async () => { - const message = 'Some error'; - const abciResponseError = new Error(message); - - fetchIdentityKeysMock.throws(abciResponseError); - - try { - await getIdentityKeysHandler(call); - - expect.fail('should throw error'); - } catch (e) { - expect(e).to.equal(abciResponseError); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityNonceHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityNonceHandlerFactory.spec.js new file mode 100644 index 00000000000..cf0029c533b --- /dev/null +++ b/packages/dapi/test/unit/grpcServer/handlers/platform/getIdentityNonceHandlerFactory.spec.js @@ -0,0 +1,110 @@ +const { + v0: { + GetIdentityNonceResponse, + Proof, + }, +} = require('@dashevo/dapi-grpc'); + +const getIdentityNonceHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getIdentityNonceHandlerFactory'); + +const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); + +describe('getIdentityNonceHandlerFactory', () => { + let call; + let driveStateRepositoryMock; + let getIdentityNonceHandler; + let nonce; + let proofFixture; + let proofMock; + let request; + let response; + let proofResponse; + + beforeEach(async function beforeEach() { + request = { + getProve: this.sinon.stub().returns(false), + }; + call = new GrpcCallMock(this.sinon, { + getV0: () => request, + }); + + proofFixture = { + merkleProof: Buffer.alloc(1, 1), + }; + + proofMock = new Proof(); + proofMock.setGrovedbProof(proofFixture.merkleProof); + + nonce = 1; + const { GetIdentityNonceResponseV0 } = GetIdentityNonceResponse; + response = new GetIdentityNonceResponse(); + response.setV0( + new GetIdentityNonceResponseV0() + .setIdentityNonce(1), + ); + + proofResponse = new GetIdentityNonceResponse(); + proofResponse.setV0( + new GetIdentityNonceResponseV0() + .setProof(proofMock), + ); + + driveStateRepositoryMock = { + fetchIdentityNonce: this.sinon.stub().resolves(response.serializeBinary()), + }; + + getIdentityNonceHandler = getIdentityNonceHandlerFactory( + driveStateRepositoryMock, + ); + }); + + it('should return valid result', async () => { + const result = await getIdentityNonceHandler(call); + + expect(result).to.be.an.instanceOf(GetIdentityNonceResponse); + expect(result.getV0() + .getIdentityNonce()).to.deep.equal(nonce); + expect(driveStateRepositoryMock.fetchIdentityNonce) + .to.be.calledOnceWith(call.request); + + const proof = result.getV0().getProof(); + expect(proof).to.be.undefined(); + }); + + it('should return proof', async () => { + request.getProve.returns(true); + + driveStateRepositoryMock.fetchIdentityNonce + .resolves(proofResponse.serializeBinary()); + + const result = await getIdentityNonceHandler(call); + + expect(result).to.be.an.instanceOf(GetIdentityNonceResponse); + + const proof = result.getV0().getProof(); + + expect(proof).to.be.an.instanceOf(Proof); + const merkleProof = proof.getGrovedbProof(); + + expect(merkleProof).to.deep.equal(proofFixture.merkleProof); + + expect(driveStateRepositoryMock.fetchIdentityNonce) + .to.be.calledOnceWith(call.request); + }); + + it('should throw an error when fetchIdentityNonce throws unknown error', async () => { + const error = new Error('Unknown error'); + + driveStateRepositoryMock.fetchIdentityNonce.throws(error); + + try { + await getIdentityNonceHandler(call); + + expect.fail('should throw an error'); + } catch (e) { + expect(e).to.equal(error); + expect(driveStateRepositoryMock.fetchIdentityNonce) + .to.be.calledOnceWith(call.request); + } + }); +}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getProofsHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getProofsHandlerFactory.spec.js deleted file mode 100644 index f701b3e5efb..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getProofsHandlerFactory.spec.js +++ /dev/null @@ -1,78 +0,0 @@ -const { - v0: { - GetProofsResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -const getProofsHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getProofsHandlerFactory'); - -const { - GetProofsResponseV0, -} = GetProofsResponse; - -describe('getProofsHandlerFactory', () => { - let call; - let getProofsHandler; - let driveClientMock; - let request; - let proofFixture; - let proofMock; - let response; - - beforeEach(async function beforeEach() { - request = { - getProve: this.sinon.stub().returns(true), - }; - - call = new GrpcCallMock(this.sinon, request); - - proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - response = new GetProofsResponse() - .setV0(new GetProofsResponseV0().setProof(proofMock)); - - driveClientMock = { - fetchProofs: this.sinon.stub().resolves(response.serializeBinary()), - }; - - getProofsHandler = getProofsHandlerFactory(driveClientMock); - }); - - it('should return proof', async () => { - const result = await getProofsHandler(call); - - expect(result).to.be.an.instanceOf(GetProofsResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(driveClientMock.fetchProofs).to.be.calledOnceWith(call.request); - }); - - it('should throw error if driveStateRepository throws an error', async () => { - const message = 'Some error'; - const abciResponseError = new Error(message); - - driveClientMock.fetchProofs.throws(abciResponseError); - - try { - await getProofsHandler(call); - - expect.fail('should throw error'); - } catch (e) { - expect(e).to.equal(abciResponseError); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getProtocolVersionUpgradeStateHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getProtocolVersionUpgradeStateHandlerFactory.spec.js deleted file mode 100644 index 4b545dbd7d5..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getProtocolVersionUpgradeStateHandlerFactory.spec.js +++ /dev/null @@ -1,116 +0,0 @@ -const { - v0: { - GetProtocolVersionUpgradeStateResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const getProtocolVersionUpgradeStateHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getProtocolVersionUpgradeStateHandlerFactory'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -describe('getProtocolVersionUpgradeStateHandlerFactory', () => { - let call; - let driveStateRepositoryMock; - let getProtocolVersionUpgradeStateHandler; - let versionNumber; - let voteCount; - let proofFixture; - let proofMock; - let request; - let response; - let proofResponse; - - beforeEach(async function beforeEach() { - request = { - getProve: this.sinon.stub().returns(false), - }; - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - versionNumber = 1; - voteCount = 1; - const { GetProtocolVersionUpgradeStateResponseV0 } = GetProtocolVersionUpgradeStateResponse; - const { Versions, VersionEntry } = GetProtocolVersionUpgradeStateResponseV0; - response = new GetProtocolVersionUpgradeStateResponse(); - response.setV0( - new GetProtocolVersionUpgradeStateResponseV0() - .setVersions(new Versions() - .setVersionsList([new VersionEntry() - .setVersionNumber(versionNumber) - .setVoteCount(voteCount)])), - ); - - proofResponse = new GetProtocolVersionUpgradeStateResponse(); - proofResponse.setV0( - new GetProtocolVersionUpgradeStateResponseV0() - .setProof(proofMock), - ); - - driveStateRepositoryMock = { - fetchVersionUpgradeState: this.sinon.stub().resolves(response.serializeBinary()), - }; - - getProtocolVersionUpgradeStateHandler = getProtocolVersionUpgradeStateHandlerFactory( - driveStateRepositoryMock, - ); - }); - - it('should return valid result', async () => { - const result = await getProtocolVersionUpgradeStateHandler(call); - - expect(result).to.be.an.instanceOf(GetProtocolVersionUpgradeStateResponse); - expect(result.getV0() - .getVersions().getVersionsList()[0].getVersionNumber()).to.deep.equal(versionNumber); - expect(driveStateRepositoryMock.fetchVersionUpgradeState) - .to.be.calledOnceWith(call.request); - - const proof = result.getV0().getProof(); - expect(proof).to.be.undefined(); - }); - - it('should return proof', async () => { - request.getProve.returns(true); - - driveStateRepositoryMock.fetchVersionUpgradeState - .resolves(proofResponse.serializeBinary()); - - const result = await getProtocolVersionUpgradeStateHandler(call); - - expect(result).to.be.an.instanceOf(GetProtocolVersionUpgradeStateResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(driveStateRepositoryMock.fetchVersionUpgradeState) - .to.be.calledOnceWith(call.request); - }); - - it('should throw an error when fetchVersionUpgradeState throws unknown error', async () => { - const error = new Error('Unknown error'); - - driveStateRepositoryMock.fetchVersionUpgradeState.throws(error); - - try { - await getProtocolVersionUpgradeStateHandler(call); - - expect.fail('should throw an error'); - } catch (e) { - expect(e).to.equal(error); - expect(driveStateRepositoryMock.fetchVersionUpgradeState) - .to.be.calledOnceWith(call.request); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/platform/getProtocolVersionUpgradeVoteStatusHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/platform/getProtocolVersionUpgradeVoteStatusHandlerFactory.spec.js deleted file mode 100644 index 2a0e09da6d5..00000000000 --- a/packages/dapi/test/unit/grpcServer/handlers/platform/getProtocolVersionUpgradeVoteStatusHandlerFactory.spec.js +++ /dev/null @@ -1,118 +0,0 @@ -const { - v0: { - GetProtocolVersionUpgradeVoteStatusResponse, - Proof, - }, -} = require('@dashevo/dapi-grpc'); - -const getProtocolVersionUpgradeVoteStatusHandlerFactory = require('../../../../../lib/grpcServer/handlers/platform/getProtocolVersionUpgradeVoteStatusHandlerFactory'); - -const GrpcCallMock = require('../../../../../lib/test/mock/GrpcCallMock'); - -describe('getProtocolVersionUpgradeVoteStatusHandlerFactory', () => { - let call; - let driveStateRepositoryMock; - let getProtocolVersionUpgradeVoteStatusHandler; - let proTxHash; - let version; - let proofFixture; - let proofMock; - let request; - let response; - let proofResponse; - - beforeEach(async function beforeEach() { - request = { - getProve: this.sinon.stub().returns(false), - }; - call = new GrpcCallMock(this.sinon, { - getV0: () => request, - }); - - proofFixture = { - merkleProof: Buffer.alloc(1, 1), - }; - - proofMock = new Proof(); - proofMock.setGrovedbProof(proofFixture.merkleProof); - - version = 1; - proTxHash = Buffer.alloc(32).fill(1); - const { - GetProtocolVersionUpgradeVoteStatusResponseV0, - } = GetProtocolVersionUpgradeVoteStatusResponse; - const { VersionSignals, VersionSignal } = GetProtocolVersionUpgradeVoteStatusResponseV0; - response = new GetProtocolVersionUpgradeVoteStatusResponse(); - response.setV0( - new GetProtocolVersionUpgradeVoteStatusResponseV0() - .setVersions(new VersionSignals() - .setVersionSignalsList([new VersionSignal() - .setProTxHash(proTxHash) - .setVersion(version)])), - ); - - proofResponse = new GetProtocolVersionUpgradeVoteStatusResponse(); - proofResponse.setV0( - new GetProtocolVersionUpgradeVoteStatusResponseV0() - .setProof(proofMock), - ); - - driveStateRepositoryMock = { - fetchVersionUpgradeVoteStatus: this.sinon.stub().resolves(response.serializeBinary()), - }; - - getProtocolVersionUpgradeVoteStatusHandler = getProtocolVersionUpgradeVoteStatusHandlerFactory( - driveStateRepositoryMock, - ); - }); - - it('should return valid result', async () => { - const result = await getProtocolVersionUpgradeVoteStatusHandler(call); - - expect(result).to.be.an.instanceOf(GetProtocolVersionUpgradeVoteStatusResponse); - expect(result.getV0() - .getVersions().getVersionSignalsList()[0].getProTxHash()).to.deep.equal(proTxHash); - expect(driveStateRepositoryMock.fetchVersionUpgradeVoteStatus) - .to.be.calledOnceWith(call.request); - - const proof = result.getV0().getProof(); - expect(proof).to.be.undefined(); - }); - - it('should return proof', async () => { - request.getProve.returns(true); - - driveStateRepositoryMock.fetchVersionUpgradeVoteStatus - .resolves(proofResponse.serializeBinary()); - - const result = await getProtocolVersionUpgradeVoteStatusHandler(call); - - expect(result).to.be.an.instanceOf(GetProtocolVersionUpgradeVoteStatusResponse); - - const proof = result.getV0().getProof(); - - expect(proof).to.be.an.instanceOf(Proof); - const merkleProof = proof.getGrovedbProof(); - - expect(merkleProof).to.deep.equal(proofFixture.merkleProof); - - expect(driveStateRepositoryMock.fetchVersionUpgradeVoteStatus) - .to.be.calledOnceWith(call.request); - }); - - it('should throw an error when fetchVersionUpgradeVoteStatus throws unknown error', async () => { - const error = new Error('Unknown error'); - - driveStateRepositoryMock.fetchVersionUpgradeVoteStatus.throws(error); - - try { - await getProtocolVersionUpgradeVoteStatusHandler(call); - - expect.fail('should throw an error'); - } catch (e) { - expect(e).to.equal(error); - expect(driveStateRepositoryMock.fetchVersionUpgradeVoteStatus) - .to.be.calledOnceWith(call.request); - } - }); -}); diff --git a/packages/dapi/test/unit/grpcServer/handlers/tx-filter-stream/subscribeToTransactionsWithProofsHandlerFactory.spec.js b/packages/dapi/test/unit/grpcServer/handlers/tx-filter-stream/subscribeToTransactionsWithProofsHandlerFactory.spec.js index c8705603bbc..523f2f8cf92 100644 --- a/packages/dapi/test/unit/grpcServer/handlers/tx-filter-stream/subscribeToTransactionsWithProofsHandlerFactory.spec.js +++ b/packages/dapi/test/unit/grpcServer/handlers/tx-filter-stream/subscribeToTransactionsWithProofsHandlerFactory.spec.js @@ -34,6 +34,7 @@ const subscribeToTransactionsWithProofsHandlerFactory = require( ); const ProcessMediator = require('../../../../../lib/transactionsFilter/ProcessMediator'); +const ChainDataProvider = require('../../../../../lib/chainDataProvider/ChainDataProvider'); use(sinonChai); use(chaiAsPromised); @@ -61,6 +62,8 @@ describe('subscribeToTransactionsWithProofsHandlerFactory', () => { let testTransactionAgainstFilterMock; let coreAPIMock; let getMemPoolTransactionsMock; + let chainDataProvider; + let zmqClientMock; beforeEach(function beforeEach() { const bloomFilterMessage = new BloomFilter(); @@ -93,12 +96,15 @@ describe('subscribeToTransactionsWithProofsHandlerFactory', () => { coreAPIMock = { getBlock: this.sinon.stub(), getBlockStats: this.sinon.stub(), - getBestBlockHeight: this.sinon.stub(), getBlockHash: this.sinon.stub(), }; getMemPoolTransactionsMock = this.sinon.stub().returns([]); + zmqClientMock = { on: this.sinon.stub(), topics: { hashblock: 'fake' } }; + + chainDataProvider = new ChainDataProvider(coreAPIMock, zmqClientMock); + subscribeToTransactionsWithProofsHandler = subscribeToTransactionsWithProofsHandlerFactory( getHistoricalTransactionsIteratorMock, subscribeToNewTransactionsMock, @@ -106,6 +112,7 @@ describe('subscribeToTransactionsWithProofsHandlerFactory', () => { testTransactionAgainstFilterMock, coreAPIMock, getMemPoolTransactionsMock, + chainDataProvider, ); this.sinon.spy(ProcessMediator.prototype, 'emit'); @@ -151,7 +158,7 @@ describe('subscribeToTransactionsWithProofsHandlerFactory', () => { call.request = TransactionsWithProofsRequest.deserializeBinary(call.request.serializeBinary()); coreAPIMock.getBlockStats.resolves({ height: 1 }); - coreAPIMock.getBestBlockHeight.resolves(10); + chainDataProvider.chainHeight = 10; try { await subscribeToTransactionsWithProofsHandler(call); @@ -184,7 +191,7 @@ describe('subscribeToTransactionsWithProofsHandlerFactory', () => { call = new GrpcCallMock(this.sinon, call.request); coreAPIMock.getBlockStats.resolves({ height: 1 }); - coreAPIMock.getBestBlockHeight.resolves(10); + chainDataProvider.chainHeight = 10; historicalTxData.push({ merkleBlock: { diff --git a/packages/dapi/test/unit/rpcServer/commands/generateToAddress.spec.js b/packages/dapi/test/unit/rpcServer/commands/generateToAddress.spec.js deleted file mode 100644 index 9b6bfcb6b86..00000000000 --- a/packages/dapi/test/unit/rpcServer/commands/generateToAddress.spec.js +++ /dev/null @@ -1,65 +0,0 @@ -const chai = require('chai'); -const sinon = require('sinon'); -const chaiAsPromised = require('chai-as-promised'); -const generateToAddressFactory = require('../../../../lib/rpcServer/commands/generateToAddress'); -const coreAPIFixture = require('../../../mocks/coreAPIFixture'); - -const { expect } = chai; -chai.use(chaiAsPromised); -let spy; - -describe('generateToAddress', () => { - describe('#factory', () => { - it('should return a function', () => { - const generate = generateToAddressFactory(coreAPIFixture); - expect(generate).to.be.a('function'); - }); - }); - - before(() => { - spy = sinon.spy(coreAPIFixture, 'generateToAddress'); - }); - - beforeEach(() => { - spy.resetHistory(); - }); - - after(() => { - spy.restore(); - }); - - it('Should return an array of block hashes', async () => { - const generateToAddress = generateToAddressFactory(coreAPIFixture); - - expect(spy.callCount).to.be.equal(0); - - const blockHashes = await generateToAddress({ blocksNumber: 10, address: '123456' }); - - expect(blockHashes).to.be.an('array'); - expect(blockHashes.length).to.be.equal(10); - expect(spy.callCount).to.be.equal(1); - }); - - it('Should throw an error if arguments are not valid', async () => { - const generateToAddress = generateToAddressFactory(coreAPIFixture); - expect(spy.callCount).to.be.equal(0); - - await expect(generateToAddress({ blocksNumber: -1, address: '123' })).to.be.rejectedWith('must be >= 1'); - expect(spy.callCount).to.be.equal(0); - - await expect(generateToAddress({ blocksNumber: 0.5, address: '123' })).to.be.rejectedWith('must be integer'); - expect(spy.callCount).to.be.equal(0); - - await expect(generateToAddress({})).to.be.rejectedWith('must have required property'); - expect(spy.callCount).to.be.equal(0); - - await expect(generateToAddress()).to.be.rejectedWith('must be object'); - expect(spy.callCount).to.be.equal(0); - - await expect(generateToAddress({ blocksNumber: 'string', address: '123' })).to.be.rejectedWith('must be integer'); - expect(spy.callCount).to.be.equal(0); - - await expect(generateToAddress({ blocksNumber: 1, address: 1 })).to.be.rejectedWith('must be string'); - expect(spy.callCount).to.be.equal(0); - }); -}); diff --git a/packages/dapi/test/unit/rpcServer/commands/getBestBlockHash.spec.js b/packages/dapi/test/unit/rpcServer/commands/getBestBlockHash.spec.js index 23dc36b268a..3c6e5572120 100644 --- a/packages/dapi/test/unit/rpcServer/commands/getBestBlockHash.spec.js +++ b/packages/dapi/test/unit/rpcServer/commands/getBestBlockHash.spec.js @@ -1,38 +1,32 @@ const chai = require('chai'); const chaiAsPromised = require('chai-as-promised'); -const sinon = require('sinon'); const getBestBlockHashFactory = require('../../../../lib/rpcServer/commands/getBestBlockHash'); -const coreAPIFixture = require('../../../mocks/coreAPIFixture'); chai.use(chaiAsPromised); + const { expect } = chai; -let spy; describe('getBestBlockHash', () => { - describe('#factory', () => { - it('should return a function', () => { - const getBestBlockHash = getBestBlockHashFactory(coreAPIFixture); - expect(getBestBlockHash).to.be.a('function'); - }); - }); + let getBestBlockHash; + let coreRPCClientMock; + let zmqClientMock; + let blockHash; - before(() => { - spy = sinon.spy(coreAPIFixture, 'getBestBlockHash'); - }); + beforeEach(function beforeEach() { + blockHash = '000000000074fc08fb6a92cb8994b14307038261e4266abc6994fa03955a1a59'; - beforeEach(() => { - spy.resetHistory(); - }); + coreRPCClientMock = { + getBestBlockHash: this.sinon.stub().resolves(blockHash), + }; + + zmqClientMock = { on: this.sinon.stub(), topics: { hashblock: 'fake' } }; - after(() => { - spy.restore(); + getBestBlockHash = getBestBlockHashFactory(coreRPCClientMock, zmqClientMock); }); it('Should return a number', async () => { - const getBestBlockHash = getBestBlockHashFactory(coreAPIFixture); - expect(spy.callCount).to.be.equal(0); const bestBlockHash = await getBestBlockHash(); - expect(bestBlockHash).to.be.an('string'); - expect(spy.callCount).to.be.equal(1); + expect(bestBlockHash).to.equals(blockHash); + expect(coreRPCClientMock.getBestBlockHash).to.be.calledOnce(); }); }); diff --git a/packages/dapi/test/unit/rpcServer/commands/getMnListDiff.spec.js b/packages/dapi/test/unit/rpcServer/commands/getMnListDiff.spec.js deleted file mode 100644 index d757928b4d0..00000000000 --- a/packages/dapi/test/unit/rpcServer/commands/getMnListDiff.spec.js +++ /dev/null @@ -1,50 +0,0 @@ -const chai = require('chai'); -const chaiAsPromised = require('chai-as-promised'); -const sinon = require('sinon'); -const getMNListDiffFactory = require('../../../../lib/rpcServer/commands/getMnListDiff'); -const coreAPIFixture = require('../../../mocks/coreAPIFixture'); - -chai.use(chaiAsPromised); -const { expect } = chai; -let spy; -let baseBlockHash; -let blockHash; - -describe('getMNListDiff', () => { - describe('#factory', () => { - it('should return a function', () => { - const getMNListDiff = getMNListDiffFactory(coreAPIFixture); - expect(getMNListDiff).to.be.a('function'); - }); - }); - - before(() => { - spy = sinon.spy(coreAPIFixture, 'getMnListDiff'); - }); - - beforeEach(() => { - spy.resetHistory(); - - baseBlockHash = '0000000000000000000000000000000000000000000000000000000000000000'; - blockHash = '0000000000000000000000000000000000000000000000000000000000000000'; - }); - - after(() => { - spy.restore(); - }); - - it('Should return a masternode list difference list object', async () => { - const getMNListDiff = getMNListDiffFactory(coreAPIFixture); - expect(spy.callCount).to.be.equal(0); - - const mnDiffList = await getMNListDiff({ baseBlockHash, blockHash }); - expect(mnDiffList).to.be.an('object'); - expect(mnDiffList.baseBlockHash.length).to.equal(64); - expect(mnDiffList.blockHash.length).to.equal(64); - expect(mnDiffList.merkleRootMNList.length).to.equal(64); - expect(mnDiffList.deletedMNs).to.be.an('Array'); - expect(mnDiffList.mnList).to.be.an('Array'); - - expect(spy.callCount).to.be.equal(1); - }); -}); diff --git a/packages/dapi/test/unit/transactionsFilter/getHistoricalTransactionsIteratorFactory.spec.js b/packages/dapi/test/unit/transactionsFilter/getHistoricalTransactionsIteratorFactory.spec.js index dcd237701f1..0630a359655 100644 --- a/packages/dapi/test/unit/transactionsFilter/getHistoricalTransactionsIteratorFactory.spec.js +++ b/packages/dapi/test/unit/transactionsFilter/getHistoricalTransactionsIteratorFactory.spec.js @@ -65,7 +65,7 @@ describe('getHistoricalTransactionsIteratorFactory', () => { }; coreRpcMock = { getMerkleBlocks: sinon.stub(), - getRawTransaction: sinon.stub(), + getRawTransactionMulti: sinon.stub(), getBlock: sinon.stub(), getBlockStats: sinon.stub(), getBlockHash: sinon.stub(), @@ -74,15 +74,18 @@ describe('getHistoricalTransactionsIteratorFactory', () => { .withArgs() .resolves([rawMerkleBlock]); - coreRpcMock.getRawTransaction - .withArgs('cd75b421157eca03eff664bdc165730f91ef2fa52df19ff415ab5acb30045425') - .resolves('020000000a1b8972f91733804588910d466c0e77cfa65afad2a025a106a82ec6e32d617760050000006b483045022100a576b4e5bf5db550c95ae3d4c56773cdf3e7c632b0c52b6daf70fbcc37a405b502201e091da13954d861040ce382b51c50384ed12095308e0b5d92892361f7e94379812103d57433a7d82e48cd246ef29b9098b24dcf7eebc565586ab26e2bafe5b4d25750ffffffff0df9aeac7e6feeac4a935df9a0220dc498a0fc95a798bcb63a5ab58e5e8e5b6e0d0000006b4830450221008409d69f155c250eb0b4e6a0cf6dca3eb4910c3fd00c1ff245b4c9cc5f319a6b02206985a6d417e707d2d64a19225882c090e4527ec216e219f5ebea8e24bb7278038121036ac21c340c9041eb634f05ab5b6523514bc24784f132b945eef9fd148d616a2dffffffff00b4819721a0e85781c32d65d0f19b3884d7b8d3fe4f0ea3f9c1ea99087e297d010000006a47304402203cc336d6e6dd9a4986eea95dc9b5c7059949503ab227adc7425a6815ab4b9a0102202325b9d275bd4d7ed533d7974f73efae7ad27227f785ec95741e246444e82f978121033c5d60a3ecb98a3cb2214da030e8c28ecaae4663a7f389988c03b123ac0520cbffffffff85d4b234e8da90562da99f35e32cfc0ac93b8d8f041a6701c5e2e82619a9288b0e0000006b483045022100b0c50f44d12831d0f81ce28f498fbd51870b358dacafdc1764f09b021d2c72dd0220511845b6202274950a6a55c4023745f40991463e82a96851f1caec00b5a8a08c812102274dcc3b3e116ad930197f445554c0f3a7514e754c2672555fba335ec69cc5a3ffffffff8c46e46c9a44c4e3998caae7ff9fed881d4e91093fceb61fc33ddc0d5a1b919f040000006a47304402204dcb8938cdf74e80a87c69fa0da61988a12d73ed3495360d5a2d15a441f5e441022033f6b881ad83b10c6affb86a7d562ad421308693e457826e47fa25e57e51f249812103353ec1efb7ebe7aac6fa8431370613bc96d1b1b6cfef8706d7c3e10191fb947fffffffffc9a1d3293ec8604027ee6e1deec58924efacc896009c8b85003b6269553cf5b1010000006a473044022038af9647a90b082d49fa8471dd14a1955b5f1a8984d50dfe08b960b5c8206d440220076d9cf76adf5f86bc8dac5e84c6c14dc6f4a8605ad4832bd305fdc55b8f871b81210294a545f4bf055ee5e4b52bc98b40273ebe7ce172f70d75e48cafcbaaa43d0168ffffffff9d964428902aeb56acfc268b27ab828dc356597ff96c7b789062a1b90cbdf8be020000006b483045022100dce2c3c2bf6ed6b3d2d6eb55d530881b37fca13d08812accd9ed79c76eed75ed02206b0806366fabe8f70c9b1e08f7359861aea480a9a2dd2e3b15145ef06d46d7ed812102faaf13ed5f32f439bfbc5a9d6b5fa392eaace8c596d6b608fd48e1e40b697c90fffffffffc17a363992de5501cb6969b9e835fb333494382990ab319b0343c9d38218abf030000006a473044022012c80bec0b961cf7f8286ac525492a27dc09de299b59e6c294088eb04bb4a1d0022001cc1a8e1bf796f8a4a1e9fd1098e3dbc6bf949be7b4b8424388e3c83792188e812103905c6ad7c04f4594d135d26d980a9c2e16b50946886731b51ed61a9bdd49900bffffffff1892cd6c3038df794331ce437f8060cc2398a3744ec0f7488d4816e43b714ad6050000006a473044022044f3946ba17f87bffcf3fd4c5cfc43c530b97d4a97e3a258372f2074029cf4e802204d22e1afac51ef05c706afc43693b75542f2a82ef89b5026189135e0b1b54f44812102a37654d73b59ab13140a5adfdb79698fe23f6f05c5bb881704b3de2435161e1cffffffff66d6108688b82371210a987b1e22e9aa69a17c98803cc2f4e20e9957552053ea050000006b483045022100d4c315756462c0be66c786617fa8054fb266b5f6c7214cbc7cb00a41869bd26c022001288863647ece1a75718abd9bce8519b99a3e4509ef5554d8a92a633da525588121025ef06ce1ef91f2e535188d8c9ce1863f9ae6d37df8f143e6f558395f849fccb5ffffffff0ae4969800000000001976a91435b4e7ccf37e7933e2b9494f840b792b234e227388ace4969800000000001976a9144accca5ad3fa16538449b20ab51734dbdc9ef22288ace4969800000000001976a9145ac4de0775a027d0f0ec54e4c3d55fe57229fc4e88ace4969800000000001976a9147d224284b61bb5c3c0a8f32324052efd4781e28b88ace4969800000000001976a914900be7732a34e46d00dbaace243f65486448f8e388ace4969800000000001976a914a16dece64baadfec54d6ca0bf77f7380a66150c388ace4969800000000001976a914cc0822f608a13008b559d9536e69251f71e1096e88ace4969800000000001976a914f43dc02e4228e32df7c9d04fe3a59f69be05da6788ace4969800000000001976a914fe70994bce368c86578ae95845e1be7a908df06388ace4969800000000001976a914ff2f09b4f1e2f6e48b1e2a470ca1db3fe20baf6988ac00000000') - .withArgs('2ef9795147caaeecee5bc2520704bb372cde06dbd2e871750f31336fd3f02be3') - .resolves('020000000a1b8972f91733804588910d466c0e77cfa65afad2a025a106a82ec6e32d617760050000006b483045022100a576b4e5bf5db550c95ae3d4c56773cdf3e7c632b0c52b6daf70fbcc37a405b502201e091da13954d861040ce382b51c50384ed12095308e0b5d92892361f7e94379812103d57433a7d82e48cd246ef29b9098b24dcf7eebc565586ab26e2bafe5b4d25750ffffffff0df9aeac7e6feeac4a935df9a0220dc498a0fc95a798bcb63a5ab58e5e8e5b6e0d0000006b4830450221008409d69f155c250eb0b4e6a0cf6dca3eb4910c3fd00c1ff245b4c9cc5f319a6b02206985a6d417e707d2d64a19225882c090e4527ec216e219f5ebea8e24bb7278038121036ac21c340c9041eb634f05ab5b6523514bc24784f132b945eef9fd148d616a2dffffffff00b4819721a0e85781c32d65d0f19b3884d7b8d3fe4f0ea3f9c1ea99087e297d010000006a47304402203cc336d6e6dd9a4986eea95dc9b5c7059949503ab227adc7425a6815ab4b9a0102202325b9d275bd4d7ed533d7974f73efae7ad27227f785ec95741e246444e82f978121033c5d60a3ecb98a3cb2214da030e8c28ecaae4663a7f389988c03b123ac0520cbffffffff85d4b234e8da90562da99f35e32cfc0ac93b8d8f041a6701c5e2e82619a9288b0e0000006b483045022100b0c50f44d12831d0f81ce28f498fbd51870b358dacafdc1764f09b021d2c72dd0220511845b6202274950a6a55c4023745f40991463e82a96851f1caec00b5a8a08c812102274dcc3b3e116ad930197f445554c0f3a7514e754c2672555fba335ec69cc5a3ffffffff8c46e46c9a44c4e3998caae7ff9fed881d4e91093fceb61fc33ddc0d5a1b919f040000006a47304402204dcb8938cdf74e80a87c69fa0da61988a12d73ed3495360d5a2d15a441f5e441022033f6b881ad83b10c6affb86a7d562ad421308693e457826e47fa25e57e51f249812103353ec1efb7ebe7aac6fa8431370613bc96d1b1b6cfef8706d7c3e10191fb947fffffffffc9a1d3293ec8604027ee6e1deec58924efacc896009c8b85003b6269553cf5b1010000006a473044022038af9647a90b082d49fa8471dd14a1955b5f1a8984d50dfe08b960b5c8206d440220076d9cf76adf5f86bc8dac5e84c6c14dc6f4a8605ad4832bd305fdc55b8f871b81210294a545f4bf055ee5e4b52bc98b40273ebe7ce172f70d75e48cafcbaaa43d0168ffffffff9d964428902aeb56acfc268b27ab828dc356597ff96c7b789062a1b90cbdf8be020000006b483045022100dce2c3c2bf6ed6b3d2d6eb55d530881b37fca13d08812accd9ed79c76eed75ed02206b0806366fabe8f70c9b1e08f7359861aea480a9a2dd2e3b15145ef06d46d7ed812102faaf13ed5f32f439bfbc5a9d6b5fa392eaace8c596d6b608fd48e1e40b697c90fffffffffc17a363992de5501cb6969b9e835fb333494382990ab319b0343c9d38218abf030000006a473044022012c80bec0b961cf7f8286ac525492a27dc09de299b59e6c294088eb04bb4a1d0022001cc1a8e1bf796f8a4a1e9fd1098e3dbc6bf949be7b4b8424388e3c83792188e812103905c6ad7c04f4594d135d26d980a9c2e16b50946886731b51ed61a9bdd49900bffffffff1892cd6c3038df794331ce437f8060cc2398a3744ec0f7488d4816e43b714ad6050000006a473044022044f3946ba17f87bffcf3fd4c5cfc43c530b97d4a97e3a258372f2074029cf4e802204d22e1afac51ef05c706afc43693b75542f2a82ef89b5026189135e0b1b54f44812102a37654d73b59ab13140a5adfdb79698fe23f6f05c5bb881704b3de2435161e1cffffffff66d6108688b82371210a987b1e22e9aa69a17c98803cc2f4e20e9957552053ea050000006b483045022100d4c315756462c0be66c786617fa8054fb266b5f6c7214cbc7cb00a41869bd26c022001288863647ece1a75718abd9bce8519b99a3e4509ef5554d8a92a633da525588121025ef06ce1ef91f2e535188d8c9ce1863f9ae6d37df8f143e6f558395f849fccb5ffffffff0ae4969800000000001976a91435b4e7ccf37e7933e2b9494f840b792b234e227388ace4969800000000001976a9144accca5ad3fa16538449b20ab51734dbdc9ef22288ace4969800000000001976a9145ac4de0775a027d0f0ec54e4c3d55fe57229fc4e88ace4969800000000001976a9147d224284b61bb5c3c0a8f32324052efd4781e28b88ace4969800000000001976a914900be7732a34e46d00dbaace243f65486448f8e388ace4969800000000001976a914a16dece64baadfec54d6ca0bf77f7380a66150c388ace4969800000000001976a914cc0822f608a13008b559d9536e69251f71e1096e88ace4969800000000001976a914f43dc02e4228e32df7c9d04fe3a59f69be05da6788ace4969800000000001976a914fe70994bce368c86578ae95845e1be7a908df06388ace4969800000000001976a914ff2f09b4f1e2f6e48b1e2a470ca1db3fe20baf6988ac00000000') - .withArgs('2241d3448560f8b1d3a07ea5c31e79eb595632984a20f50944809a61fdd9fe0b') - .resolves('020000000a1b8972f91733804588910d466c0e77cfa65afad2a025a106a82ec6e32d617760050000006b483045022100a576b4e5bf5db550c95ae3d4c56773cdf3e7c632b0c52b6daf70fbcc37a405b502201e091da13954d861040ce382b51c50384ed12095308e0b5d92892361f7e94379812103d57433a7d82e48cd246ef29b9098b24dcf7eebc565586ab26e2bafe5b4d25750ffffffff0df9aeac7e6feeac4a935df9a0220dc498a0fc95a798bcb63a5ab58e5e8e5b6e0d0000006b4830450221008409d69f155c250eb0b4e6a0cf6dca3eb4910c3fd00c1ff245b4c9cc5f319a6b02206985a6d417e707d2d64a19225882c090e4527ec216e219f5ebea8e24bb7278038121036ac21c340c9041eb634f05ab5b6523514bc24784f132b945eef9fd148d616a2dffffffff00b4819721a0e85781c32d65d0f19b3884d7b8d3fe4f0ea3f9c1ea99087e297d010000006a47304402203cc336d6e6dd9a4986eea95dc9b5c7059949503ab227adc7425a6815ab4b9a0102202325b9d275bd4d7ed533d7974f73efae7ad27227f785ec95741e246444e82f978121033c5d60a3ecb98a3cb2214da030e8c28ecaae4663a7f389988c03b123ac0520cbffffffff85d4b234e8da90562da99f35e32cfc0ac93b8d8f041a6701c5e2e82619a9288b0e0000006b483045022100b0c50f44d12831d0f81ce28f498fbd51870b358dacafdc1764f09b021d2c72dd0220511845b6202274950a6a55c4023745f40991463e82a96851f1caec00b5a8a08c812102274dcc3b3e116ad930197f445554c0f3a7514e754c2672555fba335ec69cc5a3ffffffff8c46e46c9a44c4e3998caae7ff9fed881d4e91093fceb61fc33ddc0d5a1b919f040000006a47304402204dcb8938cdf74e80a87c69fa0da61988a12d73ed3495360d5a2d15a441f5e441022033f6b881ad83b10c6affb86a7d562ad421308693e457826e47fa25e57e51f249812103353ec1efb7ebe7aac6fa8431370613bc96d1b1b6cfef8706d7c3e10191fb947fffffffffc9a1d3293ec8604027ee6e1deec58924efacc896009c8b85003b6269553cf5b1010000006a473044022038af9647a90b082d49fa8471dd14a1955b5f1a8984d50dfe08b960b5c8206d440220076d9cf76adf5f86bc8dac5e84c6c14dc6f4a8605ad4832bd305fdc55b8f871b81210294a545f4bf055ee5e4b52bc98b40273ebe7ce172f70d75e48cafcbaaa43d0168ffffffff9d964428902aeb56acfc268b27ab828dc356597ff96c7b789062a1b90cbdf8be020000006b483045022100dce2c3c2bf6ed6b3d2d6eb55d530881b37fca13d08812accd9ed79c76eed75ed02206b0806366fabe8f70c9b1e08f7359861aea480a9a2dd2e3b15145ef06d46d7ed812102faaf13ed5f32f439bfbc5a9d6b5fa392eaace8c596d6b608fd48e1e40b697c90fffffffffc17a363992de5501cb6969b9e835fb333494382990ab319b0343c9d38218abf030000006a473044022012c80bec0b961cf7f8286ac525492a27dc09de299b59e6c294088eb04bb4a1d0022001cc1a8e1bf796f8a4a1e9fd1098e3dbc6bf949be7b4b8424388e3c83792188e812103905c6ad7c04f4594d135d26d980a9c2e16b50946886731b51ed61a9bdd49900bffffffff1892cd6c3038df794331ce437f8060cc2398a3744ec0f7488d4816e43b714ad6050000006a473044022044f3946ba17f87bffcf3fd4c5cfc43c530b97d4a97e3a258372f2074029cf4e802204d22e1afac51ef05c706afc43693b75542f2a82ef89b5026189135e0b1b54f44812102a37654d73b59ab13140a5adfdb79698fe23f6f05c5bb881704b3de2435161e1cffffffff66d6108688b82371210a987b1e22e9aa69a17c98803cc2f4e20e9957552053ea050000006b483045022100d4c315756462c0be66c786617fa8054fb266b5f6c7214cbc7cb00a41869bd26c022001288863647ece1a75718abd9bce8519b99a3e4509ef5554d8a92a633da525588121025ef06ce1ef91f2e535188d8c9ce1863f9ae6d37df8f143e6f558395f849fccb5ffffffff0ae4969800000000001976a91435b4e7ccf37e7933e2b9494f840b792b234e227388ace4969800000000001976a9144accca5ad3fa16538449b20ab51734dbdc9ef22288ace4969800000000001976a9145ac4de0775a027d0f0ec54e4c3d55fe57229fc4e88ace4969800000000001976a9147d224284b61bb5c3c0a8f32324052efd4781e28b88ace4969800000000001976a914900be7732a34e46d00dbaace243f65486448f8e388ace4969800000000001976a914a16dece64baadfec54d6ca0bf77f7380a66150c388ace4969800000000001976a914cc0822f608a13008b559d9536e69251f71e1096e88ace4969800000000001976a914f43dc02e4228e32df7c9d04fe3a59f69be05da6788ace4969800000000001976a914fe70994bce368c86578ae95845e1be7a908df06388ace4969800000000001976a914ff2f09b4f1e2f6e48b1e2a470ca1db3fe20baf6988ac00000000') - .withArgs('45afbfe270014d5593cb065562f1fed726f767fe334d8b3f4379025cfa5be8c5') - .resolves('020000000a1b8972f91733804588910d466c0e77cfa65afad2a025a106a82ec6e32d617760050000006b483045022100a576b4e5bf5db550c95ae3d4c56773cdf3e7c632b0c52b6daf70fbcc37a405b502201e091da13954d861040ce382b51c50384ed12095308e0b5d92892361f7e94379812103d57433a7d82e48cd246ef29b9098b24dcf7eebc565586ab26e2bafe5b4d25750ffffffff0df9aeac7e6feeac4a935df9a0220dc498a0fc95a798bcb63a5ab58e5e8e5b6e0d0000006b4830450221008409d69f155c250eb0b4e6a0cf6dca3eb4910c3fd00c1ff245b4c9cc5f319a6b02206985a6d417e707d2d64a19225882c090e4527ec216e219f5ebea8e24bb7278038121036ac21c340c9041eb634f05ab5b6523514bc24784f132b945eef9fd148d616a2dffffffff00b4819721a0e85781c32d65d0f19b3884d7b8d3fe4f0ea3f9c1ea99087e297d010000006a47304402203cc336d6e6dd9a4986eea95dc9b5c7059949503ab227adc7425a6815ab4b9a0102202325b9d275bd4d7ed533d7974f73efae7ad27227f785ec95741e246444e82f978121033c5d60a3ecb98a3cb2214da030e8c28ecaae4663a7f389988c03b123ac0520cbffffffff85d4b234e8da90562da99f35e32cfc0ac93b8d8f041a6701c5e2e82619a9288b0e0000006b483045022100b0c50f44d12831d0f81ce28f498fbd51870b358dacafdc1764f09b021d2c72dd0220511845b6202274950a6a55c4023745f40991463e82a96851f1caec00b5a8a08c812102274dcc3b3e116ad930197f445554c0f3a7514e754c2672555fba335ec69cc5a3ffffffff8c46e46c9a44c4e3998caae7ff9fed881d4e91093fceb61fc33ddc0d5a1b919f040000006a47304402204dcb8938cdf74e80a87c69fa0da61988a12d73ed3495360d5a2d15a441f5e441022033f6b881ad83b10c6affb86a7d562ad421308693e457826e47fa25e57e51f249812103353ec1efb7ebe7aac6fa8431370613bc96d1b1b6cfef8706d7c3e10191fb947fffffffffc9a1d3293ec8604027ee6e1deec58924efacc896009c8b85003b6269553cf5b1010000006a473044022038af9647a90b082d49fa8471dd14a1955b5f1a8984d50dfe08b960b5c8206d440220076d9cf76adf5f86bc8dac5e84c6c14dc6f4a8605ad4832bd305fdc55b8f871b81210294a545f4bf055ee5e4b52bc98b40273ebe7ce172f70d75e48cafcbaaa43d0168ffffffff9d964428902aeb56acfc268b27ab828dc356597ff96c7b789062a1b90cbdf8be020000006b483045022100dce2c3c2bf6ed6b3d2d6eb55d530881b37fca13d08812accd9ed79c76eed75ed02206b0806366fabe8f70c9b1e08f7359861aea480a9a2dd2e3b15145ef06d46d7ed812102faaf13ed5f32f439bfbc5a9d6b5fa392eaace8c596d6b608fd48e1e40b697c90fffffffffc17a363992de5501cb6969b9e835fb333494382990ab319b0343c9d38218abf030000006a473044022012c80bec0b961cf7f8286ac525492a27dc09de299b59e6c294088eb04bb4a1d0022001cc1a8e1bf796f8a4a1e9fd1098e3dbc6bf949be7b4b8424388e3c83792188e812103905c6ad7c04f4594d135d26d980a9c2e16b50946886731b51ed61a9bdd49900bffffffff1892cd6c3038df794331ce437f8060cc2398a3744ec0f7488d4816e43b714ad6050000006a473044022044f3946ba17f87bffcf3fd4c5cfc43c530b97d4a97e3a258372f2074029cf4e802204d22e1afac51ef05c706afc43693b75542f2a82ef89b5026189135e0b1b54f44812102a37654d73b59ab13140a5adfdb79698fe23f6f05c5bb881704b3de2435161e1cffffffff66d6108688b82371210a987b1e22e9aa69a17c98803cc2f4e20e9957552053ea050000006b483045022100d4c315756462c0be66c786617fa8054fb266b5f6c7214cbc7cb00a41869bd26c022001288863647ece1a75718abd9bce8519b99a3e4509ef5554d8a92a633da525588121025ef06ce1ef91f2e535188d8c9ce1863f9ae6d37df8f143e6f558395f849fccb5ffffffff0ae4969800000000001976a91435b4e7ccf37e7933e2b9494f840b792b234e227388ace4969800000000001976a9144accca5ad3fa16538449b20ab51734dbdc9ef22288ace4969800000000001976a9145ac4de0775a027d0f0ec54e4c3d55fe57229fc4e88ace4969800000000001976a9147d224284b61bb5c3c0a8f32324052efd4781e28b88ace4969800000000001976a914900be7732a34e46d00dbaace243f65486448f8e388ace4969800000000001976a914a16dece64baadfec54d6ca0bf77f7380a66150c388ace4969800000000001976a914cc0822f608a13008b559d9536e69251f71e1096e88ace4969800000000001976a914f43dc02e4228e32df7c9d04fe3a59f69be05da6788ace4969800000000001976a914fe70994bce368c86578ae95845e1be7a908df06388ace4969800000000001976a914ff2f09b4f1e2f6e48b1e2a470ca1db3fe20baf6988ac00000000'); + const txs = { + cd75b421157eca03eff664bdc165730f91ef2fa52df19ff415ab5acb30045425: '020000000a1b8972f91733804588910d466c0e77cfa65afad2a025a106a82ec6e32d617760050000006b483045022100a576b4e5bf5db550c95ae3d4c56773cdf3e7c632b0c52b6daf70fbcc37a405b502201e091da13954d861040ce382b51c50384ed12095308e0b5d92892361f7e94379812103d57433a7d82e48cd246ef29b9098b24dcf7eebc565586ab26e2bafe5b4d25750ffffffff0df9aeac7e6feeac4a935df9a0220dc498a0fc95a798bcb63a5ab58e5e8e5b6e0d0000006b4830450221008409d69f155c250eb0b4e6a0cf6dca3eb4910c3fd00c1ff245b4c9cc5f319a6b02206985a6d417e707d2d64a19225882c090e4527ec216e219f5ebea8e24bb7278038121036ac21c340c9041eb634f05ab5b6523514bc24784f132b945eef9fd148d616a2dffffffff00b4819721a0e85781c32d65d0f19b3884d7b8d3fe4f0ea3f9c1ea99087e297d010000006a47304402203cc336d6e6dd9a4986eea95dc9b5c7059949503ab227adc7425a6815ab4b9a0102202325b9d275bd4d7ed533d7974f73efae7ad27227f785ec95741e246444e82f978121033c5d60a3ecb98a3cb2214da030e8c28ecaae4663a7f389988c03b123ac0520cbffffffff85d4b234e8da90562da99f35e32cfc0ac93b8d8f041a6701c5e2e82619a9288b0e0000006b483045022100b0c50f44d12831d0f81ce28f498fbd51870b358dacafdc1764f09b021d2c72dd0220511845b6202274950a6a55c4023745f40991463e82a96851f1caec00b5a8a08c812102274dcc3b3e116ad930197f445554c0f3a7514e754c2672555fba335ec69cc5a3ffffffff8c46e46c9a44c4e3998caae7ff9fed881d4e91093fceb61fc33ddc0d5a1b919f040000006a47304402204dcb8938cdf74e80a87c69fa0da61988a12d73ed3495360d5a2d15a441f5e441022033f6b881ad83b10c6affb86a7d562ad421308693e457826e47fa25e57e51f249812103353ec1efb7ebe7aac6fa8431370613bc96d1b1b6cfef8706d7c3e10191fb947fffffffffc9a1d3293ec8604027ee6e1deec58924efacc896009c8b85003b6269553cf5b1010000006a473044022038af9647a90b082d49fa8471dd14a1955b5f1a8984d50dfe08b960b5c8206d440220076d9cf76adf5f86bc8dac5e84c6c14dc6f4a8605ad4832bd305fdc55b8f871b81210294a545f4bf055ee5e4b52bc98b40273ebe7ce172f70d75e48cafcbaaa43d0168ffffffff9d964428902aeb56acfc268b27ab828dc356597ff96c7b789062a1b90cbdf8be020000006b483045022100dce2c3c2bf6ed6b3d2d6eb55d530881b37fca13d08812accd9ed79c76eed75ed02206b0806366fabe8f70c9b1e08f7359861aea480a9a2dd2e3b15145ef06d46d7ed812102faaf13ed5f32f439bfbc5a9d6b5fa392eaace8c596d6b608fd48e1e40b697c90fffffffffc17a363992de5501cb6969b9e835fb333494382990ab319b0343c9d38218abf030000006a473044022012c80bec0b961cf7f8286ac525492a27dc09de299b59e6c294088eb04bb4a1d0022001cc1a8e1bf796f8a4a1e9fd1098e3dbc6bf949be7b4b8424388e3c83792188e812103905c6ad7c04f4594d135d26d980a9c2e16b50946886731b51ed61a9bdd49900bffffffff1892cd6c3038df794331ce437f8060cc2398a3744ec0f7488d4816e43b714ad6050000006a473044022044f3946ba17f87bffcf3fd4c5cfc43c530b97d4a97e3a258372f2074029cf4e802204d22e1afac51ef05c706afc43693b75542f2a82ef89b5026189135e0b1b54f44812102a37654d73b59ab13140a5adfdb79698fe23f6f05c5bb881704b3de2435161e1cffffffff66d6108688b82371210a987b1e22e9aa69a17c98803cc2f4e20e9957552053ea050000006b483045022100d4c315756462c0be66c786617fa8054fb266b5f6c7214cbc7cb00a41869bd26c022001288863647ece1a75718abd9bce8519b99a3e4509ef5554d8a92a633da525588121025ef06ce1ef91f2e535188d8c9ce1863f9ae6d37df8f143e6f558395f849fccb5ffffffff0ae4969800000000001976a91435b4e7ccf37e7933e2b9494f840b792b234e227388ace4969800000000001976a9144accca5ad3fa16538449b20ab51734dbdc9ef22288ace4969800000000001976a9145ac4de0775a027d0f0ec54e4c3d55fe57229fc4e88ace4969800000000001976a9147d224284b61bb5c3c0a8f32324052efd4781e28b88ace4969800000000001976a914900be7732a34e46d00dbaace243f65486448f8e388ace4969800000000001976a914a16dece64baadfec54d6ca0bf77f7380a66150c388ace4969800000000001976a914cc0822f608a13008b559d9536e69251f71e1096e88ace4969800000000001976a914f43dc02e4228e32df7c9d04fe3a59f69be05da6788ace4969800000000001976a914fe70994bce368c86578ae95845e1be7a908df06388ace4969800000000001976a914ff2f09b4f1e2f6e48b1e2a470ca1db3fe20baf6988ac00000000', + '2ef9795147caaeecee5bc2520704bb372cde06dbd2e871750f31336fd3f02be3': '020000000a1b8972f91733804588910d466c0e77cfa65afad2a025a106a82ec6e32d617760050000006b483045022100a576b4e5bf5db550c95ae3d4c56773cdf3e7c632b0c52b6daf70fbcc37a405b502201e091da13954d861040ce382b51c50384ed12095308e0b5d92892361f7e94379812103d57433a7d82e48cd246ef29b9098b24dcf7eebc565586ab26e2bafe5b4d25750ffffffff0df9aeac7e6feeac4a935df9a0220dc498a0fc95a798bcb63a5ab58e5e8e5b6e0d0000006b4830450221008409d69f155c250eb0b4e6a0cf6dca3eb4910c3fd00c1ff245b4c9cc5f319a6b02206985a6d417e707d2d64a19225882c090e4527ec216e219f5ebea8e24bb7278038121036ac21c340c9041eb634f05ab5b6523514bc24784f132b945eef9fd148d616a2dffffffff00b4819721a0e85781c32d65d0f19b3884d7b8d3fe4f0ea3f9c1ea99087e297d010000006a47304402203cc336d6e6dd9a4986eea95dc9b5c7059949503ab227adc7425a6815ab4b9a0102202325b9d275bd4d7ed533d7974f73efae7ad27227f785ec95741e246444e82f978121033c5d60a3ecb98a3cb2214da030e8c28ecaae4663a7f389988c03b123ac0520cbffffffff85d4b234e8da90562da99f35e32cfc0ac93b8d8f041a6701c5e2e82619a9288b0e0000006b483045022100b0c50f44d12831d0f81ce28f498fbd51870b358dacafdc1764f09b021d2c72dd0220511845b6202274950a6a55c4023745f40991463e82a96851f1caec00b5a8a08c812102274dcc3b3e116ad930197f445554c0f3a7514e754c2672555fba335ec69cc5a3ffffffff8c46e46c9a44c4e3998caae7ff9fed881d4e91093fceb61fc33ddc0d5a1b919f040000006a47304402204dcb8938cdf74e80a87c69fa0da61988a12d73ed3495360d5a2d15a441f5e441022033f6b881ad83b10c6affb86a7d562ad421308693e457826e47fa25e57e51f249812103353ec1efb7ebe7aac6fa8431370613bc96d1b1b6cfef8706d7c3e10191fb947fffffffffc9a1d3293ec8604027ee6e1deec58924efacc896009c8b85003b6269553cf5b1010000006a473044022038af9647a90b082d49fa8471dd14a1955b5f1a8984d50dfe08b960b5c8206d440220076d9cf76adf5f86bc8dac5e84c6c14dc6f4a8605ad4832bd305fdc55b8f871b81210294a545f4bf055ee5e4b52bc98b40273ebe7ce172f70d75e48cafcbaaa43d0168ffffffff9d964428902aeb56acfc268b27ab828dc356597ff96c7b789062a1b90cbdf8be020000006b483045022100dce2c3c2bf6ed6b3d2d6eb55d530881b37fca13d08812accd9ed79c76eed75ed02206b0806366fabe8f70c9b1e08f7359861aea480a9a2dd2e3b15145ef06d46d7ed812102faaf13ed5f32f439bfbc5a9d6b5fa392eaace8c596d6b608fd48e1e40b697c90fffffffffc17a363992de5501cb6969b9e835fb333494382990ab319b0343c9d38218abf030000006a473044022012c80bec0b961cf7f8286ac525492a27dc09de299b59e6c294088eb04bb4a1d0022001cc1a8e1bf796f8a4a1e9fd1098e3dbc6bf949be7b4b8424388e3c83792188e812103905c6ad7c04f4594d135d26d980a9c2e16b50946886731b51ed61a9bdd49900bffffffff1892cd6c3038df794331ce437f8060cc2398a3744ec0f7488d4816e43b714ad6050000006a473044022044f3946ba17f87bffcf3fd4c5cfc43c530b97d4a97e3a258372f2074029cf4e802204d22e1afac51ef05c706afc43693b75542f2a82ef89b5026189135e0b1b54f44812102a37654d73b59ab13140a5adfdb79698fe23f6f05c5bb881704b3de2435161e1cffffffff66d6108688b82371210a987b1e22e9aa69a17c98803cc2f4e20e9957552053ea050000006b483045022100d4c315756462c0be66c786617fa8054fb266b5f6c7214cbc7cb00a41869bd26c022001288863647ece1a75718abd9bce8519b99a3e4509ef5554d8a92a633da525588121025ef06ce1ef91f2e535188d8c9ce1863f9ae6d37df8f143e6f558395f849fccb5ffffffff0ae4969800000000001976a91435b4e7ccf37e7933e2b9494f840b792b234e227388ace4969800000000001976a9144accca5ad3fa16538449b20ab51734dbdc9ef22288ace4969800000000001976a9145ac4de0775a027d0f0ec54e4c3d55fe57229fc4e88ace4969800000000001976a9147d224284b61bb5c3c0a8f32324052efd4781e28b88ace4969800000000001976a914900be7732a34e46d00dbaace243f65486448f8e388ace4969800000000001976a914a16dece64baadfec54d6ca0bf77f7380a66150c388ace4969800000000001976a914cc0822f608a13008b559d9536e69251f71e1096e88ace4969800000000001976a914f43dc02e4228e32df7c9d04fe3a59f69be05da6788ace4969800000000001976a914fe70994bce368c86578ae95845e1be7a908df06388ace4969800000000001976a914ff2f09b4f1e2f6e48b1e2a470ca1db3fe20baf6988ac00000000', + '2241d3448560f8b1d3a07ea5c31e79eb595632984a20f50944809a61fdd9fe0b': '020000000a1b8972f91733804588910d466c0e77cfa65afad2a025a106a82ec6e32d617760050000006b483045022100a576b4e5bf5db550c95ae3d4c56773cdf3e7c632b0c52b6daf70fbcc37a405b502201e091da13954d861040ce382b51c50384ed12095308e0b5d92892361f7e94379812103d57433a7d82e48cd246ef29b9098b24dcf7eebc565586ab26e2bafe5b4d25750ffffffff0df9aeac7e6feeac4a935df9a0220dc498a0fc95a798bcb63a5ab58e5e8e5b6e0d0000006b4830450221008409d69f155c250eb0b4e6a0cf6dca3eb4910c3fd00c1ff245b4c9cc5f319a6b02206985a6d417e707d2d64a19225882c090e4527ec216e219f5ebea8e24bb7278038121036ac21c340c9041eb634f05ab5b6523514bc24784f132b945eef9fd148d616a2dffffffff00b4819721a0e85781c32d65d0f19b3884d7b8d3fe4f0ea3f9c1ea99087e297d010000006a47304402203cc336d6e6dd9a4986eea95dc9b5c7059949503ab227adc7425a6815ab4b9a0102202325b9d275bd4d7ed533d7974f73efae7ad27227f785ec95741e246444e82f978121033c5d60a3ecb98a3cb2214da030e8c28ecaae4663a7f389988c03b123ac0520cbffffffff85d4b234e8da90562da99f35e32cfc0ac93b8d8f041a6701c5e2e82619a9288b0e0000006b483045022100b0c50f44d12831d0f81ce28f498fbd51870b358dacafdc1764f09b021d2c72dd0220511845b6202274950a6a55c4023745f40991463e82a96851f1caec00b5a8a08c812102274dcc3b3e116ad930197f445554c0f3a7514e754c2672555fba335ec69cc5a3ffffffff8c46e46c9a44c4e3998caae7ff9fed881d4e91093fceb61fc33ddc0d5a1b919f040000006a47304402204dcb8938cdf74e80a87c69fa0da61988a12d73ed3495360d5a2d15a441f5e441022033f6b881ad83b10c6affb86a7d562ad421308693e457826e47fa25e57e51f249812103353ec1efb7ebe7aac6fa8431370613bc96d1b1b6cfef8706d7c3e10191fb947fffffffffc9a1d3293ec8604027ee6e1deec58924efacc896009c8b85003b6269553cf5b1010000006a473044022038af9647a90b082d49fa8471dd14a1955b5f1a8984d50dfe08b960b5c8206d440220076d9cf76adf5f86bc8dac5e84c6c14dc6f4a8605ad4832bd305fdc55b8f871b81210294a545f4bf055ee5e4b52bc98b40273ebe7ce172f70d75e48cafcbaaa43d0168ffffffff9d964428902aeb56acfc268b27ab828dc356597ff96c7b789062a1b90cbdf8be020000006b483045022100dce2c3c2bf6ed6b3d2d6eb55d530881b37fca13d08812accd9ed79c76eed75ed02206b0806366fabe8f70c9b1e08f7359861aea480a9a2dd2e3b15145ef06d46d7ed812102faaf13ed5f32f439bfbc5a9d6b5fa392eaace8c596d6b608fd48e1e40b697c90fffffffffc17a363992de5501cb6969b9e835fb333494382990ab319b0343c9d38218abf030000006a473044022012c80bec0b961cf7f8286ac525492a27dc09de299b59e6c294088eb04bb4a1d0022001cc1a8e1bf796f8a4a1e9fd1098e3dbc6bf949be7b4b8424388e3c83792188e812103905c6ad7c04f4594d135d26d980a9c2e16b50946886731b51ed61a9bdd49900bffffffff1892cd6c3038df794331ce437f8060cc2398a3744ec0f7488d4816e43b714ad6050000006a473044022044f3946ba17f87bffcf3fd4c5cfc43c530b97d4a97e3a258372f2074029cf4e802204d22e1afac51ef05c706afc43693b75542f2a82ef89b5026189135e0b1b54f44812102a37654d73b59ab13140a5adfdb79698fe23f6f05c5bb881704b3de2435161e1cffffffff66d6108688b82371210a987b1e22e9aa69a17c98803cc2f4e20e9957552053ea050000006b483045022100d4c315756462c0be66c786617fa8054fb266b5f6c7214cbc7cb00a41869bd26c022001288863647ece1a75718abd9bce8519b99a3e4509ef5554d8a92a633da525588121025ef06ce1ef91f2e535188d8c9ce1863f9ae6d37df8f143e6f558395f849fccb5ffffffff0ae4969800000000001976a91435b4e7ccf37e7933e2b9494f840b792b234e227388ace4969800000000001976a9144accca5ad3fa16538449b20ab51734dbdc9ef22288ace4969800000000001976a9145ac4de0775a027d0f0ec54e4c3d55fe57229fc4e88ace4969800000000001976a9147d224284b61bb5c3c0a8f32324052efd4781e28b88ace4969800000000001976a914900be7732a34e46d00dbaace243f65486448f8e388ace4969800000000001976a914a16dece64baadfec54d6ca0bf77f7380a66150c388ace4969800000000001976a914cc0822f608a13008b559d9536e69251f71e1096e88ace4969800000000001976a914f43dc02e4228e32df7c9d04fe3a59f69be05da6788ace4969800000000001976a914fe70994bce368c86578ae95845e1be7a908df06388ace4969800000000001976a914ff2f09b4f1e2f6e48b1e2a470ca1db3fe20baf6988ac00000000', + '45afbfe270014d5593cb065562f1fed726f767fe334d8b3f4379025cfa5be8c5': '020000000a1b8972f91733804588910d466c0e77cfa65afad2a025a106a82ec6e32d617760050000006b483045022100a576b4e5bf5db550c95ae3d4c56773cdf3e7c632b0c52b6daf70fbcc37a405b502201e091da13954d861040ce382b51c50384ed12095308e0b5d92892361f7e94379812103d57433a7d82e48cd246ef29b9098b24dcf7eebc565586ab26e2bafe5b4d25750ffffffff0df9aeac7e6feeac4a935df9a0220dc498a0fc95a798bcb63a5ab58e5e8e5b6e0d0000006b4830450221008409d69f155c250eb0b4e6a0cf6dca3eb4910c3fd00c1ff245b4c9cc5f319a6b02206985a6d417e707d2d64a19225882c090e4527ec216e219f5ebea8e24bb7278038121036ac21c340c9041eb634f05ab5b6523514bc24784f132b945eef9fd148d616a2dffffffff00b4819721a0e85781c32d65d0f19b3884d7b8d3fe4f0ea3f9c1ea99087e297d010000006a47304402203cc336d6e6dd9a4986eea95dc9b5c7059949503ab227adc7425a6815ab4b9a0102202325b9d275bd4d7ed533d7974f73efae7ad27227f785ec95741e246444e82f978121033c5d60a3ecb98a3cb2214da030e8c28ecaae4663a7f389988c03b123ac0520cbffffffff85d4b234e8da90562da99f35e32cfc0ac93b8d8f041a6701c5e2e82619a9288b0e0000006b483045022100b0c50f44d12831d0f81ce28f498fbd51870b358dacafdc1764f09b021d2c72dd0220511845b6202274950a6a55c4023745f40991463e82a96851f1caec00b5a8a08c812102274dcc3b3e116ad930197f445554c0f3a7514e754c2672555fba335ec69cc5a3ffffffff8c46e46c9a44c4e3998caae7ff9fed881d4e91093fceb61fc33ddc0d5a1b919f040000006a47304402204dcb8938cdf74e80a87c69fa0da61988a12d73ed3495360d5a2d15a441f5e441022033f6b881ad83b10c6affb86a7d562ad421308693e457826e47fa25e57e51f249812103353ec1efb7ebe7aac6fa8431370613bc96d1b1b6cfef8706d7c3e10191fb947fffffffffc9a1d3293ec8604027ee6e1deec58924efacc896009c8b85003b6269553cf5b1010000006a473044022038af9647a90b082d49fa8471dd14a1955b5f1a8984d50dfe08b960b5c8206d440220076d9cf76adf5f86bc8dac5e84c6c14dc6f4a8605ad4832bd305fdc55b8f871b81210294a545f4bf055ee5e4b52bc98b40273ebe7ce172f70d75e48cafcbaaa43d0168ffffffff9d964428902aeb56acfc268b27ab828dc356597ff96c7b789062a1b90cbdf8be020000006b483045022100dce2c3c2bf6ed6b3d2d6eb55d530881b37fca13d08812accd9ed79c76eed75ed02206b0806366fabe8f70c9b1e08f7359861aea480a9a2dd2e3b15145ef06d46d7ed812102faaf13ed5f32f439bfbc5a9d6b5fa392eaace8c596d6b608fd48e1e40b697c90fffffffffc17a363992de5501cb6969b9e835fb333494382990ab319b0343c9d38218abf030000006a473044022012c80bec0b961cf7f8286ac525492a27dc09de299b59e6c294088eb04bb4a1d0022001cc1a8e1bf796f8a4a1e9fd1098e3dbc6bf949be7b4b8424388e3c83792188e812103905c6ad7c04f4594d135d26d980a9c2e16b50946886731b51ed61a9bdd49900bffffffff1892cd6c3038df794331ce437f8060cc2398a3744ec0f7488d4816e43b714ad6050000006a473044022044f3946ba17f87bffcf3fd4c5cfc43c530b97d4a97e3a258372f2074029cf4e802204d22e1afac51ef05c706afc43693b75542f2a82ef89b5026189135e0b1b54f44812102a37654d73b59ab13140a5adfdb79698fe23f6f05c5bb881704b3de2435161e1cffffffff66d6108688b82371210a987b1e22e9aa69a17c98803cc2f4e20e9957552053ea050000006b483045022100d4c315756462c0be66c786617fa8054fb266b5f6c7214cbc7cb00a41869bd26c022001288863647ece1a75718abd9bce8519b99a3e4509ef5554d8a92a633da525588121025ef06ce1ef91f2e535188d8c9ce1863f9ae6d37df8f143e6f558395f849fccb5ffffffff0ae4969800000000001976a91435b4e7ccf37e7933e2b9494f840b792b234e227388ace4969800000000001976a9144accca5ad3fa16538449b20ab51734dbdc9ef22288ace4969800000000001976a9145ac4de0775a027d0f0ec54e4c3d55fe57229fc4e88ace4969800000000001976a9147d224284b61bb5c3c0a8f32324052efd4781e28b88ace4969800000000001976a914900be7732a34e46d00dbaace243f65486448f8e388ace4969800000000001976a914a16dece64baadfec54d6ca0bf77f7380a66150c388ace4969800000000001976a914cc0822f608a13008b559d9536e69251f71e1096e88ace4969800000000001976a914f43dc02e4228e32df7c9d04fe3a59f69be05da6788ace4969800000000001976a914fe70994bce368c86578ae95845e1be7a908df06388ace4969800000000001976a914ff2f09b4f1e2f6e48b1e2a470ca1db3fe20baf6988ac00000000', + }; + + coreRpcMock.getRawTransactionMulti.callsFake(async (txids) => txids + .reduce((acc, txid) => { + acc[txid] = txs[txid]; + return acc; + }, {})); mockData.blocks.forEach((mockedBlockData) => { coreRpcMock.getBlock.withArgs(mockedBlockData.hash).resolves(mockedBlockData); diff --git a/packages/dash-spv/package.json b/packages/dash-spv/package.json index 212b6c2db31..35cac4b1fd6 100644 --- a/packages/dash-spv/package.json +++ b/packages/dash-spv/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dash-spv", - "version": "0.25.21", + "version": "1.0.0-dev.15", "description": "Repository containing SPV functions used by @dashevo", "main": "index.js", "scripts": { @@ -14,7 +14,7 @@ "dependencies": { "@dashevo/dark-gravity-wave": "^1.1.1", "@dashevo/dash-util": "^2.0.3", - "@dashevo/dashcore-lib": "~0.21.0", + "@dashevo/dashcore-lib": "~0.21.1", "levelup": "^4.4.0", "memdown": "^5.1.0", "wasm-x11-hash": "~0.0.2" diff --git a/packages/dashmate/README.md b/packages/dashmate/README.md index 7fa5d7a014f..f9ed156cb94 100644 --- a/packages/dashmate/README.md +++ b/packages/dashmate/README.md @@ -62,7 +62,7 @@ Example usage: ```bash $ dashmate stop -$ npm update -g dashmate +$ npm install -g dashmate $ dashmate update ╔══════════════════╤══════════════════════════════╤════════════╗ ║ Service │ Image │ Updated ║ @@ -71,11 +71,11 @@ $ dashmate update ║ Drive ABCI │ dashpay/drive:0.24 │ updated ║ ║ Drive Tenderdash │ dashpay/tenderdash:0.11.2 │ up to date ║ ║ DAPI API │ dashpay/dapi:0.24 │ updated ║ -║ DAPI Envoy │ dashpay/envoy:0.24 │ updated ║ +║ Gateway │ dashpay/envoy:0.24 │ updated ║ ║ Dashmate Helper │ dashpay/dashmate-helper:0.24 │ updated ║ ╚══════════════════╧══════════════════════════════╧════════════╝ $ dashmate update --format=json -[{"name":"core","title":"Core","updated":false,"image":"dashpay/dashd:19.2.0"},{"name":"drive_abci","title":"Drive ABCI","pulled":false,"image":"dashpay/drive:0.24"},{"name":"drive_tenderdash","title":"Drive Tenderdash","pulled":true,"image":"dashpay/tenderdash:0.11.2"},{"name":"dapi_api","title":"DAPI API","pulled":false,"image":"dashpay/dapi:0.24"},{"name":"dapi_envoy","title":"DAPI Envoy","pulled":false,"image":"dashpay/envoy:0.24"},{"name":"dashmate_helper","title":"Dashmate Helper","pulled":false,"image":"dashpay/dashmate-helper:0.24"}] +[{"name":"core","title":"Core","updated":false,"image":"dashpay/dashd:19.2.0"},{"name":"drive_abci","title":"Drive ABCI","pulled":false,"image":"dashpay/drive:0.24"},{"name":"drive_tenderdash","title":"Drive Tenderdash","pulled":true,"image":"dashpay/tenderdash:0.11.2"},{"name":"dapi_api","title":"DAPI API","pulled":false,"image":"dashpay/dapi:0.24"},{"name":"gateway","title":"Gateway","pulled":false,"image":"dashpay/envoy:0.24"},{"name":"dashmate_helper","title":"Dashmate Helper","pulled":false,"image":"dashpay/dashmate-helper:0.24"}] $ dashmate start ``` @@ -87,7 +87,7 @@ In some cases, you must also additionally reset platform data: ```bash $ dashmate stop -$ npm update -g dashmate +$ npm install -g dashmate $ dashmate reset --platform-only --hard $ dashmate update $ dashmate setup @@ -177,6 +177,8 @@ USAGE $ dashmate start [-v] [--config ] [-w] FLAGS + -f, --force force start even if any services are already running + -p, --platform start only platform -v, --verbose use verbose mode for output -w, --wait-for-readiness wait for nodes to be ready --config= configuration name to use @@ -193,12 +195,15 @@ The `stop` command is used to stop a running node. ``` USAGE - $ dashmate stop [-v] [--config ] [-f] + $ dashmate stop [--config ] [-v] [-f] [-p] [-s] FLAGS - -f, --force force stop even if any is running + -f, --force force stop even if any service is running + -p, --platform stop only platform + -s, --safe wait for dkg before stop -v, --verbose use verbose mode for output --config= configuration name to use + ``` To stop a node: @@ -212,11 +217,13 @@ The `restart` command is used to restart a node with the default or specified co ``` USAGE - $ dashmate restart [-v] [--config ] + $ dashmate restart [--config ] [-v] [-p] [-s] FLAGS - -v, --verbose use verbose mode for output - --config= configuration name to use + -p, --platform restart only platform + -s, --safe wait for dkg before stop + -v, --verbose use verbose mode for output + --config= configuration name to use ``` ### Show node status @@ -391,7 +398,8 @@ USAGE $ dashmate group stop [-v] [--group ] [-f] FLAGS - -f, --force force stop even if any service is running + -f, --force force stop even if any is running + -s, --safe wait for dkg before stop -v, --verbose use verbose mode for output --group= group name to use ``` @@ -402,11 +410,15 @@ The `group restart` command is used to restart group nodes belonging to the defa ``` USAGE - $ dashmate group restart [-v] [--group ] + $ dashmate group restart [--group ] [-v] [-s] FLAGS - -v, --verbose use verbose mode for output - --group= group name to use + -s, --safe wait for dkg before stop + -v, --verbose use verbose mode for output + --group= group name to use + +DESCRIPTION + Restart group nodes ``` #### Show group status @@ -503,7 +515,7 @@ again all your service configs (dashd.conf, config.toml, etc.), you can issue th ```bash dashmate config render -Config "testnet" service configs rendered +"testnet" service configs rendered ``` ### Development diff --git a/packages/dashmate/configs/defaults/getBaseConfigFactory.js b/packages/dashmate/configs/defaults/getBaseConfigFactory.js index 0f0d404023f..9459d657db5 100644 --- a/packages/dashmate/configs/defaults/getBaseConfigFactory.js +++ b/packages/dashmate/configs/defaults/getBaseConfigFactory.js @@ -6,7 +6,8 @@ import DashPayContract from '@dashevo/dashpay-contract/lib/systemIds.js'; import FeatureFlagsContract from '@dashevo/feature-flags-contract/lib/systemIds.js'; -import MasternodeRewardSharesContract from '@dashevo/masternode-reward-shares-contract/lib/systemIds.js'; +import MasternodeRewardSharesContract + from '@dashevo/masternode-reward-shares-contract/lib/systemIds.js'; import WithdrawalsContract from '@dashevo/withdrawals-contract/lib/systemIds.js'; @@ -18,11 +19,17 @@ import { } from '../../src/constants.js'; import Config from '../../src/config/Config.js'; -const { contractId: dpnsContractId, ownerId: dpnsOwnerId } = DPNSContract; +const { + contractId: dpnsContractId, + ownerId: dpnsOwnerId, +} = DPNSContract; const { contractId: dashpayContractId } = DashPayContract; -const { contractId: featureFlagsContractId, ownerId: featureFlagsOwnerId } = FeatureFlagsContract; +const { + contractId: featureFlagsContractId, + ownerId: featureFlagsOwnerId, +} = FeatureFlagsContract; const { contractId: masternodeRewardSharesContractId } = MasternodeRewardSharesContract; const { contractId: withdrawalsContractId } = WithdrawalsContract; @@ -72,7 +79,8 @@ export default function getBaseConfigFactory(homeDir) { port: 3001, }, docker: { - image: 'dashpay/dashd:20', commandArgs: [], + image: 'dashpay/dashd:20', + commandArgs: [], }, p2p: { host: '0.0.0.0', @@ -87,7 +95,8 @@ export default function getBaseConfigFactory(homeDir) { allowIps: ['127.0.0.1', '172.16.0.0/12', '192.168.0.0/16'], }, spork: { - address: null, privateKey: null, + address: null, + privateKey: null, }, masternode: { enable: true, @@ -96,47 +105,111 @@ export default function getBaseConfigFactory(homeDir) { }, }, miner: { - enable: false, interval: '2.5m', mediantime: null, address: null, + enable: false, + interval: '2.5m', + mediantime: null, + address: null, }, devnet: { - name: null, minimumDifficultyBlocks: 0, powTargetSpacing: 150, + name: null, + minimumDifficultyBlocks: 0, + powTargetSpacing: 150, }, log: { file: { - categories: [], path: homeDir.joinPath('logs', 'base', 'core.log'), + categories: [], + path: homeDir.joinPath('logs', 'base', 'core.log'), }, }, logIps: 0, indexes: true, }, platform: { - dapi: { - envoy: { - docker: { - image: 'dashpay/envoy:1.22.11', + gateway: { + docker: { + image: 'dashpay/envoy:1.30.2-impr.1', + }, + maxConnections: 1000, + maxHeapSizeInBytes: 125000000, // 1 Gb + upstreams: { + driveGrpc: { + maxRequests: 100, + }, + dapiApi: { + maxRequests: 100, }, - http: { + dapiCoreStreams: { + maxRequests: 100, + }, + dapiJsonRpc: { + maxRequests: 100, + }, + }, + metrics: { + enabled: false, + host: '127.0.0.1', + port: 9090, + }, + admin: { + enabled: false, + host: '127.0.0.1', + port: 9901, + }, + listeners: { + dapiAndDrive: { + http2: { + maxConcurrentStreams: 10, + }, host: '0.0.0.0', port: 443, - connectTimeout: '5s', - responseTimeout: '15s', }, - rateLimiter: { - maxTokens: 300, tokensPerFill: 150, fillInterval: '60s', enabled: true, + }, + log: { + level: 'info', + accessLogs: [ + { + type: 'stdout', + format: 'text', + template: null, + }, + ], + }, + rateLimiter: { + docker: { + image: 'envoyproxy/ratelimit:3fcc3609', }, - ssl: { + metrics: { enabled: false, - provider: 'zerossl', - providerConfigs: { - zerossl: { - apiKey: null, id: null, - }, + docker: { + image: 'prom/statsd-exporter:v0.26.1', }, + host: '127.0.0.1', + port: 9102, }, + unit: 'minute', + requestsPerUnit: 150, + blacklist: [], + whitelist: [], + enabled: true, }, + ssl: { + enabled: false, + provider: 'zerossl', + providerConfigs: { + zerossl: { + apiKey: null, + id: null, + }, + }, + }, + }, + dapi: { api: { docker: { image: `dashpay/dapi:${dockerImageVersion}`, + deploy: { + replicas: 1, + }, build: { enabled: false, context: path.join(PACKAGE_ROOT_DIR, '..', '..'), @@ -159,18 +232,37 @@ export default function getBaseConfigFactory(homeDir) { }, logs: { stdout: { - destination: 'stdout', level: 'info', format: 'compact', color: true, + destination: 'stdout', + level: 'info', + format: 'compact', + color: true, }, }, + tokioConsole: { + enabled: false, + host: '127.0.0.1', + port: 6669, + retention: 60 * 3, + }, validatorSet: { llmqType: 4, }, + chainLock: { + llmqType: 2, + dkgInterval: 288, + llmqSize: 400, + }, + metrics: { + enabled: false, + host: '127.0.0.1', + port: 29090, + }, epochTime: 788400, }, tenderdash: { mode: 'full', docker: { - image: 'dashpay/tenderdash:fix-ordered-map', + image: 'dashpay/tenderdash:0.14.0-dev.6', }, p2p: { host: '0.0.0.0', @@ -186,9 +278,11 @@ export default function getBaseConfigFactory(homeDir) { host: '127.0.0.1', port: 26657, maxOpenConnections: 900, + timeoutBroadcastTx: 0, }, pprof: { - enabled: false, port: 6060, + enabled: false, + port: 6060, }, metrics: { enabled: false, @@ -196,8 +290,14 @@ export default function getBaseConfigFactory(homeDir) { port: 26660, }, mempool: { + cacheSize: 15000, size: 5000, maxTxsBytes: 1073741824, + timeoutCheckTx: '0', + txEnqueueTimeout: '0', + txSendRateLimit: 0, + txRecvRateLimit: 0, + maxConcurrentCheckTx: 250, }, consensus: { createEmptyBlocks: true, @@ -222,18 +322,25 @@ export default function getBaseConfigFactory(homeDir) { }, }, log: { - level: 'info', format: 'plain', path: null, + level: 'info', + format: 'plain', + path: null, }, node: { - id: null, key: null, + id: null, + key: null, }, genesis: { consensus_params: { block: { - max_bytes: '22020096', max_gas: '-1', time_iota_ms: '5000', + max_bytes: '2097152', + max_gas: '57631392000', + time_iota_ms: '5000', }, evidence: { - max_age: '100000', max_age_num_blocks: '100000', max_age_duration: '172800000000000', + max_age: '100000', + max_age_num_blocks: '100000', + max_age_duration: '172800000000000', }, validator: { pub_key_types: ['bls12381'], @@ -241,6 +348,21 @@ export default function getBaseConfigFactory(homeDir) { version: { app_version: '1', }, + timeout: { + propose: '30000000000', + propose_delta: '1000000000', + vote: '2000000000', + vote_delta: '500000000', + commit: '1000000000', + bypass_commit_timeout: false, + }, + synchrony: { + message_delay: '32000000000', + precision: '500000000', + }, + abci: { + recheck_tx: true, + }, }, }, moniker: null, @@ -297,7 +419,8 @@ export default function getBaseConfigFactory(homeDir) { }, }, api: { - enable: false, port: 9100, + enable: false, + port: 9100, }, }, }, diff --git a/packages/dashmate/configs/defaults/getLocalConfigFactory.js b/packages/dashmate/configs/defaults/getLocalConfigFactory.js index 56b87efabc3..33992ceceb7 100644 --- a/packages/dashmate/configs/defaults/getLocalConfigFactory.js +++ b/packages/dashmate/configs/defaults/getLocalConfigFactory.js @@ -24,6 +24,10 @@ export default function getLocalConfigFactory(getBaseConfig) { }, }, core: { + docker: { + image: 'dashpay/dashd:20.1.0', + commandArgs: [], + }, p2p: { port: 20001, }, @@ -32,17 +36,17 @@ export default function getLocalConfigFactory(getBaseConfig) { }, }, platform: { - dapi: { - envoy: { - ssl: { - provider: SSL_PROVIDERS.SELF_SIGNED, - }, - http: { + gateway: { + ssl: { + provider: SSL_PROVIDERS.SELF_SIGNED, + }, + listeners: { + dapiAndDrive: { port: 2443, }, - rateLimiter: { - enabled: false, - }, + }, + rateLimiter: { + enabled: false, }, }, drive: { @@ -68,6 +72,11 @@ export default function getLocalConfigFactory(getBaseConfig) { validatorSet: { llmqType: 106, }, + chainLock: { + llmqType: 100, + dkgInterval: 24, + llmqSize: 3, + }, }, }, }, @@ -75,7 +84,8 @@ export default function getLocalConfigFactory(getBaseConfig) { network: NETWORK_LOCAL, }; - return new Config('local', lodashMerge({}, getBaseConfig().getOptions(), options)); + return new Config('local', lodashMerge({}, getBaseConfig() + .getOptions(), options)); } return getLocalConfig; diff --git a/packages/dashmate/configs/defaults/getTestnetConfigFactory.js b/packages/dashmate/configs/defaults/getTestnetConfigFactory.js index df5e05056f0..323d63314bb 100644 --- a/packages/dashmate/configs/defaults/getTestnetConfigFactory.js +++ b/packages/dashmate/configs/defaults/getTestnetConfigFactory.js @@ -24,6 +24,10 @@ export default function getTestnetConfigFactory(homeDir, getBaseConfig) { }, }, core: { + docker: { + image: 'dashpay/dashd:20.1.0', + commandArgs: [], + }, p2p: { port: 19999, }, @@ -40,9 +44,9 @@ export default function getTestnetConfigFactory(homeDir, getBaseConfig) { }, }, platform: { - dapi: { - envoy: { - http: { + gateway: { + listeners: { + dapiAndDrive: { port: 1443, }, }, @@ -53,6 +57,11 @@ export default function getTestnetConfigFactory(homeDir, getBaseConfig) { validatorSet: { llmqType: 6, }, + chainLock: { + llmqType: 1, + dkgInterval: 24, + llmqSize: 50, + }, }, tenderdash: { p2p: { @@ -70,8 +79,15 @@ export default function getTestnetConfigFactory(homeDir, getBaseConfig) { ], port: 36656, }, + mempool: { + timeoutCheckTx: '1s', + txEnqueueTimeout: '10ms', + txSendRateLimit: 10, + txRecvRateLimit: 12, + }, rpc: { port: 36657, + timeoutBroadcastTx: '1s', }, pprof: { port: 36060, @@ -80,38 +96,10 @@ export default function getTestnetConfigFactory(homeDir, getBaseConfig) { port: 36660, }, genesis: { - genesis_time: '2023-11-02T10:18:00.000Z', - chain_id: 'dash-testnet-37', - initial_core_chain_locked_height: 918609, - consensus_params: { - timeout: { - propose: '50000000000', - propose_delta: '10000000000', - vote: '500000000', - vote_delta: '100000000', - commit: '1000000000', - bypass_commit_timeout: false, - }, - block: { - max_bytes: '22020096', - max_gas: '-1', - time_iota_ms: '5000', - }, - evidence: { - max_age: '100000', - max_age_num_blocks: '100000', - max_age_duration: '172800000000000', - }, - validator: { - pub_key_types: [ - 'bls12381', - ], - }, - version: { - app_version: '1', - }, - }, + genesis_time: '2024-03-07T13:26:00.000Z', + chain_id: 'dash-testnet-39', validator_quorum_type: 6, + initial_core_chain_locked_height: 984306, }, }, }, @@ -139,7 +127,8 @@ export default function getTestnetConfigFactory(homeDir, getBaseConfig) { network: NETWORK_TESTNET, }; - return new Config('testnet', lodashMerge({}, getBaseConfig().getOptions(), options)); + return new Config('testnet', lodashMerge({}, getBaseConfig() + .getOptions(), options)); } return getTestnetConfig; diff --git a/packages/dashmate/configs/getConfigFileMigrationsFactory.js b/packages/dashmate/configs/getConfigFileMigrationsFactory.js index 205271a7234..cdd3cd9405f 100644 --- a/packages/dashmate/configs/getConfigFileMigrationsFactory.js +++ b/packages/dashmate/configs/getConfigFileMigrationsFactory.js @@ -1,6 +1,7 @@ /* eslint-disable no-param-reassign */ import fs from 'fs'; import path from 'path'; +import lodash from 'lodash'; import { NETWORK_LOCAL, @@ -23,6 +24,22 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) const base = defaultConfigs.get('base'); const testnet = defaultConfigs.get('testnet'); + /** + * @param {string} name + * @param {string} group + * @return {Config} + */ + function getDefaultConfigByNameOrGroup(name, group) { + let baseConfigName = name; + if (group !== null && defaultConfigs.has(group)) { + baseConfigName = group; + } else if (!defaultConfigs.has(baseConfigName)) { + baseConfigName = 'base'; + } + + return defaultConfigs.get(baseConfigName); + } + return { '0.24.0': (configFile) => { Object.entries(configFile.configs) @@ -40,7 +57,7 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) options.platform.dapi.api.docker.image = base.get('platform.dapi.api.docker.image'); - options.platform.dapi.envoy.docker.image = base.get('platform.dapi.envoy.docker.image'); + options.platform.gateway.docker.image = base.get('platform.gateway.docker.image'); }); return configFile; @@ -89,7 +106,7 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) '0.24.16': (configFile) => { Object.entries(configFile.configs) .forEach(([, options]) => { - options.platform.dapi.envoy.docker = base.get('platform.dapi.envoy.docker'); + options.platform.gateway.docker = base.get('platform.gateway.docker'); options.platform.dapi.api.docker.build = base.get('platform.dapi.api.docker.build'); @@ -170,7 +187,8 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) } if (defaultConfigs.has(name) && !options.platform.drive.tenderdash.metrics) { - options.platform.drive.tenderdash.metrics = defaultConfigs.get(name).get('platform.drive.tenderdash.metrics'); + options.platform.drive.tenderdash.metrics = defaultConfigs.get(name) + .get('platform.drive.tenderdash.metrics'); } }); return configFile; @@ -364,7 +382,7 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) options.core.p2p.host = base.get('core.p2p.host'); options.core.rpc.host = base.get('core.rpc.host'); - options.platform.dapi.envoy.http.host = base.get('platform.dapi.envoy.http.host'); + options.platform.dapi.envoy.http.host = '0.0.0.0'; options.platform.drive.tenderdash.p2p.host = base.get('platform.drive.tenderdash.p2p.host'); options.platform.drive.tenderdash.rpc.host = base.get('platform.drive.tenderdash.rpc.host'); options.platform.drive.tenderdash.metrics.host = base.get('platform.drive.tenderdash.metrics.host'); @@ -383,8 +401,8 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) '0.25.20': (configFile) => { Object.entries(configFile.configs) .forEach(([name, options]) => { - options.platform.dapi.envoy.http.connectTimeout = base.get('platform.dapi.envoy.http.connectTimeout'); - options.platform.dapi.envoy.http.responseTimeout = base.get('platform.dapi.envoy.http.responseTimeout'); + options.platform.dapi.envoy.http.connectTimeout = '5s'; + options.platform.dapi.envoy.http.responseTimeout = '15s'; options.platform.drive.tenderdash.rpc.maxOpenConnections = base.get('platform.drive.tenderdash.rpc.maxOpenConnections'); @@ -399,13 +417,202 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) options.platform.drive.tenderdash.p2p.sendRate = defaultConfig.get('platform.drive.tenderdash.p2p.sendRate'); options.platform.drive.tenderdash.p2p.recvRate = defaultConfig.get('platform.drive.tenderdash.p2p.recvRate'); - options.platform.drive.tenderdash.mempool = base.get('platform.drive.tenderdash.mempool'); + options.platform.drive.tenderdash.mempool = lodash.clone(base.get('platform.drive.tenderdash.mempool')); options.platform.drive.tenderdash.consensus.peer = base.get('platform.drive.tenderdash.consensus.peer'); options.platform.drive.tenderdash.consensus.unsafeOverride = base.get('platform.drive.tenderdash.consensus.unsafeOverride'); }); return configFile; }, + '1.0.0-dev.2': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + if (defaultConfigs.has(name)) { + options.platform.drive.tenderdash.genesis = defaultConfigs.get(name) + .get('platform.drive.tenderdash.genesis'); + } + options.platform.dapi.api.docker.deploy = base.get('platform.dapi.api.docker.deploy'); + + let baseConfigName = name; + if (options.group !== null && defaultConfigs.has(options.group)) { + baseConfigName = options.group; + } else if (!defaultConfigs.has(baseConfigName)) { + baseConfigName = 'testnet'; + } + + options.platform.drive.abci.chainLock = defaultConfigs.get(baseConfigName) + .get('platform.drive.abci.chainLock'); + }); + + return configFile; + }, + '1.0.0-dev.4': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + const defaultConfig = getDefaultConfigByNameOrGroup(name, options.group); + options.core.docker.image = defaultConfig.get('core.docker.image'); + + options.platform.drive.tenderdash.docker.image = defaultConfig.get('platform.drive.tenderdash.docker.image'); + }); + + return configFile; + }, + '1.0.0-dev.5': (configFile) => { + Object.entries(configFile.configs) + .forEach(([, options]) => { + options.platform.drive.tenderdash.mempool.cacheSize = base.get('platform.drive.tenderdash.mempool.cacheSize'); + }); + + return configFile; + }, + '1.0.0-dev.6': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + options.platform.drive.abci.tokioConsole = base.get('platform.drive.abci.tokioConsole'); + + const defaultConfig = getDefaultConfigByNameOrGroup(name, options.group); + options.platform.drive.tenderdash.docker.image = defaultConfig.get('platform.drive.tenderdash.docker.image'); + }); + + return configFile; + }, + '1.0.0-dev.7': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + if (options.network === NETWORK_TESTNET && name !== 'base') { + options.platform.drive.tenderdash.genesis = testnet.get('platform.drive.tenderdash.genesis'); + } + + const defaultConfig = getDefaultConfigByNameOrGroup(name, options.group); + options.core.docker.image = defaultConfig.get('core.docker.image'); + }); + + return configFile; + }, + '1.0.0-dev.8': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + const defaultConfig = getDefaultConfigByNameOrGroup(name, options.group); + options.core.docker.image = defaultConfig.get('core.docker.image'); + }); + + return configFile; + }, + '1.0.0-dev.9': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + options.platform.drive.tenderdash.docker.image = base.get('platform.drive.tenderdash.docker.image'); + + const defaultConfig = getDefaultConfigByNameOrGroup(name, options.group); + options.platform.drive.tenderdash.mempool.timeoutCheckTx = defaultConfig.get('platform.drive.tenderdash.mempool.timeoutCheckTx'); + options.platform.drive.tenderdash.mempool.txEnqueueTimeout = defaultConfig.get('platform.drive.tenderdash.mempool.txEnqueueTimeout'); + options.platform.drive.tenderdash.mempool.txSendRateLimit = defaultConfig.get('platform.drive.tenderdash.mempool.txSendRateLimit'); + options.platform.drive.tenderdash.mempool.txRecvRateLimit = defaultConfig.get('platform.drive.tenderdash.mempool.txRecvRateLimit'); + options.platform.drive.tenderdash.rpc.timeoutBroadcastTx = defaultConfig.get('platform.drive.tenderdash.rpc.timeoutBroadcastTx'); + }); + + return configFile; + }, + '1.0.0-dev.10': (configFile) => { + Object.entries(configFile.configs) + .forEach(([, options]) => { + options.platform.drive.tenderdash.docker.image = base.get('platform.drive.tenderdash.docker.image'); + }); + + return configFile; + }, + '1.0.0-dev.12': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + // Update tenderdash config + options.platform.drive.tenderdash.docker.image = base.get('platform.drive.tenderdash.docker.image'); + options.platform.drive.tenderdash.mempool.maxConcurrentCheckTx = base.get('platform.drive.tenderdash.mempool.maxConcurrentCheckTx'); + + // Add metrics to Drive ABCI + options.platform.drive.abci.metrics = base.get('platform.drive.abci.metrics'); + + // Envoy -> Gateway + if (options.platform.dapi.envoy) { + options.platform.gateway = lodash.cloneDeep(options.platform.dapi.envoy); + + // add new options + options.platform.gateway.maxConnections = base.get('platform.gateway.maxConnections'); + options.platform.gateway.maxHeapSizeInBytes = base.get('platform.gateway.maxHeapSizeInBytes'); + options.platform.gateway.metrics = base.get('platform.gateway.metrics'); + options.platform.gateway.admin = base.get('platform.gateway.admin'); + options.platform.gateway.upstreams = base.get('platform.gateway.upstreams'); + options.platform.gateway.log = base.get('platform.gateway.log'); + + // http -> listeners + options.platform.gateway.listeners = lodash.cloneDeep( + base.get('platform.gateway.listeners'), + ); + + options.platform.gateway.listeners.dapiAndDrive.host = options.platform.dapi.envoy + .http.host; + options.platform.gateway.listeners.dapiAndDrive.port = options.platform.dapi.envoy + .http.port; + + delete options.platform.gateway.http; + + // update rate limiter + options.platform.gateway.rateLimiter.docker = base.get('platform.gateway.rateLimiter.docker'); + options.platform.gateway.rateLimiter.unit = base.get('platform.gateway.rateLimiter.unit'); + options.platform.gateway.rateLimiter.requestsPerUnit = base.get('platform.gateway.rateLimiter.requestsPerUnit'); + options.platform.gateway.rateLimiter.blacklist = base.get('platform.gateway.rateLimiter.blacklist'); + options.platform.gateway.rateLimiter.whitelist = base.get('platform.gateway.rateLimiter.whitelist'); + options.platform.gateway.rateLimiter.metrics = base.get('platform.gateway.rateLimiter.metrics'); + + delete options.platform.gateway.rateLimiter.fillInterval; + delete options.platform.gateway.rateLimiter.maxTokens; + delete options.platform.gateway.rateLimiter.tokensPerFill; + + // delete envoy + delete options.platform.dapi.envoy; + + // update image + options.platform.gateway.docker.image = base.get('platform.gateway.docker.image'); + } + + // rename non conventional field + if (options.platform.drive.abci.tokioConsole.retention_secs) { + options.platform.drive.abci.tokioConsole.retention = options.platform.drive.abci + .tokioConsole.retention_secs; + delete options.platform.drive.abci.tokioConsole.retention_secs; + } + + // move SSL files + if (options.network !== NETWORK_MAINNET) { + const filenames = ['private.key', 'bundle.crt', 'bundle.csr', 'csr.pem']; + + for (const filename of filenames) { + const oldFilePath = homeDir.joinPath( + name, + 'platform', + 'dapi', + 'envoy', + 'ssl', + filename, + ); + const newFilePath = homeDir.joinPath( + name, + 'platform', + 'gateway', + 'ssl', + filename, + ); + + if (fs.existsSync(oldFilePath)) { + fs.mkdirSync(path.dirname(newFilePath), { recursive: true }); + fs.copyFileSync(oldFilePath, newFilePath); + fs.rmSync(oldFilePath, { recursive: true }); + } + } + } + }); + + return configFile; + }, }; } diff --git a/packages/dashmate/docker-compose.build.dapi_core_streams.yml b/packages/dashmate/docker-compose.build.dapi_core_streams.yml new file mode 100644 index 00000000000..ec9cfdcf450 --- /dev/null +++ b/packages/dashmate/docker-compose.build.dapi_core_streams.yml @@ -0,0 +1,22 @@ +version: '3.7' + +services: + dapi_core_streams: + build: + context: ${PLATFORM_DAPI_API_DOCKER_BUILD_CONTEXT:?err} + dockerfile: ${PLATFORM_DAPI_API_DOCKER_BUILD_DOCKER_FILE:?err} + target: ${PLATFORM_DAPI_API_DOCKER_BUILD_TARGET} + args: + RUSTC_WRAPPER: ${RUSTC_WRAPPER} + SCCACHE_MEMCACHED: ${SCCACHE_MEMCACHED} + SCCACHE_GHA_ENABLED: ${SCCACHE_GHA_ENABLED} + ACTIONS_CACHE_URL: ${ACTIONS_CACHE_URL} + ACTIONS_RUNTIME_TOKEN: ${ACTIONS_RUNTIME_TOKEN} + SCCACHE_BUCKET: ${SCCACHE_BUCKET} + SCCACHE_REGION: ${SCCACHE_REGION} + SCCACHE_S3_KEY_PREFIX: ${SCCACHE_S3_KEY_PREFIX} + cache_from: + - ${CACHE_DAPI_API_FROM:-${PLATFORM_DAPI_API_DOCKER_IMAGE}} + cache_to: + - ${CACHE_DAPI_API_TO:-type=inline} + image: dapi:local diff --git a/packages/dashmate/docker-compose.build.dapi_tx_filter_stream.yml b/packages/dashmate/docker-compose.build.dapi_tx_filter_stream.yml deleted file mode 100644 index 35e82f593ac..00000000000 --- a/packages/dashmate/docker-compose.build.dapi_tx_filter_stream.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: '3.7' - -services: - dapi_tx_filter_stream: - build: - context: ${PLATFORM_DAPI_API_DOCKER_BUILD_CONTEXT:?err} - dockerfile: ${PLATFORM_DAPI_API_DOCKER_BUILD_DOCKER_FILE:?err} - target: ${PLATFORM_DAPI_API_DOCKER_BUILD_TARGET} - args: - RUSTC_WRAPPER: ${RUSTC_WRAPPER} - SCCACHE_MEMCACHED: ${SCCACHE_MEMCACHED} - SCCACHE_GHA_ENABLED: ${SCCACHE_GHA_ENABLED} - ACTIONS_CACHE_URL: ${ACTIONS_CACHE_URL} - ACTIONS_RUNTIME_TOKEN: ${ACTIONS_RUNTIME_TOKEN} - SCCACHE_BUCKET: ${SCCACHE_BUCKET} - SCCACHE_REGION: ${SCCACHE_REGION} - SCCACHE_S3_KEY_PREFIX: ${SCCACHE_S3_KEY_PREFIX} - cache_from: - - ${CACHE_DAPI_API_FROM:-${PLATFORM_DAPI_API_DOCKER_IMAGE}} - cache_to: - - ${CACHE_DAPI_API_TO:-type=inline} - image: dapi:local diff --git a/packages/dashmate/docker-compose.rate_limiter.metrics.yml b/packages/dashmate/docker-compose.rate_limiter.metrics.yml new file mode 100644 index 00000000000..7e76d9959c3 --- /dev/null +++ b/packages/dashmate/docker-compose.rate_limiter.metrics.yml @@ -0,0 +1,20 @@ +version: '3.7' + +services: + gateway_rate_limiter_metrics: + image: ${PLATFORM_GATEWAY_RATE_LIMITER_METRICS_DOCKER_IMAGE:?err} + labels: + org.dashmate.service.title: "Gateway rate limiter metrics exporter" + restart: unless-stopped + entrypoint: /bin/statsd_exporter + command: + - "--statsd.mapping-config=/etc/statsd-exporter/config.yaml" + networks: + - gateway_rate_limiter + volumes: + - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/gateway/rate_limiter/statsd_exporter.yaml:/etc/statsd-exporter/config.yaml:ro + expose: + - 9125 + - 9125/udp + ports: + - ${PLATFORM_GATEWAY_RATE_LIMITER_METRICS_HOST:?err}:${PLATFORM_GATEWAY_RATE_LIMITER_METRICS_PORT:?err}:9102 diff --git a/packages/dashmate/docker-compose.rate_limiter.yml b/packages/dashmate/docker-compose.rate_limiter.yml new file mode 100644 index 00000000000..9833a620365 --- /dev/null +++ b/packages/dashmate/docker-compose.rate_limiter.yml @@ -0,0 +1,54 @@ +version: '3.7' + +services: + gateway: + depends_on: + - dapi_api + - dapi_core_streams + - drive_abci + - gateway_rate_limiter + + gateway_rate_limiter: + labels: + org.dashmate.service.title: "Gateway rate limiter" + restart: unless-stopped + image: ${PLATFORM_GATEWAY_RATE_LIMITER_DOCKER_IMAGE:?err} + command: /bin/ratelimit + depends_on: + - gateway_rate_limiter_redis + networks: + - gateway_rate_limiter + volumes: + - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/gateway/rate_limiter/rate_limiter.yaml:/data/ratelimit/config/config.yaml:ro + environment: + - LOG_LEVEL=info + - LOG_FORMAT=text + - BACKEND_TYPE=redis + - REDIS_SOCKET_TYPE=tcp + - REDIS_URL=gateway_rate_limiter_redis:6379 + - RUNTIME_ROOT=/data + - RUNTIME_SUBDIRECTORY=ratelimit + - RUNTIME_WATCH_ROOT=false + - DISABLE_STATS=${PLATFORM_GATEWAY_RATE_LIMITER_METRICS_DISABLED:?err} + - STATSD_HOST=gateway_rate_limiter_metrics + - STATSD_PORT=9125 + - CONFIG_TYPE=FILE + - GRPC_MAX_CONNECTION_AGE=1h + - GRPC_MAX_CONNECTION_AGE_GRACE=10m + - GRPC_PORT=8081 + expose: + - 8081 + profiles: + - platform + + gateway_rate_limiter_redis: + labels: + org.dashmate.service.title: "Gateway rate limiter storage" + restart: unless-stopped + image: redis:alpine + expose: + - 6379 + networks: + - gateway_rate_limiter + profiles: + - platform diff --git a/packages/dashmate/docker-compose.yml b/packages/dashmate/docker-compose.yml index 8ecff50b5b5..e4782168e48 100644 --- a/packages/dashmate/docker-compose.yml +++ b/packages/dashmate/docker-compose.yml @@ -12,6 +12,8 @@ services: ports: - 127.0.0.1:${DASHMATE_HELPER_API_PORT:?err}:${DASHMATE_HELPER_API_PORT:?err} command: yarn workspace dashmate helper ${CONFIG_NAME:?err} + expose: + - ${DASHMATE_HELPER_API_PORT:?err} volumes: - ${DASHMATE_HOME_DIR:?err}:/home/dashmate/.dashmate - /var/run/docker.sock:/var/run/docker.sock @@ -22,8 +24,8 @@ services: org.dashmate.service.title: "Core" restart: unless-stopped ports: - - ${CORE_P2P_HOST:?err}:${CORE_P2P_PORT:?err}:${CORE_P2P_PORT:?err} # P2P - - ${CORE_RPC_HOST:?err}:${CORE_RPC_PORT:?err}:${CORE_RPC_PORT:?err} #RPC + - ${CORE_P2P_HOST:?err}:${CORE_P2P_PORT:?err}:${CORE_P2P_PORT:?err} + - ${CORE_RPC_HOST:?err}:${CORE_RPC_PORT:?err}:${CORE_RPC_PORT:?err} volumes: - core_data:/home/dash - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/core/dash.conf:/home/dash/.dashcore/dash.conf:ro @@ -47,14 +49,11 @@ services: volumes: - drive_abci_data:/var/lib/dash/rs-drive-abci/db environment: - - BLOCK_SPACING_MS=3000 # TODO: sync with tenderdash - CHAIN_ID=${PLATFORM_DRIVE_TENDERDASH_GENESIS_CHAIN_ID:-devnet} - CORE_JSON_RPC_USERNAME=${CORE_RPC_USER:?err} - CORE_JSON_RPC_PASSWORD=${CORE_RPC_PASSWORD:?err} - CORE_JSON_RPC_HOST=core - CORE_JSON_RPC_PORT=${CORE_RPC_PORT:?err} - - CORE_ZMQ_HOST=core - - CORE_ZMQ_PORT=29998 - DPNS_MASTER_PUBLIC_KEY=${PLATFORM_DPNS_MASTER_PUBLIC_KEY} - DPNS_SECOND_PUBLIC_KEY=${PLATFORM_DPNS_SECOND_PUBLIC_KEY} - DASHPAY_MASTER_PUBLIC_KEY=${PLATFORM_DASHPAY_MASTER_PUBLIC_KEY} @@ -66,16 +65,30 @@ services: - MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY=${PLATFORM_MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY} - WITHDRAWALS_MASTER_PUBLIC_KEY=${PLATFORM_WITHDRAWALS_MASTER_PUBLIC_KEY} - WITHDRAWALS_SECOND_PUBLIC_KEY=${PLATFORM_WITHDRAWALS_SECOND_PUBLIC_KEY} - - QUORUM_SIZE=5 # TODO: sync with Tenderdash - - QUORUM_TYPE=${PLATFORM_DRIVE_ABCI_VALIDATOR_SET_LLMQ_TYPE:?err} - - NETWORK=${NETWORK:?err} - - TENDERDASH_P2P_PORT=${PLATFORM_DRIVE_TENDERDASH_P2P_PORT:?err} + - VALIDATOR_SET_QUORUM_TYPE=${PLATFORM_DRIVE_ABCI_VALIDATOR_SET_LLMQ_TYPE:?err} + - CHAIN_LOCK_QUORUM_TYPE=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_LLMQ_TYPE:?err} + - CHAIN_LOCK_QUORUM_WINDOW=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_DKG_INTERVAL:?err} + - CHAIN_LOCK_QUORUM_SIZE=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_LLMQ_SIZE:?err} + - DB_PATH=/var/lib/dash/rs-drive-abci/db + - ABCI_CONSENSUS_BIND_ADDRESS=tcp://0.0.0.0:26658 + - GRPC_BIND_ADDRESS=0.0.0.0:26670 + - PROMETHEUS_BIND_ADDRESS=${PLATFORM_DRIVE_ABCI_METRICS_URL} + - TOKIO_CONSOLE_ENABLED=${PLATFORM_DRIVE_ABCI_TOKIO_CONSOLE_ENABLED:?err} + - TOKIO_CONSOLE_ADDRESS=0.0.0.0:${PLATFORM_DRIVE_ABCI_TOKIO_CONSOLE_PORT:?err} + - TOKIO_CONSOLE_RETENTION_SECS=${PLATFORM_DRIVE_ABCI_TOKIO_CONSOLE_RETENTION:?err} stop_grace_period: 30s + expose: + - 26658 + - 26659 + - 26670 env_file: # Logger settings - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/drive/abci/logger.env profiles: - platform + ports: + - ${PLATFORM_DRIVE_ABCI_TOKIO_CONSOLE_HOST:?err}:${PLATFORM_DRIVE_ABCI_TOKIO_CONSOLE_PORT:?err}:${PLATFORM_DRIVE_ABCI_TOKIO_CONSOLE_PORT:?err} + - ${PLATFORM_DRIVE_ABCI_METRICS_HOST:?err}:${PLATFORM_DRIVE_ABCI_METRICS_PORT:?err}:29090 drive_tenderdash: image: ${PLATFORM_DRIVE_TENDERDASH_DOCKER_IMAGE:?err} @@ -102,6 +115,9 @@ services: labels: org.dashmate.service.title: "DAPI API" restart: unless-stopped + deploy: + mode: replicated + replicas: ${PLATFORM_DAPI_API_DOCKER_DEPLOY_REPLICAS:-1} depends_on: - drive_tenderdash environment: @@ -113,23 +129,28 @@ services: - DASHCORE_RPC_PASS=${CORE_RPC_PASSWORD:?err} - DASHCORE_ZMQ_HOST=core - DASHCORE_ZMQ_PORT=29998 - - DASHCORE_P2P_HOST=core - - DASHCORE_P2P_PORT=${CORE_P2P_PORT:?err} - - DASHCORE_P2P_NETWORK=devnet - - NETWORK=devnet + - NETWORK=${NETWORK:?err} - TENDERMINT_RPC_HOST=drive_tenderdash - TENDERMINT_RPC_PORT=${PLATFORM_DRIVE_TENDERDASH_RPC_PORT:?err} - NODE_ENV=${ENVIRONMENT:?err} - command: --only api + - DRIVE_RPC_HOST=drive_abci + - DRIVE_RPC_PORT=26670 + command: yarn run api stop_grace_period: 10s + expose: + - 3004 + - 3005 profiles: - platform - dapi_tx_filter_stream: + dapi_core_streams: image: ${PLATFORM_DAPI_API_DOCKER_IMAGE:?err} labels: org.dashmate.service.title: "DAPI Transactions Filter Stream" restart: unless-stopped + deploy: + mode: replicated + replicas: ${PLATFORM_DAPI_API_DOCKER_DEPLOY_REPLICAS:-1} environment: - TX_FILTER_STREAM_GRPC_PORT=3006 - DASHCORE_RPC_HOST=core @@ -138,34 +159,45 @@ services: - DASHCORE_RPC_PASS=${CORE_RPC_PASSWORD:?err} - DASHCORE_ZMQ_HOST=core - DASHCORE_ZMQ_PORT=29998 - - DASHCORE_P2P_HOST=core - - DASHCORE_P2P_PORT=${CORE_P2P_PORT:?err} - - DASHCORE_P2P_NETWORK=devnet - - NETWORK=devnet + - NETWORK=${NETWORK:?err} - TENDERMINT_RPC_HOST=drive_tenderdash - TENDERMINT_RPC_PORT=26657 - command: --only core-streams + - DRIVE_RPC_HOST=drive_abci + - DRIVE_RPC_PORT=26670 + expose: + - 3006 + command: yarn run core-streams stop_grace_period: 10s profiles: - platform - dapi_envoy: - image: ${PLATFORM_DAPI_ENVOY_DOCKER_IMAGE:?err} + gateway: + image: ${PLATFORM_GATEWAY_DOCKER_IMAGE:?err} labels: - org.dashmate.service.title: "DAPI Envoy" + org.dashmate.service.title: "Gateway" restart: unless-stopped ports: - - ${PLATFORM_DAPI_ENVOY_HTTP_HOST:?err}:${PLATFORM_DAPI_ENVOY_HTTP_PORT:?err}:10000 # JSON RPC and gRPC Web & Native + # HTTP entry point to the platform. + # Supports HTTP1 and HTTP2 + # Serves JSON RPC, gRPC, and gRPC-Web + - ${PLATFORM_GATEWAY_LISTENERS_DAPI_AND_DRIVE_HOST:?err}:${PLATFORM_GATEWAY_LISTENERS_DAPI_AND_DRIVE_PORT:?err}:10000 + - ${PLATFORM_GATEWAY_METRICS_HOST:?err}:${PLATFORM_GATEWAY_METRICS_PORT:?err}:9090 + - ${PLATFORM_GATEWAY_ADMIN_HOST:?err}:${PLATFORM_GATEWAY_ADMIN_PORT:?err}:9901 depends_on: - dapi_api - - dapi_tx_filter_stream + - dapi_core_streams + - drive_abci + networks: + - default + - gateway_rate_limiter environment: - ENVOY_UID=${LOCAL_UID:?err} - ENVOY_GID=${LOCAL_GID:?err} + - LOG_LEVEL=${PLATFORM_GATEWAY_LOG_LEVEL:?err} volumes: - - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/dapi/envoy/envoy.yaml:/etc/envoy/envoy.yaml:ro - - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/dapi/envoy/ssl/bundle.crt:/etc/ssl/bundle.crt:ro - - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/dapi/envoy/ssl/private.key:/etc/ssl/private.key:ro + - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/gateway/envoy.yaml:/etc/envoy/envoy.yaml:ro + - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/gateway/ssl/bundle.crt:/etc/ssl/bundle.crt:ro + - ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/gateway/ssl/private.key:/etc/ssl/private.key:ro stop_grace_period: 10s profiles: - platform @@ -173,11 +205,13 @@ services: volumes: core_data: drive_abci_data: - drive_abci_logs: drive_tenderdash: networks: default: + driver: bridge ipam: config: - subnet: ${DOCKER_NETWORK_SUBNET:?err} + gateway_rate_limiter: + driver: bridge diff --git a/packages/dashmate/package.json b/packages/dashmate/package.json index 02661e4b7ed..9802e6c4de2 100644 --- a/packages/dashmate/package.json +++ b/packages/dashmate/package.json @@ -1,6 +1,6 @@ { "name": "dashmate", - "version": "0.25.21", + "version": "1.0.0-dev.15", "description": "Distribution package for Dash node installation", "scripts": { "lint": "eslint .", @@ -54,11 +54,10 @@ }, "homepage": "https://github.com/dashevo/dashmate#readme", "dependencies": { - "@babel/core": "^7.23.3", - "@babel/eslint-parser": "^7.23.3", "@dashevo/bls": "~1.2.9", - "@dashevo/dashcore-lib": "~0.21.0", - "@dashevo/dashd-rpc": "^18.2.0", + "@dashevo/dapi-client": "workspace:*", + "@dashevo/dashcore-lib": "~0.21.1", + "@dashevo/dashd-rpc": "^18.3.0", "@dashevo/dashpay-contract": "workspace:*", "@dashevo/docker-compose": "^0.24.4", "@dashevo/dpns-contract": "workspace:*", @@ -72,6 +71,7 @@ "ajv-formats": "^2.1.1", "awilix": "^4.2.6", "begoo": "^2.0.2", + "bs58": "^4.0.1", "chalk": "^4.1.0", "cron": "^2.1.0", "dockerode": "^3.3.5", @@ -98,6 +98,8 @@ "wrap-ansi": "^7.0.0" }, "devDependencies": { + "@babel/core": "^7.23.3", + "@babel/eslint-parser": "^7.23.3", "chai": "^4.3.10", "chai-as-promised": "^7.1.1", "dirty-chai": "^2.0.1", diff --git a/packages/dashmate/scripts/helper.js b/packages/dashmate/scripts/helper.js index 5ed920107c8..6cd9feb9f61 100644 --- a/packages/dashmate/scripts/helper.js +++ b/packages/dashmate/scripts/helper.js @@ -47,8 +47,8 @@ import createDIContainer from '../src/createDIContainer.js'; configFile: asValue(configFile), }); - const provider = config.get('platform.dapi.envoy.ssl.provider'); - const isEnabled = config.get('platform.dapi.envoy.ssl.enabled'); + const provider = config.get('platform.gateway.ssl.provider'); + const isEnabled = config.get('platform.gateway.ssl.enabled'); if (isEnabled && provider === 'zerossl') { const scheduleRenewZeroSslCertificate = container.resolve('scheduleRenewZeroSslCertificate'); diff --git a/packages/dashmate/src/commands/config/render.js b/packages/dashmate/src/commands/config/render.js index 76a2f117dbb..0e9c58ae0bb 100644 --- a/packages/dashmate/src/commands/config/render.js +++ b/packages/dashmate/src/commands/config/render.js @@ -31,6 +31,6 @@ Force dashmate to render all config's service configs writeServiceConfigs(config.getName(), configFiles); // eslint-disable-next-line no-console - console.log(`Config "${config.getName()}" service configs rendered`); + console.log(`"${config.getName()}" service configs rendered`); } } diff --git a/packages/dashmate/src/commands/group/restart.js b/packages/dashmate/src/commands/group/restart.js index c05d8b3c1e0..0ba25f5f8c9 100644 --- a/packages/dashmate/src/commands/group/restart.js +++ b/packages/dashmate/src/commands/group/restart.js @@ -7,6 +7,11 @@ export default class GroupRestartCommand extends GroupBaseCommand { static flags = { ...GroupBaseCommand.flags, + safe: { + char: 's', + description: 'wait for dkg before stop', + default: false, + }, }; /** @@ -21,6 +26,7 @@ export default class GroupRestartCommand extends GroupBaseCommand { async runWithDependencies( args, { + safe: isSafe, verbose: isVerbose, }, dockerCompose, @@ -38,8 +44,8 @@ export default class GroupRestartCommand extends GroupBaseCommand { { title: 'Stop nodes', task: () => ( - // So we stop the miner first, as there's a chance that MNs will get banned - // if the miner is still running when stopping them + // So we stop the miner first, as there's a chance that MNs will get banned + // if the miner is still running when stopping them new Listr(configGroup.reverse().map((config) => ({ task: () => stopNodeTask(config), }))) @@ -66,6 +72,7 @@ export default class GroupRestartCommand extends GroupBaseCommand { try { await tasks.run({ isVerbose, + isSafe, }); } catch (e) { throw new MuteOneLineError(e); diff --git a/packages/dashmate/src/commands/group/stop.js b/packages/dashmate/src/commands/group/stop.js index 149af9cc245..50c5fc6f5b5 100644 --- a/packages/dashmate/src/commands/group/stop.js +++ b/packages/dashmate/src/commands/group/stop.js @@ -13,6 +13,11 @@ export default class GroupStopCommand extends GroupBaseCommand { description: 'force stop even if any is running', default: false, }), + safe: Flags.boolean({ + char: 's', + description: 'wait for dkg before stop', + default: false, + }), }; /** @@ -27,6 +32,7 @@ export default class GroupStopCommand extends GroupBaseCommand { args, { force: isForce, + safe: isSafe, verbose: isVerbose, }, dockerCompose, @@ -63,6 +69,7 @@ export default class GroupStopCommand extends GroupBaseCommand { await tasks.run({ isVerbose, isForce, + isSafe, }); } catch (e) { throw new MuteOneLineError(e); diff --git a/packages/dashmate/src/commands/restart.js b/packages/dashmate/src/commands/restart.js index 4cd5c29252e..903fafd73f4 100644 --- a/packages/dashmate/src/commands/restart.js +++ b/packages/dashmate/src/commands/restart.js @@ -10,6 +10,7 @@ export default class RestartCommand extends ConfigBaseCommand { static flags = { ...ConfigBaseCommand.flags, platform: Flags.boolean({ char: 'p', description: 'restart only platform', default: false }), + safe: Flags.boolean({ char: 's', description: 'wait for dkg before stop', default: false }), }; /** @@ -25,6 +26,7 @@ export default class RestartCommand extends ConfigBaseCommand { { verbose: isVerbose, platform: platformOnly, + safe: isSafe, }, dockerCompose, restartNodeTask, @@ -51,6 +53,7 @@ export default class RestartCommand extends ConfigBaseCommand { try { await tasks.run({ isVerbose, + isSafe, platformOnly: platformOnly === true, }); } catch (e) { diff --git a/packages/dashmate/src/commands/stop.js b/packages/dashmate/src/commands/stop.js index cb1c378b407..1d182ad4ea6 100644 --- a/packages/dashmate/src/commands/stop.js +++ b/packages/dashmate/src/commands/stop.js @@ -19,6 +19,11 @@ export default class StopCommand extends ConfigBaseCommand { description: 'stop only platform', default: false, }), + safe: Flags.boolean({ + char: 's', + description: 'wait for dkg before stop', + default: false, + }), }; /** @@ -32,6 +37,7 @@ export default class StopCommand extends ConfigBaseCommand { args, { force: isForce, + safe: isSafe, verbose: isVerbose, platform: platformOnly, }, @@ -59,6 +65,7 @@ export default class StopCommand extends ConfigBaseCommand { await tasks.run({ isForce, isVerbose, + isSafe, platformOnly: platformOnly === true, }); } catch (e) { diff --git a/packages/dashmate/src/commands/update.js b/packages/dashmate/src/commands/update.js index 8ba5b774d25..dce6b2c6790 100644 --- a/packages/dashmate/src/commands/update.js +++ b/packages/dashmate/src/commands/update.js @@ -35,6 +35,12 @@ export default class UpdateCommand extends ConfigBaseCommand { ) { const updateInfo = await updateNode(config); + const colors = { + updated: chalk.yellow, + 'up to date': chalk.green, + error: chalk.red, + }; + // Draw table or show json printArrayOfObjects(updateInfo .reduce( @@ -43,7 +49,7 @@ export default class UpdateCommand extends ConfigBaseCommand { }) => ([ ...acc, format === OUTPUT_FORMATS.PLAIN - ? { Service: title, Image: image, Updated: updated ? chalk.yellow('updated') : chalk.green('up to date') } + ? { Service: title, Image: image, Updated: colors[updated](updated) } : { name, title, updated, image, }, diff --git a/packages/dashmate/src/config/configJsonSchema.js b/packages/dashmate/src/config/configJsonSchema.js index d60a43e2d9e..b003a4aded4 100644 --- a/packages/dashmate/src/config/configJsonSchema.js +++ b/packages/dashmate/src/config/configJsonSchema.js @@ -50,6 +50,11 @@ export default { required: ['image', 'build'], additionalProperties: false, }, + host: { + type: 'string', + minLength: 1, + format: 'ipv4', + }, port: { type: 'integer', minimum: 0, @@ -74,7 +79,7 @@ export default { }, duration: { type: 'string', - pattern: '^[0-9]+(\\.[0-9]+)?(ms|m|s|h)$', + pattern: '^0|([0-9]+(\\.[0-9]+)?(ms|m|s|h))$', }, optionalDuration: { type: ['null', 'string'], @@ -84,6 +89,22 @@ export default { type: 'string', pattern: '^[0-9]+(\\.[0-9]+)?s$', }, + enabledHostPort: { + type: 'object', + properties: { + enabled: { + type: 'boolean', + }, + host: { + $ref: '#/definitions/host', + }, + port: { + $ref: '#/definitions/port', + }, + }, + additionalProperties: false, + required: ['enabled', 'host', 'port'], + }, }, properties: { description: { @@ -173,9 +194,7 @@ export default { type: 'object', properties: { host: { - type: 'string', - minLength: 1, - format: 'ipv4', + $ref: '#/definitions/host', }, port: { $ref: '#/definitions/port', @@ -347,18 +366,75 @@ export default { platform: { type: 'object', properties: { - dapi: { + gateway: { type: 'object', properties: { - envoy: { + docker: { + $ref: '#/definitions/docker', + }, + maxConnections: { + type: 'integer', + minimum: 1, + description: 'Maximum number of connections that Gateway accepts from downstream clients', + }, + maxHeapSizeInBytes: { + type: 'integer', + minimum: 1, + description: 'Maximum heap size in bytes. If the heap size exceeds this value, Gateway will take actions to reduce memory usage', + }, + upstreams: { type: 'object', properties: { - docker: { - $ref: '#/definitions/docker', + driveGrpc: { + $id: 'gatewayUpstream', + type: 'object', + properties: { + maxRequests: { + type: 'integer', + minimum: 1, + description: 'The maximum number of parallel requests', + }, + }, + required: ['maxRequests'], + additionalProperties: false, + }, + dapiApi: { + $ref: 'gatewayUpstream', + }, + dapiCoreStreams: { + $ref: 'gatewayUpstream', }, - http: { + dapiJsonRpc: { + $ref: 'gatewayUpstream', + }, + }, + additionalProperties: false, + required: ['driveGrpc', 'dapiApi', 'dapiCoreStreams', 'dapiJsonRpc'], + }, + metrics: { + $ref: '#/definitions/enabledHostPort', + }, + admin: { + $ref: '#/definitions/enabledHostPort', + }, + listeners: { + type: 'object', + properties: { + dapiAndDrive: { type: 'object', properties: { + http2: { + type: 'object', + properties: { + maxConcurrentStreams: { + type: 'integer', + minimum: 1, + description: 'Maximum number of concurrent streams allowed for each connection', + }, + }, + additionalProperties: false, + required: ['maxConcurrentStreams'], + }, host: { type: 'string', minLength: 1, @@ -367,87 +443,262 @@ export default { port: { $ref: '#/definitions/port', }, - connectTimeout: { - $ref: '#/definitions/durationInSeconds', - }, - responseTimeout: { - $ref: '#/definitions/durationInSeconds', - }, }, - required: ['host', 'port', 'connectTimeout', 'responseTimeout'], + required: ['http2', 'host', 'port'], additionalProperties: false, }, - rateLimiter: { + }, + required: ['dapiAndDrive'], + additionalProperties: false, + }, + rateLimiter: { + type: 'object', + properties: { + docker: { + $ref: '#/definitions/docker', + }, + unit: { + type: 'string', + enum: ['second', 'minute', 'hour', 'day'], + }, + requestsPerUnit: { + type: 'integer', + minimum: 1, + }, + blacklist: { + type: 'array', + items: { + $ref: '#/definitions/host', + }, + description: 'List of IP addresses that are blacklisted from making requests', + }, + whitelist: { + type: 'array', + items: { + $ref: '#/definitions/host', + }, + description: 'List of IP addresses that are whitelisted to make requests without limits', + }, + metrics: { type: 'object', properties: { - maxTokens: { - type: 'integer', - minimum: 0, - }, - tokensPerFill: { - type: 'integer', - minimum: 0, - }, - fillInterval: { - $ref: '#/definitions/duration', + docker: { + $ref: '#/definitions/docker', }, enabled: { type: 'boolean', }, + host: { + $ref: '#/definitions/host', + }, + port: { + $ref: '#/definitions/port', + }, }, - required: ['enabled', 'fillInterval', 'tokensPerFill', 'maxTokens'], additionalProperties: false, + required: ['docker', 'enabled', 'host', 'port'], + }, + enabled: { + type: 'boolean', + }, + }, + required: ['docker', 'enabled', 'unit', 'requestsPerUnit', 'blacklist', 'whitelist', 'metrics'], + additionalProperties: false, + }, + ssl: { + type: 'object', + properties: { + enabled: { + type: 'boolean', + }, + provider: { + type: 'string', + enum: ['zerossl', 'self-signed', 'file'], }, - ssl: { + providerConfigs: { type: 'object', properties: { - enabled: { - type: 'boolean', - }, - provider: { - type: 'string', - enum: ['zerossl', 'self-signed', 'file'], - }, - providerConfigs: { - type: 'object', + zerossl: { + type: ['object'], properties: { - zerossl: { - type: ['object'], + apiKey: { + type: ['string', 'null'], + minLength: 32, + }, + id: { + type: ['string', 'null'], + minLength: 32, + }, + }, + required: ['apiKey', 'id'], + additionalProperties: false, + }, + }, + }, + }, + required: ['provider', 'providerConfigs', 'enabled'], + additionalProperties: false, + }, + log: { + type: 'object', + properties: { + level: { + type: 'string', + enum: ['trace', 'debug', 'info', 'warn', 'error', 'critical', 'off'], + }, + accessLogs: { + type: 'array', + items: { + oneOf: [ + { + type: 'object', + properties: { + type: { + type: 'string', + minLength: 1, + enum: ['stdout', 'stderr'], + description: 'Access log type: stdout, stderr or file', + }, + format: { + type: 'string', + enum: ['text', 'json'], + }, + template: true, + }, + required: ['type', 'format'], + additionalProperties: false, + if: { + type: 'object', properties: { - apiKey: { - type: ['string', 'null'], - minLength: 32, + format: { + const: 'json', }, - id: { - type: ['string', 'null'], - minLength: 32, + }, + }, + then: { + type: 'object', + properties: { + template: { + type: ['null', 'object'], + additionalProperties: { + type: 'string', + }, + description: 'JSON fields and values. If null, default template is used.', }, }, - required: ['apiKey', 'id'], - additionalProperties: false, + required: ['template'], + }, + else: { + type: 'object', + properties: { + template: { + type: ['null', 'string'], + description: 'Template string. If null, default template is used.', + }, + }, + required: ['template'], }, }, - }, + { + type: 'object', + properties: { + type: { + type: 'string', + const: 'file', + description: 'Access log type: stdout, stderr or file', + }, + format: { + type: 'string', + enum: ['text', 'json'], + }, + path: { + type: 'string', + minLength: 1, + }, + template: true, + }, + required: ['type', 'format', 'path'], + additionalProperties: false, + if: { + type: 'object', + properties: { + format: { + const: 'json', + }, + }, + }, + then: { + type: 'object', + properties: { + template: { + type: ['null', 'object'], + additionalProperties: { + type: 'string', + }, + description: 'JSON fields and values. If null, default template is used.', + }, + }, + required: ['template'], + }, + else: { + type: 'object', + properties: { + template: { + type: ['null', 'string'], + description: 'Template string. If null, default template is used.', + }, + }, + required: ['template'], + }, + }, + ], }, - required: ['provider', 'providerConfigs', 'enabled'], - additionalProperties: false, }, }, - required: ['docker', 'http', 'rateLimiter', 'ssl'], additionalProperties: false, + required: ['level', 'accessLogs'], }, + }, + required: ['docker', 'listeners', 'rateLimiter', 'ssl', 'maxHeapSizeInBytes', 'maxConnections', 'upstreams', 'metrics', 'admin', 'log'], + additionalProperties: false, + }, + dapi: { + type: 'object', + properties: { api: { type: 'object', properties: { docker: { - $ref: '#/definitions/dockerWithBuild', + type: 'object', + properties: { + image: { + type: 'string', + minLength: 1, + }, + deploy: { + type: 'object', + properties: { + replicas: { + type: 'integer', + minimum: 0, + }, + }, + additionalProperties: false, + required: ['replicas'], + }, + build: { + $ref: '#/definitions/dockerBuild', + }, + }, + required: ['image', 'build', 'deploy'], + additionalProperties: false, }, }, required: ['docker'], additionalProperties: false, }, }, - required: ['envoy', 'api'], + required: ['api'], additionalProperties: false, }, drive: { @@ -491,6 +742,27 @@ export default { additionalProperties: false, }, }, + tokioConsole: { + type: 'object', + properties: { + enabled: { + type: 'boolean', + }, + host: { + $ref: '#/definitions/host', + }, + port: { + $ref: '#/definitions/port', + }, + retention: { + type: 'integer', + minimum: 0, + description: 'How many seconds keep data if console is not connected', + }, + }, + required: ['enabled', 'host', 'port', 'retention'], + additionalProperties: false, + }, validatorSet: { type: 'object', properties: { @@ -503,13 +775,36 @@ export default { additionalProperties: false, required: ['llmqType'], }, + chainLock: { + type: 'object', + properties: { + llmqType: { + type: 'number', + // https://github.com/dashpay/dashcore-lib/blob/843176fed9fc81feae43ccf319d99e2dd942fe1f/lib/constants/index.js#L50-L99 + enum: [1, 2, 3, 4, 5, 6, 100, 101, 102, 103, 104, 105, 106, 107], + }, + llmqSize: { + type: 'integer', + minimum: 0, + }, + dkgInterval: { + type: 'integer', + minimum: 0, + }, + }, + additionalProperties: false, + required: ['llmqType', 'llmqSize', 'dkgInterval'], + }, epochTime: { type: 'integer', minimum: 180, }, + metrics: { + $ref: '#/definitions/enabledHostPort', + }, }, additionalProperties: false, - required: ['docker', 'logs', 'validatorSet', 'epochTime'], + required: ['docker', 'logs', 'tokioConsole', 'validatorSet', 'chainLock', 'epochTime', 'metrics'], }, tenderdash: { type: 'object', @@ -566,6 +861,10 @@ export default { mempool: { type: 'object', properties: { + cacheSize: { + type: 'integer', + minimum: 0, + }, size: { type: 'integer', minimum: 0, @@ -574,9 +873,27 @@ export default { type: 'integer', minimum: 0, }, + timeoutCheckTx: { + $ref: '#/definitions/duration', + }, + txEnqueueTimeout: { + $ref: '#/definitions/duration', + }, + txSendRateLimit: { + type: 'integer', + minimum: 0, + }, + txRecvRateLimit: { + type: 'integer', + minimum: 0, + }, + maxConcurrentCheckTx: { + type: 'integer', + minimum: 0, + }, }, additionalProperties: false, - required: ['size', 'maxTxsBytes'], + required: ['size', 'maxTxsBytes', 'cacheSize', 'timeoutCheckTx', 'txEnqueueTimeout', 'txSendRateLimit', 'txRecvRateLimit', 'maxConcurrentCheckTx'], }, consensus: { type: 'object', @@ -684,8 +1001,11 @@ export default { type: 'integer', minimum: 0, }, + timeoutBroadcastTx: { + $ref: '#/definitions/duration', + }, }, - required: ['host', 'port', 'maxOpenConnections'], + required: ['host', 'port', 'maxOpenConnections', 'timeoutBroadcastTx'], additionalProperties: false, }, pprof: { @@ -702,23 +1022,7 @@ export default { additionalProperties: false, }, metrics: { - description: 'Prometheus metrics', - type: 'object', - properties: { - enabled: { - type: 'boolean', - }, - host: { - type: 'string', - minLength: 1, - format: 'ipv4', - }, - port: { - $ref: '#/definitions/port', - }, - }, - required: ['enabled', 'host', 'port'], - additionalProperties: false, + $ref: '#/definitions/enabledHostPort', }, node: { type: 'object', @@ -892,7 +1196,7 @@ export default { type: 'boolean', }, }, - required: ['dapi', 'drive', 'dpns', 'dashpay', 'featureFlags', 'sourcePath', 'masternodeRewardShares', 'withdrawals', 'enable'], + required: ['gateway', 'dapi', 'drive', 'dpns', 'dashpay', 'featureFlags', 'sourcePath', 'masternodeRewardShares', 'withdrawals', 'enable'], additionalProperties: false, }, dashmate: { diff --git a/packages/dashmate/src/config/generateEnvsFactory.js b/packages/dashmate/src/config/generateEnvsFactory.js index 9aedfbb95d6..fcb0491ecf7 100644 --- a/packages/dashmate/src/config/generateEnvsFactory.js +++ b/packages/dashmate/src/config/generateEnvsFactory.js @@ -44,7 +44,7 @@ export default function generateEnvsFactory(configFile, homeDir, getConfigProfil if (config.get('platform.dapi.api.docker.build.enabled')) { dockerComposeFiles.push('docker-compose.build.dapi_api.yml'); - dockerComposeFiles.push('docker-compose.build.dapi_tx_filter_stream.yml'); + dockerComposeFiles.push('docker-compose.build.dapi_core_streams.yml'); } } @@ -56,6 +56,14 @@ export default function generateEnvsFactory(configFile, homeDir, getConfigProfil dockerComposeFiles.push(insightComposeFile); } + if (config.get('platform.gateway.rateLimiter.enabled')) { + dockerComposeFiles.push('docker-compose.rate_limiter.yml'); + + if (config.get('platform.gateway.rateLimiter.metrics.enabled')) { + dockerComposeFiles.push('docker-compose.rate_limiter.metrics.yml'); + } + } + // we need this for compatibility with old configs const projectIdWithPrefix = configFile.getProjectId() ? `_${configFile.getProjectId()}` : ''; @@ -68,6 +76,11 @@ export default function generateEnvsFactory(configFile, homeDir, getConfigProfil tenderdashLogDirectoryPath = path.dirname(tenderdashLogFilePath); } + let driveAbciMetricsUrl = ''; + if (config.get('platform.drive.abci.metrics.enabled')) { + driveAbciMetricsUrl = 'http://0.0.0.0:29090'; + } + return { DASHMATE_HOME_DIR: homeDir.getPath(), LOCAL_UID: uid, @@ -84,6 +97,8 @@ export default function generateEnvsFactory(configFile, homeDir, getConfigProfil ), DASHMATE_HELPER_DOCKER_IMAGE, PLATFORM_DRIVE_TENDERDASH_LOG_DIRECTORY_PATH: tenderdashLogDirectoryPath, + PLATFORM_GATEWAY_RATE_LIMITER_METRICS_DISABLED: !config.get('platform.gateway.rateLimiter.metrics.enabled'), + PLATFORM_DRIVE_ABCI_METRICS_URL: driveAbciMetricsUrl, ...convertObjectToEnvs(config.getOptions()), }; } diff --git a/packages/dashmate/src/constants.js b/packages/dashmate/src/constants.js index b7f7e7c4641..7dc045e3050 100644 --- a/packages/dashmate/src/constants.js +++ b/packages/dashmate/src/constants.js @@ -28,14 +28,19 @@ export const NODE_TYPE_MASTERNODE = 'masternode'; export const NODE_TYPE_FULLNODE = 'fullnode'; export const LLMQ_TYPE_TEST = 'llmq_test'; +export const LLMQ_TYPE_TEST_PLATFORM = 'llmq_test_platform'; export const QUORUM_TYPES = { LLMQ_TYPE_TEST: 100, + LLMQ_TYPE_TEST_PLATFORM: 106, }; export const MASTERNODE_COLLATERAL_AMOUNT = 1000; export const HPMN_COLLATERAL_AMOUNT = 4000; +// number of blocks to wait before core DKG exchange session +export const MIN_BLOCKS_BEFORE_DKG = 6; + export const PACKAGE_ROOT_DIR = path.join(url.fileURLToPath(import.meta.url), '../..'); export const TEMPLATES_DIR = path.join(PACKAGE_ROOT_DIR, 'templates'); diff --git a/packages/dashmate/src/core/CoreService.js b/packages/dashmate/src/core/CoreService.js index 73c2c243156..88bd883bd00 100644 --- a/packages/dashmate/src/core/CoreService.js +++ b/packages/dashmate/src/core/CoreService.js @@ -8,6 +8,7 @@ export default class CoreService { constructor(config, rpcClient, dockerContainer) { this.config = config; this.rpcClient = rpcClient; + rpcClient.setTimeout(240 * 1000); this.dockerContainer = dockerContainer; } diff --git a/packages/dashmate/src/core/quorum/waitForDKGWindowPass.js b/packages/dashmate/src/core/quorum/waitForDKGWindowPass.js new file mode 100644 index 00000000000..21c4f2ccf25 --- /dev/null +++ b/packages/dashmate/src/core/quorum/waitForDKGWindowPass.js @@ -0,0 +1,40 @@ +import { MIN_BLOCKS_BEFORE_DKG } from '../../constants.js'; +import wait from '../../util/wait.js'; + +/** + * @param {RpcClient} rpcClient + * @return {Promise} + */ +export default async function waitForDKGWindowPass(rpcClient) { + let startBlockCount; + let startNextDkg; + + let isInDKG = true; + + do { + const [currentBlockCount, currentDkgInfo] = await Promise + .all([rpcClient.getBlockCount(), rpcClient.quorum('dkginfo')]); + + const { result: blockCount } = currentBlockCount; + const { result: dkgInfo } = currentDkgInfo; + + const { next_dkg: nextDkg } = dkgInfo; + + if (!startBlockCount) { + startBlockCount = blockCount; + } + + if (!startNextDkg) { + startNextDkg = nextDkg; + } + + isInDKG = nextDkg <= MIN_BLOCKS_BEFORE_DKG; + + if (isInDKG && blockCount > startBlockCount + startNextDkg + 1) { + throw new Error(`waitForDKGWindowPass deadline exceeded: dkg did not happen for ${startBlockCount + nextDkg + 1} ${startNextDkg + 1} blocks`); + } + + await wait(10000); + } + while (isInDKG); +} diff --git a/packages/dashmate/src/core/waitForMasternodesSync.js b/packages/dashmate/src/core/waitForMasternodesSync.js index fdb686cd177..8f115410ea2 100644 --- a/packages/dashmate/src/core/waitForMasternodesSync.js +++ b/packages/dashmate/src/core/waitForMasternodesSync.js @@ -15,9 +15,17 @@ export default async function waitForMasternodesSync(rpcClient, progressCallback do { try { await rpcClient.mnsync('next'); + + ({ + result: { IsSynced: isSynced }, + } = await rpcClient.mnsync('status')); + + ({ + result: { verificationprogress: verificationProgress }, + } = await rpcClient.getBlockchainInfo()); } catch (e) { // Core RPC is not started yet - if (!e.message.includes('Dash JSON-RPC: Request Error: ') && e.code !== -28) { + if (!e.message.includes('Dash JSON-RPC: Request Error: ') && !e.message.includes('Timeout') && e.code !== -28) { throw e; } @@ -29,13 +37,6 @@ export default async function waitForMasternodesSync(rpcClient, progressCallback continue; } - ({ - result: { IsSynced: isSynced }, - } = await rpcClient.mnsync('status')); - ({ - result: { verificationprogress: verificationProgress }, - } = await rpcClient.getBlockchainInfo()); - if (!isSynced) { progressCallback(verificationProgress); diff --git a/packages/dashmate/src/core/wallet/registerMasternode.js b/packages/dashmate/src/core/wallet/registerMasternode.js index d5d2dba2759..285c65409bd 100644 --- a/packages/dashmate/src/core/wallet/registerMasternode.js +++ b/packages/dashmate/src/core/wallet/registerMasternode.js @@ -46,7 +46,7 @@ export default async function registerMasternode( if (hp) { const platformNodeId = config.get('platform.drive.tenderdash.node.id'); const platformP2PPort = config.get('platform.drive.tenderdash.p2p.port'); - const platformHttpPort = config.get('platform.dapi.envoy.http.port'); + const platformHttpPort = config.get('platform.gateway.listeners.dapiAndDrive.port'); proTxArgs.push(platformNodeId); proTxArgs.push(platformP2PPort.toString()); diff --git a/packages/dashmate/src/helper/scheduleRenewZeroSslCertificateFactory.js b/packages/dashmate/src/helper/scheduleRenewZeroSslCertificateFactory.js index a594315ef14..8b490c6b3e9 100644 --- a/packages/dashmate/src/helper/scheduleRenewZeroSslCertificateFactory.js +++ b/packages/dashmate/src/helper/scheduleRenewZeroSslCertificateFactory.js @@ -26,8 +26,8 @@ export default function scheduleRenewZeroSslCertificateFactory( */ async function scheduleRenewZeroSslCertificate(config) { const certificate = await getCertificate( - config.get('platform.dapi.envoy.ssl.providerConfigs.zerossl.apiKey', false), - config.get('platform.dapi.envoy.ssl.providerConfigs.zerossl.id', false), + config.get('platform.gateway.ssl.providerConfigs.zerossl.apiKey', false), + config.get('platform.gateway.ssl.providerConfigs.zerossl.id', false), ); if (!certificate) { @@ -61,8 +61,11 @@ export default function scheduleRenewZeroSslCertificateFactory( configFileRepository.write(configFile); writeConfigTemplates(config); - // Restart Envoy to catch up new SSL certificates - await dockerCompose.execCommand(config, 'dapi_envoy', 'kill -SIGHUP 1'); + // TODO: We can use https://www.envoyproxy.io/docs/envoy/v1.30.1/start/quick-start/configuration-dynamic-filesystem.html#start-quick-start-dynamic-fs-dynamic-lds + // to dynamically update envoy configuration without restarting it + + // Restart Gateway to catch up new SSL certificates + await dockerCompose.execCommand(config, 'gateway', 'kill -SIGHUP 1'); return job.stop(); }, async () => { diff --git a/packages/dashmate/src/listr/prompts/createIpAndPortsForm.js b/packages/dashmate/src/listr/prompts/createIpAndPortsForm.js index 1a2495b8f36..ac93be1a621 100644 --- a/packages/dashmate/src/listr/prompts/createIpAndPortsForm.js +++ b/packages/dashmate/src/listr/prompts/createIpAndPortsForm.js @@ -107,7 +107,7 @@ export default function createIpAndPortsFormFactory(defaultConfigs) { if (initialPlatformHTTPPort === null || initialPlatformHTTPPort === undefined || network === PRESET_MAINNET) { - initialPlatformHTTPPort = defaultConfigs.get(network).get('platform.dapi.envoy.http.port').toString(); + initialPlatformHTTPPort = defaultConfigs.get(network).get('platform.gateway.listeners.dapiAndDrive.port').toString(); } fields.push({ diff --git a/packages/dashmate/src/listr/tasks/platform/waitForNodeToBeReadyTaskFactory.js b/packages/dashmate/src/listr/tasks/platform/waitForNodeToBeReadyTaskFactory.js index 371097e0612..7953d4bcd1a 100644 --- a/packages/dashmate/src/listr/tasks/platform/waitForNodeToBeReadyTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/platform/waitForNodeToBeReadyTaskFactory.js @@ -1,14 +1,14 @@ +import DAPIClient from '@dashevo/dapi-client'; +import bs58 from 'bs58'; import { Listr } from 'listr2'; +import WithdrawalsContract from '@dashevo/withdrawals-contract/lib/systemIds.js'; import wait from '../../../util/wait.js'; /** * - * @param {createTenderdashRpcClient} createTenderdashRpcClient * @return {waitForNodeToBeReadyTask} */ -export default function waitForNodeToBeReadyTaskFactory( - createTenderdashRpcClient, -) { +export default function waitForNodeToBeReadyTaskFactory() { /** * @typedef waitForNodeToBeReadyTask * @param {Config} config @@ -19,18 +19,32 @@ export default function waitForNodeToBeReadyTaskFactory( { title: `Wait for node ${config.getName()} to be ready`, task: async () => { - const host = config.get('platform.drive.tenderdash.rpc.host'); - const port = config.get('platform.drive.tenderdash.rpc.port'); + let host = config.get('platform.gateway.listeners.dapiAndDrive.host'); + const port = config.get('platform.gateway.listeners.dapiAndDrive.port'); - const tenderdashRpcClient = createTenderdashRpcClient({ host, port }); + if (host === '0.0.0.0') { + host = '127.0.0.1'; + } + + const dapiClient = new DAPIClient({ + dapiAddresses: [`${host}:${port}:no-ssl`], + loggerOptions: { + level: 'silent', + }, + }); + + const withdrawalsContractId = bs58.decode(WithdrawalsContract.contractId); let success = false; do { - const response = await tenderdashRpcClient.request('status', {}).catch(() => {}); + const response = await dapiClient.platform.getDataContract(withdrawalsContractId, { + retries: 0, + prove: false, + }) + .catch(() => { + }); - if (response) { - success = !response.result.sync_info.catching_up; - } + success = Boolean(response); if (!success) { await wait(500); diff --git a/packages/dashmate/src/listr/tasks/setup/local/enableCoreQuorumsTaskFactory.js b/packages/dashmate/src/listr/tasks/setup/local/enableCoreQuorumsTaskFactory.js index 78d7c11788d..9dd3f68699a 100644 --- a/packages/dashmate/src/listr/tasks/setup/local/enableCoreQuorumsTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/setup/local/enableCoreQuorumsTaskFactory.js @@ -1,15 +1,11 @@ import { Listr } from 'listr2'; -import lodash from 'lodash'; -import { LLMQ_TYPE_TEST, NETWORK_LOCAL } from '../../../../constants.js'; +import { LLMQ_TYPE_TEST_PLATFORM, NETWORK_LOCAL } from '../../../../constants.js'; import waitForNodesToHaveTheSameHeight from '../../../../core/waitForNodesToHaveTheSameHeight.js'; import waitForQuorumPhase from '../../../../core/quorum/waitForQuorumPhase.js'; import waitForQuorumConnections from '../../../../core/quorum/waitForQuorumConnections.js'; import waitForQuorumCommitments from '../../../../core/quorum/waitForQuorumCommitements.js'; import wait from '../../../../util/wait.js'; import waitForMasternodeProbes from '../../../../core/quorum/waitForMasternodeProbes.js'; - -const { isEqual } = lodash; - /** * @param {generateBlocks} generateBlocks * @return {enableCoreQuorumsTask} @@ -245,8 +241,9 @@ export default function enableCoreQuorumsTaskFactory(generateBlocks) { ); let { result: newQuorumList } = await ctx.seedRpcClient.quorum('list'); + let testPlatformQuorumEnabled = !!newQuorumList[LLMQ_TYPE_TEST_PLATFORM][0]; - while (isEqual(ctx.initialQuorumList, newQuorumList)) { + while (!testPlatformQuorumEnabled) { await wait(300); await ctx.bumpMockTime(); @@ -263,12 +260,13 @@ export default function enableCoreQuorumsTaskFactory(generateBlocks) { ); ({ result: newQuorumList } = await ctx.seedRpcClient.quorum('list')); + testPlatformQuorumEnabled = !!newQuorumList[LLMQ_TYPE_TEST_PLATFORM][0]; } const { result: quorumList } = await ctx.seedRpcClient.quorum('list', 1); // eslint-disable-next-line prefer-destructuring - ctx.quorumHash = quorumList[LLMQ_TYPE_TEST][0]; + ctx.quorumHash = quorumList[LLMQ_TYPE_TEST_PLATFORM][0]; const llmqType = ctx.masternodeCoreServices[0].getConfig().get('platform.drive.abci.validatorSet.llmqType'); diff --git a/packages/dashmate/src/listr/tasks/setup/regular/configureNodeTaskFactory.js b/packages/dashmate/src/listr/tasks/setup/regular/configureNodeTaskFactory.js index bdcbc554d8b..3c227b1d50d 100644 --- a/packages/dashmate/src/listr/tasks/setup/regular/configureNodeTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/setup/regular/configureNodeTaskFactory.js @@ -86,7 +86,7 @@ export default function configureNodeTaskFactory(createIpAndPortsForm) { ctx.config.set('core.p2p.port', form.coreP2PPort); if (ctx.isHP) { - ctx.config.set('platform.dapi.envoy.http.port', form.platformHTTPPort); + ctx.config.set('platform.gateway.listeners.dapiAndDrive.port', form.platformHTTPPort); ctx.config.set('platform.drive.tenderdash.p2p.port', form.platformP2PPort); } } diff --git a/packages/dashmate/src/listr/tasks/setup/regular/configureSSLCertificateTaskFactory.js b/packages/dashmate/src/listr/tasks/setup/regular/configureSSLCertificateTaskFactory.js index f489be8de39..62c9f154d0d 100644 --- a/packages/dashmate/src/listr/tasks/setup/regular/configureSSLCertificateTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/setup/regular/configureSSLCertificateTaskFactory.js @@ -91,7 +91,7 @@ export default function configureSSLCertificateTaskFactory( }, }); - ctx.config.set('platform.dapi.envoy.ssl.providerConfigs.zerossl.apiKey', apiKey); + ctx.config.set('platform.gateway.ssl.providerConfigs.zerossl.apiKey', apiKey); return obtainZeroSSLCertificateTask(ctx.config); }, @@ -141,7 +141,7 @@ export default function configureSSLCertificateTaskFactory( }); } - ctx.config.set('platform.dapi.envoy.ssl.provider', ctx.certificateProvider); + ctx.config.set('platform.gateway.ssl.provider', ctx.certificateProvider); // eslint-disable-next-line no-param-reassign task.output = ctx.certificateProvider; diff --git a/packages/dashmate/src/listr/tasks/setup/regular/getConfigurationOutputFromContext.js b/packages/dashmate/src/listr/tasks/setup/regular/getConfigurationOutputFromContext.js index de7f2be9631..d9cb36a9cbc 100644 --- a/packages/dashmate/src/listr/tasks/setup/regular/getConfigurationOutputFromContext.js +++ b/packages/dashmate/src/listr/tasks/setup/regular/getConfigurationOutputFromContext.js @@ -23,7 +23,7 @@ export default async function getConfigurationOutputFromContext(ctx) { if (ctx.isHP) { output += `\n\nPlatform P2P port: ${ctx.config.get('platform.drive.tenderdash.p2p.port')} - Platform HTTP port: ${ctx.config.get('platform.dapi.envoy.http.port')}`; + Platform HTTP port: ${ctx.config.get('platform.gateway.listeners.dapiAndDrive.port')}`; } return output; diff --git a/packages/dashmate/src/listr/tasks/setup/regular/registerMasternode/registerMasternodeWithCoreWallet.js b/packages/dashmate/src/listr/tasks/setup/regular/registerMasternode/registerMasternodeWithCoreWallet.js index 8688af05bd7..dda9811bcf3 100644 --- a/packages/dashmate/src/listr/tasks/setup/regular/registerMasternode/registerMasternodeWithCoreWallet.js +++ b/packages/dashmate/src/listr/tasks/setup/regular/registerMasternode/registerMasternodeWithCoreWallet.js @@ -218,7 +218,7 @@ export default function registerMasternodeWithCoreWalletFactory(createIpAndPorts const platformHTTPPort = state.ipAndPorts.platformHTTPPort || defaultConfigs.get(ctx.preset) - .get('platform.dapi.envoy.http.port'); + .get('platform.gateway.listeners.dapiAndDrive.port'); let command; if (ctx.isHP) { diff --git a/packages/dashmate/src/listr/tasks/setup/regular/registerMasternodeGuideTaskFactory.js b/packages/dashmate/src/listr/tasks/setup/regular/registerMasternodeGuideTaskFactory.js index b65c2c84bfb..ce358f56fd4 100644 --- a/packages/dashmate/src/listr/tasks/setup/regular/registerMasternodeGuideTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/setup/regular/registerMasternodeGuideTaskFactory.js @@ -73,7 +73,7 @@ export default function registerMasternodeGuideTaskFactory( ctx.config.set('platform.drive.tenderdash.node.id', deriveTenderdashNodeId(state.platformNodeKey)); ctx.config.set('platform.drive.tenderdash.node.key', state.platformNodeKey); - ctx.config.set('platform.dapi.envoy.http.port', state.ipAndPorts.platformHTTPPort); + ctx.config.set('platform.gateway.listeners.dapiAndDrive.port', state.ipAndPorts.platformHTTPPort); ctx.config.set('platform.drive.tenderdash.p2p.port', state.ipAndPorts.platformP2PPort); } diff --git a/packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js b/packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js index 0c0efc53e6a..51e9918a06d 100644 --- a/packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js @@ -77,7 +77,8 @@ export default function setupLocalPresetTaskFactory( ctx.minerInterval = await task.prompt({ type: 'input', message: 'Enter the interval between core blocks', - initial: configFile.getConfig('base').get('core.miner.interval'), + initial: configFile.getConfig('base') + .get('core.miner.interval'), validate: (state) => { if (state.match(/\d+(\.\d+)?([ms])/)) { return true; @@ -178,7 +179,8 @@ export default function setupLocalPresetTaskFactory( config.set('core.rpc.password', generateRandomString(12)); config.set('externalIp', hostDockerInternalIp); - const subnet = config.get('docker.network.subnet').split('.'); + const subnet = config.get('docker.network.subnet') + .split('.'); subnet[2] = nodeIndex; config.set('docker.network.subnet', subnet.join('.')); @@ -212,21 +214,26 @@ export default function setupLocalPresetTaskFactory( } else { config.set('description', `local node #${nodeIndex}`); + config.set('platform.drive.tenderdash.mode', 'validator'); + const key = generateTenderdashNodeKey(); const id = deriveTenderdashNodeId(key); config.set('platform.drive.tenderdash.node.id', id); config.set('platform.drive.tenderdash.node.key', key); - config.set('platform.dapi.envoy.http.port', config.get('platform.dapi.envoy.http.port') + (i * 100)); + config.set('platform.drive.abci.tokioConsole.port', config.get('platform.drive.abci.tokioConsole.port') + (i * 100)); + config.set('platform.drive.abci.metrics.port', config.get('platform.drive.abci.metrics.port') + (i * 100)); + config.set('platform.gateway.admin.port', config.get('platform.gateway.admin.port') + (i * 100)); + config.set('platform.gateway.listeners.dapiAndDrive.port', config.get('platform.gateway.listeners.dapiAndDrive.port') + (i * 100)); + config.set('platform.gateway.metrics.port', config.get('platform.gateway.metrics.port') + (i * 100)); + config.set('platform.gateway.rateLimiter.metrics.port', config.get('platform.gateway.rateLimiter.metrics.port') + (i * 100)); config.set('platform.drive.tenderdash.p2p.port', config.get('platform.drive.tenderdash.p2p.port') + (i * 100)); config.set('platform.drive.tenderdash.rpc.port', config.get('platform.drive.tenderdash.rpc.port') + (i * 100)); config.set('platform.drive.tenderdash.pprof.port', config.get('platform.drive.tenderdash.pprof.port') + (i * 100)); config.set('platform.drive.tenderdash.metrics.port', config.get('platform.drive.tenderdash.metrics.port') + (i * 100)); config.set('platform.drive.tenderdash.moniker', config.name); - config.set('platform.drive.tenderdash.mode', 'validator'); - // Setup logs if (ctx.debugLogs) { const stdoutLogger = config.get('platform.drive.abci.logs.stdout'); @@ -239,26 +246,37 @@ export default function setupLocalPresetTaskFactory( config.set('platform.drive.tenderdash.log.level', 'debug'); } - config.set('platform.dpns.masterPublicKey', dpnsDerivedMasterPrivateKey.privateKey.toPublicKey().toString()); - config.set('platform.dpns.secondPublicKey', dpnsDerivedSecondPrivateKey.privateKey.toPublicKey().toString()); + config.set('platform.dpns.masterPublicKey', dpnsDerivedMasterPrivateKey.privateKey.toPublicKey() + .toString()); + config.set('platform.dpns.secondPublicKey', dpnsDerivedSecondPrivateKey.privateKey.toPublicKey() + .toString()); - config.set('platform.featureFlags.masterPublicKey', featureFlagsDerivedMasterPrivateKey.privateKey.toPublicKey().toString()); - config.set('platform.featureFlags.secondPublicKey', featureFlagsDerivedSecondPrivateKey.privateKey.toPublicKey().toString()); + config.set('platform.featureFlags.masterPublicKey', featureFlagsDerivedMasterPrivateKey.privateKey.toPublicKey() + .toString()); + config.set('platform.featureFlags.secondPublicKey', featureFlagsDerivedSecondPrivateKey.privateKey.toPublicKey() + .toString()); - config.set('platform.dashpay.masterPublicKey', dashpayDerivedMasterPrivateKey.privateKey.toPublicKey().toString()); - config.set('platform.dashpay.secondPublicKey', dashpayDerivedSecondPrivateKey.privateKey.toPublicKey().toString()); + config.set('platform.dashpay.masterPublicKey', dashpayDerivedMasterPrivateKey.privateKey.toPublicKey() + .toString()); + config.set('platform.dashpay.secondPublicKey', dashpayDerivedSecondPrivateKey.privateKey.toPublicKey() + .toString()); - config.set('platform.withdrawals.masterPublicKey', withdrawalsDerivedMasterPrivateKey.privateKey.toPublicKey().toString()); - config.set('platform.withdrawals.secondPublicKey', withdrawalsDerivedSecondPrivateKey.privateKey.toPublicKey().toString()); + config.set('platform.withdrawals.masterPublicKey', withdrawalsDerivedMasterPrivateKey.privateKey.toPublicKey() + .toString()); + config.set('platform.withdrawals.secondPublicKey', withdrawalsDerivedSecondPrivateKey.privateKey.toPublicKey() + .toString()); config.set( 'platform.masternodeRewardShares.masterPublicKey', masternodeRewardSharesDerivedMasterPrivateKey.privateKey - .toPublicKey().toString(), - ); config.set( + .toPublicKey() + .toString(), + ); + config.set( 'platform.masternodeRewardShares.secondPublicKey', masternodeRewardSharesDerivedSecondPrivateKey.privateKey - .toPublicKey().toString(), + .toPublicKey() + .toString(), ); } }, @@ -290,8 +308,7 @@ export default function setupLocalPresetTaskFactory( const subTasks = platformConfigs.map((config) => ({ title: `Generate certificate for ${config.getName()}`, task: async () => obtainSelfSignedCertificateTask(config), - } - )); + })); return new Listr(subTasks); }, diff --git a/packages/dashmate/src/listr/tasks/ssl/VerificationServer.js b/packages/dashmate/src/listr/tasks/ssl/VerificationServer.js index 738c427611c..eba5de00e46 100644 --- a/packages/dashmate/src/listr/tasks/ssl/VerificationServer.js +++ b/packages/dashmate/src/listr/tasks/ssl/VerificationServer.js @@ -39,8 +39,8 @@ export default class VerificationServer { dots.templateSettings.strip = false; - // Set up Envoy config - const configSubPath = path.join('platform', 'dapi', 'envoy'); + // Set up Gateway config + const configSubPath = path.join('platform', 'gateway'); const templatePath = path.join(TEMPLATES_DIR, configSubPath, '_zerossl_validation.yaml.dot'); const templateString = fs.readFileSync(templatePath, 'utf-8'); const template = dots.template(templateString); @@ -48,9 +48,9 @@ export default class VerificationServer { const route = validationUrl.replace(`http://${config.get('externalIp')}`, ''); const body = validationContent.join('\\n'); - const envoyConfig = template({ route, body }); + const gatewayConfig = template({ route, body }); - const configDir = this.homeDir.joinPath(config.getName(), 'platform', 'dapi', 'envoy'); + const configDir = this.homeDir.joinPath(config.getName(), 'platform', 'gateway'); const configName = path.basename(templatePath, '.dot'); this.configPath = path.join(configDir, configName); @@ -59,7 +59,7 @@ export default class VerificationServer { fs.mkdirSync(configDir); } fs.rmSync(this.configPath, { force: true }); - fs.writeFileSync(this.configPath, envoyConfig, 'utf8'); + fs.writeFileSync(this.configPath, gatewayConfig, 'utf8'); } /** @@ -76,7 +76,7 @@ export default class VerificationServer { return false; } - const image = this.config.get('platform.dapi.envoy.docker.image'); + const image = this.config.get('platform.gateway.docker.image'); const name = 'dashmate-zerossl-validation'; diff --git a/packages/dashmate/src/listr/tasks/ssl/saveCertificateTask.js b/packages/dashmate/src/listr/tasks/ssl/saveCertificateTask.js index b3096936c40..bbcfac1ea04 100644 --- a/packages/dashmate/src/listr/tasks/ssl/saveCertificateTask.js +++ b/packages/dashmate/src/listr/tasks/ssl/saveCertificateTask.js @@ -20,8 +20,7 @@ export default function saveCertificateTaskFactory(homeDir) { const certificatesDir = homeDir.joinPath( config.getName(), 'platform', - 'dapi', - 'envoy', + 'gateway', 'ssl', ); @@ -34,7 +33,7 @@ export default function saveCertificateTaskFactory(homeDir) { const keyFile = path.join(certificatesDir, 'private.key'); fs.writeFileSync(keyFile, ctx.privateKeyFile, 'utf8'); - config.set('platform.dapi.envoy.ssl.enabled', true); + config.set('platform.gateway.ssl.enabled', true); }, }]); } diff --git a/packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js b/packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js index 16e5c669339..12718ad4de4 100644 --- a/packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js @@ -37,10 +37,10 @@ export default function obtainZeroSSLCertificateTaskFactory( */ async function obtainZeroSSLCertificateTask(config) { // Make sure that required config options are set - const apiKey = config.get('platform.dapi.envoy.ssl.providerConfigs.zerossl.apiKey', true); + const apiKey = config.get('platform.gateway.ssl.providerConfigs.zerossl.apiKey', true); const externalIp = config.get('externalIp', true); - const sslConfigDir = homeDir.joinPath(config.getName(), 'platform', 'dapi', 'envoy', 'ssl'); + const sslConfigDir = homeDir.joinPath(config.getName(), 'platform', 'gateway', 'ssl'); const csrFilePath = path.join(sslConfigDir, 'csr.pem'); const privateKeyFilePath = path.join(sslConfigDir, 'private.key'); const bundleFilePath = path.join(sslConfigDir, 'bundle.crt'); @@ -54,7 +54,7 @@ export default function obtainZeroSSLCertificateTaskFactory( // Skips the check if force flag is set skip: (ctx) => ctx.force, task: async (ctx, task) => { - const certificateId = await config.get('platform.dapi.envoy.ssl.providerConfigs.zerossl.id'); + const certificateId = await config.get('platform.gateway.ssl.providerConfigs.zerossl.id'); if (!certificateId) { // Certificate is not configured @@ -179,9 +179,9 @@ export default function obtainZeroSSLCertificateTaskFactory( apiKey, ); - config.set('platform.dapi.envoy.ssl.enabled', true); - config.set('platform.dapi.envoy.ssl.provider', 'zerossl'); - config.set('platform.dapi.envoy.ssl.providerConfigs.zerossl.id', ctx.certificate.id); + config.set('platform.gateway.ssl.enabled', true); + config.set('platform.gateway.ssl.provider', 'zerossl'); + config.set('platform.gateway.ssl.providerConfigs.zerossl.id', ctx.certificate.id); }, }, { diff --git a/packages/dashmate/src/listr/tasks/startNodeTaskFactory.js b/packages/dashmate/src/listr/tasks/startNodeTaskFactory.js index ac2ea87a0c3..9c0308b28cb 100644 --- a/packages/dashmate/src/listr/tasks/startNodeTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/startNodeTaskFactory.js @@ -45,16 +45,22 @@ export default function startNodeTaskFactory( // Check Drive log files are created if (config.get('platform.enable')) { + // Ensure log files for Drive are created const loggers = config.get('platform.drive.abci.logs'); - - for (const logger of Object.values(loggers)) { - if (['stdout', 'stderr'].includes(logger.destination)) { - continue; - } - - ensureFileMountExists(logger.destination, 0o666); - } - + Object.values(loggers) + .filter((logger) => logger.destination !== 'stdout' && logger.destination !== 'stderr') + .forEach((logger) => { + ensureFileMountExists(logger.destination, 0o666); + }); + + // Ensure access log files for Gateway are created + config.get('platform.gateway.log.accessLogs') + .filter((log) => log.type === 'file') + .forEach((log) => { + ensureFileMountExists(log.path, 0o666); + }); + + // Ensure tenderdash log file is created const tenderdashLogFilePath = config.get('platform.drive.tenderdash.log.path'); if (tenderdashLogFilePath !== null) { ensureFileMountExists(tenderdashLogFilePath, 0o666); diff --git a/packages/dashmate/src/listr/tasks/stopNodeTaskFactory.js b/packages/dashmate/src/listr/tasks/stopNodeTaskFactory.js index 9fe5f4dbda2..12461d60b16 100644 --- a/packages/dashmate/src/listr/tasks/stopNodeTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/stopNodeTaskFactory.js @@ -1,4 +1,7 @@ +/* eslint-disable no-console */ import { Listr } from 'listr2'; +import { MIN_BLOCKS_BEFORE_DKG } from '../../constants.js'; +import waitForDKGWindowPass from '../../core/quorum/waitForDKGWindowPass.js'; /** * @param {DockerCompose} dockerCompose @@ -34,6 +37,36 @@ export default function stopNodeTaskFactory( } }, }, + { + title: 'Check node is participating in DKG', + enabled: (ctx) => config.get('core.masternode.enable') && !ctx.isForce && !ctx.isSafe, + task: async () => { + const rpcClient = createRpcClient({ + port: config.get('core.rpc.port'), + user: config.get('core.rpc.user'), + pass: config.get('core.rpc.password'), + host: await getConnectionHost(config, 'core', 'core.rpc.host'), + }); + + const { result: dkgInfo } = await rpcClient.quorum('dkginfo'); + const { next_dkg: nextDkg } = dkgInfo; + + if (nextDkg <= MIN_BLOCKS_BEFORE_DKG) { + throw new Error('Your node is currently participating in DKG exchange session and ' + + 'stopping it right now may result in PoSE ban. Try again later, or continue with --force or --safe flags'); + } + }, + }, + { + title: 'Wait for DKG window to pass', + enabled: (ctx) => config.get('core.masternode.enable') && !ctx.isForce && ctx.isSafe, + task: async () => waitForDKGWindowPass(createRpcClient({ + port: config.get('core.rpc.port'), + user: config.get('core.rpc.user'), + pass: config.get('core.rpc.password'), + host: await getConnectionHost(config, 'core', 'core.rpc.host'), + })), + }, { title: 'Save core node time', enabled: () => config.get('group') === 'local', @@ -58,7 +91,6 @@ export default function stopNodeTaskFactory( if (ctx.platformOnly) { profiles.push('platform'); } - await dockerCompose.stop(config, { profiles }); }, }, diff --git a/packages/dashmate/src/status/scopes/platform.js b/packages/dashmate/src/status/scopes/platform.js index 74d961e63c4..b826775229d 100644 --- a/packages/dashmate/src/status/scopes/platform.js +++ b/packages/dashmate/src/status/scopes/platform.js @@ -77,7 +77,7 @@ export default function getPlatformScopeFactory( // Collecting platform data fails if Tenderdash is waiting for core to sync if (info.serviceStatus === ServiceStatusEnum.up) { const portStatusResult = await Promise.allSettled([ - providers.mnowatch.checkPortStatus(config.get('platform.dapi.envoy.http.port')), + providers.mnowatch.checkPortStatus(config.get('platform.gateway.listeners.dapiAndDrive.port')), providers.mnowatch.checkPortStatus(config.get('platform.drive.tenderdash.p2p.port')), ]); const [httpPortState, p2pPortState] = portStatusResult.map((result) => (result.status === 'fulfilled' ? result.value : null)); @@ -115,6 +115,10 @@ export default function getPlatformScopeFactory( const platformPeers = parseInt(tenderdashNetInfo.n_peers, 10); const { listening } = tenderdashNetInfo; + if (catchingUp) { + info.serviceStatus = ServiceStatusEnum.syncing; + } + info.version = version; info.listening = listening; info.latestBlockHeight = latestBlockHeight; @@ -181,7 +185,7 @@ export default function getPlatformScopeFactory( * @returns {Promise} */ async function getPlatformScope(config) { - const httpPort = config.get('platform.dapi.envoy.http.port'); + const httpPort = config.get('platform.gateway.listeners.dapiAndDrive.port'); const httpService = config.get('externalIp') ? `${config.get('externalIp')}:${httpPort}` : null; const p2pPort = config.get('platform.drive.tenderdash.p2p.port'); const p2pService = config.get('externalIp') ? `${config.get('externalIp')}:${p2pPort}` : null; diff --git a/packages/dashmate/src/test/constants/services.js b/packages/dashmate/src/test/constants/services.js index 1b29357cbbb..beb3d1d9aaf 100644 --- a/packages/dashmate/src/test/constants/services.js +++ b/packages/dashmate/src/test/constants/services.js @@ -1,9 +1,9 @@ export default { dashmate_helper: 'Dashmate Helper', - dapi_envoy: 'DAPI Envoy', + gateway: 'Gateway', dapi_api: 'DAPI API', drive_tenderdash: 'Drive Tenderdash', drive_abci: 'Drive ABCI', - dapi_tx_filter_stream: 'DAPI Transactions Filter Stream', + dapi_core_streams: 'DAPI Core Streams', core: 'Core', }; diff --git a/packages/dashmate/src/test/mock/getConfigMock.js b/packages/dashmate/src/test/mock/getConfigMock.js index 0e30ce5e0b4..1961c48f289 100644 --- a/packages/dashmate/src/test/mock/getConfigMock.js +++ b/packages/dashmate/src/test/mock/getConfigMock.js @@ -9,11 +9,11 @@ export default function getConfigMock(sinon) { configMock.get.withArgs('core.rpc.host').returns('127.0.0.1'); configMock.get.withArgs('docker.network.privateInterface').returns('127.0.0.1'); configMock.get.withArgs('docker.network.privateInterface').returns('127.0.0.1'); - configMock.get.withArgs('platform.dapi.envoy.http.port').returns('8100'); + configMock.get.withArgs('platform.gateway.listeners.dapiAndDrive.port').returns('8100'); configMock.get.withArgs('externalIp').returns('127.0.0.1'); configMock.get.withArgs('platform.drive.tenderdash.p2p.port').returns('8101'); - configMock.get.withArgs('platform.dapi.envoy.http.host').returns('0.0.0.0'); - configMock.get.withArgs('platform.dapi.envoy.http.port').returns('8102'); + configMock.get.withArgs('platform.gateway.listeners.dapiAndDrive.host').returns('0.0.0.0'); + configMock.get.withArgs('platform.gateway.listeners.dapiAndDrive.port').returns('8102'); configMock.get.withArgs('platform.drive.tenderdash.rpc.host').returns('127.0.0.1'); configMock.get.withArgs('platform.drive.tenderdash.rpc.port').returns('8103'); configMock.get.withArgs('platform.enable').returns(true); diff --git a/packages/dashmate/src/update/updateNodeFactory.js b/packages/dashmate/src/update/updateNodeFactory.js index 79996a2511d..9ce4fb126a4 100644 --- a/packages/dashmate/src/update/updateNodeFactory.js +++ b/packages/dashmate/src/update/updateNodeFactory.js @@ -19,10 +19,17 @@ export default function updateNodeFactory(getServiceList, docker) { return Promise.all( lodash.uniqBy(services, 'image') - .map(async ({ name, image, title }) => new Promise((resolve, reject) => { + .map(async ({ name, image, title }) => new Promise((resolve) => { docker.pull(image, (err, stream) => { if (err) { - reject(err); + if (process.env.DEBUG) { + // eslint-disable-next-line no-console + console.error(`Failed to update ${name} service, image ${image}, error: ${err}`); + } + + resolve({ + name, title, image, updated: 'error', + }); } else { let updated = null; @@ -33,15 +40,35 @@ export default function updateNodeFactory(getServiceList, docker) { .trim() .split('\r\n') .map((str) => JSON.parse(str)) - .filter((obj) => obj.status.startsWith('Status: ')); + .filter((obj) => obj?.status?.startsWith('Status: ')); + + if (status) { + if (status.status.includes('Image is up to date for')) { + updated = 'up to date'; + } else if (status.status.includes('Downloaded newer image for')) { + updated = 'updated'; + } + } else { + if (process.env.DEBUG) { + // eslint-disable-next-line no-console + console.error('Failed to read docker json data, status not found'); + } - if (status?.status.includes('Image is up to date for')) { - updated = false; - } else if (status?.status.includes('Downloaded newer image for')) { - updated = true; + resolve({ + name, title, image, updated: 'error', + }); } }); - stream.on('error', reject); + stream.on('error', () => { + if (process.env.DEBUG) { + // eslint-disable-next-line no-console + console.error(`Failed to update ${name} service, image ${image}, error: ${err}`); + } + + resolve({ + name, title, image, updated: 'error', + }); + }); stream.on('end', () => resolve({ name, title, image, updated, })); diff --git a/packages/dashmate/templates/core/dash.conf.dot b/packages/dashmate/templates/core/dash.conf.dot index 3907b248d8c..08885afa6c6 100644 --- a/packages/dashmate/templates/core/dash.conf.dot +++ b/packages/dashmate/templates/core/dash.conf.dot @@ -69,7 +69,6 @@ regtest=1 {{? it.core.spork.address}}sporkaddr={{=it.core.spork.address}}{{?}} {{? it.core.spork.privateKey}}sporkkey={{=it.core.spork.privateKey}}{{?}} {{? it.core.miner.mediantime}}mocktime={{=it.core.miner.mediantime}}{{?}} -llmqtestinstantsend=llmq_test llmqtestinstantsenddip0024=llmq_test_instantsend {{?? it.network === 'devnet'}} diff --git a/packages/dashmate/templates/dynamic-compose.yml.dot b/packages/dashmate/templates/dynamic-compose.yml.dot index 84fed7fa04d..c0055e69492 100644 --- a/packages/dashmate/templates/dynamic-compose.yml.dot +++ b/packages/dashmate/templates/dynamic-compose.yml.dot @@ -17,3 +17,12 @@ services: - {{=settings.destination}}:/var/log/dash/drive/{{=name}}/{{=settings.destination.split('/').reverse()[0]}} {{~}} {{?}} + + {{ gatewayLogs = it.platform.gateway.log.accessLogs.filter((l) => l.type === 'file'); }} + {{? gatewayLogs.length > 0 }} + gateway: + volumes: + {{~ gatewayLogs :log }} + - {{= log.path }}:/var/log/{{= log.path.split('/').reverse()[0] }} + {{~}} + {{?}} diff --git a/packages/dashmate/templates/platform/dapi/envoy/envoy.yaml.dot b/packages/dashmate/templates/platform/dapi/envoy/envoy.yaml.dot deleted file mode 100644 index 72447cb8112..00000000000 --- a/packages/dashmate/templates/platform/dapi/envoy/envoy.yaml.dot +++ /dev/null @@ -1,249 +0,0 @@ -!ignore filters: &filters - - name: envoy.http_connection_manager - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager - stat_prefix: ingress_http - codec_type: auto - access_log: - - name: envoy.access_loggers.file - typed_config: - "@type": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog - path: /dev/stdout - log_format: - json_format: - timestamp: "%START_TIME%" - client: "%DOWNSTREAM_REMOTE_ADDRESS_WITHOUT_PORT%" - protocol: "%PROTOCOL%" - method: "%REQ(:METHOD)%" - uri: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%" - upstream: "%UPSTREAM_HOST%" - "http-status": "%RESPONSE_CODE%" - "grpc-status": "%GRPC_STATUS%" - "rx-bytes": "%BYTES_RECEIVED%" - "tx-bytes": "%BYTES_SENT%" - "response-flags": "%RESPONSE_FLAGS%" - duration: "%DURATION%" - authority: "%REQ(:AUTHORITY)%" - http_filters: - - name: envoy.filters.http.local_ratelimit - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.http.local_ratelimit.v3.LocalRateLimit - stat_prefix: http_local_rate_limiter - # see documentation https://www.envoyproxy.io/docs/envoy/latest/api-v3/type/v3/token_bucket.proto#envoy-v3-api-msg-type-v3-tokenbucket - token_bucket: - max_tokens: {{=it.platform.dapi.envoy.rateLimiter.maxTokens}} - tokens_per_fill: {{=it.platform.dapi.envoy.rateLimiter.tokensPerFill}} - fill_interval: {{=it.platform.dapi.envoy.rateLimiter.fillInterval}} - filter_enabled: - runtime_key: local_rate_limit_enabled - default_value: - numerator: {{? it.platform.dapi.envoy.rateLimiter.enabled}}100{{??}}0{{?}} - denominator: HUNDRED - filter_enforced: - runtime_key: local_rate_limit_enforced - default_value: - numerator: 100 - denominator: HUNDRED - response_headers_to_add: - - append: false - header: - key: x-local-rate-limit - value: 'true' - - name: envoy.filters.http.grpc_web - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.http.grpc_web.v3.GrpcWeb - - name: envoy.filters.http.cors - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.http.cors.v3.Cors - - name: envoy.filters.http.router - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router - route_config: - name: local_route - virtual_hosts: - - name: dapi_services - domains: [ "*" ] - routes: - # tx subscription streaming endpoint configuration - - match: - prefix: "/org.dash.platform.dapi.v0.Core/subscribeToTransactionsWithProofs" - route: - cluster: tx_filter_stream - timeout: 660s - max_stream_duration: - grpc_timeout_header_max: 600s - # block headers subscription streaming endpoint - - match: - prefix: "/org.dash.platform.dapi.v0.Core/subscribeToBlockHeadersWithChainLocks" - route: - cluster: tx_filter_stream - timeout: 660s - max_stream_duration: - grpc_timeout_header_max: 600s - # core unary endpoints - - match: - prefix: "/org.dash.platform.dapi.v0.Core" - route: - cluster: core_and_platform - timeout: {{= it.platform.dapi.envoy.http.responseTimeout }} - # platform unary endpoints - - match: - prefix: "/org.dash.platform.dapi.v0.Platform" - route: - cluster: core_and_platform - timeout: {{= it.platform.dapi.envoy.http.responseTimeout }} - # configuration of the static responses of unsupported api versions - # core static response - - match: - safe_regex: - google_re2: { } - regex: "\/org\\.dash\\.platform\\.dapi\\.v[1-9]+\\.Core" - response_headers_to_add: - - header: - key: "Content-Type" - value: "application/grpc-web+proto" - - header: - key: "grpc-status" - value: "12" - - header: - key: "grpc-message" - value: "Specified service version is not supported" - direct_response: - status: 204 - # platform static response - - match: - safe_regex: - google_re2: { } - regex: "\/org\\.dash\\.platform\\.dapi\\.v[1-9]+\\.Platform" - response_headers_to_add: - - header: - key: "Content-Type" - value: "application/grpc-web+proto" - - header: - key: "grpc-status" - value: "12" - - header: - key: "grpc-message" - value: "Specified service version is not supported" - direct_response: - status: 204 - # JSON RPC endpoints - - match: - path: "/" - route: - cluster: json_rpc - cors: - allow_origin_string_match: - - prefix: "*" - allow_methods: GET, PUT, DELETE, POST, OPTIONS - allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout - max_age: "1728000" - expose_headers: custom-header-1,grpc-status,grpc-message - -static_resources: - listeners: - - name: grpc_and_json_rpc - address: - socket_address: - address: 0.0.0.0 - port_value: 10000 - {{? it.platform.dapi.envoy.ssl.provider === 'self-signed'}} - listener_filters: - - name: envoy.filters.listener.tls_inspector - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.listener.tls_inspector.v3.TlsInspector - filter_chains: - - filter_chain_match: - transport_protocol: raw_buffer - filters: *filters - - filter_chain_match: - transport_protocol: tls - filters: *filters - transport_socket: - name: envoy.transport_sockets.tls - typed_config: - "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext - common_tls_context: - alpn_protocols: [ "h2, http/1.1" ] - tls_certificates: - - certificate_chain: - filename: "/etc/ssl/bundle.crt" - private_key: - filename: "/etc/ssl/private.key" - {{??}} - filter_chains: - filters: *filters - transport_socket: - name: envoy.transport_sockets.tls - typed_config: - "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext - common_tls_context: - alpn_protocols: [ "h2, http/1.1" ] - tls_certificates: - - certificate_chain: - filename: "/etc/ssl/bundle.crt" - private_key: - filename: "/etc/ssl/private.key" - {{?}} - clusters: - - name: core_and_platform - connect_timeout: {{= it.platform.dapi.envoy.http.connectTimeout }} - type: logical_dns - lb_policy: round_robin - typed_extension_protocol_options: - envoy.extensions.upstreams.http.v3.HttpProtocolOptions: - "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions - explicit_http_config: - http2_protocol_options: - connection_keepalive: - interval: 30s - timeout: 5s - load_assignment: - cluster_name: core_and_platform - endpoints: - - lb_endpoints: - - endpoint: - address: - socket_address: - address: dapi_api - port_value: 3005 - - name: tx_filter_stream - connect_timeout: {{= it.platform.dapi.envoy.http.connectTimeout }} - type: logical_dns - lb_policy: round_robin - typed_extension_protocol_options: - envoy.extensions.upstreams.http.v3.HttpProtocolOptions: - "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions - explicit_http_config: - http2_protocol_options: - connection_keepalive: - interval: 30s - timeout: 5s - load_assignment: - cluster_name: tx_filter_stream - endpoints: - - lb_endpoints: - - endpoint: - address: - socket_address: - address: dapi_tx_filter_stream - port_value: 3006 - - name: json_rpc - connect_timeout: {{= it.platform.dapi.envoy.http.connectTimeout }} - type: logical_dns - lb_policy: round_robin - load_assignment: - cluster_name: json_rpc - endpoints: - - lb_endpoints: - - endpoint: - address: - socket_address: - address: dapi_api - port_value: 3004 - -admin: - address: - socket_address: - address: 0.0.0.0 # For docker container only. Must be a local/private interface. - port_value: 8081 diff --git a/packages/dashmate/templates/platform/drive/tenderdash/config.toml.dot b/packages/dashmate/templates/platform/drive/tenderdash/config.toml.dot index d5572596640..3aad5cc204c 100644 --- a/packages/dashmate/templates/platform/drive/tenderdash/config.toml.dot +++ b/packages/dashmate/templates/platform/drive/tenderdash/config.toml.dot @@ -10,10 +10,6 @@ ### Main Base Config Options ### ####################################################################### -# TCP or UNIX socket address of the ABCI application, -# or the name of an ABCI application compiled in with the Tendermint binary -proxy-app = "tcp://drive_abci:26658" - # A custom human readable name for this node {{?it.platform.drive.tenderdash.moniker}}moniker = "{{=it.platform.drive.tenderdash.moniker}}"{{?}} @@ -71,13 +67,38 @@ genesis-file = "config/genesis.json" # Path to the JSON file containing the private key to use for node authentication in the p2p protocol node-key-file = "config/node_key.json" -# Mechanism to connect to the ABCI application: socket | grpc -abci = "socket" - # If true, query the ABCI app on connecting to a new peer # so the app can decide if we should keep the connection or not filter-peers = false +####################################################### +### ABCI App Connection Options ### +####################################################### +[abci] +# TCP or UNIX socket address of the ABCI application, +# or routing rules for routed multi-app setup, +# or the name of an ABCI application compiled in with the Tendermint binary +# Example for routed multi-app setup: +# abci = "routed" +# address = "Info:socket:unix:///tmp/socket.1,Info:socket:unix:///tmp/socket.2,CheckTx:socket:unix:///tmp/socket.1,*:socket:unix:///tmp/socket.3" +address = "CheckTx:grpc:drive_abci:26670,*:socket:tcp://drive_abci:26658" +# Transport mechanism to connect to the ABCI application: socket | grpc | routed +transport = "routed" +# Maximum number of simultaneous connections to the ABCI application +# per each method. Map of a gRPC method name,like "echo", to the number of concurrent connections. +# Special value "*" can be used to set the default limit for methods not explicitly listed. +# +# Example: +# +# grpc-concurrency = [ +# { "*" = 10 }, +# { "echo" = 2 }, +# { "info" = 2 }, +#] +grpc-concurrency = [ + { "check_tx" = {{= it.platform.drive.tenderdash.mempool.maxConcurrentCheckTx }} }, +] + ####################################################### ### Priv Validator Configuration ### @@ -193,6 +214,13 @@ event-log-max-items = 0 # See https://github.com/tendermint/tendermint/issues/3435 timeout-broadcast-tx-commit = "10s" +# Timeout of transaction broadcast to mempool; 0 to disable. +# +# This setting affects timeout of CheckTX operations used before +# adding transaction to the mempool. If the operation takes longer, +# the transaction is rejected with an error. +timeout-broadcast-tx = "{{=it.platform.drive.tenderdash.rpc.timeoutBroadcastTx}}" + # Maximum size of request body, in bytes max-body-bytes = 1000000 @@ -315,16 +343,46 @@ size = {{= it.platform.drive.tenderdash.mempool.size }} max-txs-bytes = {{= it.platform.drive.tenderdash.mempool.maxTxsBytes }} # Size of the cache (used to filter transactions we saw earlier) in transactions -cache-size = 10000 +cache-size = {{= it.platform.drive.tenderdash.mempool.cacheSize }} # Do not remove invalid transactions from the cache (default: false) # Set to true if it's not possible for any invalid transaction to become valid # again in the future. -keep-invalid-txs-in-cache = false +keep-invalid-txs-in-cache = true + +# Timeout of check TX operations received from other nodes, using p2p protocol. +# Use 0 to disable. +timeout-check-tx = "{{=it.platform.drive.tenderdash.mempool.timeoutCheckTx}}" + +# TxEnqueueTimeout defines how many nanoseconds new mempool transaction (received +# from other nodes) will wait when internal processing queue is full +# (most likely due to busy CheckTx execution).Once the timeout is reached, the transaction +# will be silently dropped. +# +# If set to 0, the timeout is disabled and transactions will wait indefinitely. +tx-enqueue-timeout = "{{=it.platform.drive.tenderdash.mempool.txEnqueueTimeout}}" + +# tx-send-rate-limit is the rate limit for sending transactions to peers, in transactions per second. +# If zero, the rate limiter is disabled. +# +# Default: 0 +tx-send-rate-limit = {{=it.platform.drive.tenderdash.mempool.txSendRateLimit}} + +# tx-recv-rate-limit is the rate limit for receiving transactions from peers, in transactions per second. +# If zero, the rate limiter is disabled. +# +# Default: 0 +tx-recv-rate-limit = {{=it.platform.drive.tenderdash.mempool.txRecvRateLimit}} + +# tx-recv-rate-punish-peer set to true means that when tx-recv-rate-limit is reached, the peer will be punished +# (disconnected). If set to false, the peer will be throttled (messages will be dropped). +# +# Default: false +tx-recv-rate-punish-peer = false # Maximum size of a single transaction. # NOTE: the max size of a tx transmitted over the network is {max-tx-bytes}. -max-tx-bytes = 1048576 +max-tx-bytes = 50000 # Maximum size of a batch of transactions to send to a peer # Including space needed by encoding (one varint per transaction). diff --git a/packages/dashmate/templates/platform/dapi/envoy/_zerossl_validation.yaml.dot b/packages/dashmate/templates/platform/gateway/_zerossl_validation.yaml.dot similarity index 100% rename from packages/dashmate/templates/platform/dapi/envoy/_zerossl_validation.yaml.dot rename to packages/dashmate/templates/platform/gateway/_zerossl_validation.yaml.dot diff --git a/packages/dashmate/templates/platform/gateway/envoy.yaml.dot b/packages/dashmate/templates/platform/gateway/envoy.yaml.dot new file mode 100644 index 00000000000..2e312665dfa --- /dev/null +++ b/packages/dashmate/templates/platform/gateway/envoy.yaml.dot @@ -0,0 +1,487 @@ +!ignore filters: &filters + - name: envoy.http_connection_manager + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + stat_prefix: ingress_http + normalize_path: true + merge_slashes: true + use_remote_address: true + path_with_escaped_slashes_action: UNESCAPE_AND_REDIRECT + # Settings applied both to HTTP1 and HTTP2 + common_http_protocol_options: + # A single HTTP connection timeout. + max_connection_duration: 600s + # How long to keep the connection alive when there are no streams (requests). + idle_timeout: 300s + # Request (stream) timeout. + # HTTP2 support multiple streams (requests) per connection. + # For HTTP1 it applies for single request. + # This param is overwritten in specific routes. + max_stream_duration: 15s + # Reject malformed requests with headers containing underscores. + headers_with_underscores_action: REJECT_REQUEST + # HTTP2 specific settings + http2_protocol_options: + # As a side effect this field acts as a soft limit on the number of bytes Envoy will buffer per-stream in the + # QUIC stream send and receive buffers. Once the buffer reaches this pointer, watermark callbacks will fire + # to stop the flow of data to the stream buffers. So we reduce it from 16 MiB to 64 KiB + initial_stream_window_size: 65536 # 64 KiB + # The same but for connection-level flow-control + initial_connection_window_size: 1048576 # 1 MiB + # This option sets the maximum number of concurrent streams allowed for each connection. + # It means N requests can be in flight at the same time on a single connection. + max_concurrent_streams: {{= it.platform.gateway.listeners.dapiAndDrive.http2.maxConcurrentStreams }} + # Stream idle timeout + stream_idle_timeout: 15s +{{? it.platform.gateway.log.accessLogs }} + access_log: + {{~ it.platform.gateway.log.accessLogs :log }} + {{ loggerType = {file: 'file.v3.FileAccessLog', stdout: 'stream.v3.StdoutAccessLog', stderr: 'stream.v3.StderrAccessLog'}; }} + - name: envoy.access_loggers.{{=log.type}} + typed_config: + "@type": type.googleapis.com/envoy.extensions.access_loggers.{{=loggerType[log.type]}} + {{? log.type === 'file' }} + path: "/var/log/{{=log.path.split('/').reverse()[0]}}" + {{?? log.type === 'stream' }} + {{=log.destination}} + {{?}} + log_format: + {{? log.format === 'json' }} + json_format: + {{? log.template === null }} + timestamp: "%START_TIME%" + client: "%DOWNSTREAM_REMOTE_ADDRESS_WITHOUT_PORT%" + protocol: "%PROTOCOL%" + method: "%REQ(:METHOD)%" + uri: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%" + "http-status": "%RESPONSE_CODE%" + "grpc-status": "%GRPC_STATUS%" + "rx-bytes": "%BYTES_RECEIVED%" + "tx-bytes": "%BYTES_SENT%" + "response-flags": "%RESPONSE_FLAGS%" + duration: "%DURATION%" + {{??}} + {{ template = Object.entries(log.template); }} + {{~ template :entry }} + "{{=entry[0]}}": "{{=entry[1]}}" + {{~}} + {{?}} + {{??}} + text_format_source: + {{? log.template === null }} + inline_string: "[%START_TIME%] \"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%\" %RESPONSE_CODE% %GRPC_STATUS% %RESPONSE_FLAGS% R:%BYTES_RECEIVED% S:%BYTES_SENT% D:%DURATION%\n" + {{??}} + inline_string: "{{=log.template}}\n" + {{?}} + {{?}} + {{~}} +{{?}} + http_filters: + # TODO: Introduce when stable https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/adaptive_concurrency_filter.html + {{? it.platform.gateway.rateLimiter.enabled}} + - name: envoy.filters.http.ratelimit + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.ratelimit.v3.RateLimit + domain: edge_proxy_per_ip + # The rate limit service timeout before the request is considered failed + timeout: 5s + # Reject a request if rate limit service is unavailable + failure_mode_deny: true + # Respond with RESOURCE_EXHAUSTED status code if request is rejected + rate_limited_as_resource_exhausted: true + rate_limit_service: + grpc_service: + envoy_grpc: + cluster_name: ratelimit_service + timeout: 0.5s + transport_api_version: V3 + {{?}} + - name: envoy.filters.http.grpc_web + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.grpc_web.v3.GrpcWeb + - name: envoy.filters.http.cors + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.cors.v3.Cors + - name: envoy.filters.http.router + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router + route_config: + name: local_route + virtual_hosts: + - name: http_services + domains: [ "*" ] + routes: + # DAPI core streaming endpoints + - match: + prefix: "/org.dash.platform.dapi.v0.Core/subscribeTo" + route: + cluster: dapi_core_streams + idle_timeout: 300s + # Upstream response timeout + timeout: 600s + max_stream_duration: + # Entire stream/request timeout + max_stream_duration: 600s + grpc_timeout_header_max: 600s + # Other DAPI Core endpoints + - match: + prefix: "/org.dash.platform.dapi.v0.Core" + route: + cluster: dapi_api + # Upstream response timeout + timeout: 15s + # DAPI waitForStateTransitionResult endpoint with bigger timeout + - match: + path: "/org.dash.platform.dapi.v0.Platform/waitForStateTransitionResult" + route: + cluster: dapi_api + idle_timeout: 85s + # Upstream response timeout + timeout: 85s + max_stream_duration: + # Entire stream/request timeout + max_stream_duration: 85s + grpc_timeout_header_max: 85s + # DAPI getConsensusParams endpoint + - match: + path: "/org.dash.platform.dapi.v0.Platform/getConsensusParams" + route: + cluster: dapi_api + # Upstream response timeout + timeout: 10s + # DAPI broadcastStateTransition endpoint + - match: + path: "/org.dash.platform.dapi.v0.Platform/broadcastStateTransition" + route: + cluster: dapi_api + # Upstream response timeout + timeout: 10s + # getProofs endpoint only for internal use (DAPI -> Drive) + - match: + path: "/org.dash.platform.dapi.v0.Platform/getProofs" + response_headers_to_add: + - header: + key: "Content-Type" + value: "application/grpc-web+proto" + - header: + key: "grpc-status" + value: "12" + - header: + key: "grpc-message" + value: "getProofs endpoint is only for internal use" + direct_response: + status: 204 + # Drive gRPC endpoints + - match: + prefix: "/org.dash.platform.dapi.v0.Platform" + route: + cluster: drive_grpc + # Upstream response timeout + timeout: 10s + # Static responses of unsupported api versions + # core static response + - match: + safe_regex: + regex: "\/org\\.dash\\.platform\\.dapi\\.v[1-9]+\\." + response_headers_to_add: + - header: + key: "Content-Type" + value: "application/grpc-web+proto" + - header: + key: "grpc-status" + value: "12" + - header: + key: "grpc-message" + value: "Specified service version is not supported" + direct_response: + status: 204 + # JSON RPC endpoints + - match: + path: "/" + route: + cluster: dapi_json_rpc + # Upstream response timeout + timeout: 10s + {{? it.platform.gateway.rateLimiter.enabled }} + rate_limits: + - actions: + remote_address: {} + {{?}} + typed_per_filter_config: + envoy.filters.http.cors: + "@type": type.googleapis.com/envoy.extensions.filters.http.cors.v3.CorsPolicy + allow_origin_string_match: + - prefix: "*" + allow_methods: GET, PUT, DELETE, POST, OPTIONS + allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout + max_age: "1728000" + expose_headers: custom-header-1,grpc-status,grpc-message + +static_resources: + listeners: + - name: dapi_and_drive + address: + socket_address: + address: 0.0.0.0 # For docker container only. Must be a local/private interface. + port_value: 10000 + {{? it.platform.gateway.ssl.provider === 'self-signed'}} + listener_filters: + - name: envoy.filters.listener.tls_inspector + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.listener.tls_inspector.v3.TlsInspector + per_connection_buffer_limit_bytes: 32768 # 32 KiB + filter_chains: + - filter_chain_match: + transport_protocol: raw_buffer + filters: *filters + - filter_chain_match: + transport_protocol: tls + filters: *filters + transport_socket: + name: envoy.transport_sockets.tls + typed_config: + "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext + common_tls_context: + alpn_protocols: [ "h2, http/1.1" ] + tls_certificates: + - certificate_chain: + filename: "/etc/ssl/bundle.crt" + private_key: + filename: "/etc/ssl/private.key" + {{??}} + filter_chains: + filters: *filters + transport_socket: + name: envoy.transport_sockets.tls + typed_config: + "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext + common_tls_context: + alpn_protocols: [ "h2, http/1.1" ] + tls_certificates: + - certificate_chain: + filename: "/etc/ssl/bundle.crt" + private_key: + filename: "/etc/ssl/private.key" + {{?}} + {{? it.platform.gateway.metrics.enabled }} + # Forward /stats/prometheus (which is a part of admin endpoint) + # to a separate listener with default Prometheus path /metrics + - name: prometheus_metrics + address: + socket_address: + address: "0.0.0.0" + port_value: 9090 + filter_chains: + - filters: + - name: "envoy.http_connection_manager" + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + stat_prefix: ingress_metrics + route_config: + name: local_route + virtual_hosts: + - name: local_service + domains: [ "*" ] + routes: + - match: + prefix: "/metrics" + route: + cluster: admin + prefix_rewrite: "/stats/prometheus" + http_filters: + - name: envoy.filters.http.router + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router + {{?}} + clusters: + - name: dapi_api + type: STRICT_DNS + per_connection_buffer_limit_bytes: 32768 # 32 KiB + typed_extension_protocol_options: + envoy.extensions.upstreams.http.v3.HttpProtocolOptions: + "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions + explicit_http_config: + http2_protocol_options: + initial_stream_window_size: 65536 # 64 KiB + initial_connection_window_size: 1048576 # 1 MiB + circuit_breakers: + thresholds: + - priority: DEFAULT + # The maximum number of parallel requests + max_requests: {{= it.platform.gateway.upstreams.dapiApi.maxRequests }} + load_assignment: + cluster_name: dapi_api + endpoints: + - lb_endpoints: + - endpoint: + address: + socket_address: + address: dapi_api + port_value: 3005 + - name: dapi_core_streams + type: STRICT_DNS + per_connection_buffer_limit_bytes: 32768 # 32 KiB + typed_extension_protocol_options: + envoy.extensions.upstreams.http.v3.HttpProtocolOptions: + "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions + explicit_http_config: + http2_protocol_options: + initial_stream_window_size: 65536 # 64 KiB + initial_connection_window_size: 1048576 # 1 MiB + circuit_breakers: + thresholds: + - priority: DEFAULT + max_requests: {{= it.platform.gateway.upstreams.dapiCoreStreams.maxRequests }} + load_assignment: + cluster_name: dapi_core_streams + endpoints: + - lb_endpoints: + - endpoint: + address: + socket_address: + address: dapi_core_streams + port_value: 3006 + - name: dapi_json_rpc + type: STRICT_DNS + per_connection_buffer_limit_bytes: 32768 # 32 KiB + circuit_breakers: + thresholds: + - priority: DEFAULT + # The maximum number of parallel connections + max_connections: {{= it.platform.gateway.upstreams.dapiJsonRpc.maxRequests }} + # The maximum number of parallel requests + max_requests: {{= it.platform.gateway.upstreams.dapiJsonRpc.maxRequests }} + load_assignment: + cluster_name: dapi_json_rpc + endpoints: + - lb_endpoints: + - endpoint: + address: + socket_address: + address: dapi_api + port_value: 3004 + - name: drive_grpc + type: STRICT_DNS + per_connection_buffer_limit_bytes: 32768 # 32 KiB + typed_extension_protocol_options: + envoy.extensions.upstreams.http.v3.HttpProtocolOptions: + "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions + explicit_http_config: + http2_protocol_options: + initial_stream_window_size: 65536 # 64 KiB + initial_connection_window_size: 1048576 # 1 MiB + circuit_breakers: + thresholds: + - priority: DEFAULT + # The maximum number of parallel requests. + max_requests: {{= it.platform.gateway.upstreams.driveGrpc.maxRequests }} + load_assignment: + cluster_name: drive_grpc + endpoints: + - lb_endpoints: + - endpoint: + address: + socket_address: + address: drive_abci + port_value: 26670 + {{? it.platform.gateway.rateLimiter.enabled }} + - name: ratelimit_service + type: STRICT_DNS + connect_timeout: 1s + protocol_selection: USE_CONFIGURED_PROTOCOL + typed_extension_protocol_options: + envoy.extensions.upstreams.http.v3.HttpProtocolOptions: + "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions + explicit_http_config: + http2_protocol_options: {} + load_assignment: + cluster_name: ratelimit_service + endpoints: + - lb_endpoints: + - endpoint: + address: + socket_address: + address: gateway_rate_limiter + port_value: 8081 + {{?}} + {{? it.platform.gateway.metrics.enabled && it.platform.gateway.admin.enabled }} + - name: admin + connect_timeout: 0.25s + type: STATIC + load_assignment: + cluster_name: admin + endpoints: + - lb_endpoints: + - endpoint: + address: + socket_address: + address: "127.0.0.1" + port_value: 9901 + {{?}} + +{{? it.platform.gateway.admin.enabled }} +admin: + address: + socket_address: + address: 0.0.0.0 # For docker container only. Must be a local/private interface. + port_value: 9901 +{{?}} + +# Dynamically adjust limits based on memory usage and number of active connections +# TODO: We can use data provided by drive, tenderdash, or dapi to configure adaptive limits based on load +# https://www.envoyproxy.io/docs/envoy/v1.30.1/api-v3/extensions/resource_monitors/injected_resource/v3/injected_resource.proto +overload_manager: + refresh_interval: 0.25s + resource_monitors: + # Monitor heap size + - name: "envoy.resource_monitors.fixed_heap" + typed_config: + "@type": type.googleapis.com/envoy.extensions.resource_monitors.fixed_heap.v3.FixedHeapConfig + # Maximum heap size in bytes. If the heap size exceeds this value, Envoy will take actions to reduce memory usage. + max_heap_size_bytes: {{= it.platform.gateway.maxHeapSizeInBytes }} + # Monitor the number of active downstream connections + - name: "envoy.resource_monitors.global_downstream_max_connections" + typed_config: + "@type": type.googleapis.com/envoy.extensions.resource_monitors.downstream_connections.v3.DownstreamConnectionsConfig + max_active_downstream_connections: {{= it.platform.gateway.maxConnections }} + actions: + # Reduce the heap size by releasing free memory if the current heap size is 92% of the maximum heap size. + - name: "envoy.overload_actions.shrink_heap" + triggers: + - name: "envoy.resource_monitors.fixed_heap" + threshold: + value: 0.92 + # Disable HTTP keepalive connections if the current heap size is 92% of the maximum heap size + # OR the number of active downstream connections is 95% of the maximum number of connections. + # Envoy will drain HTTP/2 and HTTP/3 connections using GOAWAY with a drain grace period. + # For HTTP/1, Envoy will set a drain timer to close the more idle recently used connections. + - name: "envoy.overload_actions.disable_http_keepalive" + triggers: + - name: "envoy.resource_monitors.fixed_heap" + threshold: + value: 0.92 + - name: "envoy.resource_monitors.global_downstream_max_connections" + threshold: + value: 0.95 + # Stop accepting new HTTP connections in configured listeners if the number of active downstream + # connections reached the maximum. + # TODO: Use `envoy.load_shed_points.tcp_listener_accept` instead `envoy.overload_actions.stop_accepting_connections` + # when `loadshed_points` start to support `global_downstream_max_connections` monitor. + - name: "envoy.overload_actions.stop_accepting_connections" + triggers: + - name: "envoy.resource_monitors.global_downstream_max_connections" + threshold: + value: 1.0 + # Stop accepting new HTTP requests if the current heap size is 95% of the maximum heap size. + - name: "envoy.overload_actions.stop_accepting_requests" + triggers: + - name: "envoy.resource_monitors.fixed_heap" + threshold: + value: 0.95 + loadshed_points: + # Stop accepting new TCP connections if the current heap size is 95% of the maximum heap size + - name: "envoy.load_shed_points.tcp_listener_accept" + triggers: + - name: "envoy.resource_monitors.fixed_heap" + threshold: + value: 0.95 diff --git a/packages/dashmate/templates/platform/gateway/rate_limiter/rate_limiter.yaml.dot b/packages/dashmate/templates/platform/gateway/rate_limiter/rate_limiter.yaml.dot new file mode 100644 index 00000000000..4e40286adae --- /dev/null +++ b/packages/dashmate/templates/platform/gateway/rate_limiter/rate_limiter.yaml.dot @@ -0,0 +1,23 @@ +domain: edge_proxy_per_ip +descriptors: + - key: remote_address + rate_limit: + unit: {{= it.platform.gateway.rateLimiter.unit }} + requests_per_unit: {{= it.platform.gateway.rateLimiter.requestsPerUnit }} + + # Blacklisted IPs + {{~ it.platform.gateway.rateLimiter.blacklist :ip }} + - key: remote_address + value: {{= ip }} + rate_limit: + unit: second + requests_per_unit: 0 + {{~}} + + # Whitelisted IPs + {{~ it.platform.gateway.rateLimiter.whitelist :ip }} + - key: remote_address + value: {{= ip }} + rate_limit: + unlimited: true + {{~}} diff --git a/packages/dashmate/templates/platform/gateway/rate_limiter/statsd_exporter.yaml.dot b/packages/dashmate/templates/platform/gateway/rate_limiter/statsd_exporter.yaml.dot new file mode 100644 index 00000000000..31f16dd6a59 --- /dev/null +++ b/packages/dashmate/templates/platform/gateway/rate_limiter/statsd_exporter.yaml.dot @@ -0,0 +1,93 @@ +mappings: # Requires statsd exporter >= v0.6.0 since it uses the "drop" action. + - match: "ratelimit.service.rate_limit.*.*.near_limit" + name: "ratelimit_service_rate_limit_near_limit" + timer_type: "histogram" + labels: + domain: "$1" + key1: "$2" + - match: "ratelimit.service.rate_limit.*.*.over_limit" + name: "ratelimit_service_rate_limit_over_limit" + timer_type: "histogram" + labels: + domain: "$1" + key1: "$2" + - match: "ratelimit.service.rate_limit.*.*.total_hits" + name: "ratelimit_service_rate_limit_total_hits" + timer_type: "histogram" + labels: + domain: "$1" + key1: "$2" + - match: "ratelimit.service.rate_limit.*.*.within_limit" + name: "ratelimit_service_rate_limit_within_limit" + timer_type: "histogram" + labels: + domain: "$1" + key1: "$2" + + - match: "ratelimit.service.rate_limit.*.*.*.near_limit" + name: "ratelimit_service_rate_limit_near_limit" + timer_type: "histogram" + labels: + domain: "$1" + key1: "$2" + key2: "$3" + - match: "ratelimit.service.rate_limit.*.*.*.over_limit" + name: "ratelimit_service_rate_limit_over_limit" + timer_type: "histogram" + labels: + domain: "$1" + key1: "$2" + key2: "$3" + - match: "ratelimit.service.rate_limit.*.*.*.total_hits" + name: "ratelimit_service_rate_limit_total_hits" + timer_type: "histogram" + labels: + domain: "$1" + key1: "$2" + key2: "$3" + - match: "ratelimit.service.rate_limit.*.*.*.within_limit" + name: "ratelimit_service_rate_limit_within_limit" + timer_type: "histogram" + labels: + domain: "$1" + key1: "$2" + key2: "$3" + + - match: "ratelimit.service.call.should_rate_limit.*" + name: "ratelimit_service_should_rate_limit_error" + match_metric_type: counter + labels: + err_type: "$1" + + - match: "ratelimit_server.*.total_requests" + name: "ratelimit_service_total_requests" + match_metric_type: counter + labels: + grpc_method: "$1" + + - match: "ratelimit_server.*.response_time" + name: "ratelimit_service_response_time_seconds" + timer_type: histogram + labels: + grpc_method: "$1" + + - match: "ratelimit.service.config_load_success" + name: "ratelimit_service_config_load_success" + match_metric_type: counter + - match: "ratelimit.service.config_load_error" + name: "ratelimit_service_config_load_error" + match_metric_type: counter + + - match: "ratelimit.service.rate_limit.*.*.*.shadow_mode" + name: "ratelimit_service_rate_limit_shadow_mode" + timer_type: "histogram" + labels: + domain: "$1" + key1: "$2" + key2: "$3" + + # Enable below in production once you have the metrics you need + # - match: "." + # match_type: "regex" + # action: "drop" + # name: "dropped" diff --git a/packages/dashmate/test/e2e/localNetwork.spec.js b/packages/dashmate/test/e2e/localNetwork.spec.js index ca4bc23cf71..d1f8c7bb7b8 100644 --- a/packages/dashmate/test/e2e/localNetwork.spec.js +++ b/packages/dashmate/test/e2e/localNetwork.spec.js @@ -52,7 +52,7 @@ describe('Local Network', function main() { localConfig.set('dashmate.helper.api.port', 40000); localConfig.set('core.p2p.port', 40001); localConfig.set('core.rpc.port', 40002); - localConfig.set('platform.dapi.envoy.http.port', 40003); + localConfig.set('platform.gateway.listeners.dapiAndDrive.port', 40003); localConfig.set('platform.drive.tenderdash.p2p.port', 40004); localConfig.set('platform.drive.tenderdash.rpc.port', 40005); localConfig.set('platform.drive.tenderdash.pprof.port', 40006); diff --git a/packages/dashmate/test/e2e/testnetEvonode.spec.js b/packages/dashmate/test/e2e/testnetEvonode.spec.js index efabb10553e..112bd769f43 100644 --- a/packages/dashmate/test/e2e/testnetEvonode.spec.js +++ b/packages/dashmate/test/e2e/testnetEvonode.spec.js @@ -93,7 +93,7 @@ describe('Testnet Evonode', function main() { config.set('dashmate.helper.api.port', 40000); config.set('core.p2p.port', 40001); config.set('core.rpc.port', 40002); - config.set('platform.dapi.envoy.http.port', 40003); + config.set('platform.gateway.listeners.dapiAndDrive.port', 40003); config.set('platform.drive.tenderdash.p2p.port', 40004); config.set('platform.drive.tenderdash.rpc.port', 40005); config.set('platform.drive.tenderdash.pprof.port', 40006); @@ -147,6 +147,7 @@ describe('Testnet Evonode', function main() { await task.run({ isVerbose: true, + isSafe: true, }); // TODO: Assert all services are running @@ -230,6 +231,7 @@ describe('Testnet Evonode', function main() { await task.run({ isVerbose: true, + isSafe: true, }); // TODO: Assert all services are running diff --git a/packages/dashmate/test/e2e/testnetFullnode.spec.js b/packages/dashmate/test/e2e/testnetFullnode.spec.js index 147b9d820d2..965f6f78d6f 100644 --- a/packages/dashmate/test/e2e/testnetFullnode.spec.js +++ b/packages/dashmate/test/e2e/testnetFullnode.spec.js @@ -90,7 +90,7 @@ describe('Testnet Fullnode', function main() { config.set('dashmate.helper.api.port', 40000); config.set('core.p2p.port', 40001); config.set('core.rpc.port', 40002); - config.set('platform.dapi.envoy.http.port', 40003); + config.set('platform.gateway.listeners.dapiAndDrive.port', 40003); config.set('platform.drive.tenderdash.p2p.port', 40004); config.set('platform.drive.tenderdash.rpc.port', 40005); config.set('platform.drive.tenderdash.pprof.port', 40006); diff --git a/packages/dashmate/test/unit/commands/update.spec.js b/packages/dashmate/test/unit/commands/update.spec.js index ecf95ad7a39..12536a22930 100644 --- a/packages/dashmate/test/unit/commands/update.spec.js +++ b/packages/dashmate/test/unit/commands/update.spec.js @@ -42,4 +42,44 @@ describe('Update command', () => { expect(mockGetServicesList).to.have.been.calledOnceWithExactly(config); expect(mockDocker.pull).to.have.been.calledOnceWith(mockServicesList[0].image); }); + + it('should update other services if one of them fails', async function it() { + const command = new UpdateCommand(); + mockDockerResponse = { status: 'Status: Image is up to date for' }; + mockServicesList = [{ name: 'fake', image: 'fake', title: 'FAKE' }, + { name: 'fake_docker_pull_error', image: 'fake_err_image', title: 'FAKE_ERROR' }]; + + // test docker.pull returns error + mockDocker = { + pull: this.sinon.stub() + .callsFake((image, cb) => (image === mockServicesList[1].image ? cb(new Error(), null) + : cb(false, mockDockerStream))), + }; + + let updateNode = updateNodeFactory(mockGetServicesList, mockDocker); + + await command.runWithDependencies({}, { format: 'json' }, mockDocker, config, updateNode); + + expect(mockGetServicesList).to.have.been.calledOnceWithExactly(config); + expect(mockDocker.pull.firstCall.firstArg).to.equal(mockServicesList[0].image); + expect(mockDocker.pull.secondCall.firstArg).to.equal(mockServicesList[1].image); + + // test docker.pull stream returns error + mockDocker = { pull: this.sinon.stub().callsFake((image, cb) => cb(false, mockDockerStream)) }; + mockDockerStream = { + on: this.sinon.stub().callsFake((channel, cb) => (channel === 'error' ? cb(new Error()) : null)), + }; + + // reset + mockGetServicesList = this.sinon.stub().callsFake(() => mockServicesList); + mockDocker = { pull: this.sinon.stub().callsFake((image, cb) => cb(false, mockDockerStream)) }; + + updateNode = updateNodeFactory(mockGetServicesList, mockDocker); + + await command.runWithDependencies({}, { format: 'json' }, mockDocker, config, updateNode); + + expect(mockGetServicesList).to.have.been.calledOnceWithExactly(config); + expect(mockDocker.pull.firstCall.firstArg).to.equal(mockServicesList[0].image); + expect(mockDocker.pull.secondCall.firstArg).to.equal(mockServicesList[1].image); + }); }); diff --git a/packages/dashmate/test/unit/commands/config/configFile/migrateConfigFileFactory.spec.js b/packages/dashmate/test/unit/config/configFile/migrateConfigFileFactory.spec.js similarity index 82% rename from packages/dashmate/test/unit/commands/config/configFile/migrateConfigFileFactory.spec.js rename to packages/dashmate/test/unit/config/configFile/migrateConfigFileFactory.spec.js index dae0bbe8719..eb7efe51ae8 100644 --- a/packages/dashmate/test/unit/commands/config/configFile/migrateConfigFileFactory.spec.js +++ b/packages/dashmate/test/unit/config/configFile/migrateConfigFileFactory.spec.js @@ -1,9 +1,9 @@ import fs from 'fs'; import path from 'path'; -import HomeDir from '../../../../../src/config/HomeDir.js'; -import { PACKAGE_ROOT_DIR } from '../../../../../src/constants.js'; -import createDIContainer from '../../../../../src/createDIContainer.js'; -import getConfigFileDataV0250 from '../../../../../src/test/fixtures/getConfigFileDataV0250.js'; +import HomeDir from '../../../../src/config/HomeDir.js'; +import { PACKAGE_ROOT_DIR } from '../../../../src/constants.js'; +import createDIContainer from '../../../../src/createDIContainer.js'; +import getConfigFileDataV0250 from '../../../../src/test/fixtures/getConfigFileDataV0250.js'; describe('migrateConfigFileFactory', () => { let mockConfigFileData; diff --git a/packages/dashmate/test/unit/status/scopes/platform.spec.js b/packages/dashmate/test/unit/status/scopes/platform.spec.js index 59053d5ae97..ad723f3077e 100644 --- a/packages/dashmate/test/unit/status/scopes/platform.spec.js +++ b/packages/dashmate/test/unit/status/scopes/platform.spec.js @@ -47,7 +47,7 @@ describe('getPlatformScopeFactory', () => { config = getConfigMock(this.sinon); - httpPort = config.get('platform.dapi.envoy.http.port'); + httpPort = config.get('platform.gateway.listeners.dapiAndDrive.port'); httpService = `${config.get('externalIp')}:${httpPort}`; p2pPort = config.get('platform.drive.tenderdash.p2p.port'); p2pService = `${config.get('externalIp')}:${p2pPort}`; @@ -126,6 +126,72 @@ describe('getPlatformScopeFactory', () => { expect(scope).to.deep.equal(expectedScope); }); + it('should return platform syncing when it is catching up', async () => { + mockDetermineDockerStatus.returns(DockerStatusEnum.running); + mockRpcClient.mnsync.withArgs('status').returns({ result: { IsSynced: true } }); + mockDockerCompose.isServiceRunning.returns(true); + mockDockerCompose.execCommand.returns({ exitCode: 0, out: '' }); + mockMNOWatchProvider.returns(Promise.resolve('OPEN')); + + const mockStatus = { + node_info: { + version: '0', + network: 'test', + moniker: 'test', + }, + sync_info: { + catching_up: true, + latest_app_hash: 'DEADBEEF', + latest_block_height: 1337, + latest_block_hash: 'DEADBEEF', + latest_block_time: 1337, + }, + }; + const mockNetInfo = { n_peers: 6, listening: true }; + + const expectedScope = { + coreIsSynced: true, + httpPort, + httpService, + p2pPort, + p2pService, + rpcService, + httpPortState: PortStateEnum.OPEN, + p2pPortState: PortStateEnum.OPEN, + tenderdash: { + httpPortState: PortStateEnum.OPEN, + p2pPortState: PortStateEnum.OPEN, + dockerStatus: DockerStatusEnum.running, + serviceStatus: ServiceStatusEnum.syncing, + version: '0', + listening: true, + catchingUp: true, + latestBlockHash: 'DEADBEEF', + latestBlockHeight: 1337, + latestBlockTime: 1337, + latestAppHash: 'DEADBEEF', + peers: 6, + moniker: 'test', + network: 'test', + }, + drive: { + dockerStatus: DockerStatusEnum.running, + serviceStatus: ServiceStatusEnum.up, + }, + }; + + mockFetch + .onFirstCall() + .returns(Promise.resolve({ json: () => Promise.resolve(mockStatus) })) + .onSecondCall() + .returns(Promise.resolve({ json: () => Promise.resolve(mockNetInfo) })); + mockMNOWatchProvider.returns(Promise.resolve('OPEN')); + + const scope = await getPlatformScope(config); + + expect(scope).to.deep.equal(expectedScope); + }); + it('should return empty scope if error during request to core', async () => { mockRpcClient.mnsync.withArgs('status').throws(new Error()); mockDockerCompose.execCommand.returns({ exitCode: 0, out: '' }); diff --git a/packages/dashpay-contract/.eslintrc b/packages/dashpay-contract/.eslintrc index e2c337296e8..00e5bd1251f 100644 --- a/packages/dashpay-contract/.eslintrc +++ b/packages/dashpay-contract/.eslintrc @@ -17,6 +17,7 @@ "mocha": true }, "globals": { - "expect": true + "expect": true, + "BigInt": true } } diff --git a/packages/dashpay-contract/Cargo.toml b/packages/dashpay-contract/Cargo.toml index b11c400e19d..115444dcd91 100644 --- a/packages/dashpay-contract/Cargo.toml +++ b/packages/dashpay-contract/Cargo.toml @@ -1,11 +1,13 @@ [package] name = "dashpay-contract" description = "DashPay data contract schema and tools" -version = "0.25.21" +version = "1.0.0-dev.15" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" [dependencies] +platform-version = { path = "../rs-platform-version" } +thiserror = "1.0.58" serde_json = { version = "1.0" } platform-value = { path = "../rs-platform-value" } diff --git a/packages/dashpay-contract/package.json b/packages/dashpay-contract/package.json index 28724419441..7335e9a3c18 100644 --- a/packages/dashpay-contract/package.json +++ b/packages/dashpay-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dashpay-contract", - "version": "0.25.21", + "version": "1.0.0-dev.15", "description": "Reference contract of the DashPay DPA on Dash Evolution", "scripts": { "lint": "eslint .", diff --git a/packages/dashpay-contract/schema/dashpay.schema.json b/packages/dashpay-contract/schema/v1/dashpay.schema.json similarity index 98% rename from packages/dashpay-contract/schema/dashpay.schema.json rename to packages/dashpay-contract/schema/v1/dashpay.schema.json index c51ee225f03..016d40db73c 100644 --- a/packages/dashpay-contract/schema/dashpay.schema.json +++ b/packages/dashpay-contract/schema/v1/dashpay.schema.json @@ -131,6 +131,8 @@ "additionalProperties": false }, "contactRequest": { + "documentsMutable": false, + "canBeDeleted": false, "requiresIdentityEncryptionBoundedKey": 2, "requiresIdentityDecryptionBoundedKey": 2, "type": "object", diff --git a/packages/dashpay-contract/src/error.rs b/packages/dashpay-contract/src/error.rs new file mode 100644 index 00000000000..d01bbcc91cf --- /dev/null +++ b/packages/dashpay-contract/src/error.rs @@ -0,0 +1,17 @@ +use platform_version::version::FeatureVersion; + +#[derive(thiserror::Error, Debug)] +pub enum Error { + /// Platform expected some specific versions + #[error("platform unknown version on {method}, received: {received}")] + UnknownVersionMismatch { + /// method + method: String, + /// the allowed versions for this method + known_versions: Vec, + /// requested core height + received: FeatureVersion, + }, + #[error("schema deserialize error: {0}")] + InvalidSchemaJson(#[from] serde_json::Error), +} diff --git a/packages/dashpay-contract/src/lib.rs b/packages/dashpay-contract/src/lib.rs index 737eba57c6f..8d443aeaa0a 100644 --- a/packages/dashpay-contract/src/lib.rs +++ b/packages/dashpay-contract/src/lib.rs @@ -1,5 +1,9 @@ +mod error; +pub mod v1; + +pub use crate::error::Error; use platform_value::{Identifier, IdentifierBytes32}; -use serde_json::Error; +use platform_version::version::PlatformVersion; use serde_json::Value; pub const ID_BYTES: [u8; 32] = [ @@ -12,21 +16,26 @@ pub const OWNER_ID_BYTES: [u8; 32] = [ 215, 90, 101, 229, 15, 115, 5, 44, 117, 182, 217, ]; -pub mod document_types { - pub mod contact_request { - pub const NAME: &str = "contactRequest"; - - pub mod properties { - pub const TO_USER_ID: &str = "toUserId"; - pub const CORE_HEIGHT_CREATED_AT: &str = "coreHeightCreatedAt"; - pub const CORE_CHAIN_LOCKED_HEIGHT: &str = "coreChainLockedHeight"; - } - } -} - pub const ID: Identifier = Identifier(IdentifierBytes32(ID_BYTES)); pub const OWNER_ID: Identifier = Identifier(IdentifierBytes32(OWNER_ID_BYTES)); -pub fn load_documents_schemas() -> Result { - serde_json::from_str(include_str!("../schema/dashpay.schema.json")) +pub fn load_definitions(platform_version: &PlatformVersion) -> Result, Error> { + match platform_version.system_data_contracts.dashpay { + 1 => Ok(None), + version => Err(Error::UnknownVersionMismatch { + method: "dashpay_contract::load_definitions".to_string(), + known_versions: vec![1], + received: version, + }), + } +} +pub fn load_documents_schemas(platform_version: &PlatformVersion) -> Result { + match platform_version.system_data_contracts.dashpay { + 1 => v1::load_documents_schemas(), + version => Err(Error::UnknownVersionMismatch { + method: "dashpay_contract::load_documents_schemas".to_string(), + known_versions: vec![1], + received: version, + }), + } } diff --git a/packages/dashpay-contract/src/v1/mod.rs b/packages/dashpay-contract/src/v1/mod.rs new file mode 100644 index 00000000000..051b0819aca --- /dev/null +++ b/packages/dashpay-contract/src/v1/mod.rs @@ -0,0 +1,19 @@ +use crate::error::Error; +use serde_json::Value; + +pub mod document_types { + pub mod contact_request { + pub const NAME: &str = "contactRequest"; + + pub mod properties { + pub const TO_USER_ID: &str = "toUserId"; + pub const CORE_HEIGHT_CREATED_AT: &str = "coreHeightCreatedAt"; + pub const CORE_CHAIN_LOCKED_HEIGHT: &str = "coreChainLockedHeight"; + } + } +} + +pub fn load_documents_schemas() -> Result { + serde_json::from_str(include_str!("../../schema/v1/dashpay.schema.json")) + .map_err(Error::InvalidSchemaJson) +} diff --git a/packages/dashpay-contract/test/unit/schema.spec.js b/packages/dashpay-contract/test/unit/schema.spec.js index a5407a94b1b..ff6eaf14ecf 100644 --- a/packages/dashpay-contract/test/unit/schema.spec.js +++ b/packages/dashpay-contract/test/unit/schema.spec.js @@ -1,8 +1,11 @@ const { expect } = require('chai'); const crypto = require('crypto'); -const { DashPlatformProtocol, JsonSchemaError } = require('@dashevo/wasm-dpp'); +const { + DashPlatformProtocol, + JsonSchemaError, +} = require('@dashevo/wasm-dpp'); const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); -const schema = require('../../schema/dashpay.schema.json'); +const schema = require('../../schema/v1/dashpay.schema.json'); const whitepaperMasternodeText = 'Full nodes are servers running on a P2P network that allow peers to use them to receive updates about the events on the network. These nodes utilize significant amounts of traffic and other resources that incur a substantial cost. As a result, a steady decrease in the amount of these nodes has been observed for some time on the Bitcoin network and as a result, block propagation times have been upwards of 40 seconds. Many solutions have been proposed such as a new reward scheme by Microsoft Research and the Bitnodes incentive program'; const encoded32Chars = '4fafc98bbfe597f7ba2c9f767d52036d'; @@ -10,10 +13,16 @@ const encoded64Chars = '4fafc98bbfe597f7ba2c9f767d52036d2226175960a908e355e5c575 const expectJsonSchemaError = (validationResult) => { const errors = validationResult.getErrors(); - expect(errors).to.have.length(1); + expect(errors) + .to + .have + .length(1); const error = validationResult.getErrors()[0]; - expect(error).to.be.instanceof(JsonSchemaError); + expect(error) + .to + .be + .instanceof(JsonSchemaError); return error; }; @@ -29,11 +38,14 @@ describe('Dashpay Contract', () => { ); identityId = await generateRandomIdentifier(); - contract = dpp.dataContract.create(identityId, schema); + contract = dpp.dataContract.create(identityId, BigInt(1), schema); }); it('should have a valid contract definition', async () => { - expect(() => dpp.dataContract.create(identityId, schema)).to.not.throw(); + expect(() => dpp.dataContract.create(identityId, BigInt(1), schema)) + .to + .not + .throw(); }); describe('Documents', () => { @@ -55,8 +67,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxLength'); - expect(error.instancePath).to.deep.equal('/displayName'); + expect(error.keyword) + .to + .equal('maxLength'); + expect(error.instancePath) + .to + .deep + .equal('/displayName'); }); }); @@ -68,8 +85,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxLength'); - expect(error.instancePath).to.deep.equal('/publicMessage'); + expect(error.keyword) + .to + .equal('maxLength'); + expect(error.instancePath) + .to + .deep + .equal('/publicMessage'); }); }); @@ -81,8 +103,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('format'); - expect(error.instancePath).to.deep.equal('/avatarUrl'); + expect(error.keyword) + .to + .equal('format'); + expect(error.instancePath) + .to + .deep + .equal('/avatarUrl'); }); it('should have less than 2048 chars length', async () => { @@ -92,8 +119,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxLength'); - expect(error.instancePath).to.deep.equal('/avatarUrl'); + expect(error.keyword) + .to + .equal('maxLength'); + expect(error.instancePath) + .to + .deep + .equal('/avatarUrl'); }); it('should be of type URL', async () => { @@ -103,8 +135,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('format'); - expect(error.instancePath).to.deep.equal('/avatarUrl'); + expect(error.keyword) + .to + .equal('format'); + expect(error.instancePath) + .to + .deep + .equal('/avatarUrl'); }); }); @@ -116,8 +153,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.instancePath).to.deep.equal('/avatarHash'); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.instancePath) + .to + .deep + .equal('/avatarHash'); }); it('should have maximum length of 32', async () => { @@ -127,8 +169,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxItems'); - expect(error.instancePath).to.deep.equal('/avatarHash'); + expect(error.keyword) + .to + .equal('maxItems'); + expect(error.instancePath) + .to + .deep + .equal('/avatarHash'); }); it('should be of type array', async () => { @@ -138,8 +185,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.instancePath).to.deep.equal('/avatarHash'); + expect(error.keyword) + .to + .equal('type'); + expect(error.instancePath) + .to + .deep + .equal('/avatarHash'); }); }); @@ -151,8 +203,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.instancePath).to.deep.equal('/avatarFingerprint'); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.instancePath) + .to + .deep + .equal('/avatarFingerprint'); }); it('should have maximum length of 8', async () => { @@ -162,8 +219,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxItems'); - expect(error.instancePath).to.deep.equal('/avatarFingerprint'); + expect(error.keyword) + .to + .equal('maxItems'); + expect(error.instancePath) + .to + .deep + .equal('/avatarFingerprint'); }); it('should be of type array', async () => { @@ -173,8 +235,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.instancePath).to.deep.equal('/avatarFingerprint'); + expect(error.keyword) + .to + .equal('type'); + expect(error.instancePath) + .to + .deep + .equal('/avatarFingerprint'); }); }); @@ -185,8 +252,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('additionalProperties'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); + expect(error.keyword) + .to + .equal('additionalProperties'); + expect(error.params.additionalProperties) + .to + .deep + .equal(['someOtherProperty']); }); it('should be valid', async () => { @@ -194,7 +266,10 @@ describe('Dashpay Contract', () => { const result = profile.validate(dpp.protocolVersion); - expect(result.isValid()).to.be.true(); + expect(result.isValid()) + .to + .be + .true(); }); }); @@ -218,8 +293,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('encToUserId'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('encToUserId'); }); it('should have exactly 32 chars length', async () => { @@ -229,8 +308,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxItems'); - expect(error.instancePath).to.equal('/encToUserId'); + expect(error.keyword) + .to + .equal('maxItems'); + expect(error.instancePath) + .to + .equal('/encToUserId'); }); it('should have more or 32 chars length', async () => { @@ -240,8 +323,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.instancePath).to.equal('/encToUserId'); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.instancePath) + .to + .equal('/encToUserId'); }); }); @@ -253,8 +340,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('rootEncryptionKeyIndex'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('rootEncryptionKeyIndex'); }); it('should not be less than 0', async () => { @@ -264,8 +355,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.instancePath).to.equal('/rootEncryptionKeyIndex'); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.instancePath) + .to + .equal('/rootEncryptionKeyIndex'); }); }); @@ -277,8 +372,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('privateData'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('privateData'); }); }); @@ -289,8 +388,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('additionalProperties'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); + expect(error.keyword) + .to + .equal('additionalProperties'); + expect(error.params.additionalProperties) + .to + .deep + .equal(['someOtherProperty']); }); }); @@ -315,8 +419,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('toUserId'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('toUserId'); }); }); @@ -328,8 +436,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('encryptedPublicKey'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('encryptedPublicKey'); }); }); @@ -341,8 +453,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('senderKeyIndex'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('senderKeyIndex'); }); it('should not be less than 0', async () => { @@ -352,8 +468,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.instancePath).to.equal('/senderKeyIndex'); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.instancePath) + .to + .equal('/senderKeyIndex'); }); }); @@ -365,8 +485,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('recipientKeyIndex'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('recipientKeyIndex'); }); it('should not be less than 0', async () => { @@ -376,8 +500,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.instancePath).to.equal('/recipientKeyIndex'); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.instancePath) + .to + .equal('/recipientKeyIndex'); }); }); @@ -389,8 +517,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.instancePath).to.deep.equal('/encryptedAccountLabel'); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.instancePath) + .to + .deep + .equal('/encryptedAccountLabel'); }); it('should have maximum length of 80', async () => { @@ -400,8 +533,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxItems'); - expect(error.instancePath).to.deep.equal('/encryptedAccountLabel'); + expect(error.keyword) + .to + .equal('maxItems'); + expect(error.instancePath) + .to + .deep + .equal('/encryptedAccountLabel'); }); it('should be of type array', async () => { @@ -411,8 +549,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.instancePath).to.deep.equal('/encryptedAccountLabel'); + expect(error.keyword) + .to + .equal('type'); + expect(error.instancePath) + .to + .deep + .equal('/encryptedAccountLabel'); }); }); @@ -424,8 +567,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.instancePath).to.deep.equal('/autoAcceptProof'); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.instancePath) + .to + .deep + .equal('/autoAcceptProof'); }); it('should have maximum length of 102', async () => { @@ -435,8 +583,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxItems'); - expect(error.instancePath).to.deep.equal('/autoAcceptProof'); + expect(error.keyword) + .to + .equal('maxItems'); + expect(error.instancePath) + .to + .deep + .equal('/autoAcceptProof'); }); it('should be of type array', async () => { @@ -446,8 +599,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.instancePath).to.deep.equal('/autoAcceptProof'); + expect(error.keyword) + .to + .equal('type'); + expect(error.instancePath) + .to + .deep + .equal('/autoAcceptProof'); }); }); @@ -459,8 +617,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('accountReference'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('accountReference'); }); it('should not be less than 0', async () => { @@ -470,8 +632,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.instancePath).to.equal('/accountReference'); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.instancePath) + .to + .equal('/accountReference'); }); }); @@ -483,8 +649,12 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.instancePath).to.equal('/coreHeightCreatedAt'); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.instancePath) + .to + .equal('/coreHeightCreatedAt'); }); }); @@ -495,8 +665,13 @@ describe('Dashpay Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('additionalProperties'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); + expect(error.keyword) + .to + .equal('additionalProperties'); + expect(error.params.additionalProperties) + .to + .deep + .equal(['someOtherProperty']); }); }); }); diff --git a/packages/data-contracts/Cargo.toml b/packages/data-contracts/Cargo.toml index 655973b97a0..30e4c1ee003 100644 --- a/packages/data-contracts/Cargo.toml +++ b/packages/data-contracts/Cargo.toml @@ -1,12 +1,14 @@ [package] name = "data-contracts" description = "Dash Platform system data contracts" -version = "0.25.21" +version = "1.0.0-dev.15" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" [dependencies] +thiserror = "1.0.58" +platform-version = { path = "../rs-platform-version" } serde_json = { version = "1.0" } withdrawals-contract = { path = "../withdrawals-contract" } masternode-reward-shares-contract = { path = "../masternode-reward-shares-contract" } diff --git a/packages/data-contracts/src/error.rs b/packages/data-contracts/src/error.rs new file mode 100644 index 00000000000..b9a5dd5d244 --- /dev/null +++ b/packages/data-contracts/src/error.rs @@ -0,0 +1,104 @@ +use platform_version::version::FeatureVersion; + +#[derive(thiserror::Error, Debug)] +pub enum Error { + /// Platform expected some specific versions + #[error("platform unknown version on {method}, received: {received}")] + UnknownVersionMismatch { + /// method + method: String, + /// the allowed versions for this method + known_versions: Vec, + /// requested core height + received: FeatureVersion, + }, + #[error("schema deserialize error: {0}")] + InvalidSchemaJson(#[from] serde_json::Error), +} + +impl From for Error { + fn from(e: withdrawals_contract::Error) -> Self { + match e { + withdrawals_contract::Error::UnknownVersionMismatch { + method, + known_versions, + received, + } => Error::UnknownVersionMismatch { + method, + known_versions, + received, + }, + withdrawals_contract::Error::InvalidSchemaJson(e) => Error::InvalidSchemaJson(e), + } + } +} + +impl From for Error { + fn from(e: dashpay_contract::Error) -> Self { + match e { + dashpay_contract::Error::UnknownVersionMismatch { + method, + known_versions, + received, + } => Error::UnknownVersionMismatch { + method, + known_versions, + received, + }, + dashpay_contract::Error::InvalidSchemaJson(e) => Error::InvalidSchemaJson(e), + } + } +} + +impl From for Error { + fn from(e: dpns_contract::Error) -> Self { + match e { + dpns_contract::Error::UnknownVersionMismatch { + method, + known_versions, + received, + } => Error::UnknownVersionMismatch { + method, + known_versions, + received, + }, + dpns_contract::Error::InvalidSchemaJson(e) => Error::InvalidSchemaJson(e), + } + } +} + +impl From for Error { + fn from(e: masternode_reward_shares_contract::Error) -> Self { + match e { + masternode_reward_shares_contract::Error::UnknownVersionMismatch { + method, + known_versions, + received, + } => Error::UnknownVersionMismatch { + method, + known_versions, + received, + }, + masternode_reward_shares_contract::Error::InvalidSchemaJson(e) => { + Error::InvalidSchemaJson(e) + } + } + } +} + +impl From for Error { + fn from(e: feature_flags_contract::Error) -> Self { + match e { + feature_flags_contract::Error::UnknownVersionMismatch { + method, + known_versions, + received, + } => Error::UnknownVersionMismatch { + method, + known_versions, + received, + }, + feature_flags_contract::Error::InvalidSchemaJson(e) => Error::InvalidSchemaJson(e), + } + } +} diff --git a/packages/data-contracts/src/lib.rs b/packages/data-contracts/src/lib.rs index 460233bb221..f6761d1eb8c 100644 --- a/packages/data-contracts/src/lib.rs +++ b/packages/data-contracts/src/lib.rs @@ -1,14 +1,18 @@ -use serde_json::{Error, Value}; +mod error; +use serde_json::Value; + +use crate::error::Error; pub use dashpay_contract; pub use dpns_contract; pub use feature_flags_contract; pub use masternode_reward_shares_contract; use platform_value::Identifier; +use platform_version::version::PlatformVersion; pub use withdrawals_contract; #[repr(u8)] -#[derive(PartialEq, Eq, Clone, Copy, Debug, Ord, PartialOrd)] +#[derive(PartialEq, Eq, Clone, Copy, Debug, Ord, PartialOrd, Hash)] pub enum SystemDataContract { Withdrawals = 0, MasternodeRewards = 1, @@ -20,6 +24,7 @@ pub enum SystemDataContract { pub struct DataContractSource { pub id_bytes: [u8; 32], pub owner_id_bytes: [u8; 32], + pub version: u32, pub definitions: Option, pub document_schemas: Value, } @@ -36,37 +41,46 @@ impl SystemDataContract { Identifier::new(bytes) } /// Returns [DataContractSource] - pub fn source(self) -> Result { + pub fn source(self, platform_version: &PlatformVersion) -> Result { let data = match self { SystemDataContract::Withdrawals => DataContractSource { id_bytes: withdrawals_contract::ID_BYTES, owner_id_bytes: withdrawals_contract::OWNER_ID_BYTES, - definitions: None, - document_schemas: withdrawals_contract::load_documents_schemas()?, + version: platform_version.system_data_contracts.withdrawals as u32, + definitions: withdrawals_contract::load_definitions(platform_version)?, + document_schemas: withdrawals_contract::load_documents_schemas(platform_version)?, }, SystemDataContract::MasternodeRewards => DataContractSource { id_bytes: masternode_reward_shares_contract::ID_BYTES, owner_id_bytes: masternode_reward_shares_contract::OWNER_ID_BYTES, - definitions: None, - document_schemas: masternode_reward_shares_contract::load_documents_schemas()?, + version: platform_version + .system_data_contracts + .masternode_reward_shares as u32, + definitions: withdrawals_contract::load_definitions(platform_version)?, + document_schemas: masternode_reward_shares_contract::load_documents_schemas( + platform_version, + )?, }, SystemDataContract::FeatureFlags => DataContractSource { id_bytes: feature_flags_contract::ID_BYTES, owner_id_bytes: feature_flags_contract::OWNER_ID_BYTES, - definitions: None, - document_schemas: feature_flags_contract::load_documents_schemas()?, + version: platform_version.system_data_contracts.feature_flags as u32, + definitions: feature_flags_contract::load_definitions(platform_version)?, + document_schemas: feature_flags_contract::load_documents_schemas(platform_version)?, }, SystemDataContract::DPNS => DataContractSource { id_bytes: dpns_contract::ID_BYTES, owner_id_bytes: dpns_contract::OWNER_ID_BYTES, - definitions: None, - document_schemas: dpns_contract::load_documents_schemas()?, + version: platform_version.system_data_contracts.dpns as u32, + definitions: dpns_contract::load_definitions(platform_version)?, + document_schemas: dpns_contract::load_documents_schemas(platform_version)?, }, SystemDataContract::Dashpay => DataContractSource { id_bytes: dashpay_contract::ID_BYTES, owner_id_bytes: dashpay_contract::OWNER_ID_BYTES, - definitions: None, - document_schemas: dashpay_contract::load_documents_schemas()?, + version: platform_version.system_data_contracts.dashpay as u32, + definitions: dashpay_contract::load_definitions(platform_version)?, + document_schemas: dashpay_contract::load_documents_schemas(platform_version)?, }, }; diff --git a/packages/dpns-contract/.eslintrc b/packages/dpns-contract/.eslintrc index eec7881491c..cb6c7636b60 100644 --- a/packages/dpns-contract/.eslintrc +++ b/packages/dpns-contract/.eslintrc @@ -1,15 +1,18 @@ { - "extends": "airbnb-base", - "rules": { - "no-plusplus": 0, - "eol-last": [ - "error", - "always" - ], - "class-methods-use-this": "off", - "curly": [ - "error", - "all" - ] - } -} \ No newline at end of file + "extends": "airbnb-base", + "rules": { + "no-plusplus": 0, + "eol-last": [ + "error", + "always" + ], + "class-methods-use-this": "off", + "curly": [ + "error", + "all" + ] + }, + "globals": { + "BigInt": true + } +} diff --git a/packages/dpns-contract/Cargo.toml b/packages/dpns-contract/Cargo.toml index aee9162ccad..708bfc1885d 100644 --- a/packages/dpns-contract/Cargo.toml +++ b/packages/dpns-contract/Cargo.toml @@ -1,11 +1,13 @@ [package] name = "dpns-contract" description = "DPNS data contract schema and tools" -version = "0.25.21" +version = "1.0.0-dev.15" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" [dependencies] +thiserror = "1.0.58" +platform-version = { path = "../rs-platform-version" } serde_json = { version = "1.0" } platform-value = { path = "../rs-platform-value" } diff --git a/packages/dpns-contract/package.json b/packages/dpns-contract/package.json index a1ea82bda12..1cd50c4af76 100644 --- a/packages/dpns-contract/package.json +++ b/packages/dpns-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dpns-contract", - "version": "0.25.21", + "version": "1.0.0-dev.15", "description": "A contract and helper scripts for DPNS DApp", "scripts": { "lint": "eslint .", diff --git a/packages/dpns-contract/schema/dpns-contract-documents.json b/packages/dpns-contract/schema/v1/dpns-contract-documents.json similarity index 100% rename from packages/dpns-contract/schema/dpns-contract-documents.json rename to packages/dpns-contract/schema/v1/dpns-contract-documents.json diff --git a/packages/dpns-contract/src/error.rs b/packages/dpns-contract/src/error.rs new file mode 100644 index 00000000000..d01bbcc91cf --- /dev/null +++ b/packages/dpns-contract/src/error.rs @@ -0,0 +1,17 @@ +use platform_version::version::FeatureVersion; + +#[derive(thiserror::Error, Debug)] +pub enum Error { + /// Platform expected some specific versions + #[error("platform unknown version on {method}, received: {received}")] + UnknownVersionMismatch { + /// method + method: String, + /// the allowed versions for this method + known_versions: Vec, + /// requested core height + received: FeatureVersion, + }, + #[error("schema deserialize error: {0}")] + InvalidSchemaJson(#[from] serde_json::Error), +} diff --git a/packages/dpns-contract/src/lib.rs b/packages/dpns-contract/src/lib.rs index 0321c3823c9..6c379e90249 100644 --- a/packages/dpns-contract/src/lib.rs +++ b/packages/dpns-contract/src/lib.rs @@ -1,5 +1,10 @@ +mod error; +pub mod v1; + +pub use crate::error::Error; use platform_value::{Identifier, IdentifierBytes32}; -use serde_json::{Error, Value}; +use platform_version::version::PlatformVersion; +use serde_json::Value; pub const ID_BYTES: [u8; 32] = [ 230, 104, 198, 89, 175, 102, 174, 225, 231, 44, 24, 109, 222, 123, 91, 126, 10, 29, 113, 42, 9, @@ -11,27 +16,25 @@ pub const OWNER_ID_BYTES: [u8; 32] = [ 67, 4, 181, 246, 153, 65, 68, 40, 110, 253, 172, ]; -pub mod document_types { - pub mod domain { - pub const NAME: &str = "domain"; - - pub mod properties { - pub const LABEL: &str = "label"; - pub const NORMALIZED_LABEL: &str = "normalizedLabel"; - pub const PARENT_DOMAIN_NAME: &str = "parentDomainName"; - pub const NORMALIZED_PARENT_DOMAIN_NAME: &str = "normalizedParentDomainName"; - pub const PREORDER_SALT: &str = "preorderSalt"; - pub const ALLOW_SUBDOMAINS: &str = "subdomainRules.allowSubdomains"; - pub const RECORDS: &str = "records"; - pub const DASH_UNIQUE_IDENTITY_ID: &str = "dashUniqueIdentityId"; - pub const DASH_ALIAS_IDENTITY_ID: &str = "dashAliasIdentityId"; - } - } -} - pub const ID: Identifier = Identifier(IdentifierBytes32(ID_BYTES)); pub const OWNER_ID: Identifier = Identifier(IdentifierBytes32(OWNER_ID_BYTES)); - -pub fn load_documents_schemas() -> Result { - serde_json::from_str(include_str!("../schema/dpns-contract-documents.json")) +pub fn load_definitions(platform_version: &PlatformVersion) -> Result, Error> { + match platform_version.system_data_contracts.withdrawals { + 1 => Ok(None), + version => Err(Error::UnknownVersionMismatch { + method: "dpns_contract::load_definitions".to_string(), + known_versions: vec![1], + received: version, + }), + } +} +pub fn load_documents_schemas(platform_version: &PlatformVersion) -> Result { + match platform_version.system_data_contracts.withdrawals { + 1 => v1::load_documents_schemas(), + version => Err(Error::UnknownVersionMismatch { + method: "dpns_contract::load_documents_schemas".to_string(), + known_versions: vec![1], + received: version, + }), + } } diff --git a/packages/dpns-contract/src/v1/mod.rs b/packages/dpns-contract/src/v1/mod.rs new file mode 100644 index 00000000000..fb2117245e0 --- /dev/null +++ b/packages/dpns-contract/src/v1/mod.rs @@ -0,0 +1,25 @@ +use crate::Error; +use serde_json::Value; + +pub mod document_types { + pub mod domain { + pub const NAME: &str = "domain"; + + pub mod properties { + pub const LABEL: &str = "label"; + pub const NORMALIZED_LABEL: &str = "normalizedLabel"; + pub const PARENT_DOMAIN_NAME: &str = "parentDomainName"; + pub const NORMALIZED_PARENT_DOMAIN_NAME: &str = "normalizedParentDomainName"; + pub const PREORDER_SALT: &str = "preorderSalt"; + pub const ALLOW_SUBDOMAINS: &str = "subdomainRules.allowSubdomains"; + pub const RECORDS: &str = "records"; + pub const DASH_UNIQUE_IDENTITY_ID: &str = "dashUniqueIdentityId"; + pub const DASH_ALIAS_IDENTITY_ID: &str = "dashAliasIdentityId"; + } + } +} + +pub fn load_documents_schemas() -> Result { + serde_json::from_str(include_str!("../../schema/v1/dpns-contract-documents.json")) + .map_err(Error::InvalidSchemaJson) +} diff --git a/packages/dpns-contract/test/unit/dpnsContract.spec.js b/packages/dpns-contract/test/unit/dpnsContract.spec.js index 148d79f51c2..faa88951511 100644 --- a/packages/dpns-contract/test/unit/dpnsContract.spec.js +++ b/packages/dpns-contract/test/unit/dpnsContract.spec.js @@ -1,19 +1,26 @@ const crypto = require('crypto'); const { - DashPlatformProtocol, JsonSchemaError, + DashPlatformProtocol, + JsonSchemaError, } = require('@dashevo/wasm-dpp'); const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); const { expect } = require('chai'); -const dpnsContractDocumentsSchema = require('../../schema/dpns-contract-documents.json'); +const dpnsContractDocumentsSchema = require('../../schema/v1/dpns-contract-documents.json'); const expectJsonSchemaError = (validationResult, errorCount = 1) => { const errors = validationResult.getErrors(); - expect(errors).to.have.length(errorCount); + expect(errors) + .to + .have + .length(errorCount); const error = validationResult.getErrors()[0]; - expect(error).to.be.instanceof(JsonSchemaError); + expect(error) + .to + .be + .instanceof(JsonSchemaError); return error; }; @@ -30,11 +37,14 @@ describe('DPNS Contract', () => { identityId = await generateRandomIdentifier(); - dataContract = dpp.dataContract.create(identityId, dpnsContractDocumentsSchema); + dataContract = dpp.dataContract.create(identityId, BigInt(1), dpnsContractDocumentsSchema); }); it('should have a valid contract definition', async () => { - expect(() => dpp.dataContract.create(identityId, dpnsContractDocumentsSchema)).to.not.throw(); + expect(() => dpp.dataContract.create(identityId, BigInt(1), dpnsContractDocumentsSchema)) + .to + .not + .throw(); }); describe('documents', () => { @@ -55,8 +65,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('saltedDomainHash'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('saltedDomainHash'); }); it('should not be empty', async () => { @@ -66,8 +80,13 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.instancePath).to.deep.equal('/saltedDomainHash'); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.instancePath) + .to + .deep + .equal('/saltedDomainHash'); }); it('should be not less than 32 bytes', async () => { @@ -77,8 +96,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.instancePath).to.equal('/saltedDomainHash'); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.instancePath) + .to + .equal('/saltedDomainHash'); }); it('should be not longer than 32 bytes', async () => { @@ -88,8 +111,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxItems'); - expect(error.instancePath).to.equal('/saltedDomainHash'); + expect(error.keyword) + .to + .equal('maxItems'); + expect(error.instancePath) + .to + .equal('/saltedDomainHash'); }); }); @@ -100,8 +127,13 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('additionalProperties'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); + expect(error.keyword) + .to + .equal('additionalProperties'); + expect(error.params.additionalProperties) + .to + .deep + .equal(['someOtherProperty']); }); it('should be valid', async () => { @@ -109,7 +141,10 @@ describe('DPNS Contract', () => { const result = await preorder.validate(dpp.protocolVersion); - expect(result.isValid()).to.be.true(); + expect(result.isValid()) + .to + .be + .true(); }); }); @@ -139,8 +174,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('label'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('label'); }); it('should follow pattern', async () => { @@ -150,8 +189,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('pattern'); - expect(error.instancePath).to.equal('/label'); + expect(error.keyword) + .to + .equal('pattern'); + expect(error.instancePath) + .to + .equal('/label'); }); it('should be longer than 3 chars', async () => { @@ -161,8 +204,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minLength'); - expect(error.instancePath).to.equal('/label'); + expect(error.keyword) + .to + .equal('minLength'); + expect(error.instancePath) + .to + .equal('/label'); }); it('should be less than 63 chars', async () => { @@ -172,8 +219,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult, 2); - expect(error.keyword).to.equal('pattern'); - expect(error.instancePath).to.equal('/label'); + expect(error.keyword) + .to + .equal('pattern'); + expect(error.instancePath) + .to + .equal('/label'); }); }); @@ -185,8 +236,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('normalizedLabel'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('normalizedLabel'); }); it('should follow pattern', async () => { @@ -196,8 +251,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('pattern'); - expect(error.instancePath).to.equal('/normalizedLabel'); + expect(error.keyword) + .to + .equal('pattern'); + expect(error.instancePath) + .to + .equal('/normalizedLabel'); }); it('should be less than 63 chars', async () => { @@ -207,8 +266,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult, 2); - expect(error.keyword).to.equal('pattern'); - expect(error.instancePath).to.equal('/normalizedLabel'); + expect(error.keyword) + .to + .equal('pattern'); + expect(error.instancePath) + .to + .equal('/normalizedLabel'); }); }); @@ -220,8 +283,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('normalizedParentDomainName'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('normalizedParentDomainName'); }); it('should be less than 190 chars', async () => { @@ -231,8 +298,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult, 2); - expect(error.keyword).to.equal('pattern'); - expect(error.instancePath).to.equal('/normalizedParentDomainName'); + expect(error.keyword) + .to + .equal('pattern'); + expect(error.instancePath) + .to + .equal('/normalizedParentDomainName'); }); it('should follow pattern', async () => { @@ -242,8 +313,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('pattern'); - expect(error.instancePath).to.equal('/normalizedParentDomainName'); + expect(error.keyword) + .to + .equal('pattern'); + expect(error.instancePath) + .to + .equal('/normalizedParentDomainName'); }); }); @@ -255,8 +330,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('preorderSalt'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('preorderSalt'); }); it('should not be empty', async () => { @@ -267,8 +346,13 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.instancePath).to.deep.equal('/preorderSalt'); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.instancePath) + .to + .deep + .equal('/preorderSalt'); }); it('should be not less than 32 bytes', async () => { @@ -278,8 +362,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minItems'); - expect(error.instancePath).to.equal('/preorderSalt'); + expect(error.keyword) + .to + .equal('minItems'); + expect(error.instancePath) + .to + .equal('/preorderSalt'); }); it('should be not longer than 32 bytes', async () => { @@ -289,8 +377,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxItems'); - expect(error.instancePath).to.equal('/preorderSalt'); + expect(error.keyword) + .to + .equal('maxItems'); + expect(error.instancePath) + .to + .equal('/preorderSalt'); }); }); @@ -302,8 +394,13 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('additionalProperties'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); + expect(error.keyword) + .to + .equal('additionalProperties'); + expect(error.params.additionalProperties) + .to + .deep + .equal(['someOtherProperty']); }); it('should be valid', async () => { @@ -311,7 +408,10 @@ describe('DPNS Contract', () => { const result = await domain.validate(dpp.protocolVersion); - expect(result.isValid()).to.be.true(); + expect(result.isValid()) + .to + .be + .true(); }); describe('Records', () => { @@ -322,8 +422,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('records'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('records'); }); it('should not be empty', async () => { @@ -333,8 +437,13 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minProperties'); - expect(error.instancePath).to.deep.equal('/records'); + expect(error.keyword) + .to + .equal('minProperties'); + expect(error.instancePath) + .to + .deep + .equal('/records'); }); it('should not have additional properties', async () => { @@ -346,9 +455,16 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('additionalProperties'); - expect(error.instancePath).to.equal('/records'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); + expect(error.keyword) + .to + .equal('additionalProperties'); + expect(error.instancePath) + .to + .equal('/records'); + expect(error.params.additionalProperties) + .to + .deep + .equal(['someOtherProperty']); }); describe('Dash Identity', () => { @@ -362,8 +478,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maxProperties'); - expect(error.instancePath).to.equal('/records'); + expect(error.keyword) + .to + .equal('maxProperties'); + expect(error.instancePath) + .to + .equal('/records'); }); describe('dashUniqueIdentityId', () => { @@ -374,7 +494,9 @@ describe('DPNS Contract', () => { expect(() => { dpp.document.create(dataContract, identityId, 'domain', rawDomainDocument); - }).to.throw(); + }) + .to + .throw(); }); it('should no more than 32 bytes', async () => { @@ -384,7 +506,9 @@ describe('DPNS Contract', () => { expect(() => { dpp.document.create(dataContract, identityId, 'domain', rawDomainDocument); - }).to.throw(); + }) + .to + .throw(); }); }); @@ -396,7 +520,9 @@ describe('DPNS Contract', () => { expect(() => { dpp.document.create(dataContract, identityId, 'domain', rawDomainDocument); - }).to.throw(); + }) + .to + .throw(); }); it('should no more than 32 bytes', async () => { @@ -406,7 +532,9 @@ describe('DPNS Contract', () => { expect(() => { dpp.document.create(dataContract, identityId, 'domain', rawDomainDocument); - }).to.throw(); + }) + .to + .throw(); }); }); }); @@ -420,8 +548,12 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('subdomainRules'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('subdomainRules'); }); it('should not have additional properties', async () => { @@ -431,9 +563,16 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('additionalProperties'); - expect(error.instancePath).to.equal('/subdomainRules'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); + expect(error.keyword) + .to + .equal('additionalProperties'); + expect(error.instancePath) + .to + .equal('/subdomainRules'); + expect(error.params.additionalProperties) + .to + .deep + .equal(['someOtherProperty']); }); describe('allowSubdomains', () => { @@ -444,8 +583,13 @@ describe('DPNS Contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.instancePath).to.deep.equal('/subdomainRules/allowSubdomains'); + expect(error.keyword) + .to + .equal('type'); + expect(error.instancePath) + .to + .deep + .equal('/subdomainRules/allowSubdomains'); }); }); }); diff --git a/packages/feature-flags-contract/.eslintrc b/packages/feature-flags-contract/.eslintrc index eec7881491c..cb6c7636b60 100644 --- a/packages/feature-flags-contract/.eslintrc +++ b/packages/feature-flags-contract/.eslintrc @@ -1,15 +1,18 @@ { - "extends": "airbnb-base", - "rules": { - "no-plusplus": 0, - "eol-last": [ - "error", - "always" - ], - "class-methods-use-this": "off", - "curly": [ - "error", - "all" - ] - } -} \ No newline at end of file + "extends": "airbnb-base", + "rules": { + "no-plusplus": 0, + "eol-last": [ + "error", + "always" + ], + "class-methods-use-this": "off", + "curly": [ + "error", + "all" + ] + }, + "globals": { + "BigInt": true + } +} diff --git a/packages/feature-flags-contract/Cargo.toml b/packages/feature-flags-contract/Cargo.toml index c5933bfd89d..93416fb0369 100644 --- a/packages/feature-flags-contract/Cargo.toml +++ b/packages/feature-flags-contract/Cargo.toml @@ -1,11 +1,13 @@ [package] name = "feature-flags-contract" description = "Feature flags data contract schema and tools" -version = "0.25.21" +version = "1.0.0-dev.15" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" [dependencies] +thiserror = "1.0.58" +platform-version = { path = "../rs-platform-version" } serde_json = { version = "1.0" } platform-value = { path = "../rs-platform-value" } diff --git a/packages/feature-flags-contract/package.json b/packages/feature-flags-contract/package.json index 14799d25208..ae041474d6b 100644 --- a/packages/feature-flags-contract/package.json +++ b/packages/feature-flags-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/feature-flags-contract", - "version": "0.25.21", + "version": "1.0.0-dev.15", "description": "Data Contract to store Dash Platform feature flags", "scripts": { "build": "", diff --git a/packages/feature-flags-contract/schema/feature-flags-documents.json b/packages/feature-flags-contract/schema/v1/feature-flags-documents.json similarity index 100% rename from packages/feature-flags-contract/schema/feature-flags-documents.json rename to packages/feature-flags-contract/schema/v1/feature-flags-documents.json diff --git a/packages/feature-flags-contract/src/error.rs b/packages/feature-flags-contract/src/error.rs new file mode 100644 index 00000000000..d01bbcc91cf --- /dev/null +++ b/packages/feature-flags-contract/src/error.rs @@ -0,0 +1,17 @@ +use platform_version::version::FeatureVersion; + +#[derive(thiserror::Error, Debug)] +pub enum Error { + /// Platform expected some specific versions + #[error("platform unknown version on {method}, received: {received}")] + UnknownVersionMismatch { + /// method + method: String, + /// the allowed versions for this method + known_versions: Vec, + /// requested core height + received: FeatureVersion, + }, + #[error("schema deserialize error: {0}")] + InvalidSchemaJson(#[from] serde_json::Error), +} diff --git a/packages/feature-flags-contract/src/lib.rs b/packages/feature-flags-contract/src/lib.rs index 50264845dfc..a509ebc2e05 100644 --- a/packages/feature-flags-contract/src/lib.rs +++ b/packages/feature-flags-contract/src/lib.rs @@ -1,5 +1,9 @@ +mod error; +pub mod v1; + +pub use crate::error::Error; use platform_value::{Identifier, IdentifierBytes32}; -use serde_json::Error; +use platform_version::version::PlatformVersion; use serde_json::Value; pub const ID_BYTES: [u8; 32] = [ @@ -12,20 +16,26 @@ pub const OWNER_ID_BYTES: [u8; 32] = [ 154, 191, 43, 51, 101, 131, 190, 89, 135, 167, 21, ]; -pub mod document_types { - pub mod update_consensus_params { - pub const NAME: &str = "updateConsensusParams"; - - pub mod properties { - pub const PROPERTY_BLOCK_HEIGHT: &str = "height"; - pub const PROPERTY_ENABLE_AT_HEIGHT: &str = "enableAtHeight"; - } - } -} - pub const ID: Identifier = Identifier(IdentifierBytes32(ID_BYTES)); pub const OWNER_ID: Identifier = Identifier(IdentifierBytes32(OWNER_ID_BYTES)); -pub fn load_documents_schemas() -> Result { - serde_json::from_str(include_str!("../schema/feature-flags-documents.json")) +pub fn load_definitions(platform_version: &PlatformVersion) -> Result, Error> { + match platform_version.system_data_contracts.withdrawals { + 1 => Ok(None), + version => Err(Error::UnknownVersionMismatch { + method: "feature_flags_contract::load_definitions".to_string(), + known_versions: vec![1], + received: version, + }), + } +} +pub fn load_documents_schemas(platform_version: &PlatformVersion) -> Result { + match platform_version.system_data_contracts.withdrawals { + 1 => v1::load_documents_schemas(), + version => Err(Error::UnknownVersionMismatch { + method: "feature_flags_contract::load_documents_schemas".to_string(), + known_versions: vec![1], + received: version, + }), + } } diff --git a/packages/feature-flags-contract/src/v1/mod.rs b/packages/feature-flags-contract/src/v1/mod.rs new file mode 100644 index 00000000000..43ccaf608a4 --- /dev/null +++ b/packages/feature-flags-contract/src/v1/mod.rs @@ -0,0 +1,18 @@ +use crate::error::Error; +use serde_json::Value; + +pub mod document_types { + pub mod update_consensus_params { + pub const NAME: &str = "updateConsensusParams"; + + pub mod properties { + pub const PROPERTY_BLOCK_HEIGHT: &str = "height"; + pub const PROPERTY_ENABLE_AT_HEIGHT: &str = "enableAtHeight"; + } + } +} + +pub fn load_documents_schemas() -> Result { + serde_json::from_str(include_str!("../../schema/v1/feature-flags-documents.json")) + .map_err(Error::InvalidSchemaJson) +} diff --git a/packages/feature-flags-contract/test/unit/featureFlagsContract.spec.js b/packages/feature-flags-contract/test/unit/featureFlagsContract.spec.js index f06deea8d41..c15c4978db5 100644 --- a/packages/feature-flags-contract/test/unit/featureFlagsContract.spec.js +++ b/packages/feature-flags-contract/test/unit/featureFlagsContract.spec.js @@ -1,17 +1,26 @@ -const { DashPlatformProtocol, JsonSchemaError } = require('@dashevo/wasm-dpp'); +const { + DashPlatformProtocol, + JsonSchemaError, +} = require('@dashevo/wasm-dpp'); const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); const { expect } = require('chai'); const crypto = require('crypto'); -const featureFlagsContractDocumentsSchema = require('../../schema/feature-flags-documents.json'); +const featureFlagsContractDocumentsSchema = require('../../schema/v1/feature-flags-documents.json'); const expectJsonSchemaError = (validationResult, errorCount = 1) => { const errors = validationResult.getErrors(); - expect(errors).to.have.length(errorCount); + expect(errors) + .to + .have + .length(errorCount); const error = validationResult.getErrors()[0]; - expect(error).to.be.instanceof(JsonSchemaError); + expect(error) + .to + .be + .instanceof(JsonSchemaError); return error; }; @@ -28,12 +37,24 @@ describe('Feature Flags contract', () => { identityId = await generateRandomIdentifier(); - dataContract = dpp.dataContract.create(identityId, featureFlagsContractDocumentsSchema); + dataContract = dpp.dataContract.create( + identityId, + BigInt(1), + featureFlagsContractDocumentsSchema, + ); }); it('should have a valid contract definition', async () => { - expect(() => dpp.dataContract.create(identityId, featureFlagsContractDocumentsSchema)) - .to.not.throw(); + expect(() => { + dpp.dataContract.create( + identityId, + BigInt(1), + featureFlagsContractDocumentsSchema, + ); + }) + .to + .not + .throw(); }); describe('documents', () => { @@ -68,8 +89,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult, 2); - expect(error.keyword).to.equal('minProperties'); - expect(error.params.minProperties).to.equal(3); + expect(error.keyword) + .to + .equal('minProperties'); + expect(error.params.minProperties) + .to + .equal(3); }); it('should not have additional properties', async () => { @@ -86,8 +111,13 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('additionalProperties'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); + expect(error.keyword) + .to + .equal('additionalProperties'); + expect(error.params.additionalProperties) + .to + .deep + .equal(['someOtherProperty']); }); describe('enabledAtHeight', () => { @@ -98,8 +128,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('enableAtHeight'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('enableAtHeight'); }); it('should be integer', () => { @@ -109,8 +143,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 1', () => { @@ -120,8 +158,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(1); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(1); }); }); @@ -140,8 +182,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minProperties'); - expect(error.params.minProperties).to.equal(1); + expect(error.keyword) + .to + .equal('minProperties'); + expect(error.params.minProperties) + .to + .equal(1); }); describe('maxBytes', () => { @@ -154,8 +200,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 1', async () => { @@ -167,8 +217,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(1); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(1); }); }); @@ -182,8 +236,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 1', async () => { @@ -195,8 +253,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(1); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(1); }); }); @@ -205,7 +267,10 @@ describe('Feature Flags contract', () => { const result = updateConsensusParams.validate(dpp.protocolVersion); - expect(result.isValid()).to.be.true(); + expect(result.isValid()) + .to + .be + .true(); }); }); @@ -228,8 +293,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minProperties'); - expect(error.params.minProperties).to.equal(1); + expect(error.keyword) + .to + .equal('minProperties'); + expect(error.params.minProperties) + .to + .equal(1); }); describe('maxBytes', () => { @@ -242,8 +311,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 1', async () => { @@ -255,8 +328,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(1); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(1); }); }); @@ -270,8 +347,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 1', async () => { @@ -283,8 +364,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(1); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(1); }); }); @@ -297,8 +382,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('seconds'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('seconds'); }); it('should be integer', () => { @@ -308,8 +397,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 1', () => { @@ -319,8 +412,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(1); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(1); }); }); @@ -332,8 +429,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('nanos'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('nanos'); }); it('should be integer', () => { @@ -343,8 +444,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 0', () => { @@ -354,8 +459,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(0); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(0); }); }); }); @@ -365,7 +474,10 @@ describe('Feature Flags contract', () => { const result = updateConsensusParams.validate(dpp.protocolVersion); - expect(result.isValid()).to.be.true(); + expect(result.isValid()) + .to + .be + .true(); }); }); @@ -383,8 +495,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minProperties'); - expect(error.params.minProperties).to.equal(1); + expect(error.keyword) + .to + .equal('minProperties'); + expect(error.params.minProperties) + .to + .equal(1); }); describe('appVersion', () => { @@ -397,8 +513,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.params.type) + .to + .equal('integer'); }); it('should be at least 1', async () => { @@ -410,8 +530,12 @@ describe('Feature Flags contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.params.minimum).to.equal(1); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.params.minimum) + .to + .equal(1); }); }); @@ -420,7 +544,10 @@ describe('Feature Flags contract', () => { const result = updateConsensusParams.validate(dpp.protocolVersion); - expect(result.isValid()).to.be.true(); + expect(result.isValid()) + .to + .be + .true(); }); }); @@ -429,7 +556,10 @@ describe('Feature Flags contract', () => { const result = updateConsensusParams.validate(dpp.protocolVersion); - expect(result.isValid()).to.be.true(); + expect(result.isValid()) + .to + .be + .true(); }); }); }); diff --git a/packages/js-dapi-client/docs/_sidebar.md b/packages/js-dapi-client/docs/_sidebar.md index 2d2059938e0..6f1d91a8ec7 100644 --- a/packages/js-dapi-client/docs/_sidebar.md +++ b/packages/js-dapi-client/docs/_sidebar.md @@ -7,13 +7,15 @@ - [.broadcastTransaction()](usage/application/core/broadcastTransaction.md) - [.generateToAddress()](usage/application/core/generateToAddress.md) - [.getBestBlockHash()](usage/application/core/getBestBlockHash.md) + - [.getBestBlockHeight()](usage/application/core/getBestBlockHeight.md) - [.getBlockByHash()](usage/application/core/getBlockByHash.md) - [.getBlockByHeight()](usage/application/core/getBlockByHeight.md) - [.getBlockHash()](usage/application/core/getBlockHash.md) - - [.getMnListDiff()](usage/application/core/getMnListDiff.md) - [.getStatus()](usage/application/core/getStatus.md) - [.getTransaction()](usage/application/core/getTransaction.md) - [.subscribeToTransactionsWithProofs()](usage/application/core/subscribeToTransactionsWithProofs.md) + - [.subscribeToBlockHeadersWithChainLocks()](usage/application/core/subscribeToBlockHeadersWithChainLocks.md) + - [.subscribeToMasternodeList()](usage/application/core/subscribeToMasternodeList.md) - Platform - [.broadcastStateTransition()](usage/application/platform/broadcastStateTransition.md) - [.getDataContract()](usage/application/platform/getDataContract.md) diff --git a/packages/js-dapi-client/docs/usage/application/core/generateToAddress.md b/packages/js-dapi-client/docs/usage/application/core/generateToAddress.md deleted file mode 100644 index e3eb7fafcfc..00000000000 --- a/packages/js-dapi-client/docs/usage/application/core/generateToAddress.md +++ /dev/null @@ -1,13 +0,0 @@ -**Usage**: `await client.core.generateToAddress(blockMumber, address, options)` -**Description**: Allow to broadcast a valid **signed** transaction to the network. -**Notes**: Will only works on regtest. - -Parameters: - -| parameters | type | required | Description | -|---------------------------|---------------------|----------------| ------------------------------------------------------------------------------------------------ | -| **blocksNumber** | Number | yes | A number of block to see generated on the regtest network | -| **address** | String | yes | The address that will receive the newly generated Dash | -| **options** | DAPIClientOptions | no | | - -Returns : {Promise} - a set of generated blockhashes. diff --git a/packages/js-dapi-client/docs/usage/application/core/getBestBlockHeight.md b/packages/js-dapi-client/docs/usage/application/core/getBestBlockHeight.md new file mode 100644 index 00000000000..9a301c031e6 --- /dev/null +++ b/packages/js-dapi-client/docs/usage/application/core/getBestBlockHeight.md @@ -0,0 +1,10 @@ +**Usage**: `await client.core.getBestBlockHeight(options)` +**Description**: Allow to fetch the best (highest/latest block height) from the network + +Parameters: + +| parameters | type | required | Description | +|---------------------------|---------------------|----------------| ------------------------------------------------------------------------------------------------ | +| **options** | DAPIClientOptions | no | | + +Returns : {Promise} - The best block height diff --git a/packages/js-dapi-client/docs/usage/application/core/getMnListDiff.md b/packages/js-dapi-client/docs/usage/application/core/getMnListDiff.md deleted file mode 100644 index 9c1ee698ab0..00000000000 --- a/packages/js-dapi-client/docs/usage/application/core/getMnListDiff.md +++ /dev/null @@ -1,12 +0,0 @@ -**Usage**: `await client.core.getMnListDiff(baseBlockHash, blockHash, options)` -**Description**: Allow to fetch a specific block hash from its height - -Parameters: - -| parameters | type | required | Description | -|---------------------------|---------------------|----------------| ------------------------------------------------------------------------------------------------ | -| **baseBlockHash** | String | yes | hash or height of start block | -| **blockHash** | String | yes | hash or height of end block | -| **options** | DAPIClientOptions | no | | - -Returns : {Promise} - The Masternode List Diff of the specified period diff --git a/packages/js-dapi-client/docs/usage/application/core/subscribeToBlockHeadersWithChainLocks.md b/packages/js-dapi-client/docs/usage/application/core/subscribeToBlockHeadersWithChainLocks.md new file mode 100644 index 00000000000..5c7b09201c6 --- /dev/null +++ b/packages/js-dapi-client/docs/usage/application/core/subscribeToBlockHeadersWithChainLocks.md @@ -0,0 +1,39 @@ +**Usage**: `await client.core.subscribeToBlockHeadersWithChainLocks(options = { count: 0 })`\ +**Description**: Returns a ClientReadableStream streaming of block headers and chainlocks. + + +Parameters: + +| parameters | type | required | Description | +|----------------------------|------------------|----------------| ------------------------------------------------------------------------------------------------ | +| **options.fromBlockHash** | String | yes | Specifies block hash to start syncing from | +| **options.fromBlockHeight**| Number | yes | Specifies block height to start syncing from | +| **options.count** | Number | no (default: 0)| Number of blocks to sync, if set to 0 syncing is continuously sends new data as well | + +Returns : Promise|!grpc.web.ClientReadableStream + +Example : + +```js +const { BlockHeader, ChainLock } = require('@dashevo/dashcore-lib'); + +const stream = await client.subscribeToBlockHeadersWithChainLocks({ fromBlockHeight: 0 }); + +stream + .on('data', (response) => { + const rawHeaders = response.getBlockHeaders(); + const rawChainLock = response.getChainLock(); + + if (headers.length > 0) { + const headers = rawHeaders.map((rawHeader) => new BlockHeader(rawHeader)); + console.dir(headers); + } + + if (rawChainLock) { + const chainLock = new ChainLock(rawChainLock); + } + }) + .on('error', (err) => { + // do something with err + }); +``` diff --git a/packages/js-dapi-client/docs/usage/application/core/subscribeToMasternodeList.md b/packages/js-dapi-client/docs/usage/application/core/subscribeToMasternodeList.md new file mode 100644 index 00000000000..badcd7ff782 --- /dev/null +++ b/packages/js-dapi-client/docs/usage/application/core/subscribeToMasternodeList.md @@ -0,0 +1,24 @@ +**Usage**: `await client.core.subscribeToMasternodeList(options = {})`\ +**Description**: Returns a ClientReadableStream streaming of masternode list diffs ([DIP-4](https://github.com/dashpay/dips/blob/master/dip-0004.md)). As a first message it returns a diff from the first block to the current tip and a diff for each new chainlocked block. + +Returns : Promise|!grpc.web.ClientReadableStream + +Example : + +```js +const { SimplifiedMNList, SimplifiedMNListDiff } = require('@dashevo/dashcore-lib'); + +const stream = await client.subscribeToMasternodeList(); + +const list = new SimplifiedMNList(); + +stream + .on('data', (response) => { + const diffBuffer = Buffer.from(response.getMasternodeListDiff_asU8()); + const diff = new SimplifiedMNListDiff(diffBuffer); + list.applyDiff(diff); + }) + .on('error', (err) => { + // do something with err + }); +``` diff --git a/packages/js-dapi-client/docs/usage/application/core/subscribeToTransactionsWithProofs.md b/packages/js-dapi-client/docs/usage/application/core/subscribeToTransactionsWithProofs.md new file mode 100644 index 00000000000..7411b3eeedd --- /dev/null +++ b/packages/js-dapi-client/docs/usage/application/core/subscribeToTransactionsWithProofs.md @@ -0,0 +1,48 @@ +**Usage**: `await client.core.subscribeToTransactionsWithProofs(bloomFilter, options = { count: 0 })`\ +**Description**: For any provided bloomfilter, it will return a ClientReadableStream streaming the transaction matching the filter. + + +Parameters: + +| parameters | type | required | Description | +|----------------------------|------------------|----------------| ------------------------------------------------------------------------------------------------ | +| **bloomFilter.vData** | Uint8Array/Array | yes | The filter itself is simply a bit field of arbitrary byte-aligned size. The maximum size is 36,000 bytes. | +| **bloomFilter.nHashFuncs** | Number | yes | The number of hash functions to use in this filter. The maximum value allowed in this field is 50. | +| **bloomFilter.nTweak** | Number | yes | A random value to add to the seed value in the hash function used by the bloom filter. | +| **bloomFilter.nFlags** | Number | yes | A set of flags that control how matched items are added to the filter. | +| **options.fromBlockHash** | String | yes | Specifies block hash to start syncing from | +| **options.fromBlockHeight**| Number | yes | Specifies block height to start syncing from | +| **options.count** | Number | no (default: 0)| Number of blocks to sync, if set to 0 syncing is continuously sends new data as well | + +Returns : Promise|!grpc.web.ClientReadableStream + +Example : + +```js +const { BloomFilter, Transaction, MerkleBlock } = require('@dashevo/dashcore-lib'); + +const filter = BloomFilter.create(1, 0.001); // A BloomFilter object +const stream = await client.subscribeToTransactionsWithProofs(filter, { fromBlockHeight: 0 }); + +stream + .on('data', (response) => { + const rawMerkleBlock = response.getRawMerkleBlock(); + const rawTransactions = response.getRawTransactions(); + + if (merkleBlock) { + const merkleBlock = new MerkleBlock(rawMerkleBlock); + console.dir(merkleBlock); + } + + if (transactions.length > 0) { + // tx are probabilistic, so you will have to verify it's yours + const transactions = transactions.getTransactionsList() + .map((tx) => new Transaction(Buffer.from(tx))); + + console.dir(transactions); + } + }) + .on('error', (err) => { + // do something with err + }); +``` diff --git a/packages/js-dapi-client/docs/usage/utils/subscribeToTransactionsWithProofs.md b/packages/js-dapi-client/docs/usage/utils/subscribeToTransactionsWithProofs.md deleted file mode 100644 index 96602882b5d..00000000000 --- a/packages/js-dapi-client/docs/usage/utils/subscribeToTransactionsWithProofs.md +++ /dev/null @@ -1,45 +0,0 @@ -**Usage**: `await client.core.subscribeToTransactionsWithProofs(bloomFilter, options = { count: 0 })`\ -**Description**: For any provided bloomfilter, it will return a ClientReadableStream streaming the transaction matching the filter. - - -Parameters: - -| parameters | type | required | Description | -|----------------------------|------------------|----------------| ------------------------------------------------------------------------------------------------ | -| **bloomFilter.vData** | Uint8Array/Array | yes | The filter itself is simply a bit field of arbitrary byte-aligned size. The maximum size is 36,000 bytes. | -| **bloomFilter.nHashFuncs** | Number | yes | The number of hash functions to use in this filter. The maximum value allowed in this field is 50. | -| **bloomFilter.nTweak** | Number | yes | A random value to add to the seed value in the hash function used by the bloom filter. | -| **bloomFilter.nFlags** | Number | yes | A set of flags that control how matched items are added to the filter. | -| **options.fromBlockHash** | String | yes | Specifies block hash to start syncing from | -| **options.fromBlockHeight**| Number | yes | Specifies block height to start syncing from | -| **options.count** | Number | no (default: 0)| Number of blocks to sync, if set to 0 syncing is continuously sends new data as well | - -Returns : Promise|!grpc.web.ClientReadableStream - -Example : - -```js -const filter; // A BloomFilter object -const stream = await client.subscribeToTransactionsWithProofs(filter, { fromBlockHeight: 0 }); - -stream - .on('data', (response) => { - const merkleBlock = response.getRawMerkleBlock(); - const transactions = response.getRawTransactions(); - - if (merkleBlock) { - const merkleBlockHex = Buffer.from(merkleBlock).toString('hex'); - } - - if (transactions) { - transactions.getTransactionsList() - .forEach((tx) => { - // tx are probabilistic, so you will have to verify it's yours - const tx = new Transaction(Buffer.from(tx)); - }); - } - }) - .on('error', (err) => { - // do something with err - }); -``` diff --git a/packages/js-dapi-client/lib/BlockHeadersProvider/createBlockHeadersProviderFromOptions.js b/packages/js-dapi-client/lib/BlockHeadersProvider/createBlockHeadersProviderFromOptions.js index 4b79bf158df..642da97dc79 100644 --- a/packages/js-dapi-client/lib/BlockHeadersProvider/createBlockHeadersProviderFromOptions.js +++ b/packages/js-dapi-client/lib/BlockHeadersProvider/createBlockHeadersProviderFromOptions.js @@ -19,14 +19,15 @@ const validateNumber = (value, name, min = NaN, max = NaN) => { /** * @typedef {createBlockHeadersProviderFromOptions} * @param {DAPIClientOptions} options + * @param logger * @param {CoreMethodsFacade} coreMethods * @returns {BlockHeadersProvider} */ -function createBlockHeadersProviderFromOptions(options, coreMethods) { +function createBlockHeadersProviderFromOptions(options, coreMethods, logger) { let blockHeadersProvider; if (options.blockHeadersProvider) { if (options.blockHeadersProviderOptions) { - throw new DAPIClientError("Can't use 'blockHeadersProviderOptions' with 'blockHeadersProvider' option"); + throw new DAPIClientError('Can\'t use \'blockHeadersProviderOptions\' with \'blockHeadersProvider\' option'); } blockHeadersProvider = options.blockHeadersProvider; @@ -37,6 +38,7 @@ function createBlockHeadersProviderFromOptions(options, coreMethods) { coreMethods.subscribeToBlockHeadersWithChainLocks, { maxRetriesOnError: -1, + logger, }, )({ fromBlockHeight, diff --git a/packages/js-dapi-client/lib/DAPIClient.js b/packages/js-dapi-client/lib/DAPIClient.js index d6561c24683..f939cbddd49 100644 --- a/packages/js-dapi-client/lib/DAPIClient.js +++ b/packages/js-dapi-client/lib/DAPIClient.js @@ -34,6 +34,7 @@ class DAPIClient extends EventEmitter { blockHeadersProviderOptions: BlockHeadersProvider.defaultOptions, loggerOptions: { identifier: '', + level: undefined, }, ...options, }; @@ -57,7 +58,10 @@ class DAPIClient extends EventEmitter { this.core = new CoreMethodsFacade(jsonRpcTransport, grpcTransport); this.platform = new PlatformMethodsFacade(grpcTransport); - this.logger = logger.getForId(this.options.loggerOptions.identifier); + this.logger = logger.getForId( + this.options.loggerOptions.identifier, + this.options.loggerOptions.level, + ); this.initBlockHeadersProvider(); } @@ -66,12 +70,30 @@ class DAPIClient extends EventEmitter { * @private */ initBlockHeadersProvider() { - this.blockHeadersProvider = createBlockHeadersProviderFromOptions(this.options, this.core); + this.blockHeadersProvider = createBlockHeadersProviderFromOptions( + this.options, + this.core, + this.logger, + ); this.blockHeadersProvider.on(BlockHeadersProvider.EVENTS.ERROR, (e) => { this.emit(EVENTS.ERROR, e); }); } + + /** + * Close all open connections + * @returns {Promise} + */ + async disconnect() { + // Stop block headers provider + await this.blockHeadersProvider.stop(); + + // Stop masternode list provider + if (this.dapiAddressProvider.smlProvider) { + await this.dapiAddressProvider.smlProvider.unsubscribe(); + } + } } DAPIClient.EVENTS = EVENTS; @@ -89,6 +111,7 @@ DAPIClient.EVENTS = EVENTS; * @property {boolean} [throwDeadlineExceeded] * @property {object} [loggerOptions] * @property {string} [loggerOptions.identifier] + * @property {string} [loggerOptions.level] * @property {BlockHeadersProvider} [blockHeadersProvider] * @property {BlockHeadersProviderOptions} [blockHeadersProviderOptions] */ diff --git a/packages/js-dapi-client/lib/SimplifiedMasternodeListProvider/SimplifiedMasternodeListProvider.js b/packages/js-dapi-client/lib/SimplifiedMasternodeListProvider/SimplifiedMasternodeListProvider.js index 8e40f8de296..f275aa4e644 100644 --- a/packages/js-dapi-client/lib/SimplifiedMasternodeListProvider/SimplifiedMasternodeListProvider.js +++ b/packages/js-dapi-client/lib/SimplifiedMasternodeListProvider/SimplifiedMasternodeListProvider.js @@ -1,27 +1,33 @@ const SimplifiedMNList = require('@dashevo/dashcore-lib/lib/deterministicmnlist/SimplifiedMNList'); const SimplifiedMNListDiff = require('@dashevo/dashcore-lib/lib/deterministicmnlist/SimplifiedMNListDiff'); +const logger = require('../logger'); + class SimplifiedMasternodeListProvider { /** - * - * @param {JsonRpcTransport} jsonRpcTransport - JsonRpcTransport instance + * @param {Function} createStream - JsonRpcTransport instance * @param {object} [options] - Options - * @param {number} [options.updateInterval] * @param {string} [options.network] + * @param {string} [options.loggerOptions] */ - constructor(jsonRpcTransport, options = {}) { - this.jsonRpcTransport = jsonRpcTransport; - - this.options = { - updateInterval: 60000, - ...options, - }; - - this.simplifiedMNList = new SimplifiedMNList(undefined, this.options.network); + constructor(createStream, options = {}) { + this.createStream = createStream; + this.options = options; + this.logger = logger.getForId( + this.options.loggerOptions.identifier, + this.options.loggerOptions.level, + ); - this.lastUpdateDate = 0; + /** + * @type {ReconnectableStream} + */ + this.stream = undefined; + this.removeStreamListeners = () => {}; - this.baseBlockHash = SimplifiedMasternodeListProvider.NULL_HASH; + /** + * @type {SimplifiedMNList} + */ + this.simplifiedMNList = new SimplifiedMNList(undefined); } /** @@ -29,75 +35,178 @@ class SimplifiedMasternodeListProvider { * @returns {Promise} */ async getSimplifiedMNList() { - if (this.needsUpdate()) { - await this.updateMasternodeList(); + if (this.stream === undefined) { + await this.subscribeToMasternodeList(); } return this.simplifiedMNList; } /** - * Checks whether simplified masternode list needs update + * Subscribe to simplified masternodes list updates. No need to call it manually * @private - * @returns {boolean} + * @returns {Promise} */ - needsUpdate() { - return Date.now() - this.options.updateInterval > this.lastUpdateDate; - } - - /** - * Updates simplified masternodes list. No need to call it manually - * @private - */ - async updateMasternodeList() { - const diff = await this.getSimplifiedMNListDiff(); - - try { - this.simplifiedMNList.applyDiff(diff); - } catch (e) { - if (e.message === 'Cannot apply diff: previous blockHash needs to equal the new diff\'s baseBlockHash') { - this.reset(); - - await this.updateMasternodeList(); - - return; - } - - throw e; + async subscribeToMasternodeList() { + if (this.stream) { + this.logger.debug('Masternode list stream already started'); + return Promise.resolve(); } - this.baseBlockHash = diff.blockHash; + this.logger.debug('Starting masternode list stream'); - this.lastUpdateDate = Date.now(); - } + this.stream = await this.createStream(); - /** - * Fetches masternode diff from DAPI - * @private - * @returns {Promise} - */ - async getSimplifiedMNListDiff() { - const blockHash = await this.jsonRpcTransport.request('getBestBlockHash'); + let diffCount = 0; + let resolved = false; - const rawSimplifiedMNListDiff = await this.jsonRpcTransport.request( - 'getMnListDiff', - { baseBlockHash: this.baseBlockHash, blockHash }, - { addresses: [this.jsonRpcTransport.getLastUsedAddress()] }, - ); + const rejectDiff = (error) => { + this.logger.silly('Stream is cancelled due to error. Retrying...', { error }); - return new SimplifiedMNListDiff(rawSimplifiedMNListDiff, this.options.network); + this.stream.cancel(); + this.stream.retryOnError(error); + }; + + return new Promise((resolve, reject) => { + const errorHandler = (error) => { + this.stream = null; + + this.logger.error( + `Masternode list sync failed: ${error.message}`, + { error, diffCount }, + ); + + if (!resolved) { + reject(error); + resolved = true; + } + }; + + const dataHandler = (response) => { + diffCount += 1; + + if (diffCount === 1) { + this.logger.silly( + 'Full masternode list diff received', + { diffCount }, + ); + } else { + this.logger.silly( + 'Received masternode list diff', + { diffCount }, + ); + } + + let simplifiedMNListDiff; + let simplifiedMNListDiffBuffer; + try { + simplifiedMNListDiffBuffer = Buffer.from(response.getMasternodeListDiff_asU8()); + simplifiedMNListDiff = new SimplifiedMNListDiff( + simplifiedMNListDiffBuffer, + this.options.network, + ); + } catch (e) { + this.logger.warn( + `Can't parse masternode list diff: ${e.message}`, + { + diffCount, + network: this.options.network, + error: e, + simplifiedMNListDiff: simplifiedMNListDiffBuffer.toString('hex'), + }, + ); + + rejectDiff(e); + + return; + } + + this.logger.silly( + 'Parsed masternode list diff successfully', + { + diffCount, + blockHash: simplifiedMNListDiff.blockHash, + }, + ); + + try { + // Restart list when we receive a full diff + if (diffCount === 1) { + this.simplifiedMNList = new SimplifiedMNList(simplifiedMNListDiff); + } else { + this.simplifiedMNList.applyDiff(simplifiedMNListDiff); + } + } catch (e) { + this.logger.warn( + `Can't apply masternode list diff: ${e.message}`, + { + diffCount, + network: this.options.network, + blockHash: simplifiedMNListDiff.blockHash, + error: e, + simplifiedMNListDiff, + }, + ); + + rejectDiff(e); + } + + this.logger.silly( + 'Masternode list diff applied successfully', + { + diffCount, + blockHash: simplifiedMNListDiff.blockHash, + }, + ); + + if (!resolved) { + resolve(); + resolved = true; + } + }; + + const beforeReconnectHandler = () => { + diffCount = 0; + + this.logger.debug( + 'Restarting masternode list stream', + { diffCount }, + ); + }; + + const endHandler = () => { + this.logger.warn( + 'Masternode list sync stopped', + { diffCount }, + ); + + this.removeStreamListeners(); + this.stream = null; + }; + + this.stream.on('data', dataHandler); + this.stream.on('beforeReconnect', beforeReconnectHandler); + this.stream.on('error', errorHandler); + this.stream.on('end', endHandler); + + this.removeStreamListeners = () => { + this.stream.removeListener('data', dataHandler); + this.stream.removeListener('beforeReconnect', beforeReconnectHandler); + this.stream.removeListener('error', errorHandler); + this.stream.removeListener('end', endHandler); + }; + }); } /** - * Reset simplifiedMNList - * @private + * Unsubscribe from masternode list updates */ - reset() { - this.simplifiedMNList = new SimplifiedMNList(undefined, this.options.network); - - this.lastUpdateDate = 0; - - this.baseBlockHash = SimplifiedMasternodeListProvider.NULL_HASH; + unsubscribe() { + if (this.stream) { + this.removeStreamListeners(); + this.stream.cancel(); + this.stream = null; + } } } diff --git a/packages/js-dapi-client/lib/SimplifiedMasternodeListProvider/createMasternodeListStreamFactory.js b/packages/js-dapi-client/lib/SimplifiedMasternodeListProvider/createMasternodeListStreamFactory.js new file mode 100644 index 00000000000..fca1a8e6c7b --- /dev/null +++ b/packages/js-dapi-client/lib/SimplifiedMasternodeListProvider/createMasternodeListStreamFactory.js @@ -0,0 +1,49 @@ +const { + v0: { + MasternodeListRequest, + CorePromiseClient, + }, +} = require('@dashevo/dapi-grpc'); + +const GrpcTransport = require('../transport/GrpcTransport/GrpcTransport'); +const createGrpcTransportError = require('../transport/GrpcTransport/createGrpcTransportError'); +const ReconnectableStream = require('../transport/ReconnectableStream'); + +/** + * Creates continues masternode list stream + * + * @param {createDAPIAddressProviderFromOptions} createDAPIAddressProviderFromOptions + * @param {ListDAPIAddressProvider} listDAPIAddressProvider + * @param {Object} options + * @return {function(...[*]): Promise} + */ +function createMasternodeListStreamFactory( + createDAPIAddressProviderFromOptions, + listDAPIAddressProvider, + options, +) { + const grpcTransport = new GrpcTransport( + createDAPIAddressProviderFromOptions, + listDAPIAddressProvider, + createGrpcTransportError, + options, + ); + + return ReconnectableStream + .create( + () => grpcTransport.request( + CorePromiseClient, + 'subscribeToMasternodeList', + new MasternodeListRequest(), + { + timeout: undefined, + autoReconnectInterval: 0, + }, + ), + { + maxRetriesOnError: -1, + }, + ); +} + +module.exports = createMasternodeListStreamFactory; diff --git a/packages/js-dapi-client/lib/dapiAddressProvider/createDAPIAddressProviderFromOptions.js b/packages/js-dapi-client/lib/dapiAddressProvider/createDAPIAddressProviderFromOptions.js index 73403ddc240..5a02a00b58d 100644 --- a/packages/js-dapi-client/lib/dapiAddressProvider/createDAPIAddressProviderFromOptions.js +++ b/packages/js-dapi-client/lib/dapiAddressProvider/createDAPIAddressProviderFromOptions.js @@ -6,10 +6,7 @@ const ListDAPIAddressProvider = require('./ListDAPIAddressProvider'); const SimplifiedMasternodeListProvider = require('../SimplifiedMasternodeListProvider/SimplifiedMasternodeListProvider'); const SimplifiedMasternodeListDAPIAddressProvider = require('./SimplifiedMasternodeListDAPIAddressProvider'); - -const JsonRpcTransport = require('../transport/JsonRpcTransport/JsonRpcTransport'); -const requestJsonRpc = require('../transport/JsonRpcTransport/requestJsonRpc'); -const createJsonTransportError = require('../transport/JsonRpcTransport/createJsonTransportError'); +const createMasternodeListStreamFactory = require('../SimplifiedMasternodeListProvider/createMasternodeListStreamFactory'); const DAPIClientError = require('../errors/DAPIClientError'); @@ -82,17 +79,15 @@ function createDAPIAddressProviderFromOptions(options) { options, ); - const jsonRpcTransport = new JsonRpcTransport( + const createStream = createMasternodeListStreamFactory( createDAPIAddressProviderFromOptions, - requestJsonRpc, listDAPIAddressProvider, - createJsonTransportError, options, ); const smlProvider = new SimplifiedMasternodeListProvider( - jsonRpcTransport, - { network: options.network }, + createStream, + options, ); return new SimplifiedMasternodeListDAPIAddressProvider( diff --git a/packages/js-dapi-client/lib/logger/index.js b/packages/js-dapi-client/lib/logger/index.js index c59df018a9c..a06b34c145d 100644 --- a/packages/js-dapi-client/lib/logger/index.js +++ b/packages/js-dapi-client/lib/logger/index.js @@ -1,7 +1,9 @@ const util = require('util'); const winston = require('winston'); -const LOG_LEVEL = process.env.LOG_LEVEL || 'info'; +// TODO: Refactor to use params instead on envs + +const LOG_LEVEL = process.env.LOG_LEVEL || 'silent'; const LOG_TO_FILE = process.env.LOG_WALLET_TO_FILE || 'false'; // Log levels: @@ -36,6 +38,7 @@ const createLogger = (formats = [], id = '') => { const transports = [ new winston.transports.Console({ format, + silent: LOG_LEVEL === 'silent', }), ]; @@ -44,6 +47,7 @@ const createLogger = (formats = [], id = '') => { new winston.transports.File({ filename: `wallet${id !== '' ? `_${id}` : ''}`, format, + silent: LOG_LEVEL === 'silent', }), ); } diff --git a/packages/js-dapi-client/lib/methods/core/CoreMethodsFacade.js b/packages/js-dapi-client/lib/methods/core/CoreMethodsFacade.js index 306add3c953..4aa080cb272 100644 --- a/packages/js-dapi-client/lib/methods/core/CoreMethodsFacade.js +++ b/packages/js-dapi-client/lib/methods/core/CoreMethodsFacade.js @@ -1,14 +1,15 @@ const broadcastTransactionFactory = require('./broadcastTransactionFactory'); -const generateToAddressFactory = require('./generateToAddressFactory'); const getBestBlockHashFactory = require('./getBestBlockHashFactory'); +const getBestBlockHeightFactory = require('./getBestBlockHeightFactory'); const getBlockByHashFactory = require('./getBlockByHashFactory'); const getBlockByHeightFactory = require('./getBlockByHeightFactory'); const getBlockHashFactory = require('./getBlockHashFactory'); -const getMnListDiffFactory = require('./getMnListDiffFactory'); -const getStatusFactory = require('./getStatusFactory'); +const getBlockchainStatusFactory = require('./getBlockchainStatusFactory'); +const getMasternodeStatusFactory = require('./getMasternodeStatusFactory'); const getTransactionFactory = require('./getTransaction/getTransactionFactory'); const subscribeToTransactionsWithProofsFactory = require('./subscribeToTransactionsWithProofsFactory'); const subscribeToBlockHeadersWithChainLocksFactory = require('./subscribeToBlockHeadersWithChainLocksFactory'); +const subscribeToToMasternodeListFactory = require('./subscribeToMasternodeListFactory'); class CoreMethodsFacade { /** @@ -17,13 +18,13 @@ class CoreMethodsFacade { */ constructor(jsonRpcTransport, grpcTransport) { this.broadcastTransaction = broadcastTransactionFactory(grpcTransport); - this.generateToAddress = generateToAddressFactory(jsonRpcTransport); this.getBestBlockHash = getBestBlockHashFactory(jsonRpcTransport); + this.getBestBlockHeight = getBestBlockHeightFactory(grpcTransport); this.getBlockByHash = getBlockByHashFactory(grpcTransport); this.getBlockByHeight = getBlockByHeightFactory(grpcTransport); this.getBlockHash = getBlockHashFactory(jsonRpcTransport); - this.getMnListDiff = getMnListDiffFactory(jsonRpcTransport); - this.getStatus = getStatusFactory(grpcTransport); + this.getBlockchainStatus = getBlockchainStatusFactory(grpcTransport); + this.getMasternodeStatus = getMasternodeStatusFactory(grpcTransport); this.getTransaction = getTransactionFactory(grpcTransport); this.subscribeToTransactionsWithProofs = subscribeToTransactionsWithProofsFactory( grpcTransport, @@ -31,6 +32,9 @@ class CoreMethodsFacade { this.subscribeToBlockHeadersWithChainLocks = subscribeToBlockHeadersWithChainLocksFactory( grpcTransport, ); + this.subscribeToMasternodeList = subscribeToToMasternodeListFactory( + grpcTransport, + ); } } diff --git a/packages/js-dapi-client/lib/methods/core/generateToAddressFactory.js b/packages/js-dapi-client/lib/methods/core/generateToAddressFactory.js deleted file mode 100644 index c6eaea08860..00000000000 --- a/packages/js-dapi-client/lib/methods/core/generateToAddressFactory.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * @param {JsonRpcTransport} jsonRpcTransport - * @returns {generateToAddress} - */ -function generateToAddressFactory(jsonRpcTransport) { - /** - * ONLY FOR TESTING PURPOSES WITH REGTEST. WILL NOT WORK ON TESTNET/LIVENET. - * @typedef {generateToAddress} - * @param {number} blocksNumber - Number of blocks to generate - * @param {string} address - The address that will receive the newly generated Dash - * @param {DAPIClientOptions} [options] - * @returns {Promise} - block hashes - */ - function generateToAddress(blocksNumber, address, options = {}) { - return jsonRpcTransport.request( - 'generateToAddress', - { blocksNumber, address }, - options, - ); - } - - return generateToAddress; -} - -module.exports = generateToAddressFactory; diff --git a/packages/js-dapi-client/lib/methods/core/getBestBlockHeightFactory.js b/packages/js-dapi-client/lib/methods/core/getBestBlockHeightFactory.js new file mode 100644 index 00000000000..485010fd33b --- /dev/null +++ b/packages/js-dapi-client/lib/methods/core/getBestBlockHeightFactory.js @@ -0,0 +1,34 @@ +const { + v0: { + GetBestBlockHeightRequest, + CorePromiseClient, + }, +} = require('@dashevo/dapi-grpc'); + +/** + * + * @param {GrpcTransport} grpcTransport + * @returns {getBestBlockHeight} + */ +function getBestBlockHeightFactory(grpcTransport) { + /** + * Returns block height of chain tip + * @typedef {getBestBlockHeight} + * @param {DAPIClientOptions} [options] + * @returns {Promise} + */ + async function getBestBlockHeight(options = {}) { + const response = await grpcTransport.request( + CorePromiseClient, + 'getBestBlockHeight', + new GetBestBlockHeightRequest(), + options, + ); + + return response.getHeight(); + } + + return getBestBlockHeight; +} + +module.exports = getBestBlockHeightFactory; diff --git a/packages/js-dapi-client/lib/methods/core/getBlockchainStatusFactory.js b/packages/js-dapi-client/lib/methods/core/getBlockchainStatusFactory.js new file mode 100644 index 00000000000..22b1f88e573 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/core/getBlockchainStatusFactory.js @@ -0,0 +1,59 @@ +const { + v0: { + GetBlockchainStatusRequest, + GetBlockchainStatusResponse, + CorePromiseClient, + }, +} = require('@dashevo/dapi-grpc'); + +/** + * @param {GrpcTransport} grpcTransport + * @returns {getBlockchainStatus} + */ +function getBlockchainStatusFactory(grpcTransport) { + /** + * Get Core chain status + * @typedef {getBlockchainStatus} + * @param {DAPIClientOptions} [options] + * @returns {Promise} + */ + async function getBlockchainStatus(options = {}) { + const getBlockchainStatusRequest = new GetBlockchainStatusRequest(); + + const response = await grpcTransport.request( + CorePromiseClient, + 'getBlockchainStatus', + getBlockchainStatusRequest, + options, + ); + + const responseObject = response.toObject(); + + // Respond with Buffers instead of base64 for binary fields + + if (response.getChain()) { + if (response.getChain() + .getBestBlockHash()) { + responseObject.chain.bestBlockHash = Buffer.from(response.getChain() + .getBestBlockHash()); + } + + if (response.getChain() + .getChainWork()) { + responseObject.chain.chainWork = Buffer.from(response.getChain() + .getChainWork()); + } + } + + // Respond with constant names instead of constant values + + responseObject.status = Object.keys(GetBlockchainStatusResponse.Status) + .find((key) => GetBlockchainStatusResponse.Status[key] === responseObject.status); + + return responseObject; + } + + return getBlockchainStatus; +} + +module.exports = getBlockchainStatusFactory; diff --git a/packages/js-dapi-client/lib/methods/core/getMasternodeStatusFactory.js b/packages/js-dapi-client/lib/methods/core/getMasternodeStatusFactory.js new file mode 100644 index 00000000000..c0da5feef98 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/core/getMasternodeStatusFactory.js @@ -0,0 +1,45 @@ +const { + v0: { + GetMasternodeStatusRequest, + GetMasternodeStatusResponse, + CorePromiseClient, + }, +} = require('@dashevo/dapi-grpc'); + +/** + * @param {GrpcTransport} grpcTransport + * @returns {getMasternodeStatus} + */ +function getMasternodeStatusFactory(grpcTransport) { + /** + * Get Core chain status + * @typedef {getMasternodeStatus} + * @param {DAPIClientOptions} [options] + * @returns {Promise} + */ + async function getMasternodeStatus(options = {}) { + const getMasternodeStatusRequest = new GetMasternodeStatusRequest(); + + const response = await grpcTransport.request( + CorePromiseClient, + 'getMasternodeStatus', + getMasternodeStatusRequest, + options, + ); + + const responseObject = response.toObject(); + + // Respond with constant names instead of constant values + + responseObject.status = Object.keys(GetMasternodeStatusResponse.Status) + .find((key) => GetMasternodeStatusResponse.Status[key] === responseObject.status); + + responseObject.proTxHash = Buffer.from(responseObject.proTxHash, 'base64'); + + return responseObject; + } + + return getMasternodeStatus; +} + +module.exports = getMasternodeStatusFactory; diff --git a/packages/js-dapi-client/lib/methods/core/getMnListDiffFactory.js b/packages/js-dapi-client/lib/methods/core/getMnListDiffFactory.js deleted file mode 100644 index 88401fc52b2..00000000000 --- a/packages/js-dapi-client/lib/methods/core/getMnListDiffFactory.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * @param {JsonRpcTransport} jsonRpcTransport - * @returns {getMnListDiff} - */ -function getMnListDiffFactory(jsonRpcTransport) { - /** - * Get deterministic masternodelist diff - * @typedef {getMnListDiff} - * @param {string} baseBlockHash - hash or height of start block - * @param {string} blockHash - hash or height of end block - * @param {DAPIClientOptions} [options] - * @returns {Promise} - */ - function getMnListDiff(baseBlockHash, blockHash, options = {}) { - return jsonRpcTransport.request('getMnListDiff', { baseBlockHash, blockHash }, options); - } - - return getMnListDiff; -} - -module.exports = getMnListDiffFactory; diff --git a/packages/js-dapi-client/lib/methods/core/getStatusFactory.js b/packages/js-dapi-client/lib/methods/core/getStatusFactory.js deleted file mode 100644 index b631e6edfe7..00000000000 --- a/packages/js-dapi-client/lib/methods/core/getStatusFactory.js +++ /dev/null @@ -1,68 +0,0 @@ -const { - v0: { - GetStatusRequest, - GetStatusResponse, - CorePromiseClient, - }, -} = require('@dashevo/dapi-grpc'); - -/** - * @param {GrpcTransport} grpcTransport - * @returns {getStatus} - */ -function getStatusFactory(grpcTransport) { - /** - * Get Core chain status - * @typedef {getStatus} - * @param {DAPIClientOptions} [options] - * @returns {Promise} - */ - async function getStatus(options = {}) { - const getStatusRequest = new GetStatusRequest(); - - const response = await grpcTransport.request( - CorePromiseClient, - 'getStatus', - getStatusRequest, - options, - ); - - const responseObject = response.toObject(); - - // Respond with Buffers instead of base64 for binary fields - - if (response.getChain()) { - if (response.getChain().getBestBlockHash()) { - responseObject.chain.bestBlockHash = Buffer.from(response.getChain().getBestBlockHash()); - } - - if (response.getChain().getChainWork()) { - responseObject.chain.chainWork = Buffer.from(response.getChain().getChainWork()); - } - } - - if (response.getMasternode()) { - if (response.getMasternode().getProTxHash()) { - responseObject.masternode.proTxHash = Buffer.from(response.getMasternode().getProTxHash()); - } - } - - // Respond with constant names instead of constant values - - responseObject.status = Object.keys(GetStatusResponse.Status) - .find((key) => GetStatusResponse.Status[key] === responseObject.status); - - if (responseObject.masternode) { - responseObject.masternode.status = Object.keys(GetStatusResponse.Masternode.Status) - .find((key) => ( - GetStatusResponse.Masternode.Status[key] === responseObject.masternode.status - )); - } - - return responseObject; - } - - return getStatus; -} - -module.exports = getStatusFactory; diff --git a/packages/js-dapi-client/lib/methods/core/subscribeToMasternodeListFactory.js b/packages/js-dapi-client/lib/methods/core/subscribeToMasternodeListFactory.js new file mode 100644 index 00000000000..1d7ba8228a6 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/core/subscribeToMasternodeListFactory.js @@ -0,0 +1,46 @@ +const { + v0: { + MasternodeListRequest, + CorePromiseClient, + }, +} = require('@dashevo/dapi-grpc'); + +/** + * @param {GrpcTransport} grpcTransport + * @returns {subscribeToMasternodeList} + */ +function subscribeToMasternodeListFactory(grpcTransport) { + /** + * @typedef {subscribeToMasternodeList} + * @param {DAPIClientOptions & subscribeToMasternodeListOptions} [options] + * @returns { + * EventEmitter|!grpc.web.ClientReadableStream + * } + */ + async function subscribeToMasternodeList(options = { }) { + // eslint-disable-next-line no-param-reassign + options = { + // Override global timeout option + // and timeout for this method by default + timeout: undefined, + ...options, + }; + + const request = new MasternodeListRequest(); + + return grpcTransport.request( + CorePromiseClient, + 'subscribeToMasternodeList', + request, + options, + ); + } + + return subscribeToMasternodeList; +} + +/** + * @typedef {object} subscribeToMasternodeListOptions + */ + +module.exports = subscribeToMasternodeListFactory; diff --git a/packages/js-dapi-client/lib/methods/core/subscribeToTransactionsWithProofsFactory.js b/packages/js-dapi-client/lib/methods/core/subscribeToTransactionsWithProofsFactory.js index 5678042ecfc..bf1784291eb 100644 --- a/packages/js-dapi-client/lib/methods/core/subscribeToTransactionsWithProofsFactory.js +++ b/packages/js-dapi-client/lib/methods/core/subscribeToTransactionsWithProofsFactory.js @@ -29,7 +29,7 @@ function subscribeToTransactionsWithProofsFactory(grpcTransport) { * EventEmitter|!grpc.web.ClientReadableStream * } */ - async function subscribeToTransactionsWithProofs(bloomFilter, options = { }) { + async function subscribeToTransactionsWithProofs(bloomFilter, options = {}) { // eslint-disable-next-line no-param-reassign options = { count: 0, diff --git a/packages/js-dapi-client/lib/methods/platform/PlatformMethodsFacade.js b/packages/js-dapi-client/lib/methods/platform/PlatformMethodsFacade.js index ce90c4457b6..e82f776cbb0 100644 --- a/packages/js-dapi-client/lib/methods/platform/PlatformMethodsFacade.js +++ b/packages/js-dapi-client/lib/methods/platform/PlatformMethodsFacade.js @@ -3,12 +3,16 @@ const getDataContractFactory = require('./getDataContract/getDataContractFactory const getDataContractHistoryFactory = require('./getDataContractHistory/getDataContractHistoryFactory'); const getDocumentsFactory = require('./getDocuments/getDocumentsFactory'); const getIdentityFactory = require('./getIdentity/getIdentityFactory'); -const getIdentitiesByPublicKeyHashesFactory = require('./getIdentitiesByPublicKeyHashes/getIdentitiesByPublicKeyHashesFactory'); +const getIdentityByPublicKeyHashFactory = require('./getIdentityByPublicKeyHash/getIdentityByPublicKeyHashFactory'); +const getIdentitiesContractKeysFactory = require('./getIdentitiesContractKeys/getIdentitiesContractKeysFactory'); const waitForStateTransitionResultFactory = require('./waitForStateTransitionResult/waitForStateTransitionResultFactory'); const getConsensusParamsFactory = require('./getConsensusParams/getConsensusParamsFactory'); const getEpochsInfoFactory = require('./getEpochsInfo/getEpochsInfoFactory'); const getProtocolVersionUpgradeVoteStatusFactory = require('./getProtocolVersionUpgradeVoteStatus/getProtocolVersionUpgradeVoteStatusFactory'); const getProtocolVersionUpgradeStateFactory = require('./getProtocolVersionUpgradeState/getProtocolVersionUpgradeStateFactory'); +const getIdentityContractNonceFactory = require('./getIdentityContractNonce/getIdentityContractNonceFactory'); +const getIdentityNonceFactory = require('./getIdentityNonce/getIdentityNonceFactory'); +const getIdentityKeysFactory = require('./getIdentityKeys/getIdentityKeysFactory'); class PlatformMethodsFacade { /** @@ -20,7 +24,8 @@ class PlatformMethodsFacade { this.getDataContractHistory = getDataContractHistoryFactory(grpcTransport); this.getDocuments = getDocumentsFactory(grpcTransport); this.getIdentity = getIdentityFactory(grpcTransport); - this.getIdentitiesByPublicKeyHashes = getIdentitiesByPublicKeyHashesFactory(grpcTransport); + this.getIdentityByPublicKeyHash = getIdentityByPublicKeyHashFactory(grpcTransport); + this.getIdentitiesContractKeys = getIdentitiesContractKeysFactory(grpcTransport); this.waitForStateTransitionResult = waitForStateTransitionResultFactory(grpcTransport); this.getConsensusParams = getConsensusParamsFactory(grpcTransport); this.getEpochsInfo = getEpochsInfoFactory(grpcTransport); @@ -28,6 +33,9 @@ class PlatformMethodsFacade { grpcTransport, ); this.getProtocolVersionUpgradeState = getProtocolVersionUpgradeStateFactory(grpcTransport); + this.getIdentityContractNonce = getIdentityContractNonceFactory(grpcTransport); + this.getIdentityNonce = getIdentityNonceFactory(grpcTransport); + this.getIdentityKeys = getIdentityKeysFactory(grpcTransport); } } diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentitiesByPublicKeyHashes/GetIdentitiesByPublicKeyHashesResponse.js b/packages/js-dapi-client/lib/methods/platform/getIdentitiesByPublicKeyHashes/GetIdentitiesByPublicKeyHashesResponse.js deleted file mode 100644 index 18b6198fb43..00000000000 --- a/packages/js-dapi-client/lib/methods/platform/getIdentitiesByPublicKeyHashes/GetIdentitiesByPublicKeyHashesResponse.js +++ /dev/null @@ -1,46 +0,0 @@ -const AbstractResponse = require('../response/AbstractResponse'); - -class GetIdentitiesByPublicKeyHashesResponse extends AbstractResponse { - /** - * @param {Buffer[]} identities - * @param {Metadata} metadata - * @param {Proof} [proof] - */ - constructor(identities, metadata, proof = undefined) { - super(metadata, proof); - - this.identities = identities; - } - - /** - * @returns {Buffer[]} - */ - getIdentities() { - return this.identities; - } - - /** - * @param proto - * @returns {GetIdentitiesByPublicKeyHashesResponse} - */ - static createFromProto(proto) { - const { metadata, proof } = AbstractResponse.createMetadataAndProofFromProto(proto); - - const identitiesList = proto.getV0().getIdentities(); - - return new GetIdentitiesByPublicKeyHashesResponse( - identitiesList !== undefined - ? identitiesList.getIdentityEntriesList() - .map((identity) => { - const value = identity.getValue(); - // TODO: rework to return whole `identity.getValue()` instead of inner getValue() - return value && Buffer.from(value.getValue()); - }) - : [], - metadata, - proof, - ); - } -} - -module.exports = GetIdentitiesByPublicKeyHashesResponse; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentitiesByPublicKeyHashes/getIdentitiesByPublicKeyHashesFactory.js b/packages/js-dapi-client/lib/methods/platform/getIdentitiesByPublicKeyHashes/getIdentitiesByPublicKeyHashesFactory.js deleted file mode 100644 index 0580db39189..00000000000 --- a/packages/js-dapi-client/lib/methods/platform/getIdentitiesByPublicKeyHashes/getIdentitiesByPublicKeyHashesFactory.js +++ /dev/null @@ -1,65 +0,0 @@ -const { - v0: { - PlatformPromiseClient, - GetIdentitiesByPublicKeyHashesRequest, - }, -} = require('@dashevo/dapi-grpc'); - -const GetIdentitiesByPublicKeyHashesResponse = require('./GetIdentitiesByPublicKeyHashesResponse'); -const InvalidResponseError = require('../response/errors/InvalidResponseError'); - -/** - * @param {GrpcTransport} grpcTransport - * @returns {getIdentitiesByPublicKeyHashes} - */ -function getIdentitiesByPublicKeyHashesFactory(grpcTransport) { - /** - * Fetch the identities by public key hashes - * @typedef {getIdentitiesByPublicKeyHashes} - * @param {Buffer[]} publicKeyHashes - * @param {DAPIClientOptions & {prove: boolean}} [options] - * @returns {Promise} - */ - async function getIdentitiesByPublicKeyHashes(publicKeyHashes, options = {}) { - const { GetIdentitiesByPublicKeyHashesRequestV0 } = GetIdentitiesByPublicKeyHashesRequest; - const getIdentitiesByPublicKeyHashesRequest = new GetIdentitiesByPublicKeyHashesRequest(); - getIdentitiesByPublicKeyHashesRequest.setV0( - new GetIdentitiesByPublicKeyHashesRequestV0() - .setPublicKeyHashesList( - publicKeyHashes, - ).setProve(!!options.prove), - ); - - let lastError; - - // TODO: simple retry before the dapi versioning is properly implemented - for (let i = 0; i < 3; i += 1) { - try { - // eslint-disable-next-line no-await-in-loop - const getIdentitiesByPublicKeyHashesResponse = await grpcTransport.request( - PlatformPromiseClient, - 'getIdentitiesByPublicKeyHashes', - getIdentitiesByPublicKeyHashesRequest, - options, - ); - - return GetIdentitiesByPublicKeyHashesResponse - .createFromProto(getIdentitiesByPublicKeyHashesResponse); - } catch (e) { - if (e instanceof InvalidResponseError) { - lastError = e; - } else { - throw e; - } - } - } - - // If we made it past the cycle it means that the retry didn't work, - // and we're throwing the last error encountered - throw lastError; - } - - return getIdentitiesByPublicKeyHashes; -} - -module.exports = getIdentitiesByPublicKeyHashesFactory; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentitiesContractKeys/GetIdentitiesContractKeysResponse.js b/packages/js-dapi-client/lib/methods/platform/getIdentitiesContractKeys/GetIdentitiesContractKeysResponse.js new file mode 100644 index 00000000000..4fd843f6f92 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentitiesContractKeys/GetIdentitiesContractKeysResponse.js @@ -0,0 +1,65 @@ +const { Identifier } = require('@dashevo/wasm-dpp'); +const AbstractResponse = require('../response/AbstractResponse'); + +class GetIdentitiesContractKeysResponse extends AbstractResponse { + /** + * @param {object} identitiesKeys + * @param {Metadata} metadata + * @param {Proof} [proof] + */ + constructor(identitiesKeys, metadata, proof = undefined) { + super(metadata, proof); + + this.identitiesKeys = identitiesKeys; + } + + /** + * @returns {object} + */ + getIdentitiesKeys() { + return this.identitiesKeys; + } + + /** + * @param proto + * @returns {GetIdentitiesContractKeysResponse} + */ + static createFromProto(proto) { + const { metadata, proof } = AbstractResponse.createMetadataAndProofFromProto(proto); + + const identitiesKeys = proto.getV0().getIdentitiesKeys(); + + let identitiesKeysMap = {}; + if (identitiesKeys) { + const keysEntries = identitiesKeys.getEntriesList(); + + identitiesKeysMap = keysEntries.reduce((acc, entry) => { + const identityId = Identifier.from(Buffer.from(entry.getIdentityId())).toString(); + if (!acc[identityId]) { + acc[identityId] = {}; + } + + entry.getKeysList().forEach((key) => { + const purpose = key.getPurpose(); + if (!acc[identityId][purpose]) { + // eslint-disable-next-line no-param-reassign + acc[identityId][purpose] = []; + } + + // eslint-disable-next-line no-param-reassign + acc[identityId][purpose] = acc[identityId][purpose].concat(key.getKeysBytesList()); + }, {}); + + return acc; + }, {}); + } + + return new GetIdentitiesContractKeysResponse( + identitiesKeysMap, + metadata, + proof, + ); + } +} + +module.exports = GetIdentitiesContractKeysResponse; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentitiesContractKeys/getIdentitiesContractKeysFactory.js b/packages/js-dapi-client/lib/methods/platform/getIdentitiesContractKeys/getIdentitiesContractKeysFactory.js new file mode 100644 index 00000000000..47140bfe0cc --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentitiesContractKeys/getIdentitiesContractKeysFactory.js @@ -0,0 +1,93 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentitiesContractKeysRequest, + }, +} = require('@dashevo/dapi-grpc'); +const { IdentityPublicKey } = require('@dashevo/wasm-dpp'); + +const GetIdentitiesContractKeysResponse = require('./GetIdentitiesContractKeysResponse'); +const InvalidResponseError = require('../response/errors/InvalidResponseError'); + +/** + * @param {GrpcTransport} grpcTransport + * @returns {getIdentitiesContractKeys} + */ +function getIdentitiesContractKeysFactory(grpcTransport) { + /** + * Fetch the identities by public key hashes + * @typedef {getIdentitiesContractKeys} + * @param {Buffer[]} identitiesIds + * @param {Buffer} contractId + * @param {IdentityPublicKey.PURPOSES[]} keyPurposes + * @param {string | null} documentTypeName + * @param {DAPIClientOptions & {prove: boolean}} [options] + * @returns {Promise} + */ + async function getIdentitiesContractKeys( + identitiesIds, + contractId, + keyPurposes, + documentTypeName = null, + options = {}, + ) { + const { GetIdentitiesContractKeysRequestV0 } = GetIdentitiesContractKeysRequest; + const getIdentitiesContractKeysRequest = new GetIdentitiesContractKeysRequest(); + + // eslint-disable-next-line no-param-reassign + identitiesIds = identitiesIds.map((id) => { + if (Buffer.isBuffer(id)) { + // eslint-disable-next-line no-param-reassign + id = Buffer.from(id); + } + + return id; + }); + + if (Buffer.isBuffer(contractId)) { + // eslint-disable-next-line no-param-reassign + contractId = Buffer.from(contractId); + } + + getIdentitiesContractKeysRequest.setV0( + new GetIdentitiesContractKeysRequestV0() + .setProve(!!options.prove) + .setIdentitiesIdsList(identitiesIds) + .setContractId(contractId) + .setPurposesList(keyPurposes) + .setDocumentTypeName(documentTypeName), + ); + + let lastError; + + // TODO: simple retry before the dapi versioning is properly implemented + for (let i = 0; i < 3; i += 1) { + try { + // eslint-disable-next-line no-await-in-loop + const getIdentitiesContractKeysResponse = await grpcTransport.request( + PlatformPromiseClient, + 'getIdentitiesContractKeys', + getIdentitiesContractKeysRequest, + options, + ); + + return GetIdentitiesContractKeysResponse + .createFromProto(getIdentitiesContractKeysResponse); + } catch (e) { + if (e instanceof InvalidResponseError) { + lastError = e; + } else { + throw e; + } + } + } + + // If we made it past the cycle it means that the retry didn't work, + // and we're throwing the last error encountered + throw lastError; + } + + return getIdentitiesContractKeys; +} + +module.exports = getIdentitiesContractKeysFactory; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentityByPublicKeyHash/GetIdentityByPublicKeyHashResponse.js b/packages/js-dapi-client/lib/methods/platform/getIdentityByPublicKeyHash/GetIdentityByPublicKeyHashResponse.js new file mode 100644 index 00000000000..86f97aecfe7 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentityByPublicKeyHash/GetIdentityByPublicKeyHashResponse.js @@ -0,0 +1,40 @@ +const AbstractResponse = require('../response/AbstractResponse'); + +class GetIdentityByPublicKeyHashResponse extends AbstractResponse { + /** + * @param {Buffer} identities + * @param identity + * @param {Metadata} metadata + * @param {Proof} [proof] + */ + constructor(identity, metadata, proof = undefined) { + super(metadata, proof); + + this.identity = identity; + } + + /** + * @returns {Buffer[]} + */ + getIdentity() { + return this.identity; + } + + /** + * @param proto + * @returns {GetIdentityByPublicKeyHashResponse} + */ + static createFromProto(proto) { + const { metadata, proof } = AbstractResponse.createMetadataAndProofFromProto(proto); + + const identity = proto.getV0().getIdentity(); + + return new GetIdentityByPublicKeyHashResponse( + Buffer.from(identity), + metadata, + proof, + ); + } +} + +module.exports = GetIdentityByPublicKeyHashResponse; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentityByPublicKeyHash/getIdentityByPublicKeyHashFactory.js b/packages/js-dapi-client/lib/methods/platform/getIdentityByPublicKeyHash/getIdentityByPublicKeyHashFactory.js new file mode 100644 index 00000000000..ed3ca1fca7e --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentityByPublicKeyHash/getIdentityByPublicKeyHashFactory.js @@ -0,0 +1,64 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentityByPublicKeyHashRequest, + }, +} = require('@dashevo/dapi-grpc'); + +const GetIdentityByPublicKeyHashResponse = require('./GetIdentityByPublicKeyHashResponse'); +const InvalidResponseError = require('../response/errors/InvalidResponseError'); + +/** + * @param {GrpcTransport} grpcTransport + * @returns {getIdentityByPublicKeyHash} + */ +function getIdentityByPublicKeyHashFactory(grpcTransport) { + /** + * Fetch the identity by public key hash + * @typedef {getIdentityByPublicKeyHash} + * @param {Buffer} publicKeyHash + * @param {DAPIClientOptions & {prove: boolean}} [options] + * @returns {Promise} + */ + async function getIdentityByPublicKeyHash(publicKeyHash, options = {}) { + const { GetIdentityByPublicKeyHashRequestV0 } = GetIdentityByPublicKeyHashRequest; + const getIdentityByPublicKeyHashRequest = new GetIdentityByPublicKeyHashRequest(); + getIdentityByPublicKeyHashRequest.setV0( + new GetIdentityByPublicKeyHashRequestV0() + .setPublicKeyHash(publicKeyHash) + .setProve(!!options.prove), + ); + + let lastError; + + // TODO: simple retry before the dapi versioning is properly implemented + for (let i = 0; i < 3; i += 1) { + try { + // eslint-disable-next-line no-await-in-loop + const getIdentityByPublicKeyHashResponse = await grpcTransport.request( + PlatformPromiseClient, + 'getIdentityByPublicKeyHash', + getIdentityByPublicKeyHashRequest, + options, + ); + + return GetIdentityByPublicKeyHashResponse + .createFromProto(getIdentityByPublicKeyHashResponse); + } catch (e) { + if (e instanceof InvalidResponseError) { + lastError = e; + } else { + throw e; + } + } + } + + // If we made it past the cycle it means that the retry didn't work, + // and we're throwing the last error encountered + throw lastError; + } + + return getIdentityByPublicKeyHash; +} + +module.exports = getIdentityByPublicKeyHashFactory; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentityContractNonce/GetIdentityContractNonceResponse.js b/packages/js-dapi-client/lib/methods/platform/getIdentityContractNonce/GetIdentityContractNonceResponse.js new file mode 100644 index 00000000000..e04d6aaafa5 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentityContractNonce/GetIdentityContractNonceResponse.js @@ -0,0 +1,49 @@ +const AbstractResponse = require('../response/AbstractResponse'); +const InvalidResponseError = require('../response/errors/InvalidResponseError'); + +const IDENTITY_CONTRACT_NONCE_VALUE_FILTER = 0xFFFFFFFFFF; + +class GetIdentityContractNonceResponse extends AbstractResponse { + /** + * @param {number} identityContractNonce + * @param {Metadata} metadata + * @param {Proof} [proof] + */ + constructor(identityContractNonce, metadata, proof = undefined) { + super(metadata, proof); + + this.identityContractNonce = identityContractNonce; + } + + /** + * @returns {number} + */ + getIdentityContractNonce() { + return this.identityContractNonce; + } + + /** + * @param proto + * @returns {GetIdentityContractNonceResponse} + */ + static createFromProto(proto) { + // eslint-disable-next-line + const identityContractNonce = proto.getV0() + .getIdentityContractNonce() & IDENTITY_CONTRACT_NONCE_VALUE_FILTER; + const { metadata, proof } = AbstractResponse.createMetadataAndProofFromProto( + proto, + ); + + if ((typeof identityContractNonce === 'undefined' || identityContractNonce === null) && !proof) { + throw new InvalidResponseError('Contract nonce data is not defined'); + } + + return new GetIdentityContractNonceResponse( + identityContractNonce, + metadata, + proof, + ); + } +} + +module.exports = GetIdentityContractNonceResponse; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentityContractNonce/getIdentityContractNonceFactory.js b/packages/js-dapi-client/lib/methods/platform/getIdentityContractNonce/getIdentityContractNonceFactory.js new file mode 100644 index 00000000000..00ae1a93ef1 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentityContractNonce/getIdentityContractNonceFactory.js @@ -0,0 +1,81 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentityContractNonceRequest, + }, +} = require('@dashevo/dapi-grpc'); + +const GetIdentityContractNonceResponse = require('./GetIdentityContractNonceResponse'); +const InvalidResponseError = require('../response/errors/InvalidResponseError'); + +/** + * @param {GrpcTransport} grpcTransport + * @returns {getIdentityContractNonce} + */ +function getIdentityContractNonceFactory(grpcTransport) { + /** + * Fetch the version upgrade vote status + * @typedef {getIdentityContractNonce} + * @param {Buffer} identityId + * @param {Buffer} contractId + * @param {DAPIClientOptions & {prove: boolean}} [options] + * @returns {Promise} + */ + async function getIdentityContractNonce(identityId, contractId, options = {}) { + const { + GetIdentityContractNonceRequestV0, + } = GetIdentityContractNonceRequest; + + // eslint-disable-next-line max-len + const getIdentityContractNonceRequest = new GetIdentityContractNonceRequest(); + + if (Buffer.isBuffer(identityId)) { + // eslint-disable-next-line no-param-reassign + identityId = Buffer.from(identityId); + } + + if (Buffer.isBuffer(contractId)) { + // eslint-disable-next-line no-param-reassign + contractId = Buffer.from(contractId); + } + + getIdentityContractNonceRequest.setV0( + new GetIdentityContractNonceRequestV0() + .setIdentityId(identityId) + .setContractId(contractId) + .setProve(!!options.prove), + ); + + let lastError; + + // TODO: simple retry before the dapi versioning is properly implemented + for (let i = 0; i < 3; i += 1) { + try { + // eslint-disable-next-line no-await-in-loop + const getIdentityContractNonceResponse = await grpcTransport.request( + PlatformPromiseClient, + 'getIdentityContractNonce', + getIdentityContractNonceRequest, + options, + ); + + return GetIdentityContractNonceResponse + .createFromProto(getIdentityContractNonceResponse); + } catch (e) { + if (e instanceof InvalidResponseError) { + lastError = e; + } else { + throw e; + } + } + } + + // If we made it past the cycle it means that the retry didn't work, + // and we're throwing the last error encountered + throw lastError; + } + + return getIdentityContractNonce; +} + +module.exports = getIdentityContractNonceFactory; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentityKeys/GetIdentityKeysResponse.js b/packages/js-dapi-client/lib/methods/platform/getIdentityKeys/GetIdentityKeysResponse.js new file mode 100644 index 00000000000..de377cfdfb5 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentityKeys/GetIdentityKeysResponse.js @@ -0,0 +1,52 @@ +const AbstractResponse = require('../response/AbstractResponse'); +const InvalidResponseError = require('../response/errors/InvalidResponseError'); + +class GetIdentityKeysResponse extends AbstractResponse { + /** + * @param {number} identityKeys + * @param {Metadata} metadata + * @param {Proof} [proof] + */ + constructor(identityKeys, metadata, proof = undefined) { + super(metadata, proof); + + this.identityKeys = identityKeys; + } + + /** + * @returns {number} + */ + getIdentityKeys() { + return this.identityKeys; + } + + /** + * @param proto + * @returns {GetIdentityKeysResponse} + */ + static createFromProto(proto) { + // eslint-disable-next-line + const keys = proto.getV0().getKeys(); + const { metadata, proof } = AbstractResponse.createMetadataAndProofFromProto( + proto, + ); + + let identityKeys = []; + if ((typeof keys === 'undefined' || keys === null) && !proof) { + throw new InvalidResponseError('Identity keys are not defined'); + } else if (!proof) { + identityKeys = keys.getKeysBytesList(); + if ((typeof identityKeys === 'undefined' || identityKeys === null) && !proof) { + throw new InvalidResponseError('Identity keys are not defined'); + } + } + + return new GetIdentityKeysResponse( + identityKeys, + metadata, + proof, + ); + } +} + +module.exports = GetIdentityKeysResponse; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentityKeys/getIdentityKeysFactory.js b/packages/js-dapi-client/lib/methods/platform/getIdentityKeys/getIdentityKeysFactory.js new file mode 100644 index 00000000000..d54b6601065 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentityKeys/getIdentityKeysFactory.js @@ -0,0 +1,78 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentityKeysRequest, + KeyRequestType, + SpecificKeys, + }, +} = require('@dashevo/dapi-grpc'); +const { UInt32Value } = require('google-protobuf/google/protobuf/wrappers_pb'); + +const GetIdentityKeysResponse = require('./GetIdentityKeysResponse'); +const InvalidResponseError = require('../response/errors/InvalidResponseError'); + +/** + * @param {GrpcTransport} grpcTransport + * @returns {getIdentityKeys} + */ +function getIdentityKeysFactory(grpcTransport) { + /** + * Fetch the version upgrade vote status + * @typedef {getIdentityKeys} + * @param {Buffer} identityId + * @param {number[]} keyIds + * @param {number} limit + * @param {DAPIClientOptions & {prove: boolean}} [options] + * @returns {Promise} + */ + async function getIdentityKeys(identityId, keyIds, limit = 100, options = {}) { + const { GetIdentityKeysRequestV0 } = GetIdentityKeysRequest; + const getIdentityKeysRequest = new GetIdentityKeysRequest(); + + if (Buffer.isBuffer(identityId)) { + // eslint-disable-next-line no-param-reassign + identityId = Buffer.from(identityId); + } + + getIdentityKeysRequest.setV0( + new GetIdentityKeysRequestV0() + .setIdentityId(identityId) + .setRequestType(new KeyRequestType() + .setSpecificKeys(new SpecificKeys().setKeyIdsList(keyIds))) + .setLimit(new UInt32Value([limit])) + .setProve(!!options.prove), + ); + + let lastError; + + // TODO: simple retry before the dapi versioning is properly implemented + for (let i = 0; i < 3; i += 1) { + try { + // eslint-disable-next-line no-await-in-loop + const getIdentityKeysResponse = await grpcTransport.request( + PlatformPromiseClient, + 'getIdentityKeys', + getIdentityKeysRequest, + options, + ); + + return GetIdentityKeysResponse + .createFromProto(getIdentityKeysResponse); + } catch (e) { + if (e instanceof InvalidResponseError) { + lastError = e; + } else { + throw e; + } + } + } + + // If we made it past the cycle it means that the retry didn't work, + // and we're throwing the last error encountered + throw lastError; + } + + return getIdentityKeys; +} + +module.exports = getIdentityKeysFactory; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentityNonce/GetIdentityNonceResponse.js b/packages/js-dapi-client/lib/methods/platform/getIdentityNonce/GetIdentityNonceResponse.js new file mode 100644 index 00000000000..a490a1390b5 --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentityNonce/GetIdentityNonceResponse.js @@ -0,0 +1,49 @@ +const AbstractResponse = require('../response/AbstractResponse'); +const InvalidResponseError = require('../response/errors/InvalidResponseError'); + +const IDENTITY_NONCE_VALUE_FILTER = 0xFFFFFFFFFF; + +class GetIdentityNonceResponse extends AbstractResponse { + /** + * @param {number} identityNonce + * @param {Metadata} metadata + * @param {Proof} [proof] + */ + constructor(identityNonce, metadata, proof = undefined) { + super(metadata, proof); + + this.identityNonce = identityNonce; + } + + /** + * @returns {number} + */ + getIdentityNonce() { + return this.identityNonce; + } + + /** + * @param proto + * @returns {GetIdentityNonceResponse} + */ + static createFromProto(proto) { + // eslint-disable-next-line + const identityNonce = proto.getV0() + .getIdentityNonce() & IDENTITY_NONCE_VALUE_FILTER; + const { metadata, proof } = AbstractResponse.createMetadataAndProofFromProto( + proto, + ); + + if ((typeof identityNonce === 'undefined' || identityNonce === null) && !proof) { + throw new InvalidResponseError('Nonce data is not defined'); + } + + return new GetIdentityNonceResponse( + identityNonce, + metadata, + proof, + ); + } +} + +module.exports = GetIdentityNonceResponse; diff --git a/packages/js-dapi-client/lib/methods/platform/getIdentityNonce/getIdentityNonceFactory.js b/packages/js-dapi-client/lib/methods/platform/getIdentityNonce/getIdentityNonceFactory.js new file mode 100644 index 00000000000..4c0193889fd --- /dev/null +++ b/packages/js-dapi-client/lib/methods/platform/getIdentityNonce/getIdentityNonceFactory.js @@ -0,0 +1,74 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentityNonceRequest, + }, +} = require('@dashevo/dapi-grpc'); + +const GetIdentityNonceResponse = require('./GetIdentityNonceResponse'); +const InvalidResponseError = require('../response/errors/InvalidResponseError'); + +/** + * @param {GrpcTransport} grpcTransport + * @returns {getIdentityNonce} + */ +function getIdentityNonceFactory(grpcTransport) { + /** + * Fetch the version upgrade vote status + * @typedef {getIdentityNonce} + * @param {Buffer} identityId + * @param {DAPIClientOptions & {prove: boolean}} [options] + * @returns {Promise} + */ + async function getIdentityNonce(identityId, options = {}) { + const { + GetIdentityNonceRequestV0, + } = GetIdentityNonceRequest; + + // eslint-disable-next-line max-len + const getIdentityNonceRequest = new GetIdentityNonceRequest(); + + if (Buffer.isBuffer(identityId)) { + // eslint-disable-next-line no-param-reassign + identityId = Buffer.from(identityId); + } + + getIdentityNonceRequest.setV0( + new GetIdentityNonceRequestV0() + .setIdentityId(identityId) + .setProve(!!options.prove), + ); + + let lastError; + + // TODO: simple retry before the dapi versioning is properly implemented + for (let i = 0; i < 3; i += 1) { + try { + // eslint-disable-next-line no-await-in-loop + const getIdentityNonceResponse = await grpcTransport.request( + PlatformPromiseClient, + 'getIdentityNonce', + getIdentityNonceRequest, + options, + ); + + return GetIdentityNonceResponse + .createFromProto(getIdentityNonceResponse); + } catch (e) { + if (e instanceof InvalidResponseError) { + lastError = e; + } else { + throw e; + } + } + } + + // If we made it past the cycle it means that the retry didn't work, + // and we're throwing the last error encountered + throw lastError; + } + + return getIdentityNonce; +} + +module.exports = getIdentityNonceFactory; diff --git a/packages/js-dapi-client/lib/transport/GrpcTransport/GrpcTransport.js b/packages/js-dapi-client/lib/transport/GrpcTransport/GrpcTransport.js index f792c0738a9..5a25bf5e2e1 100644 --- a/packages/js-dapi-client/lib/transport/GrpcTransport/GrpcTransport.js +++ b/packages/js-dapi-client/lib/transport/GrpcTransport/GrpcTransport.js @@ -1,3 +1,4 @@ +const GrpcErrorCodes = require('@dashevo/grpc-common/lib/server/error/GrpcErrorCodes'); const logger = require('../../logger'); const MaxRetriesReachedError = require('../errors/response/MaxRetriesReachedError'); @@ -81,7 +82,12 @@ class GrpcTransport { } catch (error) { this.lastUsedAddress = address; - this.logger.error(`GRPC Request ${method} to ${address.toString()} failed with error: ${error.message}`); + // Show NOT_FOUND errors only in debug mode + if (error.code !== GrpcErrorCodes.NOT_FOUND) { + this.logger.error(`GRPC Request ${method} to ${address.toString()} failed with error: ${error.message}`); + } else { + this.logger.debug(`GRPC Request ${method} to ${address.toString()} failed with error: ${error.message}`); + } // for unknown errors if (error.code === undefined) { @@ -98,6 +104,8 @@ class GrpcTransport { throw responseError; } + // TODO: Shouldn't we call address.markAsBanned() here? + if (options.retries === 0) { throw new MaxRetriesReachedError(responseError); } diff --git a/packages/js-dapi-client/lib/transport/GrpcTransport/createGrpcTransportError.js b/packages/js-dapi-client/lib/transport/GrpcTransport/createGrpcTransportError.js index 98043b61217..103c37bb399 100644 --- a/packages/js-dapi-client/lib/transport/GrpcTransport/createGrpcTransportError.js +++ b/packages/js-dapi-client/lib/transport/GrpcTransport/createGrpcTransportError.js @@ -118,7 +118,7 @@ async function createGrpcTransportError(grpcError, dapiAddress) { } // DPP consensus errors - if (code >= 1000 && code < 5000) { + if (code >= 10000 && code < 50000) { const consensusError = deserializeConsensusError(data.serializedError || []); delete data.serializedError; diff --git a/packages/js-dapi-client/lib/transport/ReconnectableStream.js b/packages/js-dapi-client/lib/transport/ReconnectableStream.js index 260e38f1247..af3a22c8fb8 100644 --- a/packages/js-dapi-client/lib/transport/ReconnectableStream.js +++ b/packages/js-dapi-client/lib/transport/ReconnectableStream.js @@ -12,8 +12,7 @@ const wait = require('../utils/wait'); * delay in MS to perform retry after an error */ const defaultOptions = { - // TODO: manage timeout according to the Nginx setting of the node - autoReconnectInterval: 50000, + autoReconnectInterval: 600000, maxRetriesOnError: 10, retryOnErrorDelay: 1000, }; @@ -57,6 +56,8 @@ class ReconnectableStream extends EventEmitter { const opts = { ...defaultOptions, ...options }; + this.logger = opts.logger || { debug: () => {} }; + /** * Auto-reconnect interval in millisecond * It is needed to automatically reconnect to another DAPI node @@ -109,6 +110,8 @@ class ReconnectableStream extends EventEmitter { } async connect(...args) { + // eslint-disable-next-line no-unused-expressions + this.logger.debug('[ReconnectableStream] Connecting to stream'); // Memorize current stream args (which can be altered by beforeReconnect logic) this.args = args; @@ -127,6 +130,8 @@ class ReconnectableStream extends EventEmitter { if (this.reconnectTimeout) { throw new Error('Auto reconnect timeout is already running.'); } + // eslint-disable-next-line no-unused-expressions + this.logger.debug('[ReconnectableStream] Setting reconnect timeout'); this.reconnectTimeout = this.setTimeout( this.reconnect, this.autoReconnectInterval, @@ -134,6 +139,8 @@ class ReconnectableStream extends EventEmitter { } reconnect() { + // eslint-disable-next-line no-unused-expressions + this.logger.debug('[ReconnectableStream] Try reconnecting to stream'); if (this.reconnectTimeout) { this.reconnectTimeout = null; this.stream.cancel(); @@ -146,6 +153,8 @@ class ReconnectableStream extends EventEmitter { this.emit(EVENTS.BEFORE_RECONNECT, updateArgs); this.connect(...newArgs) .catch((connectError) => this.emit(EVENTS.ERROR, connectError)); + // eslint-disable-next-line no-unused-expressions + this.logger.debug('[ReconnectableStream] Reconnected to stream'); } } @@ -186,9 +195,13 @@ class ReconnectableStream extends EventEmitter { * @private */ endHandler() { - this.stopAutoReconnect(); - this.stream = null; - this.emit(EVENTS.END); + // eslint-disable-next-line no-unused-expressions + this.logger.debug('[ReconnectableStream] End handler, stream exists:', !!this.stream); + if (this.stream) { + this.stopAutoReconnect(); + this.stream = null; + this.emit(EVENTS.END); + } } /** @@ -197,9 +210,21 @@ class ReconnectableStream extends EventEmitter { * @param e */ errorHandler(e) { + // eslint-disable-next-line no-unused-expressions + this.logger.debug(`[ReconnectableStream] Error in stream, code ${e.code}, e:`, e); + // In case of cancellation nothing has to happen. + // Do not retry UNKNOWN error code - HACH for grpc-web that ignores following error that happens + // in a while after stream cancellation + // Error message: + // "Response closed without grpc-status (Headers only) { + // [Error: Response closed without grpc-status (Headers only)]" // TODO: do we need to propagate GrpcErrorCodes.CANCELLED further? - if (e.code === GrpcErrorCodes.CANCELLED) { + if (e.code === GrpcErrorCodes.CANCELLED + || (e.code === GrpcErrorCodes.UNKNOWN && this.stream === null) + ) { + // e.code + this.logger.debug(`[ReconnectableStream] Returning from error handler without restart, error code ${e.code}, e:`); return; } @@ -212,6 +237,8 @@ class ReconnectableStream extends EventEmitter { * @param e */ retryOnError(e) { + // eslint-disable-next-line no-unused-expressions + this.logger.debug('[ReconnectableStream] Error handler', e); // Stop reconnect timeout if there is one this.stopAutoReconnect(); @@ -252,9 +279,13 @@ class ReconnectableStream extends EventEmitter { * @private */ stopAutoReconnect() { + // eslint-disable-next-line no-unused-expressions + this.logger.debug('[ReconnectableStream] Stopping auto reconnect'); if (this.reconnectTimeout) { this.clearTimeout(this.reconnectTimeout); this.reconnectTimeout = null; + // eslint-disable-next-line no-unused-expressions + this.logger.debug('[ReconnectableStream] Stoped auto reconnect'); } } @@ -265,7 +296,18 @@ class ReconnectableStream extends EventEmitter { * @returns {*} */ cancel() { + // eslint-disable-next-line no-unused-expressions + this.logger.debug('[ReconnectableStream] Canceling streams'); this.stopAutoReconnect(); + // Hack for browsers to properly unsubscribe from ERROR event. + // (It will continue propagating despite of calling cancel) + // Ref to unsubscribe from ERROR event + const { stream } = this; + setTimeout(() => { + stream.removeListener(EVENTS.ERROR, this.errorHandler); + // endHandler + this.stream = null; + }, 1000); return this.stream.cancel(); } } diff --git a/packages/js-dapi-client/package.json b/packages/js-dapi-client/package.json index 68a85d2a446..8f13a34a86b 100644 --- a/packages/js-dapi-client/package.json +++ b/packages/js-dapi-client/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-client", - "version": "0.25.21", + "version": "1.0.0-dev.15", "description": "Client library used to access Dash DAPI endpoints", "main": "lib/index.js", "contributors": [ @@ -28,7 +28,7 @@ "dependencies": { "@dashevo/dapi-grpc": "workspace:*", "@dashevo/dash-spv": "workspace:*", - "@dashevo/dashcore-lib": "~0.21.0", + "@dashevo/dashcore-lib": "~0.21.1", "@dashevo/grpc-common": "workspace:*", "@dashevo/wasm-dpp": "workspace:*", "bs58": "^4.0.1", @@ -92,7 +92,7 @@ "test:integration": "mocha './test/integration/**/*.spec.js'", "test:node": "NODE_ENV=test mocha", "test:browsers": "karma start ./karma.conf.js --single-run", - "test:coverage": "NODE_ENV=test nyc --check-coverage --stmts=98 --branch=98 --funcs=98 --lines=95 yarn run mocha 'test/unit/**/*.spec.js' 'test/integration/**/*.spec.js'", + "test:coverage": "NODE_ENV=test nyc --check-coverage --stmts=98 --branch=98 --funcs=98 --lines=90 yarn run mocha 'test/unit/**/*.spec.js' 'test/integration/**/*.spec.js'", "prepublishOnly": "yarn run build:web" }, "ultra": { diff --git a/packages/js-dapi-client/test/integration/SMLProvider/SimplifiedMasternodeListProvider.spec.js b/packages/js-dapi-client/test/integration/SMLProvider/SimplifiedMasternodeListProvider.spec.js index c6eecea9864..aeb50c773bd 100644 --- a/packages/js-dapi-client/test/integration/SMLProvider/SimplifiedMasternodeListProvider.spec.js +++ b/packages/js-dapi-client/test/integration/SMLProvider/SimplifiedMasternodeListProvider.spec.js @@ -7,7 +7,8 @@ const getMNListDiffsFixture = require('../../../lib/test/fixtures/getMNListDiffs const wait = require('../../../lib/utils/wait'); -describe('SimplifiedMasternodeListProvider', () => { +// TODO: Update test to new implementation +describe.skip('SimplifiedMasternodeListProvider', () => { let jsonTransportMock; let smlProvider; let lastUsedAddress; diff --git a/packages/js-dapi-client/test/integration/methods/core/CoreMethodsFacade.spec.js b/packages/js-dapi-client/test/integration/methods/core/CoreMethodsFacade.spec.js index 0e007be0676..d7eeecc6875 100644 --- a/packages/js-dapi-client/test/integration/methods/core/CoreMethodsFacade.spec.js +++ b/packages/js-dapi-client/test/integration/methods/core/CoreMethodsFacade.spec.js @@ -5,7 +5,8 @@ const { BroadcastTransactionResponse, GetBlockResponse, GetTransactionResponse, - GetStatusResponse, + GetBlockchainStatusResponse, + GetMasternodeStatusResponse, }, } = require('@dashevo/dapi-grpc'); @@ -43,17 +44,6 @@ describe('CoreMethodsFacade', () => { }); }); - describe('#generateToAddress', () => { - it('should generate address', async () => { - const response = 'response'; - jsonRpcTransportMock.request.resolves(response); - await coreMethods.generateToAddress(1, 'yTMDce5yEpiPqmgPrPmTj7yAmQPJERUSVy'); - - expect(grpcTransportMock.request).to.be.not.called(); - expect(jsonRpcTransportMock.request).to.be.calledOnce(); - }); - }); - describe('#getBestBlockHash', () => { it('should get best block hash', async () => { const response = '000000000b0339e07bce8b3186a6a57a3c45d10e16c4bce18ef81b667bc822b2'; @@ -102,40 +92,30 @@ describe('CoreMethodsFacade', () => { }); }); - describe('#getMnListDiff', () => { - it('should get mn list diff', async () => { - const baseBlockHash = '0000047d24635e347be3aaaeb66c26be94901a2f962feccd4f95090191f208c1'; - const blockHash = '000000000b0339e07bce8b3186a6a57a3c45d10e16c4bce18ef81b667bc822b2'; - - const response = { - baseBlockHash, - blockHash, - deletedMNs: [], - mnList: [], - }; - jsonRpcTransportMock.request.resolves(response); - await coreMethods.getMnListDiff(baseBlockHash, blockHash); + describe('#getBlockchainStatus', () => { + it('should get status', async () => { + const response = new GetBlockchainStatusResponse(); - expect(grpcTransportMock.request).to.be.not.called(); - expect(jsonRpcTransportMock.request).to.be.calledOnce(); - }); - }); + response.setStatus(GetBlockchainStatusResponse.Status.READY); - describe('#getStatus', () => { - it('should get status', async () => { - const response = new GetStatusResponse(); + grpcTransportMock.request.resolves(response); - response.setStatus(GetStatusResponse.Status.READY); + await coreMethods.getBlockchainStatus(); - const masternode = new GetStatusResponse.Masternode(); + expect(jsonRpcTransportMock.request).to.be.not.called(); + expect(grpcTransportMock.request).to.be.calledOnce(); + }); + }); - masternode.setStatus(GetStatusResponse.Masternode.Status.READY); + describe('#getMasternodeStatus', () => { + it('should get masternode status', async () => { + const response = new GetMasternodeStatusResponse(); - response.setMasternode(masternode); + response.setStatus(GetMasternodeStatusResponse.Status.READY); grpcTransportMock.request.resolves(response); - await coreMethods.getStatus(); + await coreMethods.getMasternodeStatus(); expect(jsonRpcTransportMock.request).to.be.not.called(); expect(grpcTransportMock.request).to.be.calledOnce(); diff --git a/packages/js-dapi-client/test/integration/methods/platform/PlatformMethodsFacade.spec.js b/packages/js-dapi-client/test/integration/methods/platform/PlatformMethodsFacade.spec.js index a75a0304015..eea314d64a6 100644 --- a/packages/js-dapi-client/test/integration/methods/platform/PlatformMethodsFacade.spec.js +++ b/packages/js-dapi-client/test/integration/methods/platform/PlatformMethodsFacade.spec.js @@ -4,11 +4,17 @@ const { GetDataContractResponse, GetDocumentsResponse, GetIdentityResponse, + GetIdentityByPublicKeyHashResponse, + GetIdentitiesContractKeysResponse, GetEpochsInfoResponse, GetProtocolVersionUpgradeVoteStatusResponse, GetProtocolVersionUpgradeStateResponse, + GetIdentityContractNonceResponse, + GetIdentityNonceResponse, + GetIdentityKeysResponse, BroadcastStateTransitionResponse, WaitForStateTransitionResultResponse, + KeyPurpose, }, } = require('@dashevo/dapi-grpc'); @@ -21,6 +27,8 @@ const PlatformMethodsFacade = require('../../../../lib/methods/platform/Platform const { WaitForStateTransitionResultResponseV0 } = WaitForStateTransitionResultResponse; const { GetIdentityResponseV0 } = GetIdentityResponse; +const { GetIdentityByPublicKeyHashResponseV0 } = GetIdentityByPublicKeyHashResponse; +const { GetIdentitiesContractKeysResponseV0 } = GetIdentitiesContractKeysResponse; const { GetDocumentsResponseV0 } = GetDocumentsResponse; const { GetDataContractResponseV0 } = GetDataContractResponse; const { GetEpochsInfoResponseV0 } = GetEpochsInfoResponse; @@ -28,6 +36,9 @@ const { GetProtocolVersionUpgradeVoteStatusResponseV0, } = GetProtocolVersionUpgradeVoteStatusResponse; const { GetProtocolVersionUpgradeStateResponseV0 } = GetProtocolVersionUpgradeStateResponse; +const { GetIdentityContractNonceResponseV0 } = GetIdentityContractNonceResponse; +const { GetIdentityNonceResponseV0 } = GetIdentityNonceResponse; +const { GetIdentityKeysResponseV0 } = GetIdentityKeysResponse; describe('PlatformMethodsFacade', () => { let grpcTransportMock; @@ -108,6 +119,56 @@ describe('PlatformMethodsFacade', () => { }); }); + describe('#getIdentityByPublicKeyHash', () => { + it('should get Identity', async () => { + const response = new GetIdentityByPublicKeyHashResponse(); + response.setV0( + new GetIdentityByPublicKeyHashResponseV0() + .setMetadata(new ResponseMetadata()) + .setIdentity((await getIdentityFixture()).toBuffer()), + ); + + grpcTransportMock.request.resolves(response); + + await platformMethods.getIdentityByPublicKeyHash('41nthkqvHBLnqiMkSbsdTNANzYu9bgdv4etKoRUunY1M'); + + expect(grpcTransportMock.request).to.be.calledOnce(); + }); + }); + + describe('#getIdentitiesContractKeys', () => { + it('should get identities keys', async () => { + const identityFixture = await getIdentityFixture(); + + const { IdentitiesKeys, IdentityKeys, PurposeKeys } = GetIdentitiesContractKeysResponseV0; + + const response = new GetIdentitiesContractKeysResponse(); + response.setV0( + new GetIdentitiesContractKeysResponseV0() + .setIdentitiesKeys(new IdentitiesKeys() + .setEntriesList([ + new IdentityKeys() + .setIdentityId(new Uint8Array(identityFixture.getId().toBuffer())) + .setKeysList([ + new PurposeKeys() + .setPurpose(KeyPurpose.ENCRYPTION) + .setKeysBytesList(identityFixture.getPublicKeys() + .map((key) => new Uint8Array(key.toBuffer()))), + ]), + ])) + .setMetadata(new ResponseMetadata()), + ); + + grpcTransportMock.request.resolves(response); + + await platformMethods.getIdentitiesContractKeys([ + Buffer.alloc(32).fill(1), + ], Buffer.alloc(32).fill(2), [KeyPurpose.ENCRYPTION]); + + expect(grpcTransportMock.request).to.be.calledOnce(); + }); + }); + describe('#waitForStateTransitionResult', () => { it('should wait for state transition', async () => { const response = new WaitForStateTransitionResultResponse(); @@ -201,4 +262,60 @@ describe('PlatformMethodsFacade', () => { expect(grpcTransportMock.request).to.be.calledOnce(); }); }); + + describe('#getIdentityContractNonce', () => { + it('should get nonce', async () => { + const response = new GetIdentityContractNonceResponse(); + + response.setV0( + new GetIdentityContractNonceResponseV0() + .setIdentityContractNonce(1) + .setMetadata(new ResponseMetadata()), + ); + + grpcTransportMock.request.resolves(response); + + await platformMethods.getIdentityContractNonce(Buffer.alloc(32), Buffer.alloc(32)); + + expect(grpcTransportMock.request).to.be.calledOnce(); + }); + }); + + describe('#getIdentityNonce', () => { + it('should get nonce', async () => { + const response = new GetIdentityNonceResponse(); + + response.setV0( + new GetIdentityNonceResponseV0() + .setIdentityNonce(1) + .setMetadata(new ResponseMetadata()), + ); + + grpcTransportMock.request.resolves(response); + + await platformMethods.getIdentityNonce(Buffer.alloc(32), Buffer.alloc(32)); + + expect(grpcTransportMock.request).to.be.calledOnce(); + }); + }); + + describe('#getIdentityKeys', () => { + it('should get keys', async () => { + const response = new GetIdentityKeysResponse(); + + const { Keys } = GetIdentityKeysResponseV0; + + response.setV0( + new GetIdentityKeysResponseV0() + .setKeys(new Keys().setKeysBytesList([Buffer.alloc(41), Buffer.alloc(46)])) + .setMetadata(new ResponseMetadata()), + ); + + grpcTransportMock.request.resolves(response); + + await platformMethods.getIdentityKeys(Buffer.alloc(32), [0, 1], 100, {}); + + expect(grpcTransportMock.request).to.be.calledOnce(); + }); + }); }); diff --git a/packages/js-dapi-client/test/unit/DAPIClient.spec.js b/packages/js-dapi-client/test/unit/DAPIClient.spec.js index 73283a9d8ac..dd57d1ff7e2 100644 --- a/packages/js-dapi-client/test/unit/DAPIClient.spec.js +++ b/packages/js-dapi-client/test/unit/DAPIClient.spec.js @@ -26,6 +26,7 @@ describe('DAPIClient', () => { blockHeadersProviderOptions: BlockHeadersProvider.defaultOptions, loggerOptions: { identifier: '', + level: undefined, }, }); @@ -51,6 +52,7 @@ describe('DAPIClient', () => { blockHeadersProviderOptions: BlockHeadersProvider.defaultOptions, loggerOptions: { identifier: '', + level: undefined, }, }); @@ -82,6 +84,7 @@ describe('DAPIClient', () => { blockHeadersProviderOptions: BlockHeadersProvider.defaultOptions, loggerOptions: { identifier: '', + level: undefined, }, }); @@ -109,6 +112,7 @@ describe('DAPIClient', () => { blockHeadersProviderOptions: BlockHeadersProvider.defaultOptions, loggerOptions: { identifier: '', + level: undefined, }, }); diff --git a/packages/js-dapi-client/test/unit/methods/core/generateToAddressFactory.spec.js b/packages/js-dapi-client/test/unit/methods/core/generateToAddressFactory.spec.js deleted file mode 100644 index c35d5c3c868..00000000000 --- a/packages/js-dapi-client/test/unit/methods/core/generateToAddressFactory.spec.js +++ /dev/null @@ -1,32 +0,0 @@ -const generateToAddressFactory = require( - '../../../../lib/methods/core/generateToAddressFactory', -); - -describe('generateToAddressFactory', () => { - let generateToAddress; - let jsonRpcTransport; - - beforeEach(function beforeEach() { - jsonRpcTransport = { - request: this.sinon.stub(), - }; - - generateToAddress = generateToAddressFactory(jsonRpcTransport); - }); - - it('should call generateToAddress method', async () => { - const resultData = 'result'; - const blocksNumber = 10; - const address = 'yTMDce5yEpiPqmgPrPmTj7yAmQPJERUSVy'; - const options = {}; - jsonRpcTransport.request.resolves(resultData); - - const result = await generateToAddress(blocksNumber, address, options); - expect(result).to.equal(resultData); - expect(jsonRpcTransport.request).to.be.calledOnceWithExactly( - 'generateToAddress', - { blocksNumber, address }, - options, - ); - }); -}); diff --git a/packages/js-dapi-client/test/unit/methods/core/getBlockchainStatusFactory.spec.js b/packages/js-dapi-client/test/unit/methods/core/getBlockchainStatusFactory.spec.js new file mode 100644 index 00000000000..bceb20a0ec6 --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/core/getBlockchainStatusFactory.spec.js @@ -0,0 +1,60 @@ +const { + v0: { + GetBlockchainStatusRequest, + GetBlockchainStatusResponse, + CorePromiseClient, + }, +} = require('@dashevo/dapi-grpc'); + +const getBlockchainStatusFactory = require('../../../../lib/methods/core/getBlockchainStatusFactory'); + +describe('getBlockchainStatusFactory', () => { + let getBlockchainStatus; + let grpcTransportMock; + + beforeEach(function beforeEach() { + grpcTransportMock = { + request: this.sinon.stub(), + }; + getBlockchainStatus = getBlockchainStatusFactory(grpcTransportMock); + }); + + it('should return status', async () => { + const response = new GetBlockchainStatusResponse(); + + response.setStatus(GetBlockchainStatusResponse.Status.READY); + + const chain = new GetBlockchainStatusResponse.Chain(); + chain.setBestBlockHash(Buffer.from('bestBlockHash')); + + response.setChain(chain); + + grpcTransportMock.request.resolves(response); + + const options = { + timeout: 1000, + }; + + const result = await getBlockchainStatus( + options, + ); + + const request = new GetBlockchainStatusRequest(); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + CorePromiseClient, + 'getBlockchainStatus', + request, + options, + ); + + const expectedResult = { + ...response.toObject(), + status: 'READY', + }; + + expectedResult.chain.bestBlockHash = Buffer.from(expectedResult.chain.bestBlockHash, 'base64'); + + expect(result).to.deep.equal(expectedResult); + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/core/getMasternodeStatusFactory.spec.js b/packages/js-dapi-client/test/unit/methods/core/getMasternodeStatusFactory.spec.js new file mode 100644 index 00000000000..fdd1b569e53 --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/core/getMasternodeStatusFactory.spec.js @@ -0,0 +1,54 @@ +const { + v0: { + GetMasternodeStatusRequest, + GetMasternodeStatusResponse, + CorePromiseClient, + }, +} = require('@dashevo/dapi-grpc'); + +const getMasternodeStatusFactory = require('../../../../lib/methods/core/getMasternodeStatusFactory'); + +describe('getMasternodeStatusFactory', () => { + let getMasternodeStatus; + let grpcTransportMock; + + beforeEach(function beforeEach() { + grpcTransportMock = { + request: this.sinon.stub(), + }; + getMasternodeStatus = getMasternodeStatusFactory(grpcTransportMock); + }); + + it('should return status', async () => { + const response = new GetMasternodeStatusResponse(); + + response.setStatus(GetMasternodeStatusResponse.Status.READY); + + grpcTransportMock.request.resolves(response); + + const options = { + timeout: 1000, + }; + + const result = await getMasternodeStatus( + options, + ); + + const request = new GetMasternodeStatusRequest(); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + CorePromiseClient, + 'getMasternodeStatus', + request, + options, + ); + + const expectedResult = { + ...response.toObject(), + proTxHash: Buffer.alloc(0), + status: 'READY', + }; + + expect(result).to.deep.equal(expectedResult); + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/core/getMnListDiffFactory.spec.js b/packages/js-dapi-client/test/unit/methods/core/getMnListDiffFactory.spec.js deleted file mode 100644 index 9b7e996aa53..00000000000 --- a/packages/js-dapi-client/test/unit/methods/core/getMnListDiffFactory.spec.js +++ /dev/null @@ -1,35 +0,0 @@ -const getMnListDiffFactory = require('../../../../lib/methods/core/getMnListDiffFactory'); - -const getMNListDiffsFixture = require('../../../../lib/test/fixtures/getMNListDiffsFixture'); - -describe('getMnListDiff', () => { - let getMnListDiff; - let jsonRpcTransportMock; - let mnListDiff; - let baseBlockHash; - let blockHash; - - beforeEach(function beforeEach() { - baseBlockHash = '0000047d24635e347be3aaaeb66c26be94901a2f962feccd4f95090191f208c1'; - blockHash = '000000000b0339e07bce8b3186a6a57a3c45d10e16c4bce18ef81b667bc822b2'; - mnListDiff = getMNListDiffsFixture(); - - jsonRpcTransportMock = { - request: this.sinon.stub().resolves(mnListDiff), - }; - getMnListDiff = getMnListDiffFactory(jsonRpcTransportMock); - }); - - it('should return deterministic masternodelist diff', async () => { - const options = {}; - - const result = await getMnListDiff(baseBlockHash, blockHash, options); - - expect(result).to.deep.equal(mnListDiff); - expect(jsonRpcTransportMock.request).to.be.calledOnceWithExactly( - 'getMnListDiff', - { baseBlockHash, blockHash }, - options, - ); - }); -}); diff --git a/packages/js-dapi-client/test/unit/methods/core/getStatusFactory.spec.js b/packages/js-dapi-client/test/unit/methods/core/getStatusFactory.spec.js deleted file mode 100644 index b5376020dee..00000000000 --- a/packages/js-dapi-client/test/unit/methods/core/getStatusFactory.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { - v0: { - GetStatusRequest, - GetStatusResponse, - CorePromiseClient, - }, -} = require('@dashevo/dapi-grpc'); - -const getStatusFactory = require('../../../../lib/methods/core/getStatusFactory'); - -describe('getStatusFactory', () => { - let getStatus; - let grpcTransportMock; - - beforeEach(function beforeEach() { - grpcTransportMock = { - request: this.sinon.stub(), - }; - getStatus = getStatusFactory(grpcTransportMock); - }); - - it('should return status', async () => { - const response = new GetStatusResponse(); - - response.setStatus(GetStatusResponse.Status.READY); - - const masternode = new GetStatusResponse.Masternode(); - - masternode.setStatus(GetStatusResponse.Masternode.Status.READY); - - const chain = new GetStatusResponse.Chain(); - chain.setBestBlockHash(Buffer.from('bestBlockHash')); - - response.setMasternode(masternode); - response.setChain(chain); - - grpcTransportMock.request.resolves(response); - - const options = { - timeout: 1000, - }; - - const result = await getStatus( - options, - ); - - const request = new GetStatusRequest(); - - expect(grpcTransportMock.request).to.be.calledOnceWithExactly( - CorePromiseClient, - 'getStatus', - request, - options, - ); - - const expectedResult = { - ...response.toObject(), - status: 'READY', - masternode: { - ...response.getMasternode().toObject(), - status: 'READY', - }, - }; - - expectedResult.chain.bestBlockHash = Buffer.from(expectedResult.chain.bestBlockHash, 'base64'); - - expect(result).to.deep.equal(expectedResult); - }); -}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesByPublicKeyHashes/GetIdentitiesByPublicKeyHashesResponse.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesByPublicKeyHashes/GetIdentitiesByPublicKeyHashesResponse.spec.js deleted file mode 100644 index b43a0e5686f..00000000000 --- a/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesByPublicKeyHashes/GetIdentitiesByPublicKeyHashesResponse.spec.js +++ /dev/null @@ -1,144 +0,0 @@ -const { BytesValue } = require('google-protobuf/google/protobuf/wrappers_pb'); - -const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); -const { - v0: { - GetIdentitiesByPublicKeyHashesResponse, - ResponseMetadata, - Proof: ProofResponse, - }, -} = require('@dashevo/dapi-grpc'); - -const GetIdentitiesByPublicKeyHashesResponseClass = require('../../../../../lib/methods/platform/getIdentitiesByPublicKeyHashes/GetIdentitiesByPublicKeyHashesResponse'); -const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); -const InvalidResponseError = require('../../../../../lib/methods/platform/response/errors/InvalidResponseError'); -const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); -const Proof = require('../../../../../lib/methods/platform/response/Proof'); -const Metadata = require('../../../../../lib/methods/platform/response/Metadata'); - -describe('GetIdentitiesByPublicKeyHashesResponse', () => { - let getIdentitiesResponse; - let metadataFixture; - let identityFixture; - let proto; - let proofFixture; - - beforeEach(async () => { - metadataFixture = getMetadataFixture(); - identityFixture = await getIdentityFixture(); - proofFixture = getProofFixture(); - - const { - IdentitiesByPublicKeyHashes, - PublicKeyHashIdentityEntry, - GetIdentitiesByPublicKeyHashesResponseV0, - } = GetIdentitiesByPublicKeyHashesResponse; - - proto = new GetIdentitiesByPublicKeyHashesResponse(); - - const metadata = new ResponseMetadata(); - metadata.setHeight(metadataFixture.height); - metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); - metadata.setTimeMs(metadataFixture.timeMs); - metadata.setProtocolVersion(metadataFixture.protocolVersion); - - proto.setV0( - new GetIdentitiesByPublicKeyHashesResponseV0().setIdentities( - new IdentitiesByPublicKeyHashes() - .setIdentityEntriesList([ - new PublicKeyHashIdentityEntry() - .setPublicKeyHash(Buffer.alloc(20)) - .setValue(new BytesValue().setValue(identityFixture.toBuffer())), - ]), - ).setMetadata(metadata), - ); - - getIdentitiesResponse = new GetIdentitiesByPublicKeyHashesResponseClass( - [identityFixture.toBuffer()], - new Metadata(metadataFixture), - ); - }); - - it('should return identities', () => { - const identities = getIdentitiesResponse.getIdentities(); - const proof = getIdentitiesResponse.getProof(); - - expect(identities).to.deep.members([identityFixture.toBuffer()]); - expect(proof).to.equal(undefined); - }); - - it('should return proof', () => { - getIdentitiesResponse = new GetIdentitiesByPublicKeyHashesResponseClass( - [], - new Metadata(metadataFixture), - new Proof(proofFixture), - ); - - const identities = getIdentitiesResponse.getIdentities(); - const proof = getIdentitiesResponse.getProof(); - - expect(identities).to.deep.members([]); - expect(proof).to.be.an.instanceOf(Proof); - expect(proof.getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); - expect(proof.getQuorumHash()).to.deep.equal(proofFixture.quorumHash); - expect(proof.getSignature()).to.deep.equal(proofFixture.signature); - }); - - it('should create an instance from proto', () => { - getIdentitiesResponse = GetIdentitiesByPublicKeyHashesResponseClass.createFromProto(proto); - expect(getIdentitiesResponse).to.be.an.instanceOf( - GetIdentitiesByPublicKeyHashesResponseClass, - ); - expect(getIdentitiesResponse.getIdentities()).to.deep.equal([identityFixture.toBuffer()]); - - expect(getIdentitiesResponse.getMetadata()) - .to.be.an.instanceOf(Metadata); - expect(getIdentitiesResponse.getMetadata().getHeight()) - .to.equal(metadataFixture.height); - expect(getIdentitiesResponse.getMetadata().getCoreChainLockedHeight()) - .to.equal(metadataFixture.coreChainLockedHeight); - - expect(getIdentitiesResponse.getProof()).to.equal(undefined); - }); - - it('should create an instance with proof from proto', () => { - const proofProto = new ProofResponse(); - - proofProto.setQuorumHash(proofFixture.quorumHash); - proofProto.setSignature(proofFixture.signature); - proofProto.setGrovedbProof(proofFixture.merkleProof); - proofProto.setRound(proofFixture.round); - - proto.getV0().setProof(proofProto); - - getIdentitiesResponse = GetIdentitiesByPublicKeyHashesResponseClass.createFromProto(proto); - expect(getIdentitiesResponse).to.be.an.instanceOf( - GetIdentitiesByPublicKeyHashesResponseClass, - ); - expect(getIdentitiesResponse.getIdentities()).to.deep.members([]); - expect(getIdentitiesResponse.getMetadata()).to.deep.equal(metadataFixture); - - expect(getIdentitiesResponse.getProof()) - .to.be.an.instanceOf(Proof); - expect(getIdentitiesResponse.getProof().getGrovedbProof()) - .to.deep.equal(proofFixture.merkleProof); - expect(getIdentitiesResponse.getProof().getQuorumHash()) - .to.deep.equal(proofFixture.quorumHash); - expect(getIdentitiesResponse.getProof().getSignature()) - .to.deep.equal(proofFixture.signature); - expect(getIdentitiesResponse.getProof().getRound()) - .to.deep.equal(proofFixture.round); - }); - - it('should throw InvalidResponseError if Metadata is not defined', () => { - proto.getV0().setMetadata(undefined); - - try { - getIdentitiesResponse = GetIdentitiesByPublicKeyHashesResponseClass.createFromProto(proto); - - expect.fail('should throw InvalidResponseError'); - } catch (e) { - expect(e).to.be.an.instanceOf(InvalidResponseError); - } - }); -}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesByPublicKeyHashes/getIdentitiesByPublicKeyHashesFactory.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesByPublicKeyHashes/getIdentitiesByPublicKeyHashesFactory.spec.js deleted file mode 100644 index 205e45583f8..00000000000 --- a/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesByPublicKeyHashes/getIdentitiesByPublicKeyHashesFactory.spec.js +++ /dev/null @@ -1,166 +0,0 @@ -const { BytesValue } = require('google-protobuf/google/protobuf/wrappers_pb'); -const { - v0: { - PlatformPromiseClient, - GetIdentitiesByPublicKeyHashesRequest, - GetIdentitiesByPublicKeyHashesResponse, - ResponseMetadata, - Proof: ProofResponse, - }, -} = require('@dashevo/dapi-grpc'); - -const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); -const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); -const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); - -const getIdentitiesByPublicKeyHashesFactory = require( - '../../../../../lib/methods/platform/getIdentitiesByPublicKeyHashes/getIdentitiesByPublicKeyHashesFactory', -); -const Proof = require('../../../../../lib/methods/platform/response/Proof'); - -describe('getIdentitiesByPublicKeyHashesFactory', () => { - let grpcTransportMock; - let getIdentitiesByPublicKeyHashes; - let options; - let response; - let identityFixture; - let publicKeyHash; - let metadataFixture; - let proofFixture; - let proofResponse; - - beforeEach(async function beforeEach() { - identityFixture = await getIdentityFixture(); - metadataFixture = getMetadataFixture(); - proofFixture = getProofFixture(); - - const metadata = new ResponseMetadata(); - metadata.setHeight(metadataFixture.height); - metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); - metadata.setTimeMs(metadataFixture.timeMs); - metadata.setProtocolVersion(metadataFixture.protocolVersion); - - const { - IdentitiesByPublicKeyHashes, - PublicKeyHashIdentityEntry, - GetIdentitiesByPublicKeyHashesResponseV0, - } = GetIdentitiesByPublicKeyHashesResponse; - - response = new GetIdentitiesByPublicKeyHashesResponse(); - response.setV0( - new GetIdentitiesByPublicKeyHashesResponseV0().setIdentities( - new IdentitiesByPublicKeyHashes() - .setIdentityEntriesList([ - new PublicKeyHashIdentityEntry() - .setPublicKeyHash(publicKeyHash) - .setValue(new BytesValue().setValue(identityFixture.toBuffer())), - ]), - ).setMetadata(metadata), - ); - - proofResponse = new ProofResponse(); - - proofResponse.setQuorumHash(proofFixture.quorumHash); - proofResponse.setSignature(proofFixture.signature); - proofResponse.setGrovedbProof(proofFixture.merkleProof); - proofResponse.setRound(proofFixture.round); - - publicKeyHash = identityFixture.getPublicKeyById(1).hash(); - - grpcTransportMock = { - request: this.sinon.stub().resolves(response), - }; - - options = { - timeout: 1000, - }; - - getIdentitiesByPublicKeyHashes = getIdentitiesByPublicKeyHashesFactory(grpcTransportMock); - }); - - it('should return public key hashes to identity map', async () => { - const result = await getIdentitiesByPublicKeyHashes([publicKeyHash], options); - - const { GetIdentitiesByPublicKeyHashesRequestV0 } = GetIdentitiesByPublicKeyHashesRequest; - const request = new GetIdentitiesByPublicKeyHashesRequest(); - request.setV0( - new GetIdentitiesByPublicKeyHashesRequestV0() - .setPublicKeyHashesList([publicKeyHash]) - .setProve(false), - ); - - expect(grpcTransportMock.request).to.be.calledOnceWithExactly( - PlatformPromiseClient, - 'getIdentitiesByPublicKeyHashes', - request, - options, - ); - expect(result.getIdentities()).to.have.deep.equal([identityFixture.toBuffer()]); - expect(result.getMetadata()).to.deep.equal(metadataFixture); - expect(result.getProof()).to.equal(undefined); - }); - - it('should return proof', async () => { - options.prove = true; - response.getV0().setProof(proofResponse); - - const result = await getIdentitiesByPublicKeyHashes([publicKeyHash], options); - - const { GetIdentitiesByPublicKeyHashesRequestV0 } = GetIdentitiesByPublicKeyHashesRequest; - const request = new GetIdentitiesByPublicKeyHashesRequest(); - request.setV0( - new GetIdentitiesByPublicKeyHashesRequestV0() - .setPublicKeyHashesList([publicKeyHash]) - .setProve(true), - ); - - expect(grpcTransportMock.request).to.be.calledOnceWithExactly( - PlatformPromiseClient, - 'getIdentitiesByPublicKeyHashes', - request, - options, - ); - expect(result.getIdentities()).to.have.deep.members([]); - - expect(result.getMetadata()).to.deep.equal(metadataFixture); - - expect(result.getProof()).to.be.an.instanceOf(Proof); - expect(result.getProof().getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); - expect(result.getProof().getQuorumHash()).to.deep.equal(proofFixture.quorumHash); - expect(result.getProof().getSignature()).to.deep.equal(proofFixture.signature); - expect(result.getProof().getRound()).to.deep.equal(proofFixture.round); - expect(result.getMetadata()).to.deep.equal(metadataFixture); - expect(result.getMetadata().getHeight()).to.equal(metadataFixture.height); - expect(result.getMetadata().getCoreChainLockedHeight()).to.equal( - metadataFixture.coreChainLockedHeight, - ); - }); - - it('should throw unknown error', async () => { - const error = new Error('Unknown found'); - - grpcTransportMock.request.throws(error); - - const { GetIdentitiesByPublicKeyHashesRequestV0 } = GetIdentitiesByPublicKeyHashesRequest; - const request = new GetIdentitiesByPublicKeyHashesRequest(); - request.setV0( - new GetIdentitiesByPublicKeyHashesRequestV0() - .setPublicKeyHashesList([publicKeyHash]) - .setProve(false), - ); - - try { - await getIdentitiesByPublicKeyHashes([publicKeyHash], options); - - expect.fail('should throw unknown error'); - } catch (e) { - expect(e).to.deep.equal(error); - expect(grpcTransportMock.request).to.be.calledOnceWithExactly( - PlatformPromiseClient, - 'getIdentitiesByPublicKeyHashes', - request, - options, - ); - } - }); -}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesContractKeys/GetIdentitiesContractKeysResponse.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesContractKeys/GetIdentitiesContractKeysResponse.spec.js new file mode 100644 index 00000000000..36fe8f57d7a --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesContractKeys/GetIdentitiesContractKeysResponse.spec.js @@ -0,0 +1,177 @@ +const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); +const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); +const { + v0: { + GetIdentitiesContractKeysResponse, + ResponseMetadata, + KeyPurpose, + Proof: ProofResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const GetIdentitiesContractKeysResponseClass = require('../../../../../lib/methods/platform/getIdentitiesContractKeys/GetIdentitiesContractKeysResponse'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const InvalidResponseError = require('../../../../../lib/methods/platform/response/errors/InvalidResponseError'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); +const Metadata = require('../../../../../lib/methods/platform/response/Metadata'); + +describe('GetIdentitiesContractKeysResponse', () => { + let getIdentitiesContractKeysResponse; + let metadataFixture; + let identityFixtureA; + let identityFixtureB; + let identitiesContractKeys; + let proto; + let proofFixture; + + beforeEach(async () => { + metadataFixture = getMetadataFixture(); + identityFixtureA = await getIdentityFixture(await generateRandomIdentifier()); + identityFixtureB = await getIdentityFixture(await generateRandomIdentifier()); + proofFixture = getProofFixture(); + + const { + GetIdentitiesContractKeysResponseV0, + } = GetIdentitiesContractKeysResponse; + + const { IdentitiesKeys, IdentityKeys, PurposeKeys } = GetIdentitiesContractKeysResponseV0; + + proto = new GetIdentitiesContractKeysResponse(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + proto.setV0( + new GetIdentitiesContractKeysResponseV0() + .setIdentitiesKeys(new IdentitiesKeys() + .setEntriesList([ + new IdentityKeys() + .setIdentityId(new Uint8Array(identityFixtureA.getId().toBuffer())) + .setKeysList([ + new PurposeKeys() + .setPurpose(KeyPurpose.ENCRYPTION) + .setKeysBytesList(identityFixtureA.getPublicKeys() + .map((key) => new Uint8Array(key.toBuffer()))), + ]), + new IdentityKeys() + .setIdentityId(new Uint8Array(identityFixtureB.getId().toBuffer())) + .setKeysList([ + new PurposeKeys() + .setPurpose(KeyPurpose.DECRYPTION) + .setKeysBytesList(identityFixtureB.getPublicKeys() + .map((key) => new Uint8Array(key.toBuffer()))), + ]), + ])) + .setMetadata(metadata), + ); + + identitiesContractKeys = { + [identityFixtureA.getId().toString()]: { + [KeyPurpose.ENCRYPTION]: identityFixtureA.getPublicKeys() + .map((key) => new Uint8Array(key.toBuffer())), + }, + [identityFixtureB.getId().toString()]: { + [KeyPurpose.DECRYPTION]: identityFixtureB.getPublicKeys() + .map((key) => new Uint8Array(key.toBuffer())), + }, + }; + + getIdentitiesContractKeysResponse = new GetIdentitiesContractKeysResponseClass( + identitiesContractKeys, + new Metadata(metadataFixture), + ); + }); + + it('should return identities keys', () => { + const keys = getIdentitiesContractKeysResponse.getIdentitiesKeys(); + const proof = getIdentitiesContractKeysResponse.getProof(); + + expect(keys).to.deep.equal(identitiesContractKeys); + expect(proof).to.equal(undefined); + }); + + it('should return proof', () => { + getIdentitiesContractKeysResponse = new GetIdentitiesContractKeysResponseClass( + {}, + new Metadata(metadataFixture), + new Proof(proofFixture), + ); + + const keys = getIdentitiesContractKeysResponse.getIdentitiesKeys(); + const proof = getIdentitiesContractKeysResponse.getProof(); + + expect(keys).to.deep.equal({}); + expect(proof).to.be.an.instanceOf(Proof); + expect(proof.getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(proof.getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(proof.getSignature()).to.deep.equal(proofFixture.signature); + }); + + it('should create an instance from proto', () => { + getIdentitiesContractKeysResponse = GetIdentitiesContractKeysResponseClass + .createFromProto(proto); + expect(getIdentitiesContractKeysResponse).to.be.an.instanceOf( + GetIdentitiesContractKeysResponseClass, + ); + + expect(getIdentitiesContractKeysResponse.getIdentitiesKeys()).to.deep.equal( + identitiesContractKeys, + ); + + expect(getIdentitiesContractKeysResponse.getMetadata()) + .to.be.an.instanceOf(Metadata); + expect(getIdentitiesContractKeysResponse.getMetadata().getHeight()) + .to.equal(metadataFixture.height); + expect(getIdentitiesContractKeysResponse.getMetadata().getCoreChainLockedHeight()) + .to.equal(metadataFixture.coreChainLockedHeight); + + expect(getIdentitiesContractKeysResponse.getProof()).to.equal(undefined); + }); + + it('should create an instance with proof from proto', () => { + const proofProto = new ProofResponse(); + + proofProto.setQuorumHash(proofFixture.quorumHash); + proofProto.setSignature(proofFixture.signature); + proofProto.setGrovedbProof(proofFixture.merkleProof); + proofProto.setRound(proofFixture.round); + + proto.getV0().setProof(proofProto); + + getIdentitiesContractKeysResponse = GetIdentitiesContractKeysResponseClass + .createFromProto(proto); + expect(getIdentitiesContractKeysResponse).to.be.an.instanceOf( + GetIdentitiesContractKeysResponseClass, + ); + expect(getIdentitiesContractKeysResponse.getIdentitiesKeys()).to.deep.equal({}); + expect(getIdentitiesContractKeysResponse.getMetadata()).to.deep.equal(metadataFixture); + + expect(getIdentitiesContractKeysResponse.getProof()) + .to.be.an.instanceOf(Proof); + expect(getIdentitiesContractKeysResponse.getProof().getGrovedbProof()) + .to.deep.equal(proofFixture.merkleProof); + expect(getIdentitiesContractKeysResponse.getProof().getQuorumHash()) + .to.deep.equal(proofFixture.quorumHash); + expect(getIdentitiesContractKeysResponse.getProof().getSignature()) + .to.deep.equal(proofFixture.signature); + expect(getIdentitiesContractKeysResponse.getProof().getRound()) + .to.deep.equal(proofFixture.round); + }); + + it('should throw InvalidResponseError if Metadata is not defined', () => { + proto.getV0().setMetadata(undefined); + + try { + getIdentitiesContractKeysResponse = GetIdentitiesContractKeysResponseClass + .createFromProto(proto); + + expect.fail('should throw InvalidResponseError'); + } catch (e) { + expect(e).to.be.an.instanceOf(InvalidResponseError); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesContractKeys/getIdentitiesContractKeysFactory.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesContractKeys/getIdentitiesContractKeysFactory.spec.js new file mode 100644 index 00000000000..f6f061092db --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentitiesContractKeys/getIdentitiesContractKeysFactory.spec.js @@ -0,0 +1,214 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentitiesContractKeysRequest, + GetIdentitiesContractKeysResponse, + KeyPurpose, + ResponseMetadata, + Proof: ProofResponse, + }, +} = require('@dashevo/dapi-grpc'); +const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); + +const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); + +const getIdentitiesContractKeysFactory = require( + '../../../../../lib/methods/platform/getIdentitiesContractKeys/getIdentitiesContractKeysFactory', +); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); + +describe('getIdentitiesContractKeysFactory', () => { + let grpcTransportMock; + let getIdentitiesContractKeys; + let options; + let response; + + let identityFixtureA; + let identityFixtureB; + let contractId; + let identitiesContractKeys; + + let metadataFixture; + let proofFixture; + let proofResponse; + + let mockRequest; + + beforeEach(async function beforeEach() { + identityFixtureA = await getIdentityFixture(await generateRandomIdentifier()); + identityFixtureB = await getIdentityFixture(await generateRandomIdentifier()); + contractId = await generateRandomIdentifier(); + metadataFixture = getMetadataFixture(); + proofFixture = getProofFixture(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + const { + GetIdentitiesContractKeysResponseV0, + } = GetIdentitiesContractKeysResponse; + + const { IdentitiesKeys, IdentityKeys, PurposeKeys } = GetIdentitiesContractKeysResponseV0; + + response = new GetIdentitiesContractKeysResponse(); + response.setV0( + new GetIdentitiesContractKeysResponseV0() + .setIdentitiesKeys(new IdentitiesKeys() + .setEntriesList([ + new IdentityKeys() + .setIdentityId(new Uint8Array(identityFixtureA.getId().toBuffer())) + .setKeysList([ + new PurposeKeys() + .setPurpose(KeyPurpose.ENCRYPTION) + .setKeysBytesList(identityFixtureA.getPublicKeys() + .map((key) => new Uint8Array(key.toBuffer()))), + ]), + new IdentityKeys() + .setIdentityId(new Uint8Array(identityFixtureB.getId().toBuffer())) + .setKeysList([ + new PurposeKeys() + .setPurpose(KeyPurpose.DECRYPTION) + .setKeysBytesList(identityFixtureB.getPublicKeys() + .map((key) => new Uint8Array(key.toBuffer()))), + ]), + ])) + .setMetadata(metadata), + ); + + proofResponse = new ProofResponse(); + + proofResponse.setQuorumHash(proofFixture.quorumHash); + proofResponse.setSignature(proofFixture.signature); + proofResponse.setGrovedbProof(proofFixture.merkleProof); + proofResponse.setRound(proofFixture.round); + + identitiesContractKeys = { + [identityFixtureA.getId().toString()]: { + [KeyPurpose.ENCRYPTION]: identityFixtureA.getPublicKeys() + .map((key) => new Uint8Array(key.toBuffer())), + }, + [identityFixtureB.getId().toString()]: { + [KeyPurpose.DECRYPTION]: identityFixtureB.getPublicKeys() + .map((key) => new Uint8Array(key.toBuffer())), + }, + }; + + grpcTransportMock = { + request: this.sinon.stub().resolves(response), + }; + + options = { + timeout: 1000, + }; + + mockRequest = () => { + const { GetIdentitiesContractKeysRequestV0 } = GetIdentitiesContractKeysRequest; + const request = new GetIdentitiesContractKeysRequest(); + request.setV0( + new GetIdentitiesContractKeysRequestV0() + .setProve(!!options.prove) + .setIdentitiesIdsList( + [Buffer.from(identityFixtureA.getId()), Buffer.from(identityFixtureB.getId())], + ) + .setContractId(Buffer.from(contractId)) + .setPurposesList([KeyPurpose.ENCRYPTION, KeyPurpose.DECRYPTION]) + .setDocumentTypeName('contactRequest'), + ); + + return request; + }; + + getIdentitiesContractKeys = getIdentitiesContractKeysFactory(grpcTransportMock); + }); + + it('should return identity ids to key purposes to keys', async () => { + const result = await getIdentitiesContractKeys( + [identityFixtureA.getId(), identityFixtureB.getId()], + contractId, + [KeyPurpose.ENCRYPTION, KeyPurpose.DECRYPTION], + 'contactRequest', + options, + ); + + const request = mockRequest(); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentitiesContractKeys', + request, + options, + ); + expect(result.getIdentitiesKeys()).to.deep.equal(identitiesContractKeys); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getProof()).to.equal(undefined); + }); + + it('should return proof', async () => { + options.prove = true; + response.getV0().setProof(proofResponse); + + const result = await getIdentitiesContractKeys( + [identityFixtureA.getId(), identityFixtureB.getId()], + contractId, + [KeyPurpose.ENCRYPTION, KeyPurpose.DECRYPTION], + 'contactRequest', + options, + ); + + const request = mockRequest(); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentitiesContractKeys', + request, + options, + ); + expect(result.getIdentitiesKeys()).to.deep.equal({}); + + expect(result.getMetadata()).to.deep.equal(metadataFixture); + + expect(result.getProof()).to.be.an.instanceOf(Proof); + expect(result.getProof().getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(result.getProof().getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(result.getProof().getSignature()).to.deep.equal(proofFixture.signature); + expect(result.getProof().getRound()).to.deep.equal(proofFixture.round); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getMetadata().getHeight()).to.equal(metadataFixture.height); + expect(result.getMetadata().getCoreChainLockedHeight()).to.equal( + metadataFixture.coreChainLockedHeight, + ); + }); + + it('should throw unknown error', async () => { + const error = new Error('Unknown found'); + + grpcTransportMock.request.throws(error); + + const request = mockRequest(); + + try { + await getIdentitiesContractKeys( + [identityFixtureA.getId(), identityFixtureB.getId()], + contractId, + [KeyPurpose.ENCRYPTION, KeyPurpose.DECRYPTION], + 'contactRequest', + options, + ); + + expect.fail('should throw unknown error'); + } catch (e) { + expect(e).to.deep.equal(error); + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentitiesContractKeys', + request, + options, + ); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentityByPublicKeyHash/GetIdentityByPublicKeyHashResponse.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentityByPublicKeyHash/GetIdentityByPublicKeyHashResponse.spec.js new file mode 100644 index 00000000000..bda482f7dff --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentityByPublicKeyHash/GetIdentityByPublicKeyHashResponse.spec.js @@ -0,0 +1,136 @@ +const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); +const { + v0: { + GetIdentityByPublicKeyHashResponse, + ResponseMetadata, + Proof: ProofResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const GetIdentityByPublicKeyHashResponseClass = require('../../../../../lib/methods/platform/getIdentityByPublicKeyHash/GetIdentityByPublicKeyHashResponse'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const InvalidResponseError = require('../../../../../lib/methods/platform/response/errors/InvalidResponseError'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); +const Metadata = require('../../../../../lib/methods/platform/response/Metadata'); + +describe('GetIdentityByPublicKeyHashResponse', () => { + let getIdentityResponse; + let metadataFixture; + let identityFixture; + let proto; + let proofFixture; + + beforeEach(async () => { + metadataFixture = getMetadataFixture(); + identityFixture = await getIdentityFixture(); + proofFixture = getProofFixture(); + + const { + GetIdentityByPublicKeyHashResponseV0, + } = GetIdentityByPublicKeyHashResponse; + + proto = new GetIdentityByPublicKeyHashResponse(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + proto.setV0( + new GetIdentityByPublicKeyHashResponseV0() + .setIdentity(identityFixture.toBuffer()) + .setMetadata(metadata), + ); + + getIdentityResponse = new GetIdentityByPublicKeyHashResponseClass( + identityFixture.toBuffer(), + new Metadata(metadataFixture), + ); + }); + + it('should return identity', () => { + const identity = getIdentityResponse.getIdentity(); + const proof = getIdentityResponse.getProof(); + + expect(identity).to.deep.equal(identityFixture.toBuffer()); + expect(proof).to.equal(undefined); + }); + + it('should return proof', () => { + getIdentityResponse = new GetIdentityByPublicKeyHashResponseClass( + undefined, + new Metadata(metadataFixture), + new Proof(proofFixture), + ); + + const identity = getIdentityResponse.getIdentity(); + const proof = getIdentityResponse.getProof(); + + expect(identity).to.equal(undefined); + expect(proof).to.be.an.instanceOf(Proof); + expect(proof.getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(proof.getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(proof.getSignature()).to.deep.equal(proofFixture.signature); + }); + + it('should create an instance from proto', () => { + getIdentityResponse = GetIdentityByPublicKeyHashResponseClass.createFromProto(proto); + expect(getIdentityResponse).to.be.an.instanceOf( + GetIdentityByPublicKeyHashResponseClass, + ); + expect(getIdentityResponse.getIdentity()).to.deep.equal(identityFixture.toBuffer()); + + expect(getIdentityResponse.getMetadata()) + .to.be.an.instanceOf(Metadata); + expect(getIdentityResponse.getMetadata().getHeight()) + .to.equal(metadataFixture.height); + expect(getIdentityResponse.getMetadata().getCoreChainLockedHeight()) + .to.equal(metadataFixture.coreChainLockedHeight); + + expect(getIdentityResponse.getProof()).to.equal(undefined); + }); + + it('should create an instance with proof from proto', () => { + const proofProto = new ProofResponse(); + + proofProto.setQuorumHash(proofFixture.quorumHash); + proofProto.setSignature(proofFixture.signature); + proofProto.setGrovedbProof(proofFixture.merkleProof); + proofProto.setRound(proofFixture.round); + + proto.getV0().setProof(proofProto); + proto.getV0().setIdentity(undefined); + + getIdentityResponse = GetIdentityByPublicKeyHashResponseClass.createFromProto(proto); + expect(getIdentityResponse).to.be.an.instanceOf( + GetIdentityByPublicKeyHashResponseClass, + ); + expect(getIdentityResponse.getIdentity()).to.deep.equal(Buffer.alloc(0)); + expect(getIdentityResponse.getMetadata()).to.deep.equal(metadataFixture); + + expect(getIdentityResponse.getProof()) + .to.be.an.instanceOf(Proof); + expect(getIdentityResponse.getProof().getGrovedbProof()) + .to.deep.equal(proofFixture.merkleProof); + expect(getIdentityResponse.getProof().getQuorumHash()) + .to.deep.equal(proofFixture.quorumHash); + expect(getIdentityResponse.getProof().getSignature()) + .to.deep.equal(proofFixture.signature); + expect(getIdentityResponse.getProof().getRound()) + .to.deep.equal(proofFixture.round); + }); + + it('should throw InvalidResponseError if Metadata is not defined', () => { + proto.getV0().setMetadata(undefined); + + try { + getIdentityResponse = GetIdentityByPublicKeyHashResponseClass.createFromProto(proto); + + expect.fail('should throw InvalidResponseError'); + } catch (e) { + expect(e).to.be.an.instanceOf(InvalidResponseError); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentityByPublicKeyHash/getIdentityByPublicKeyHashFactory.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentityByPublicKeyHash/getIdentityByPublicKeyHashFactory.spec.js new file mode 100644 index 00000000000..c36acc5eff6 --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentityByPublicKeyHash/getIdentityByPublicKeyHashFactory.spec.js @@ -0,0 +1,158 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentityByPublicKeyHashRequest, + GetIdentityByPublicKeyHashResponse, + ResponseMetadata, + Proof: ProofResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const getIdentityFixture = require('@dashevo/wasm-dpp/lib/test/fixtures/getIdentityFixture'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); + +const getIdentityByPublicKeyHashFactory = require( + '../../../../../lib/methods/platform/getIdentityByPublicKeyHash/getIdentityByPublicKeyHashFactory', +); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); + +describe('getIdentityByPublicKeyHashFactory', () => { + let grpcTransportMock; + let getIdentityByPublicKeyHash; + let options; + let response; + let identityFixture; + let publicKeyHash; + let metadataFixture; + let proofFixture; + let proofResponse; + + beforeEach(async function beforeEach() { + identityFixture = await getIdentityFixture(); + metadataFixture = getMetadataFixture(); + proofFixture = getProofFixture(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + const { + GetIdentityByPublicKeyHashResponseV0, + } = GetIdentityByPublicKeyHashResponse; + + response = new GetIdentityByPublicKeyHashResponse(); + response.setV0( + new GetIdentityByPublicKeyHashResponseV0() + .setIdentity(identityFixture.toBuffer()) + .setMetadata(metadata), + ); + + proofResponse = new ProofResponse(); + + proofResponse.setQuorumHash(proofFixture.quorumHash); + proofResponse.setSignature(proofFixture.signature); + proofResponse.setGrovedbProof(proofFixture.merkleProof); + proofResponse.setRound(proofFixture.round); + + publicKeyHash = identityFixture.getPublicKeyById(1).hash(); + + grpcTransportMock = { + request: this.sinon.stub().resolves(response), + }; + + options = { + timeout: 1000, + }; + + getIdentityByPublicKeyHash = getIdentityByPublicKeyHashFactory(grpcTransportMock); + }); + + it('should return identity', async () => { + const result = await getIdentityByPublicKeyHash(publicKeyHash, options); + + const { GetIdentityByPublicKeyHashRequestV0 } = GetIdentityByPublicKeyHashRequest; + const request = new GetIdentityByPublicKeyHashRequest(); + request.setV0( + new GetIdentityByPublicKeyHashRequestV0() + .setPublicKeyHash(publicKeyHash) + .setProve(false), + ); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityByPublicKeyHash', + request, + options, + ); + expect(result.getIdentity()).to.have.deep.equal(identityFixture.toBuffer()); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getProof()).to.equal(undefined); + }); + + it('should return proof', async () => { + options.prove = true; + response.getV0().setProof(proofResponse); + + const result = await getIdentityByPublicKeyHash(publicKeyHash, options); + + const { GetIdentityByPublicKeyHashRequestV0 } = GetIdentityByPublicKeyHashRequest; + const request = new GetIdentityByPublicKeyHashRequest(); + request.setV0( + new GetIdentityByPublicKeyHashRequestV0() + .setPublicKeyHash(publicKeyHash) + .setProve(true), + ); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityByPublicKeyHash', + request, + options, + ); + expect(result.getIdentity()).to.deep.equal(Buffer.alloc(0)); + + expect(result.getMetadata()).to.deep.equal(metadataFixture); + + expect(result.getProof()).to.be.an.instanceOf(Proof); + expect(result.getProof().getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(result.getProof().getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(result.getProof().getSignature()).to.deep.equal(proofFixture.signature); + expect(result.getProof().getRound()).to.deep.equal(proofFixture.round); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getMetadata().getHeight()).to.equal(metadataFixture.height); + expect(result.getMetadata().getCoreChainLockedHeight()).to.equal( + metadataFixture.coreChainLockedHeight, + ); + }); + + it('should throw unknown error', async () => { + const error = new Error('Unknown found'); + + grpcTransportMock.request.throws(error); + + const { GetIdentityByPublicKeyHashRequestV0 } = GetIdentityByPublicKeyHashRequest; + const request = new GetIdentityByPublicKeyHashRequest(); + request.setV0( + new GetIdentityByPublicKeyHashRequestV0() + .setPublicKeyHash(publicKeyHash) + .setProve(false), + ); + + try { + await getIdentityByPublicKeyHash(publicKeyHash, options); + + expect.fail('should throw unknown error'); + } catch (e) { + expect(e).to.deep.equal(error); + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityByPublicKeyHash', + request, + options, + ); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentityContractNonce/GetIdentityContractNonce.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentityContractNonce/GetIdentityContractNonce.spec.js new file mode 100644 index 00000000000..efb8e532f4d --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentityContractNonce/GetIdentityContractNonce.spec.js @@ -0,0 +1,129 @@ +const { + v0: { + GetIdentityContractNonceResponse, + ResponseMetadata, + Proof: ProofResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const GetIdentityContractNonceResponseClass = require('../../../../../lib/methods/platform/getIdentityContractNonce/GetIdentityContractNonceResponse'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const InvalidResponseError = require('../../../../../lib/methods/platform/response/errors/InvalidResponseError'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); +const Metadata = require('../../../../../lib/methods/platform/response/Metadata'); + +describe('GetIdentityContractNonceResponse', () => { + let getIdentityContractNonceResponse; + let metadataFixture; + let nonce; + let proto; + let proofFixture; + + beforeEach(async () => { + metadataFixture = getMetadataFixture(); + nonce = 1; + proofFixture = getProofFixture(); + + const { GetIdentityContractNonceResponseV0 } = GetIdentityContractNonceResponse; + proto = new GetIdentityContractNonceResponse(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + proto.setV0( + new GetIdentityContractNonceResponseV0() + .setIdentityContractNonce(nonce) + .setMetadata(metadata), + + ); + + getIdentityContractNonceResponse = new GetIdentityContractNonceResponseClass( + nonce, + new Metadata(metadataFixture), + ); + }); + + it('should return Identity', () => { + const identityContractNonce = getIdentityContractNonceResponse.getIdentityContractNonce(); + const proof = getIdentityContractNonceResponse.getProof(); + + expect(identityContractNonce).to.deep.equal(nonce); + expect(proof).to.equal(undefined); + }); + + it('should return proof', () => { + getIdentityContractNonceResponse = new GetIdentityContractNonceResponseClass( + Buffer.alloc(0), + new Metadata(metadataFixture), + new Proof(proofFixture), + ); + + const identityContractNonce = getIdentityContractNonceResponse.getIdentityContractNonce(); + const proof = getIdentityContractNonceResponse.getProof(); + + expect(identityContractNonce).to.deep.equal(Buffer.alloc(0)); + expect(proof).to.be.an.instanceOf(Proof); + expect(proof.getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(proof.getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(proof.getSignature()).to.deep.equal(proofFixture.signature); + expect(proof.getRound()).to.deep.equal(proofFixture.round); + }); + + it('should create an instance from proto', () => { + getIdentityContractNonceResponse = GetIdentityContractNonceResponseClass.createFromProto(proto); + expect(getIdentityContractNonceResponse).to.be + .an.instanceOf(GetIdentityContractNonceResponseClass); + expect(getIdentityContractNonceResponse.getIdentityContractNonce()).to.deep.equal(nonce); + + expect(getIdentityContractNonceResponse.getMetadata()) + .to.be.an.instanceOf(Metadata); + expect(getIdentityContractNonceResponse.getMetadata().getHeight()) + .to.equal(metadataFixture.height); + expect(getIdentityContractNonceResponse.getMetadata().getCoreChainLockedHeight()) + .to.equal(metadataFixture.coreChainLockedHeight); + + expect(getIdentityContractNonceResponse.getProof()).to.equal(undefined); + }); + + it('should create an instance with proof from proto', () => { + const proofProto = new ProofResponse(); + + proofProto.setQuorumHash(proofFixture.quorumHash); + proofProto.setSignature(proofFixture.signature); + proofProto.setGrovedbProof(proofFixture.merkleProof); + proofProto.setRound(proofFixture.round); + + proto.getV0().setIdentityContractNonce(undefined); + proto.getV0().setProof(proofProto); + + getIdentityContractNonceResponse = GetIdentityContractNonceResponseClass.createFromProto(proto); + + expect(getIdentityContractNonceResponse.getIdentityContractNonce()) + .to.deep.equal(0); + expect(getIdentityContractNonceResponse.getMetadata()).to.deep.equal(metadataFixture); + + const proof = getIdentityContractNonceResponse.getProof(); + expect(proof).to.be.an.instanceOf(Proof); + expect(proof.getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(proof.getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(proof.getSignature()).to.deep.equal(proofFixture.signature); + expect(proof.getRound()).to.deep.equal(proofFixture.round); + }); + + it('should throw InvalidResponseError if Metadata is not defined', () => { + proto.getV0().setMetadata(undefined); + + try { + getIdentityContractNonceResponse = GetIdentityContractNonceResponseClass + .createFromProto(proto); + + expect.fail('should throw InvalidResponseError'); + } catch (e) { + expect(e).to.be.an.instanceOf(InvalidResponseError); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentityContractNonce/getIdentityContractNonceFactory.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentityContractNonce/getIdentityContractNonceFactory.spec.js new file mode 100644 index 00000000000..0f5e46045b9 --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentityContractNonce/getIdentityContractNonceFactory.spec.js @@ -0,0 +1,158 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentityContractNonceRequest, + GetIdentityContractNonceResponse, + ResponseMetadata, + Proof: ProofResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const getIdentityContractNonceFactory = require('../../../../../lib/methods/platform/getIdentityContractNonce/getIdentityContractNonceFactory'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); + +describe('getIdentityContractNonceFactory', () => { + let grpcTransportMock; + let getIdentityContractNonce; + let options; + let response; + let nonce; + let identityId; + let contractId; + let metadataFixture; + let proofFixture; + let proofResponse; + + beforeEach(async function beforeEach() { + nonce = 1; + identityId = Buffer.alloc(32).fill(0); + contractId = Buffer.alloc(32).fill(1); + + metadataFixture = getMetadataFixture(); + proofFixture = getProofFixture(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + const { GetIdentityContractNonceResponseV0 } = GetIdentityContractNonceResponse; + response = new GetIdentityContractNonceResponse(); + response.setV0( + new GetIdentityContractNonceResponseV0() + .setIdentityContractNonce(nonce) + .setMetadata(metadata), + ); + + proofResponse = new ProofResponse(); + + proofResponse.setQuorumHash(proofFixture.quorumHash); + proofResponse.setSignature(proofFixture.signature); + proofResponse.setGrovedbProof(proofFixture.merkleProof); + proofResponse.setRound(proofFixture.round); + + grpcTransportMock = { + request: this.sinon.stub().resolves(response), + }; + + getIdentityContractNonce = getIdentityContractNonceFactory(grpcTransportMock); + + options = { + timeout: 1000, + }; + }); + + it('should return identity nonce', async () => { + const result = await getIdentityContractNonce(identityId, contractId, options); + + const { GetIdentityContractNonceRequestV0 } = GetIdentityContractNonceRequest; + const request = new GetIdentityContractNonceRequest(); + request.setV0( + new GetIdentityContractNonceRequestV0() + .setIdentityId(identityId) + .setContractId(contractId) + .setProve(false), + ); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityContractNonce', + request, + options, + ); + expect(result.getIdentityContractNonce()).to.deep.equal(nonce); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getProof()).to.equal(undefined); + }); + + it('should return proof', async () => { + options.prove = true; + response.getV0().setIdentityContractNonce(undefined); + response.getV0().setProof(proofResponse); + + const result = await getIdentityContractNonce(identityId, contractId, options); + + const { GetIdentityContractNonceRequestV0 } = GetIdentityContractNonceRequest; + const request = new GetIdentityContractNonceRequest(); + request.setV0( + new GetIdentityContractNonceRequestV0() + .setIdentityId(identityId) + .setContractId(contractId) + .setProve(true), + ); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityContractNonce', + request, + options, + ); + + expect(result.getIdentityContractNonce()).to.deep.equal(0); + + expect(result.getMetadata()).to.deep.equal(metadataFixture); + + expect(result.getProof()).to.be.an.instanceOf(Proof); + expect(result.getProof().getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(result.getProof().getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(result.getProof().getSignature()).to.deep.equal(proofFixture.signature); + expect(result.getProof().getRound()).to.deep.equal(proofFixture.round); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getMetadata().getHeight()).to.equal(metadataFixture.height); + expect(result.getMetadata().getCoreChainLockedHeight()).to.equal( + metadataFixture.coreChainLockedHeight, + ); + }); + + it('should throw unknown error', async () => { + const error = new Error('Unknown found'); + + grpcTransportMock.request.throws(error); + + const { GetIdentityContractNonceRequestV0 } = GetIdentityContractNonceRequest; + const request = new GetIdentityContractNonceRequest(); + request.setV0( + new GetIdentityContractNonceRequestV0() + .setIdentityId(identityId) + .setContractId(contractId) + .setProve(false), + ); + + try { + await getIdentityContractNonce(identityId, contractId, options); + + expect.fail('should throw unknown error'); + } catch (e) { + expect(e).to.deep.equal(error); + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityContractNonce', + request, + options, + ); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentityKeys/GetIdentityKeys.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentityKeys/GetIdentityKeys.spec.js new file mode 100644 index 00000000000..e9d13836c2e --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentityKeys/GetIdentityKeys.spec.js @@ -0,0 +1,130 @@ +const { + v0: { + GetIdentityKeysResponse, + ResponseMetadata, + Proof: ProofResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const GetIdentityKeysResponseClass = require('../../../../../lib/methods/platform/getIdentityKeys/GetIdentityKeysResponse'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const InvalidResponseError = require('../../../../../lib/methods/platform/response/errors/InvalidResponseError'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); +const Metadata = require('../../../../../lib/methods/platform/response/Metadata'); + +describe('GetIdentityKeysResponse', () => { + let getIdentityKeysResponse; + let metadataFixture; + let keys; + let proto; + let proofFixture; + + beforeEach(async () => { + metadataFixture = getMetadataFixture(); + keys = [Buffer.alloc(41).fill(1), Buffer.alloc(48).fill(2), Buffer.alloc(55).fill(3)]; + proofFixture = getProofFixture(); + + const { GetIdentityKeysResponseV0 } = GetIdentityKeysResponse; + proto = new GetIdentityKeysResponse(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + const { Keys } = GetIdentityKeysResponseV0; + + proto.setV0( + new GetIdentityKeysResponseV0() + .setKeys(new Keys().setKeysBytesList(keys)) + .setMetadata(metadata), + ); + + getIdentityKeysResponse = new GetIdentityKeysResponseClass( + keys, + new Metadata(metadataFixture), + ); + }); + + it('should return Identity Keys', () => { + const identityKeys = getIdentityKeysResponse.getIdentityKeys(); + const proof = getIdentityKeysResponse.getProof(); + + expect(identityKeys).to.deep.equal(keys); + expect(proof).to.equal(undefined); + }); + + it('should return proof', () => { + getIdentityKeysResponse = new GetIdentityKeysResponseClass( + Buffer.alloc(0), + new Metadata(metadataFixture), + new Proof(proofFixture), + ); + + const identityKeys = getIdentityKeysResponse.getIdentityKeys(); + const proof = getIdentityKeysResponse.getProof(); + + expect(identityKeys).to.deep.equal(Buffer.alloc(0)); + expect(proof).to.be.an.instanceOf(Proof); + expect(proof.getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(proof.getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(proof.getSignature()).to.deep.equal(proofFixture.signature); + expect(proof.getRound()).to.deep.equal(proofFixture.round); + }); + + it('should create an instance from proto', () => { + getIdentityKeysResponse = GetIdentityKeysResponseClass.createFromProto(proto); + expect(getIdentityKeysResponse).to.be + .an.instanceOf(GetIdentityKeysResponseClass); + expect(getIdentityKeysResponse.getIdentityKeys()).to.deep.equal(keys); + + expect(getIdentityKeysResponse.getMetadata()) + .to.be.an.instanceOf(Metadata); + expect(getIdentityKeysResponse.getMetadata().getHeight()) + .to.equal(metadataFixture.height); + expect(getIdentityKeysResponse.getMetadata().getCoreChainLockedHeight()) + .to.equal(metadataFixture.coreChainLockedHeight); + + expect(getIdentityKeysResponse.getProof()).to.equal(undefined); + }); + + it('should create an instance with proof from proto', () => { + const proofProto = new ProofResponse(); + + proofProto.setQuorumHash(proofFixture.quorumHash); + proofProto.setSignature(proofFixture.signature); + proofProto.setGrovedbProof(proofFixture.merkleProof); + proofProto.setRound(proofFixture.round); + + proto.getV0().setKeys(undefined); + proto.getV0().setProof(proofProto); + + getIdentityKeysResponse = GetIdentityKeysResponseClass.createFromProto(proto); + + expect(getIdentityKeysResponse.getIdentityKeys()) + .to.deep.equal([]); + expect(getIdentityKeysResponse.getMetadata()).to.deep.equal(metadataFixture); + + const proof = getIdentityKeysResponse.getProof(); + expect(proof).to.be.an.instanceOf(Proof); + expect(proof.getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(proof.getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(proof.getSignature()).to.deep.equal(proofFixture.signature); + expect(proof.getRound()).to.deep.equal(proofFixture.round); + }); + + it('should throw InvalidResponseError if Metadata is not defined', () => { + proto.getV0().setMetadata(undefined); + + try { + getIdentityKeysResponse = GetIdentityKeysResponseClass + .createFromProto(proto); + + expect.fail('should throw InvalidResponseError'); + } catch (e) { + expect(e).to.be.an.instanceOf(InvalidResponseError); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentityKeys/getIdentityKeysFactory.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentityKeys/getIdentityKeysFactory.spec.js new file mode 100644 index 00000000000..b1368ee41b9 --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentityKeys/getIdentityKeysFactory.spec.js @@ -0,0 +1,173 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentityKeysRequest, + GetIdentityKeysResponse, + ResponseMetadata, + Proof: ProofResponse, + KeyRequestType, + SpecificKeys, + }, +} = require('@dashevo/dapi-grpc'); +const { UInt32Value } = require('google-protobuf/google/protobuf/wrappers_pb'); + +const { GetIdentityKeysResponseV0 } = GetIdentityKeysResponse; +const { Keys } = GetIdentityKeysResponseV0; + +const getIdentityKeysFactory = require('../../../../../lib/methods/platform/getIdentityKeys/getIdentityKeysFactory'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); + +describe('getIdentityKeysFactory', () => { + let grpcTransportMock; + let getIdentityKeys; + let options; + let response; + let keys; + let identityId; + let keyIds; + let limit; + let metadataFixture; + let proofFixture; + let proofResponse; + + beforeEach(async function beforeEach() { + keys = [Buffer.alloc(41), Buffer.alloc(46)]; + keyIds = [0, 1]; + limit = 100; + + identityId = Buffer.alloc(32).fill(0); + + metadataFixture = getMetadataFixture(); + proofFixture = getProofFixture(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + response = new GetIdentityKeysResponse(); + + response.setV0( + new GetIdentityKeysResponseV0() + .setKeys(new Keys().setKeysBytesList(keys)) + .setMetadata(metadata), + ); + + proofResponse = new ProofResponse(); + + proofResponse.setQuorumHash(proofFixture.quorumHash); + proofResponse.setSignature(proofFixture.signature); + proofResponse.setGrovedbProof(proofFixture.merkleProof); + proofResponse.setRound(proofFixture.round); + + grpcTransportMock = { + request: this.sinon.stub().resolves(response), + }; + + getIdentityKeys = getIdentityKeysFactory(grpcTransportMock); + + options = { + timeout: 1000, + }; + }); + + it('should return identity keys', async () => { + const result = await getIdentityKeys(identityId, keyIds, limit, options); + + const { GetIdentityKeysRequestV0 } = GetIdentityKeysRequest; + const request = new GetIdentityKeysRequest(); + request.setV0( + new GetIdentityKeysRequestV0() + .setIdentityId(identityId) + .setRequestType(new KeyRequestType().setSpecificKeys(new SpecificKeys() + .setKeyIdsList(keyIds))) + .setLimit(new UInt32Value([limit])) + .setProve(false), + ); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityKeys', + request, + options, + ); + expect(result.getIdentityKeys()).to.deep.equal(keys); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getProof()).to.equal(undefined); + }); + + it('should return proof', async () => { + options.prove = true; + response.getV0().setKeys(undefined); + response.getV0().setProof(proofResponse); + + const result = await getIdentityKeys(identityId, keyIds, limit, options); + + const { GetIdentityKeysRequestV0 } = GetIdentityKeysRequest; + const request = new GetIdentityKeysRequest(); + request.setV0( + new GetIdentityKeysRequestV0() + .setIdentityId(identityId) + .setRequestType(new KeyRequestType().setSpecificKeys(new SpecificKeys() + .setKeyIdsList(keyIds))) + .setLimit(new UInt32Value([limit])) + .setProve(true), + ); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityKeys', + request, + options, + ); + + expect(result.getIdentityKeys()).to.deep.equal([]); + + expect(result.getMetadata()).to.deep.equal(metadataFixture); + + expect(result.getProof()).to.be.an.instanceOf(Proof); + expect(result.getProof().getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(result.getProof().getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(result.getProof().getSignature()).to.deep.equal(proofFixture.signature); + expect(result.getProof().getRound()).to.deep.equal(proofFixture.round); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getMetadata().getHeight()).to.equal(metadataFixture.height); + expect(result.getMetadata().getCoreChainLockedHeight()).to.equal( + metadataFixture.coreChainLockedHeight, + ); + }); + + it('should throw unknown error', async () => { + const error = new Error('Unknown found'); + + grpcTransportMock.request.throws(error); + + const { GetIdentityKeysRequestV0 } = GetIdentityKeysRequest; + const request = new GetIdentityKeysRequest(); + request.setV0( + new GetIdentityKeysRequestV0() + .setIdentityId(identityId) + .setRequestType(new KeyRequestType().setSpecificKeys(new SpecificKeys() + .setKeyIdsList(keyIds))) + .setLimit(new UInt32Value([100])) + .setProve(false), + ); + + try { + await getIdentityKeys(identityId, keyIds, limit, options); + + expect.fail('should throw unknown error'); + } catch (e) { + expect(e).to.deep.equal(error); + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityKeys', + request, + options, + ); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentityNonce/GetIdentityNonce.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentityNonce/GetIdentityNonce.spec.js new file mode 100644 index 00000000000..6a0d7ca6f6c --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentityNonce/GetIdentityNonce.spec.js @@ -0,0 +1,129 @@ +const { + v0: { + GetIdentityNonceResponse, + ResponseMetadata, + Proof: ProofResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const GetIdentityNonceResponseClass = require('../../../../../lib/methods/platform/getIdentityNonce/GetIdentityNonceResponse'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const InvalidResponseError = require('../../../../../lib/methods/platform/response/errors/InvalidResponseError'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); +const Metadata = require('../../../../../lib/methods/platform/response/Metadata'); + +describe('GetIdentityNonceResponse', () => { + let getIdentityNonceResponse; + let metadataFixture; + let nonce; + let proto; + let proofFixture; + + beforeEach(async () => { + metadataFixture = getMetadataFixture(); + nonce = 1; + proofFixture = getProofFixture(); + + const { GetIdentityNonceResponseV0 } = GetIdentityNonceResponse; + proto = new GetIdentityNonceResponse(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + proto.setV0( + new GetIdentityNonceResponseV0() + .setIdentityNonce(nonce) + .setMetadata(metadata), + + ); + + getIdentityNonceResponse = new GetIdentityNonceResponseClass( + nonce, + new Metadata(metadataFixture), + ); + }); + + it('should return Identity', () => { + const IdentityNonce = getIdentityNonceResponse.getIdentityNonce(); + const proof = getIdentityNonceResponse.getProof(); + + expect(IdentityNonce).to.deep.equal(nonce); + expect(proof).to.equal(undefined); + }); + + it('should return proof', () => { + getIdentityNonceResponse = new GetIdentityNonceResponseClass( + Buffer.alloc(0), + new Metadata(metadataFixture), + new Proof(proofFixture), + ); + + const IdentityNonce = getIdentityNonceResponse.getIdentityNonce(); + const proof = getIdentityNonceResponse.getProof(); + + expect(IdentityNonce).to.deep.equal(Buffer.alloc(0)); + expect(proof).to.be.an.instanceOf(Proof); + expect(proof.getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(proof.getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(proof.getSignature()).to.deep.equal(proofFixture.signature); + expect(proof.getRound()).to.deep.equal(proofFixture.round); + }); + + it('should create an instance from proto', () => { + getIdentityNonceResponse = GetIdentityNonceResponseClass.createFromProto(proto); + expect(getIdentityNonceResponse).to.be + .an.instanceOf(GetIdentityNonceResponseClass); + expect(getIdentityNonceResponse.getIdentityNonce()).to.deep.equal(nonce); + + expect(getIdentityNonceResponse.getMetadata()) + .to.be.an.instanceOf(Metadata); + expect(getIdentityNonceResponse.getMetadata().getHeight()) + .to.equal(metadataFixture.height); + expect(getIdentityNonceResponse.getMetadata().getCoreChainLockedHeight()) + .to.equal(metadataFixture.coreChainLockedHeight); + + expect(getIdentityNonceResponse.getProof()).to.equal(undefined); + }); + + it('should create an instance with proof from proto', () => { + const proofProto = new ProofResponse(); + + proofProto.setQuorumHash(proofFixture.quorumHash); + proofProto.setSignature(proofFixture.signature); + proofProto.setGrovedbProof(proofFixture.merkleProof); + proofProto.setRound(proofFixture.round); + + proto.getV0().setIdentityNonce(undefined); + proto.getV0().setProof(proofProto); + + getIdentityNonceResponse = GetIdentityNonceResponseClass.createFromProto(proto); + + expect(getIdentityNonceResponse.getIdentityNonce()) + .to.deep.equal(0); + expect(getIdentityNonceResponse.getMetadata()).to.deep.equal(metadataFixture); + + const proof = getIdentityNonceResponse.getProof(); + expect(proof).to.be.an.instanceOf(Proof); + expect(proof.getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(proof.getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(proof.getSignature()).to.deep.equal(proofFixture.signature); + expect(proof.getRound()).to.deep.equal(proofFixture.round); + }); + + it('should throw InvalidResponseError if Metadata is not defined', () => { + proto.getV0().setMetadata(undefined); + + try { + getIdentityNonceResponse = GetIdentityNonceResponseClass + .createFromProto(proto); + + expect.fail('should throw InvalidResponseError'); + } catch (e) { + expect(e).to.be.an.instanceOf(InvalidResponseError); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/methods/platform/getIdentityNonce/getIdentityNonceFactory.spec.js b/packages/js-dapi-client/test/unit/methods/platform/getIdentityNonce/getIdentityNonceFactory.spec.js new file mode 100644 index 00000000000..b0f0b9fc222 --- /dev/null +++ b/packages/js-dapi-client/test/unit/methods/platform/getIdentityNonce/getIdentityNonceFactory.spec.js @@ -0,0 +1,153 @@ +const { + v0: { + PlatformPromiseClient, + GetIdentityNonceRequest, + GetIdentityNonceResponse, + ResponseMetadata, + Proof: ProofResponse, + }, +} = require('@dashevo/dapi-grpc'); + +const getIdentityNonceFactory = require('../../../../../lib/methods/platform/getIdentityNonce/getIdentityNonceFactory'); +const getMetadataFixture = require('../../../../../lib/test/fixtures/getMetadataFixture'); +const getProofFixture = require('../../../../../lib/test/fixtures/getProofFixture'); +const Proof = require('../../../../../lib/methods/platform/response/Proof'); + +describe('getIdentityNonceFactory', () => { + let grpcTransportMock; + let getIdentityNonce; + let options; + let response; + let nonce; + let identityId; + let metadataFixture; + let proofFixture; + let proofResponse; + + beforeEach(async function beforeEach() { + nonce = 1; + identityId = Buffer.alloc(32).fill(0); + + metadataFixture = getMetadataFixture(); + proofFixture = getProofFixture(); + + const metadata = new ResponseMetadata(); + metadata.setHeight(metadataFixture.height); + metadata.setCoreChainLockedHeight(metadataFixture.coreChainLockedHeight); + metadata.setTimeMs(metadataFixture.timeMs); + metadata.setProtocolVersion(metadataFixture.protocolVersion); + + const { GetIdentityNonceResponseV0 } = GetIdentityNonceResponse; + response = new GetIdentityNonceResponse(); + response.setV0( + new GetIdentityNonceResponseV0() + .setIdentityNonce(nonce) + .setMetadata(metadata), + ); + + proofResponse = new ProofResponse(); + + proofResponse.setQuorumHash(proofFixture.quorumHash); + proofResponse.setSignature(proofFixture.signature); + proofResponse.setGrovedbProof(proofFixture.merkleProof); + proofResponse.setRound(proofFixture.round); + + grpcTransportMock = { + request: this.sinon.stub().resolves(response), + }; + + getIdentityNonce = getIdentityNonceFactory(grpcTransportMock); + + options = { + timeout: 1000, + }; + }); + + it('should return identity nonce', async () => { + const result = await getIdentityNonce(identityId, options); + + const { GetIdentityNonceRequestV0 } = GetIdentityNonceRequest; + const request = new GetIdentityNonceRequest(); + request.setV0( + new GetIdentityNonceRequestV0() + .setIdentityId(identityId) + .setProve(false), + ); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityNonce', + request, + options, + ); + expect(result.getIdentityNonce()).to.deep.equal(nonce); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getProof()).to.equal(undefined); + }); + + it('should return proof', async () => { + options.prove = true; + response.getV0().setIdentityNonce(undefined); + response.getV0().setProof(proofResponse); + + const result = await getIdentityNonce(identityId, options); + + const { GetIdentityNonceRequestV0 } = GetIdentityNonceRequest; + const request = new GetIdentityNonceRequest(); + request.setV0( + new GetIdentityNonceRequestV0() + .setIdentityId(identityId) + .setProve(true), + ); + + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityNonce', + request, + options, + ); + + expect(result.getIdentityNonce()).to.deep.equal(0); + + expect(result.getMetadata()).to.deep.equal(metadataFixture); + + expect(result.getProof()).to.be.an.instanceOf(Proof); + expect(result.getProof().getGrovedbProof()).to.deep.equal(proofFixture.merkleProof); + expect(result.getProof().getQuorumHash()).to.deep.equal(proofFixture.quorumHash); + expect(result.getProof().getSignature()).to.deep.equal(proofFixture.signature); + expect(result.getProof().getRound()).to.deep.equal(proofFixture.round); + expect(result.getMetadata()).to.deep.equal(metadataFixture); + expect(result.getMetadata().getHeight()).to.equal(metadataFixture.height); + expect(result.getMetadata().getCoreChainLockedHeight()).to.equal( + metadataFixture.coreChainLockedHeight, + ); + }); + + it('should throw unknown error', async () => { + const error = new Error('Unknown found'); + + grpcTransportMock.request.throws(error); + + const { GetIdentityNonceRequestV0 } = GetIdentityNonceRequest; + const request = new GetIdentityNonceRequest(); + request.setV0( + new GetIdentityNonceRequestV0() + .setIdentityId(identityId) + .setProve(false), + ); + + try { + await getIdentityNonce(identityId, options); + + expect.fail('should throw unknown error'); + } catch (e) { + expect(e).to.deep.equal(error); + expect(grpcTransportMock.request).to.be.calledOnceWithExactly( + PlatformPromiseClient, + 'getIdentityNonce', + request, + options, + ); + } + }); +}); diff --git a/packages/js-dapi-client/test/unit/transport/GrpcTransport/createGrpcTransportError.spec.js b/packages/js-dapi-client/test/unit/transport/GrpcTransport/createGrpcTransportError.spec.js index 7cab061aa32..13205f6e0c2 100644 --- a/packages/js-dapi-client/test/unit/transport/GrpcTransport/createGrpcTransportError.spec.js +++ b/packages/js-dapi-client/test/unit/transport/GrpcTransport/createGrpcTransportError.spec.js @@ -168,7 +168,7 @@ describe('createGrpcTransportError', () => { metadata.set('drive-error-data-bin', driveErrorDataBin); const grpcError = new GrpcError( - 1000, + 10001, 'Parsing error', ); grpcError.metadata = metadata; diff --git a/packages/js-dapi-client/test/unit/transport/ReconnectableStream.spec.js b/packages/js-dapi-client/test/unit/transport/ReconnectableStream.spec.js index b7f7769662c..c946312a074 100644 --- a/packages/js-dapi-client/test/unit/transport/ReconnectableStream.spec.js +++ b/packages/js-dapi-client/test/unit/transport/ReconnectableStream.spec.js @@ -3,6 +3,7 @@ const { expect } = require('chai'); const ReconnectableStream = require('../../../lib/transport/ReconnectableStream'); const wait = require('../../../lib/utils/wait'); +const logger = require('../../../lib/logger'); describe('ReconnectableStream', () => { let reconnectableStream; @@ -14,20 +15,23 @@ describe('ReconnectableStream', () => { beforeEach(function () { stream = new EventEmitter(); - stream.cancel = this.sinon.stub().callsFake(() => { - stream.emit('error', { - message: 'CANCELED_ON_CLIENT', - code: 1, + stream.cancel = this.sinon.stub() + .callsFake(() => { + stream.emit('error', { + message: 'CANCELED_ON_CLIENT', + code: 1, + }); }); - }); this.sinon.spy(stream, 'on'); this.sinon.spy(stream, 'removeListener'); - const createStream = this.sinon.stub().returns(stream); + const createStream = this.sinon.stub() + .returns(stream); reconnectableStream = new ReconnectableStream(createStream, { maxRetriesOnError, retryOnErrorDelay, + logger, }); this.sinon.spy(reconnectableStream, 'addListeners'); @@ -39,43 +43,68 @@ describe('ReconnectableStream', () => { this.sinon.spy(reconnectableStream, 'stopAutoReconnect'); this.sinon.spy(reconnectableStream, 'retryOnError'); this.sinon.stub(reconnectableStream, 'clearTimeout'); - this.sinon.stub(reconnectableStream, 'setTimeout').callsFake((callback) => { - setTimeoutCallback = callback; - return setTimeoutReference; - }); + this.sinon.stub(reconnectableStream, 'setTimeout') + .callsFake((callback) => { + setTimeoutCallback = callback; + return setTimeoutReference; + }); }); describe('#connect', () => { it('should connect and create timeout', async () => { const args = [1, 2, 3]; await reconnectableStream.connect(...args); - expect(reconnectableStream.args).to.deep.equal(args); - expect(reconnectableStream.stream).to.equal(stream); - expect(reconnectableStream.addListeners).to.have.been.calledOnce(); - expect(reconnectableStream.startAutoReconnect).to.have.been.calledOnce(); + expect(reconnectableStream.args) + .to + .deep + .equal(args); + expect(reconnectableStream.stream) + .to + .equal(stream); + expect(reconnectableStream.addListeners) + .to + .have + .been + .calledOnce(); + expect(reconnectableStream.startAutoReconnect) + .to + .have + .been + .calledOnce(); }); it('should not initiate auto reconnect if autoReconnectInterval is not set', async () => { reconnectableStream.autoReconnectInterval = 0; await reconnectableStream.connect(); - expect(reconnectableStream.startAutoReconnect).to.have.not.been.called(); + expect(reconnectableStream.startAutoReconnect) + .to + .have + .not + .been + .called(); }); }); describe('#startAutoReconnect', () => { it('should trigger reconnect after timeout', async () => { reconnectableStream.stream = stream; - reconnectableStream.stream.on('error', () => {}); + reconnectableStream.stream.on('error', () => { + }); reconnectableStream.startAutoReconnect(); setTimeoutCallback(); - expect(reconnectableStream.reconnect).to.have.been.calledOnce(); + expect(reconnectableStream.reconnect) + .to + .have + .been + .calledOnce(); }); it('should not allow starting auto reconnect twice', () => { reconnectableStream.startAutoReconnect(); expect(reconnectableStream.startAutoReconnect.bind(reconnectableStream)) - .to.throw('Auto reconnect timeout is already running.'); + .to + .throw('Auto reconnect timeout is already running.'); }); }); @@ -83,26 +112,36 @@ describe('ReconnectableStream', () => { it('should update connect arguments', async () => { reconnectableStream.reconnectTimeout = 1; reconnectableStream.stream = stream; - reconnectableStream.stream.on('error', () => {}); + reconnectableStream.stream.on('error', () => { + }); reconnectableStream.on(ReconnectableStream.EVENTS.BEFORE_RECONNECT, (updateArgs) => { updateArgs('newArg1', 'newArg2'); }); reconnectableStream.reconnect(); - expect(reconnectableStream.connect).to.have.been.calledWith('newArg1', 'newArg2'); + expect(reconnectableStream.connect) + .to + .have + .been + .calledWith('newArg1', 'newArg2'); }); it('should reconnect only if reconnectTimeout exists', () => { reconnectableStream.reconnect(); expect(stream.cancel) - .to.have.not.been.called(); + .to + .have + .not + .been + .called(); }); it('should handle error on reconnect', async () => { reconnectableStream.reconnectTimeout = 1; reconnectableStream.stream = stream; - reconnectableStream.stream.on('error', () => {}); + reconnectableStream.stream.on('error', () => { + }); const errorEventPromise = new Promise((resolve) => { reconnectableStream.on('error', resolve); @@ -112,7 +151,9 @@ describe('ReconnectableStream', () => { reconnectableStream.createStream.throws(err); reconnectableStream.reconnect(); const emittedError = await errorEventPromise; - expect(emittedError).to.equal(err); + expect(emittedError) + .to + .equal(err); }); }); @@ -121,9 +162,21 @@ describe('ReconnectableStream', () => { reconnectableStream.stream = new EventEmitter(); this.sinon.spy(reconnectableStream.stream, 'on'); reconnectableStream.addListeners(); - expect(reconnectableStream.stream.on).to.have.been.calledWith('error'); - expect(reconnectableStream.stream.on).to.have.been.calledWith('data'); - expect(reconnectableStream.stream.on).to.have.been.calledWith('end'); + expect(reconnectableStream.stream.on) + .to + .have + .been + .calledWith('error'); + expect(reconnectableStream.stream.on) + .to + .have + .been + .calledWith('data'); + expect(reconnectableStream.stream.on) + .to + .have + .been + .calledWith('end'); }); it('should rewire cancel logic', function () { @@ -133,9 +186,15 @@ describe('ReconnectableStream', () => { reconnectableStream.addListeners(); reconnectableStream.stream.cancel(); expect(reconnectableStream.stream.removeListener) - .to.have.been.calledWith('data', reconnectableStream.dataHandler); + .to + .have + .been + .calledWith('data', reconnectableStream.dataHandler); expect(reconnectableStream.stream.removeListener) - .to.have.been.calledWith('end', reconnectableStream.endHandler); + .to + .have + .been + .calledWith('end', reconnectableStream.endHandler); }); }); @@ -145,14 +204,23 @@ describe('ReconnectableStream', () => { message: 'CANCELED_ON_CLIENT', code: 1, }); - expect(reconnectableStream.retryOnError).to.have.not.been.called(); + expect(reconnectableStream.retryOnError) + .to + .have + .not + .been + .called(); }); it('should retry on error', function () { reconnectableStream.stream = stream; reconnectableStream.retryOnError = this.sinon.spy(); reconnectableStream.errorHandler(new Error('Retry on error')); - expect(reconnectableStream.retryOnError).to.have.been.calledOnce(); + expect(reconnectableStream.retryOnError) + .to + .have + .been + .calledOnce(); reconnectableStream.stopAutoReconnect(); }); }); @@ -161,15 +229,27 @@ describe('ReconnectableStream', () => { it('should stop reconnect timeout', async () => { reconnectableStream.reconnectTimeout = setTimeoutReference; reconnectableStream.stopAutoReconnect(); - expect(reconnectableStream.clearTimeout).to.have.been + expect(reconnectableStream.clearTimeout) + .to + .have + .been .calledOnceWith(setTimeoutReference); - expect(reconnectableStream.reconnectTimeout).to.equal(null); + expect(reconnectableStream.reconnectTimeout) + .to + .equal(null); }); it('should do nothing in case reconnect timeout is not set', async () => { reconnectableStream.stopAutoReconnect(); - expect(reconnectableStream.clearTimeout).to.have.not.been.called(); - expect(reconnectableStream.reconnectTimeout).to.equal(null); + expect(reconnectableStream.clearTimeout) + .to + .have + .not + .been + .called(); + expect(reconnectableStream.reconnectTimeout) + .to + .equal(null); }); }); @@ -178,17 +258,36 @@ describe('ReconnectableStream', () => { reconnectableStream.stream = new EventEmitter(); reconnectableStream.stream.cancel = this.sinon.stub(); reconnectableStream.cancel(); - expect(reconnectableStream.stopAutoReconnect).to.have.been.calledOnce(); - expect(reconnectableStream.stream.cancel).to.have.been.calledOnce(); + expect(reconnectableStream.stopAutoReconnect) + .to + .have + .been + .calledOnce(); + expect(reconnectableStream.stream.cancel) + .to + .have + .been + .calledOnce(); }); }); describe('#endHandler', () => { it('should handle end event', async () => { + reconnectableStream.stream = {}; reconnectableStream.endHandler(); - expect(reconnectableStream.stopAutoReconnect).to.have.been.called(); - expect(reconnectableStream.emit).to.have.been.calledWith(ReconnectableStream.EVENTS.END); - expect(reconnectableStream.stream).to.equal(null); + expect(reconnectableStream.stopAutoReconnect) + .to + .have + .been + .called(); + expect(reconnectableStream.emit) + .to + .have + .been + .calledWith(ReconnectableStream.EVENTS.END); + expect(reconnectableStream.stream) + .to + .equal(null); }); }); @@ -199,10 +298,26 @@ describe('ReconnectableStream', () => { await wait(10); - expect(reconnectableStream.stopAutoReconnect).to.have.been.calledOnce(); - expect(reconnectableStream.stream.removeListener).to.have.been.calledWith('end'); - expect(reconnectableStream.stream.removeListener).to.have.been.calledWith('data'); - expect(reconnectableStream.connect).to.have.been.calledOnce(); + expect(reconnectableStream.stopAutoReconnect) + .to + .have + .been + .calledOnce(); + expect(reconnectableStream.stream.removeListener) + .to + .have + .been + .calledWith('end'); + expect(reconnectableStream.stream.removeListener) + .to + .have + .been + .calledWith('data'); + expect(reconnectableStream.connect) + .to + .have + .been + .calledOnce(); }); it('should manage args via beforeReconnect', async () => { @@ -217,10 +332,26 @@ describe('ReconnectableStream', () => { await wait(10); - expect(reconnectableStream.stopAutoReconnect).to.have.been.calledOnce(); - expect(reconnectableStream.stream.removeListener).to.have.been.calledWith('end'); - expect(reconnectableStream.stream.removeListener).to.have.been.calledWith('data'); - expect(reconnectableStream.connect).to.have.been.calledOnceWith(newArgs); + expect(reconnectableStream.stopAutoReconnect) + .to + .have + .been + .calledOnce(); + expect(reconnectableStream.stream.removeListener) + .to + .have + .been + .calledWith('end'); + expect(reconnectableStream.stream.removeListener) + .to + .have + .been + .calledWith('data'); + expect(reconnectableStream.connect) + .to + .have + .been + .calledOnceWith(newArgs); }); it('should handle error in case retry attempts were exhausted', async () => { @@ -242,7 +373,9 @@ describe('ReconnectableStream', () => { const error = new Error('Last error'); reconnectableStream.retryOnError(error); - expect(lastError).to.equal(error); + expect(lastError) + .to + .equal(error); }); it('should handle retry error', async () => { @@ -261,11 +394,19 @@ describe('ReconnectableStream', () => { // Wait for await wait(10); - expect(reconnectableStream.stopAutoReconnect).to.have.been.calledOnce(); - expect(reconnectableStream.emit).to.have.been.calledWith( - 'error', - retryError, - ); + expect(reconnectableStream.stopAutoReconnect) + .to + .have + .been + .calledOnce(); + expect(reconnectableStream.emit) + .to + .have + .been + .calledWith( + 'error', + retryError, + ); }); }); }); diff --git a/packages/js-dash-sdk/package.json b/packages/js-dash-sdk/package.json index 6c2380476c0..662bc45dd04 100644 --- a/packages/js-dash-sdk/package.json +++ b/packages/js-dash-sdk/package.json @@ -1,6 +1,6 @@ { "name": "dash", - "version": "3.25.21", + "version": "4.0.0-dev.15", "description": "Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)", "main": "build/index.js", "unpkg": "dist/dash.min.js", @@ -41,13 +41,14 @@ "@dashevo/bls": "~1.2.9", "@dashevo/dapi-client": "workspace:*", "@dashevo/dapi-grpc": "workspace:*", - "@dashevo/dashcore-lib": "~0.21.0", + "@dashevo/dashcore-lib": "~0.21.1", "@dashevo/dashpay-contract": "workspace:*", "@dashevo/dpns-contract": "workspace:*", "@dashevo/grpc-common": "workspace:*", "@dashevo/masternode-reward-shares-contract": "workspace:*", "@dashevo/wallet-lib": "workspace:*", "@dashevo/wasm-dpp": "workspace:*", + "@dashevo/withdrawals-contract": "workspace:*", "bs58": "^4.0.1", "node-inspect-extracted": "^1.0.8", "winston": "^3.2.1" diff --git a/packages/js-dash-sdk/src/SDK/Client/Client.spec.ts b/packages/js-dash-sdk/src/SDK/Client/Client.spec.ts index d677d7d6323..b44f7cd02fd 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Client.spec.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Client.spec.ts @@ -181,9 +181,9 @@ describe('Dash - Client', function suite() { describe('#platform.identities.topUp', async () => { it('should top up an identity', async () => { // Registering an identity we're going to top up - const identity = await client.platform.identities.register(1000); + const identity = await client.platform.identities.register(200000); // Topping up the identity - await client.platform.identities.topUp(identity.getId(), 1000); + await client.platform.identities.topUp(identity.getId(), 60000); expect(identity).to.be.not.null; @@ -206,7 +206,7 @@ describe('Dash - Client', function suite() { it('should throw TransitionBroadcastError when transport resolves error', async () => { // Registering an identity we're going to top up - const identity = await client.platform.identities.register(10000); + const identity = await client.platform.identities.register(200000); const errorResponse = { error: { @@ -234,7 +234,7 @@ describe('Dash - Client', function suite() { describe('#platform.identities.update', async () => { it('should update an identity', async () => { - const identity = await client.platform.identities.register(1000); + const identity = await client.platform.identities.register(200000); const privateKey = new PrivateKey(privateKeyFixture); @@ -271,7 +271,7 @@ describe('Dash - Client', function suite() { it('should throw TransitionBroadcastError when transport resolves error', async () => { // Registering an identity we're going to top up - const identity = await client.platform.identities.register(10000); + const identity = await client.platform.identities.register(200000); const errorResponse = { error: { @@ -389,7 +389,8 @@ describe('Dash - Client', function suite() { expect(await interceptedSt.verifySignature( identityFixture.getPublicKeyById(2), )).to.be.equal(true); - expect(interceptedSt.getEntropy()).to.be.deep.equal(dataContractFixture.getEntropy()); + expect(interceptedSt.getIdentityNonce()).to.be + .deep.equal(dataContractFixture.getIdentityNonce()); expect(interceptedSt.getDataContract().toObject()) .to.be.deep.equal(dataContractFixture.toObject()); }); diff --git a/packages/js-dash-sdk/src/SDK/Client/Client.ts b/packages/js-dash-sdk/src/SDK/Client/Client.ts index c5ed17cec57..7f185677ea5 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Client.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Client.ts @@ -6,6 +6,7 @@ import DAPIClient from '@dashevo/dapi-client'; import { contractId as dpnsContractId } from '@dashevo/dpns-contract/lib/systemIds'; import { contractId as dashpayContractId } from '@dashevo/dashpay-contract/lib/systemIds'; import { contractId as masternodeRewardSharesContractId } from '@dashevo/masternode-reward-shares-contract/lib/systemIds'; +import { contractId as withdrawalsContractId } from '@dashevo/withdrawals-contract/lib/systemIds'; import { Platform } from './Platform'; import { ClientApps, ClientAppsOptions } from './ClientApps'; @@ -138,6 +139,9 @@ export class Client extends EventEmitter { masternodeRewardShares: { contractId: masternodeRewardSharesContractId, }, + withdrawals: { + contractId: withdrawalsContractId, + }, ...this.options.apps, }); @@ -161,6 +165,7 @@ export class Client extends EventEmitter { options = { index: this.defaultAccountIndex, + synchronize: true, ...options, }; @@ -175,6 +180,8 @@ export class Client extends EventEmitter { if (this.wallet) { await this.wallet.disconnect(); } + + await this.dapiClient.disconnect(); } /** diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/Fetcher/withRetry.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/Fetcher/withRetry.ts index b13472a06db..031601620ed 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/Fetcher/withRetry.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/Fetcher/withRetry.ts @@ -1,4 +1,4 @@ -import fibonacci from '../../../../utils/fibonacci'; +import { fibonacci } from '../../../../utils/fibonacci'; import { wait } from '../../../../utils/wait'; /** diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/IStateTransitionResult.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/IStateTransitionResult.ts index ce464f641f4..2b679814453 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/IStateTransitionResult.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/IStateTransitionResult.ts @@ -1,6 +1,8 @@ +import { Metadata } from '@dashevo/dapi-client/lib/methods/platform/response/Metadata'; import { IPlatformStateProof } from './IPlatformStateProof'; export interface IStateTransitionResult { + metadata: Metadata, proof?: IPlatformStateProof, error?: { code: number, diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/NonceManager/NonceManager.spec.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/NonceManager/NonceManager.spec.ts new file mode 100644 index 00000000000..018150fd933 --- /dev/null +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/NonceManager/NonceManager.spec.ts @@ -0,0 +1,97 @@ +import { Identifier } from '@dashevo/wasm-dpp'; +import { expect } from 'chai'; +import NonceManager, { NONCE_FETCH_INTERVAL } from './NonceManager'; + +describe('Dash - NonceManager', () => { + let nonceManager: NonceManager; + let dapiClientMock; + const identityId = new Identifier(Buffer.alloc(32).fill(1)); + const contractId = new Identifier(Buffer.alloc(32).fill(2)); + + beforeEach(function beforeEach() { + dapiClientMock = { + platform: { + getIdentityContractNonce: this.sinon.stub(), + getIdentityNonce: this.sinon.stub(), + }, + }; + + nonceManager = new NonceManager(dapiClientMock); + }); + + describe('Identity nonce', () => { + it('should set and get identity nonce', async () => { + nonceManager.setIdentityNonce(identityId, 1); + expect(await nonceManager.getIdentityNonce(identityId)).to.be.equal(1); + expect(dapiClientMock.platform.getIdentityNonce).to.not.be.called(); + }); + + it('should fetch identity nonce if it is not present', async () => { + dapiClientMock.platform.getIdentityNonce.resolves({ identityNonce: 1 }); + expect(await nonceManager.getIdentityNonce(identityId)).to.be.equal(1); + expect(dapiClientMock.platform.getIdentityNonce).to.be.calledOnce(); + }); + + it('should invalidate and re-fetch nonce after interval passed', async function it() { + const clock = this.sinon.useFakeTimers(); + dapiClientMock.platform.getIdentityNonce.resolves({ identityNonce: 1 }); + expect(await nonceManager.getIdentityNonce(identityId)).to.be.equal(1); + + clock.tick(NONCE_FETCH_INTERVAL + 1); + dapiClientMock.platform.getIdentityNonce.resolves({ identityNonce: 2 }); + await nonceManager.getIdentityNonce(identityId); + expect(await nonceManager.getIdentityNonce(identityId)).to.be.equal(2); + clock.restore(); + }); + + it('should bump identity nonce', async () => { + dapiClientMock.platform.getIdentityNonce.resolves({ identityNonce: 1 }); + const prevNonce = await nonceManager.getIdentityNonce(identityId); + const nextNonce = await nonceManager.bumpIdentityNonce(identityId); + const currentNonce = await nonceManager.getIdentityNonce(identityId); + expect(nextNonce) + .to.equal(currentNonce) + .to.equal(prevNonce + 1); + }); + }); + + describe('Identity contract nonce', () => { + it('should set and get identity contract nonce', async () => { + nonceManager.setIdentityContractNonce(identityId, contractId, 1); + expect(await nonceManager.getIdentityContractNonce(identityId, contractId)) + .to.be.equal(1); + expect(dapiClientMock.platform.getIdentityContractNonce).to.not.be.called(); + }); + + it('should fetch identity contract nonce if it is not present', async () => { + dapiClientMock.platform.getIdentityContractNonce.resolves({ identityContractNonce: 1 }); + expect(await nonceManager.getIdentityContractNonce(identityId, contractId)) + .to.be.equal(1); + expect(dapiClientMock.platform.getIdentityContractNonce).to.be.calledOnce(); + }); + + it('should invalidate and re-fetch nonce after interval passed', async function it() { + const clock = this.sinon.useFakeTimers(); + dapiClientMock.platform.getIdentityContractNonce.resolves({ identityContractNonce: 1 }); + expect(await nonceManager.getIdentityContractNonce(identityId, contractId)) + .to.be.equal(1); + + clock.tick(NONCE_FETCH_INTERVAL + 1); + dapiClientMock.platform.getIdentityContractNonce.resolves({ identityContractNonce: 2 }); + await nonceManager.getIdentityContractNonce(identityId, contractId); + expect(await nonceManager.getIdentityContractNonce(identityId, contractId)) + .to.be.equal(2); + clock.restore(); + }); + + it('should bump identity contract nonce', async () => { + dapiClientMock.platform.getIdentityContractNonce.resolves({ identityContractNonce: 1 }); + const prevNonce = await nonceManager.getIdentityContractNonce(identityId, contractId); + const nextNonce = await nonceManager.bumpIdentityContractNonce(identityId, contractId); + const currentNonce = await nonceManager.getIdentityContractNonce(identityId, contractId); + expect(nextNonce) + .to.equal(currentNonce) + .to.equal(prevNonce + 1); + }); + }); +}); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/NonceManager/NonceManager.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/NonceManager/NonceManager.ts new file mode 100644 index 00000000000..8c4cc38268c --- /dev/null +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/NonceManager/NonceManager.ts @@ -0,0 +1,162 @@ +import DAPIClient from '@dashevo/dapi-client'; +import { Identifier } from '@dashevo/wasm-dpp'; + +type NonceState = { + value: number, + lastFetchedAt: number, +}; + +// 20 min +export const NONCE_FETCH_INTERVAL = 1200 * 1000; + +class NonceManager { + public dapiClient: DAPIClient; + + private identityNonce: Map; + + private identityContractNonce: Map>; + + constructor(dapiClient: DAPIClient) { + this.dapiClient = dapiClient; + + this.identityNonce = new Map(); + this.identityContractNonce = new Map(); + } + + public setIdentityNonce(identityId: Identifier, nonce: number) { + const identityIdStr = identityId.toString(); + const nonceState = this.identityNonce.get(identityIdStr); + + if (!nonceState) { + this.identityNonce.set(identityIdStr, { + value: nonce, + lastFetchedAt: Date.now(), + }); + } else { + nonceState.value = nonce; + } + } + + public async getIdentityNonce(identityId: Identifier): Promise { + const identityIdStr = identityId.toString(); + let nonceState = this.identityNonce.get(identityIdStr); + + if (typeof nonceState === 'undefined') { + const { identityNonce } = await this.dapiClient.platform.getIdentityNonce(identityId); + + if (typeof identityNonce === 'undefined') { + throw new Error('Identity nonce is not found'); + } + + nonceState = { + value: identityNonce, + lastFetchedAt: Date.now(), + }; + + this.identityNonce.set(identityIdStr, nonceState); + } else { + const now = Date.now(); + if (now - nonceState.lastFetchedAt > NONCE_FETCH_INTERVAL) { + const { identityNonce } = await this.dapiClient.platform.getIdentityNonce(identityId); + + if (typeof identityNonce === 'undefined') { + throw new Error('Identity nonce is not found'); + } + + nonceState.value = identityNonce; + nonceState.lastFetchedAt = now; + } + } + + return nonceState.value; + } + + public async bumpIdentityNonce(identityId: Identifier): Promise { + const nextIdentityNonce = await this.getIdentityNonce(identityId) + 1; + this.setIdentityNonce(identityId, nextIdentityNonce); + return nextIdentityNonce; + } + + public setIdentityContractNonce(identityId: Identifier, contractId: Identifier, nonce: number) { + const identityIdStr = identityId.toString(); + const contractIdStr = contractId.toString(); + + let contractNonce = this.identityContractNonce.get(identityIdStr); + + if (!contractNonce) { + contractNonce = new Map(); + this.identityContractNonce.set(identityIdStr, contractNonce); + } + + const nonceState = contractNonce.get(contractIdStr); + + if (!nonceState) { + contractNonce.set(contractIdStr, { + value: nonce, + lastFetchedAt: Date.now(), + }); + } else { + nonceState.value = nonce; + } + } + + public async getIdentityContractNonce( + identityId: Identifier, + contractId: Identifier, + ): Promise { + const identityIdStr = identityId.toString(); + const contractIdStr = contractId.toString(); + + let contractNonce = this.identityContractNonce.get(identityIdStr); + + if (!contractNonce) { + contractNonce = new Map(); + this.identityContractNonce.set(identityIdStr, contractNonce); + } + + let nonceState = contractNonce.get(contractIdStr); + + if (typeof nonceState === 'undefined') { + const { identityContractNonce } = await this.dapiClient.platform + .getIdentityContractNonce(identityId, contractId); + + if (typeof identityContractNonce === 'undefined') { + throw new Error('Identity contract nonce is not found'); + } + + nonceState = { + value: identityContractNonce, + lastFetchedAt: Date.now(), + }; + + contractNonce.set(contractIdStr, nonceState); + } else { + const now = Date.now(); + if (now - nonceState.lastFetchedAt > NONCE_FETCH_INTERVAL) { + const { identityContractNonce } = await this.dapiClient.platform + .getIdentityContractNonce(identityId, contractId); + + if (typeof identityContractNonce === 'undefined') { + throw new Error('Identity nonce is not found'); + } + + nonceState.value = identityContractNonce; + nonceState.lastFetchedAt = now; + } + } + + return nonceState.value; + } + + public async bumpIdentityContractNonce( + identityId: Identifier, + contractId: Identifier, + ): Promise { + const nextIdentityContractNonce = await this + .getIdentityContractNonce(identityId, contractId) + 1; + this.setIdentityContractNonce(identityId, contractId, nextIdentityContractNonce); + return nextIdentityContractNonce; + } +} + +export default NonceManager; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/Platform.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/Platform.ts index 07e26cb522b..873fe62c53d 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/Platform.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/Platform.ts @@ -21,6 +21,7 @@ import getIdentity from './methods/identities/get'; import registerIdentity from './methods/identities/register'; import topUpIdentity from './methods/identities/topUp'; import creditTransferIdentity from './methods/identities/creditTransfer'; +import creditWithdrawal from './methods/identities/creditWithdrawal'; import updateIdentity from './methods/identities/update'; import createIdentityCreateTransition from './methods/identities/internal/createIdentityCreateTransition'; import createIdentityTopUpTransition from './methods/identities/internal/createIdentityTopUpTransition'; @@ -35,6 +36,7 @@ import broadcastStateTransition from './broadcastStateTransition'; import logger, { ConfigurableLogger } from '../../../logger'; import Fetcher from './Fetcher'; +import NonceManager from './NonceManager/NonceManager'; /** * Interface for PlatformOpts @@ -77,6 +79,7 @@ interface Identities { register: Function, topUp: Function, creditTransfer: Function, + withdrawCredits: Function, update: Function, utils: { createAssetLockTransaction: Function @@ -151,6 +154,8 @@ export class Platform { protected fetcher: Fetcher; + public nonceManager: NonceManager; + /** * Construct some instance of Platform * @@ -181,6 +186,7 @@ export class Platform { topUp: topUpIdentity.bind(this), creditTransfer: creditTransferIdentity.bind(this), update: updateIdentity.bind(this), + withdrawCredits: creditWithdrawal.bind(this), utils: { createAssetLockProof: createAssetLockProof.bind(this), createAssetLockTransaction: createAssetLockTransaction.bind(this), @@ -200,6 +206,7 @@ export class Platform { } this.fetcher = new Fetcher(this.client.getDAPIClient()); + this.nonceManager = new NonceManager(this.client.getDAPIClient()); } async initialize() { diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/broadcastStateTransition.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/broadcastStateTransition.ts index 912cd4fd340..a12b67872f4 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/broadcastStateTransition.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/broadcastStateTransition.ts @@ -22,8 +22,8 @@ export default async function broadcastStateTransition( stateTransition: any, // TODO: restore once validation is done? // eslint-disable-next-line - options: { skipValidation?: boolean; } = {}, -): Promise { + options: { skipValidation?: boolean; } = {}, +): Promise { const { client } = platform; // TODO(versioning): restore diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/create.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/create.ts index 6b5db8e7453..8b40c79b141 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/create.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/create.ts @@ -17,7 +17,12 @@ export async function create( await this.initialize(); - const dataContract = this.dpp.dataContract.create(identity.getId(), contractDefinitions); + const identityNonce = await this.nonceManager.bumpIdentityNonce(identity.getId()); + const dataContract = this.dpp.dataContract.create( + identity.getId(), + BigInt(identityNonce), + contractDefinitions, + ); this.logger.debug(`[Contracts#create] created data contract "${dataContract.getId()}"`); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/update.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/update.ts index e684eab16aa..7347d158b3c 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/update.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/update.ts @@ -25,12 +25,19 @@ export default async function update( updatedDataContract.incrementVersion(); + const identityId = identity.getId(); + const dataContractId = dataContract.getId(); + + const identityContractNonce = await this.nonceManager + .bumpIdentityContractNonce(identityId, dataContractId); + const dataContractUpdateTransition = dpp.dataContract - .createDataContractUpdateTransition(updatedDataContract); + .createDataContractUpdateTransition(updatedDataContract, BigInt(identityContractNonce)); this.logger.silly(`[DataContract#update] Created data contract update transition ${dataContract.getId()}`); await signStateTransition(this, dataContractUpdateTransition, identity, 2); + // Broadcast state transition also wait for the result to be obtained await broadcastStateTransition(this, dataContractUpdateTransition); this.logger.silly(`[DataContract#update] Broadcasted data contract update transition ${dataContract.getId()}`); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/broadcast.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/broadcast.ts index 53308978d3b..4bbe6b6479d 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/broadcast.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/broadcast.ts @@ -31,7 +31,25 @@ export default async function broadcast( const { dpp } = this; - const documentsBatchTransition = dpp.document.createStateTransition(documents); + const identityId = identity.getId(); + const dataContractId = [ + ...(documents.create || []), + ...(documents.replace || []), + ...(documents.delete || []), + ][0]?.getDataContractId(); + + if (!dataContractId) { + throw new Error('Data contract ID is not found'); + } + + const identityContractNonce = await this.nonceManager + .bumpIdentityContractNonce(identityId, dataContractId); + + const documentsBatchTransition = dpp.document.createStateTransition(documents, { + [identityId.toString()]: { + [dataContractId.toString()]: identityContractNonce, + }, + }); this.logger.silly('[Document#broadcast] Created documents batch transition'); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditTransfer.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditTransfer.ts index 946284560b3..71c0f196584 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditTransfer.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditTransfer.ts @@ -16,19 +16,23 @@ export async function creditTransfer( recipientId = Identifier.from(recipientId); + const identityNonce = await this.nonceManager.bumpIdentityNonce(identity.getId()); + const identityCreditTransferTransition = dpp.identity .createIdentityCreditTransferTransition( - identity.getId(), + identity, recipientId, BigInt(amount), + BigInt(identityNonce), ); this.logger.silly('[Identity#creditTransfer] Created IdentityCreditTransferTransition'); - const signerKeyIndex = 2; + const signerKeyIndex = 3; await signStateTransition(this, identityCreditTransferTransition, identity, signerKeyIndex); + // Skipping validation because it's already done above await broadcastStateTransition(this, identityCreditTransferTransition, { skipValidation: true, }); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditWithdrawal.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditWithdrawal.ts new file mode 100644 index 00000000000..a2bd513397e --- /dev/null +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditWithdrawal.ts @@ -0,0 +1,119 @@ +import { Identity } from '@dashevo/wasm-dpp'; +import { Address, Script } from '@dashevo/dashcore-lib'; +import { Metadata } from '@dashevo/dapi-client/lib/methods/platform/response/Metadata'; +import broadcastStateTransition from '../../broadcastStateTransition'; +import { Platform } from '../../Platform'; +import { signStateTransition } from '../../signStateTransition'; +import { nearestGreaterFibonacci } from '../../../../../utils/fibonacci'; + +export const STATUSES = { + PENDING: 0, + POOLED: 1, + BROADCASTED: 2, + COMPLETED: 3, +}; + +// Implement remaining pooling types when they ready on drive side +const DEFAULT_POOLING = 0; + +// TODO: add to dashcore-lib +// Asset unlock TX size is fixed with the default pooling +// since it has zero inputs and only one output +const ASSET_UNLOCK_TX_SIZE = 190; + +// Minimal accepted core fee per byte to avoid low fee error from core +const MIN_ASSET_UNLOCK_CORE_FEE_PER_BYTE = 1; + +// Minimal withdrawal amount in credits to avoid dust error from core +const MINIMAL_WITHDRAWAL_AMOUNT = ASSET_UNLOCK_TX_SIZE * MIN_ASSET_UNLOCK_CORE_FEE_PER_BYTE * 1000; + +type WithdrawalOptions = { + signingKeyIndex: number +}; + +/** Creates platform credits withdrawal request + * @param identity - identity to withdraw from + * @param amount - amount of credits to withdraw + * @param to - Dash L1 address + * @param options - withdrawal options + */ +export async function creditWithdrawal( + this: Platform, + identity: Identity, + amount: number, + to: string, + options: WithdrawalOptions = { + signingKeyIndex: 3, + }, +): Promise { + await this.initialize(); + + const { dpp } = this; + + let toAddress: Address; + try { + toAddress = new Address(to, this.client.network); + } catch (e) { + throw new Error(`Invalid core recipient "${to}" for network ${this.client.network}`); + } + this.logger.debug(`[Identity#creditWithdrawal] credits withdrawal from ${identity.getId().toString()} to ${toAddress.toString()} with amount ${amount}`); + + const outputScript = Script.buildPublicKeyHashOut(toAddress); + + const balance = identity.getBalance(); + if (amount > balance) { + throw new Error(`Withdrawal amount "${amount}" is bigger that identity balance "${balance}"`); + } + + if (amount < MINIMAL_WITHDRAWAL_AMOUNT) { + throw new Error(`Withdrawal amount "${amount}" is less than minimal allowed withdrawal amount "${MINIMAL_WITHDRAWAL_AMOUNT}"`); + } + + if (!this.client.wallet) { + throw new Error('Wallet is not initialized'); + } + + // Divide by 1000 as stated in policy for GetDustThreshold + // https://github.com/dashpay/dash/blob/master/src/policy/policy.cpp#L23 + const minRelayFeePerByte = Math.ceil(this.client.wallet.storage + .getDefaultChainStore().state.fees.minRelay / 1000); + + const coreFeePerByte = nearestGreaterFibonacci(minRelayFeePerByte); + + const identityNonce = await this.nonceManager.bumpIdentityNonce(identity.getId()); + + const identityCreditWithdrawalTransition = dpp.identity + .createIdentityCreditWithdrawalTransition( + identity.getId(), + BigInt(amount), + coreFeePerByte, + DEFAULT_POOLING, + // @ts-ignore + outputScript.toBuffer(), + BigInt(identityNonce), + ); + + this.logger.silly('[Identity#creditWithdrawal] Created IdentityCreditWithdrawalTransition'); + + await signStateTransition( + this, + identityCreditWithdrawalTransition, + identity, + options.signingKeyIndex, + ); + + // Skipping validation because it's already done above + const stateTransitionResult = await broadcastStateTransition( + this, + identityCreditWithdrawalTransition, + { + skipValidation: true, + }, + ); + + this.logger.silly('[Identity#creditWithdrawal] Broadcasted IdentityCreditWithdrawalTransition'); + + return stateTransitionResult.metadata; +} + +export default creditWithdrawal; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts index 40aaa6ff7ab..83ece7d2377 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts @@ -26,35 +26,55 @@ export async function createIdentityCreateTransition( const identityIndex = await account.getUnusedIdentityIndex(); + // Authentication master key + const { privateKey: identityMasterPrivateKey } = account.identities .getIdentityHDKeyByIndex(identityIndex, 0); const identityMasterPublicKey = identityMasterPrivateKey.toPublicKey(); - const { privateKey: identitySecondPrivateKey } = account.identities + const masterKey = new IdentityPublicKey(1); + masterKey.setId(0); + masterKey.setData(identityMasterPublicKey.toBuffer()); + masterKey.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.MASTER); + + // Authentication high level key + + const { privateKey: identityHighAuthPrivateKey } = account.identities .getIdentityHDKeyByIndex(identityIndex, 1); - const identitySecondPublicKey = identitySecondPrivateKey.toPublicKey(); + const identityHighAuthPublicKey = identityHighAuthPrivateKey.toPublicKey(); + + const highAuthKey = new IdentityPublicKey(1); + highAuthKey.setId(1); + highAuthKey.setData(identityHighAuthPublicKey.toBuffer()); + highAuthKey.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.HIGH); + + // Authentication critical level key - const { privateKey: identityThirdPrivateKey } = account.identities + const { privateKey: identityCriticalAuthPrivateKey } = account.identities .getIdentityHDKeyByIndex(identityIndex, 2); - const identityThirdPublicKey = identityThirdPrivateKey.toPublicKey(); + const identityCriticalAuthPublicKey = identityCriticalAuthPrivateKey.toPublicKey(); - const keyOne = new IdentityPublicKey(1); - keyOne.setData(identityMasterPublicKey.toBuffer()); + const criticalAuthKey = new IdentityPublicKey(1); + criticalAuthKey.setId(2); + criticalAuthKey.setData(identityCriticalAuthPublicKey.toBuffer()); + criticalAuthKey.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.CRITICAL); - const keyTwo = new IdentityPublicKey(1); - keyTwo.setId(1); - keyTwo.setData(identitySecondPublicKey.toBuffer()); - keyTwo.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.HIGH); + // Transfer key - const keyThree = new IdentityPublicKey(1); - keyThree.setId(2); - keyThree.setData(identityThirdPublicKey.toBuffer()); - keyThree.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.CRITICAL); + const { privateKey: identityTransferPrivateKey } = account.identities + .getIdentityHDKeyByIndex(identityIndex, 3); + const identityTransferPublicKey = identityTransferPrivateKey.toPublicKey(); + + const transferKey = new IdentityPublicKey(1); + transferKey.setId(3); + transferKey.setPurpose(IdentityPublicKey.PURPOSES.TRANSFER); + transferKey.setData(identityTransferPublicKey.toBuffer()); + transferKey.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.CRITICAL); // Create Identity const identity = dpp.identity.create( assetLockProof.createIdentifier(), - [keyOne, keyTwo, keyThree], + [masterKey, highAuthKey, criticalAuthKey, transferKey], ); // Create ST @@ -64,35 +84,62 @@ export async function createIdentityCreateTransition( ); // Create key proofs - const [masterKey, secondKey, thirdKey] = identityCreateTransition.getPublicKeys(); + const [ + stMasterKey, stHighAuthKey, stCriticalAuthKey, stTransferKey, + ] = identityCreateTransition.getPublicKeys(); + + // Sign master key + + identityCreateTransition.signByPrivateKey( + identityMasterPrivateKey.toBuffer(), + IdentityPublicKey.TYPES.ECDSA_SECP256K1, + ); - await identityCreateTransition - .signByPrivateKey(identityMasterPrivateKey.toBuffer(), IdentityPublicKey.TYPES.ECDSA_SECP256K1); + stMasterKey.setSignature(identityCreateTransition.getSignature()); - masterKey.setSignature(identityCreateTransition.getSignature()); + identityCreateTransition.setSignature(undefined); + + // Sign high auth key + + identityCreateTransition.signByPrivateKey( + identityHighAuthPrivateKey.toBuffer(), + IdentityPublicKey.TYPES.ECDSA_SECP256K1, + ); + + stHighAuthKey.setSignature(identityCreateTransition.getSignature()); identityCreateTransition.setSignature(undefined); - await identityCreateTransition - .signByPrivateKey(identitySecondPrivateKey.toBuffer(), IdentityPublicKey.TYPES.ECDSA_SECP256K1); + // Sign critical auth key - secondKey.setSignature(identityCreateTransition.getSignature()); + identityCreateTransition.signByPrivateKey( + identityCriticalAuthPrivateKey.toBuffer(), + IdentityPublicKey.TYPES.ECDSA_SECP256K1, + ); + + stCriticalAuthKey.setSignature(identityCreateTransition.getSignature()); identityCreateTransition.setSignature(undefined); - await identityCreateTransition - .signByPrivateKey(identityThirdPrivateKey.toBuffer(), IdentityPublicKey.TYPES.ECDSA_SECP256K1); + // Sign transfer key + + identityCreateTransition.signByPrivateKey( + identityTransferPrivateKey.toBuffer(), + IdentityPublicKey.TYPES.ECDSA_SECP256K1, + ); - thirdKey.setSignature(identityCreateTransition.getSignature()); + stTransferKey.setSignature(identityCreateTransition.getSignature()); identityCreateTransition.setSignature(undefined); // Set public keys back after updating their signatures - identityCreateTransition.setPublicKeys([masterKey, secondKey, thirdKey]); + identityCreateTransition.setPublicKeys([ + stMasterKey, stHighAuthKey, stCriticalAuthKey, stTransferKey, + ]); // Sign and validate state transition - await identityCreateTransition + identityCreateTransition .signByPrivateKey(assetLockPrivateKey.toBuffer(), IdentityPublicKey.TYPES.ECDSA_SECP256K1); // TODO(versioning): restore diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/update.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/update.ts index 0ba6e5dcd21..941e75d303b 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/update.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/update.ts @@ -28,8 +28,11 @@ export async function update( const { dpp } = this; + const identityNonce = await this.nonceManager.bumpIdentityNonce(identity.getId()); + const identityUpdateTransition = dpp.identity.createIdentityUpdateTransition( identity, + BigInt(identityNonce), publicKeys, ); diff --git a/packages/js-dash-sdk/src/test/fixtures/createIdentityFixtureInAccount.ts b/packages/js-dash-sdk/src/test/fixtures/createIdentityFixtureInAccount.ts index 062cb2cc73c..986e6e10d7e 100644 --- a/packages/js-dash-sdk/src/test/fixtures/createIdentityFixtureInAccount.ts +++ b/packages/js-dash-sdk/src/test/fixtures/createIdentityFixtureInAccount.ts @@ -16,6 +16,7 @@ export async function createIdentityFixtureInAccount(account) { const publicKeyOne = new IdentityPublicKey(1); publicKeyOne.setData(identityMasterPrivateKey.toPublicKey().toBuffer()); + publicKeyOne.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.MASTER); const publicKeyTwo = new IdentityPublicKey(1); publicKeyTwo.setId(1); diff --git a/packages/js-dash-sdk/src/test/mocks/createAndAttachTransportMocksToClient.ts b/packages/js-dash-sdk/src/test/mocks/createAndAttachTransportMocksToClient.ts index fe0655ea2ee..b59c77b43f0 100644 --- a/packages/js-dash-sdk/src/test/mocks/createAndAttachTransportMocksToClient.ts +++ b/packages/js-dash-sdk/src/test/mocks/createAndAttachTransportMocksToClient.ts @@ -9,6 +9,7 @@ import { createDapiClientMock } from './createDapiClientMock'; import { wait } from '../../utils/wait'; const GetIdentityResponse = require('@dashevo/dapi-client/lib/methods/platform/getIdentity/GetIdentityResponse'); +const NotFoundError = require('@dashevo/dapi-client/lib/transport/GrpcTransport/errors/NotFoundError'); const TxStreamMock = require('@dashevo/wallet-lib/src/test/mocks/TxStreamMock'); const TxStreamDataResponseMock = require('@dashevo/wallet-lib/src/test/mocks/TxStreamDataResponseMock'); @@ -84,6 +85,7 @@ export async function createAndAttachTransportMocksToClient(client, sinon) { // Mock dapi client for platform endpoints client.dapiClient = dapiClientMock; client.platform.fetcher.dapiClient = dapiClientMock; + client.platform.nonceManager.dapiClient = dapiClientMock; // Starting account sync const accountPromise = client.wallet.getAccount(); @@ -102,7 +104,8 @@ export async function createAndAttachTransportMocksToClient(client, sinon) { await accountPromise; // Putting data in transport stubs - transportMock.getIdentitiesByPublicKeyHashes.resolves([]); + transportMock.getIdentityByPublicKeyHash + .rejects(new NotFoundError('Identity not found', {}, null)); makeTxStreamEmitISLocksForTransactions(transportMock, txStreamMock); await makeGetIdentityRespondWithIdentity(client, dapiClientMock); diff --git a/packages/js-dash-sdk/src/test/mocks/createDapiClientMock.ts b/packages/js-dash-sdk/src/test/mocks/createDapiClientMock.ts index b5242efd843..b0f73ee401b 100644 --- a/packages/js-dash-sdk/src/test/mocks/createDapiClientMock.ts +++ b/packages/js-dash-sdk/src/test/mocks/createDapiClientMock.ts @@ -7,6 +7,8 @@ export function createDapiClientMock(sinon: SinonSandbox) { getIdentity: sinon.stub(), waitForStateTransitionResult: sinon.stub().resolves({}), getDataContract: sinon.stub(), + getIdentityContractNonce: sinon.stub().resolves({ identityContractNonce: 1 }), + getIdentityNonce: sinon.stub().resolves({ identityNonce: 1 }), }, }; } diff --git a/packages/js-dash-sdk/src/utils/fibonacci.ts b/packages/js-dash-sdk/src/utils/fibonacci.ts index 22ceb5c1c4e..3a8fd66b88a 100644 --- a/packages/js-dash-sdk/src/utils/fibonacci.ts +++ b/packages/js-dash-sdk/src/utils/fibonacci.ts @@ -1,8 +1,16 @@ -const fibonacci = (n) => { +export const fibonacci = (n: number): number => { if (n < 2) { return n; } return fibonacci(n - 1) + fibonacci(n - 2); }; -export default fibonacci; +export const nearestGreaterFibonacci = (value: number) => { + const phi = (1 + Math.sqrt(5)) / 2; + + // Use the rearranged Binet's formula to find the nearest index + const n = Math.ceil(Math.log(value * Math.sqrt(5) + 0.5) / Math.log(phi)); + + // Calculate the Fibonacci number using Binet's formula + return Math.round(phi ** n / Math.sqrt(5)); +}; diff --git a/packages/js-grpc-common/index.js b/packages/js-grpc-common/index.js index ed85e5354ca..add20ba40f3 100644 --- a/packages/js-grpc-common/index.js +++ b/packages/js-grpc-common/index.js @@ -22,6 +22,7 @@ const ResourceExhaustedGrpcError = require('./lib/server/error/ResourceExhausted const DeadlineExceededGrpcError = require('./lib/server/error/DeadlineExceededGrpcError'); const NotFoundGrpcError = require('./lib/server/error/NotFoundGrpcError'); const UnavailableGrpcError = require('./lib/server/error/UnavailableGrpcError'); +const UnimplementedGrpcError = require('./lib/server/error/UnimplementedGrpcError'); const AlreadyExistsGrpcError = require('./lib/server/error/AlreadyExistsGrpcError'); const GrpcError = require('./lib/server/error/GrpcError'); @@ -59,6 +60,7 @@ module.exports = { NotFoundGrpcError, UnavailableGrpcError, AlreadyExistsGrpcError, + UnimplementedGrpcError, }, checks: { checkVersionWrapperFactory, diff --git a/packages/js-grpc-common/lib/server/error/UnimplementedGrpcError.js b/packages/js-grpc-common/lib/server/error/UnimplementedGrpcError.js new file mode 100644 index 00000000000..a9a054c9b8c --- /dev/null +++ b/packages/js-grpc-common/lib/server/error/UnimplementedGrpcError.js @@ -0,0 +1,14 @@ +const GrpcError = require('./GrpcError'); +const GrpcErrorCodes = require('./GrpcErrorCodes'); + +class UnimplementedGrpcError extends GrpcError { + /** + * @param {string} message + * @param {Object} [metadata] + */ + constructor(message, metadata = undefined) { + super(GrpcErrorCodes.UNIMPLEMENTED, message, metadata); + } +} + +module.exports = UnimplementedGrpcError; diff --git a/packages/js-grpc-common/package.json b/packages/js-grpc-common/package.json index b63941f2870..36bf23b4606 100644 --- a/packages/js-grpc-common/package.json +++ b/packages/js-grpc-common/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/grpc-common", - "version": "0.25.21", + "version": "1.0.0-dev.15", "description": "Common GRPC library", "main": "index.js", "scripts": { diff --git a/packages/masternode-reward-shares-contract/.eslintrc b/packages/masternode-reward-shares-contract/.eslintrc index 333860e2f93..cb6c7636b60 100644 --- a/packages/masternode-reward-shares-contract/.eslintrc +++ b/packages/masternode-reward-shares-contract/.eslintrc @@ -1,15 +1,18 @@ { - "extends": "airbnb-base", - "rules": { - "no-plusplus": 0, - "eol-last": [ - "error", - "always" - ], - "class-methods-use-this": "off", - "curly": [ - "error", - "all" - ] - } + "extends": "airbnb-base", + "rules": { + "no-plusplus": 0, + "eol-last": [ + "error", + "always" + ], + "class-methods-use-this": "off", + "curly": [ + "error", + "all" + ] + }, + "globals": { + "BigInt": true + } } diff --git a/packages/masternode-reward-shares-contract/Cargo.toml b/packages/masternode-reward-shares-contract/Cargo.toml index f18d7c30e78..d5e3194eab4 100644 --- a/packages/masternode-reward-shares-contract/Cargo.toml +++ b/packages/masternode-reward-shares-contract/Cargo.toml @@ -1,11 +1,13 @@ [package] name = "masternode-reward-shares-contract" description = "Masternode reward shares data contract schema and tools" -version = "0.25.21" +version = "1.0.0-dev.15" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" [dependencies] +thiserror = "1.0.58" +platform-version = { path = "../rs-platform-version" } serde_json = { version = "1.0" } platform-value = { path = "../rs-platform-value" } diff --git a/packages/masternode-reward-shares-contract/package.json b/packages/masternode-reward-shares-contract/package.json index 484ccbfda10..a1a97d841a5 100644 --- a/packages/masternode-reward-shares-contract/package.json +++ b/packages/masternode-reward-shares-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/masternode-reward-shares-contract", - "version": "0.25.21", + "version": "1.0.0-dev.15", "description": "A contract and helper scripts for reward sharing", "scripts": { "lint": "eslint .", diff --git a/packages/masternode-reward-shares-contract/schema/masternode-reward-shares-documents.json b/packages/masternode-reward-shares-contract/schema/v1/masternode-reward-shares-documents.json similarity index 100% rename from packages/masternode-reward-shares-contract/schema/masternode-reward-shares-documents.json rename to packages/masternode-reward-shares-contract/schema/v1/masternode-reward-shares-documents.json diff --git a/packages/masternode-reward-shares-contract/src/error.rs b/packages/masternode-reward-shares-contract/src/error.rs new file mode 100644 index 00000000000..d01bbcc91cf --- /dev/null +++ b/packages/masternode-reward-shares-contract/src/error.rs @@ -0,0 +1,17 @@ +use platform_version::version::FeatureVersion; + +#[derive(thiserror::Error, Debug)] +pub enum Error { + /// Platform expected some specific versions + #[error("platform unknown version on {method}, received: {received}")] + UnknownVersionMismatch { + /// method + method: String, + /// the allowed versions for this method + known_versions: Vec, + /// requested core height + received: FeatureVersion, + }, + #[error("schema deserialize error: {0}")] + InvalidSchemaJson(#[from] serde_json::Error), +} diff --git a/packages/masternode-reward-shares-contract/src/lib.rs b/packages/masternode-reward-shares-contract/src/lib.rs index 5d9a0fe4004..124f0e66278 100644 --- a/packages/masternode-reward-shares-contract/src/lib.rs +++ b/packages/masternode-reward-shares-contract/src/lib.rs @@ -1,5 +1,9 @@ +mod error; +pub mod v1; + +pub use crate::error::Error; use platform_value::{Identifier, IdentifierBytes32}; -use serde_json::Error; +use platform_version::version::PlatformVersion; use serde_json::Value; pub const ID_BYTES: [u8; 32] = [ @@ -15,19 +19,23 @@ pub const OWNER_ID_BYTES: [u8; 32] = [ pub const ID: Identifier = Identifier(IdentifierBytes32(ID_BYTES)); pub const OWNER_ID: Identifier = Identifier(IdentifierBytes32(OWNER_ID_BYTES)); -pub mod document_types { - pub mod reward_share { - pub const NAME: &str = "rewardShare"; - - pub mod properties { - pub const PAY_TO_ID: &str = "payToId"; - pub const PERCENTAGE: &str = "percentage"; - } +pub fn load_definitions(platform_version: &PlatformVersion) -> Result, Error> { + match platform_version.system_data_contracts.withdrawals { + 0 => Ok(None), + version => Err(Error::UnknownVersionMismatch { + method: "masternode_reward_shares_contract::load_definitions".to_string(), + known_versions: vec![0], + received: version, + }), } } - -pub fn load_documents_schemas() -> Result { - serde_json::from_str(include_str!( - "../schema/masternode-reward-shares-documents.json" - )) +pub fn load_documents_schemas(platform_version: &PlatformVersion) -> Result { + match platform_version.system_data_contracts.withdrawals { + 1 => v1::load_documents_schemas(), + version => Err(Error::UnknownVersionMismatch { + method: "masternode_reward_shares_contract::load_documents_schemas".to_string(), + known_versions: vec![1], + received: version, + }), + } } diff --git a/packages/masternode-reward-shares-contract/src/v1/mod.rs b/packages/masternode-reward-shares-contract/src/v1/mod.rs new file mode 100644 index 00000000000..0af222aa0b7 --- /dev/null +++ b/packages/masternode-reward-shares-contract/src/v1/mod.rs @@ -0,0 +1,20 @@ +use crate::error::Error; +use serde_json::Value; + +pub mod document_types { + pub mod reward_share { + pub const NAME: &str = "rewardShare"; + + pub mod properties { + pub const PAY_TO_ID: &str = "payToId"; + pub const PERCENTAGE: &str = "percentage"; + } + } +} + +pub(super) fn load_documents_schemas() -> Result { + serde_json::from_str(include_str!( + "../../schema/v1/masternode-reward-shares-documents.json" + )) + .map_err(Error::InvalidSchemaJson) +} diff --git a/packages/masternode-reward-shares-contract/test/unit/masternodeRewardSharesContract.spec.js b/packages/masternode-reward-shares-contract/test/unit/masternodeRewardSharesContract.spec.js index 704249bc68a..e2eae634f1e 100644 --- a/packages/masternode-reward-shares-contract/test/unit/masternodeRewardSharesContract.spec.js +++ b/packages/masternode-reward-shares-contract/test/unit/masternodeRewardSharesContract.spec.js @@ -1,17 +1,26 @@ -const { DashPlatformProtocol, JsonSchemaError } = require('@dashevo/wasm-dpp'); +const { + DashPlatformProtocol, + JsonSchemaError, +} = require('@dashevo/wasm-dpp'); const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync'); const { expect } = require('chai'); const crypto = require('crypto'); -const rewardSharingContractSchema = require('../../schema/masternode-reward-shares-documents.json'); +const rewardSharingContractSchema = require('../../schema/v1/masternode-reward-shares-documents.json'); const expectJsonSchemaError = (validationResult, errorCount = 1) => { const errors = validationResult.getErrors(); - expect(errors).to.have.length(errorCount); + expect(errors) + .to + .have + .length(errorCount); const error = validationResult.getErrors()[0]; - expect(error).to.be.instanceof(JsonSchemaError); + expect(error) + .to + .be + .instanceof(JsonSchemaError); return error; }; @@ -29,7 +38,11 @@ describe('Masternode reward shares contract', () => { identityId = await generateRandomIdentifier(); - contract = dpp.dataContract.create(identityId, rewardSharingContractSchema); + contract = dpp.dataContract.create( + identityId, + BigInt(1), + rewardSharingContractSchema, + ); rewardShare = { payToId: await generateRandomIdentifier(), @@ -38,8 +51,10 @@ describe('Masternode reward shares contract', () => { }); it('should have a valid contract definition', async () => { - expect(() => dpp.dataContract.create(identityId, rewardSharingContractSchema)) - .to.not.throw(); + expect(() => dpp.dataContract.create(identityId, BigInt(1), rewardSharingContractSchema)) + .to + .not + .throw(); }); describe('payToId', () => { @@ -50,22 +65,28 @@ describe('Masternode reward shares contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('payToId'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('payToId'); }); it('should have no less than 32 bytes', () => { rewardShare.payToId = Buffer.alloc(31); expect(() => dpp.document.create(contract, identityId, 'rewardShare', rewardShare)) - .to.throw(); + .to + .throw(); }); it('should have no more than 32 bytes', async () => { rewardShare.payToId = Buffer.alloc(33); expect(() => dpp.document.create(contract, identityId, 'rewardShare', rewardShare)) - .to.throw(); + .to + .throw(); }); }); @@ -77,8 +98,12 @@ describe('Masternode reward shares contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('required'); - expect(error.params.missingProperty).to.equal('percentage'); + expect(error.keyword) + .to + .equal('required'); + expect(error.params.missingProperty) + .to + .equal('percentage'); }); it('should not be less than 1', () => { @@ -88,8 +113,12 @@ describe('Masternode reward shares contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('minimum'); - expect(error.instancePath).to.equal('/percentage'); + expect(error.keyword) + .to + .equal('minimum'); + expect(error.instancePath) + .to + .equal('/percentage'); }); it('should not be more than 10000', () => { @@ -99,8 +128,12 @@ describe('Masternode reward shares contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('maximum'); - expect(error.instancePath).to.equal('/percentage'); + expect(error.keyword) + .to + .equal('maximum'); + expect(error.instancePath) + .to + .equal('/percentage'); }); it('should be a number', () => { @@ -110,9 +143,15 @@ describe('Masternode reward shares contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('type'); - expect(error.instancePath).to.equal('/percentage'); - expect(error.params.type).to.equal('integer'); + expect(error.keyword) + .to + .equal('type'); + expect(error.instancePath) + .to + .equal('/percentage'); + expect(error.params.type) + .to + .equal('integer'); }); }); @@ -123,7 +162,12 @@ describe('Masternode reward shares contract', () => { const validationResult = document.validate(dpp.protocolVersion); const error = expectJsonSchemaError(validationResult); - expect(error.keyword).to.equal('additionalProperties'); - expect(error.params.additionalProperties).to.deep.equal(['someOtherProperty']); + expect(error.keyword) + .to + .equal('additionalProperties'); + expect(error.params.additionalProperties) + .to + .deep + .equal(['someOtherProperty']); }); }); diff --git a/packages/platform-test-suite/lib/test/bootstrap.js b/packages/platform-test-suite/lib/test/bootstrap.js index 477b2cfdb6e..f4e9d46724b 100644 --- a/packages/platform-test-suite/lib/test/bootstrap.js +++ b/packages/platform-test-suite/lib/test/bootstrap.js @@ -10,6 +10,10 @@ use(chaiAsPromised); use(dirtyChai); use(sinonChai); +dotenvSafe.config({ + path: path.resolve(__dirname, '..', '..', '.env'), +}); + process.env.NODE_ENV = 'test'; let faucetIndex = 1; @@ -21,10 +25,6 @@ if (process.env.MOCHA_WORKER_ID) { process.env.FAUCET_ADDRESS = process.env[`FAUCET_${faucetIndex}_ADDRESS`]; process.env.FAUCET_PRIVATE_KEY = process.env[`FAUCET_${faucetIndex}_PRIVATE_KEY`]; -dotenvSafe.config({ - path: path.resolve(__dirname, '..', '..', '.env'), -}); - exports.mochaHooks = { beforeEach() { if (!this.sinon) { diff --git a/packages/platform-test-suite/lib/test/createClientWithFundedWallet.js b/packages/platform-test-suite/lib/test/createClientWithFundedWallet.js index 7fa02011661..b2b302ff4e2 100644 --- a/packages/platform-test-suite/lib/test/createClientWithFundedWallet.js +++ b/packages/platform-test-suite/lib/test/createClientWithFundedWallet.js @@ -61,7 +61,7 @@ async function createClientWithFundedWallet(amount, HDPrivateKey = undefined) { await fundWallet(faucetClient.wallet, client.wallet, amount); if (useFaucetWalletStorage) { - await faucetClient.wallet.disconnect(); + await faucetClient.disconnect(); } return client; diff --git a/packages/platform-test-suite/lib/test/fixtures/getDataContractFixture.js b/packages/platform-test-suite/lib/test/fixtures/getDataContractFixture.js index 7c62e08ac24..5acec950e51 100644 --- a/packages/platform-test-suite/lib/test/fixtures/getDataContractFixture.js +++ b/packages/platform-test-suite/lib/test/fixtures/getDataContractFixture.js @@ -10,11 +10,12 @@ const { let randomOwnerId = null; /** - * + * @param {number} identityNonce * @param {Identifier} [ownerId] * @return {Promise} */ module.exports = async function getDataContractFixture( + identityNonce, ownerId = randomOwnerId, ) { const { DataContractFactory, Identifier, getLatestProtocolVersion } = await Platform @@ -150,5 +151,5 @@ module.exports = async function getDataContractFixture( documentsMutableContractDefault: true, }; - return factory.create(ownerId, documents, config); + return factory.create(ownerId, BigInt(identityNonce), documents, config); }; diff --git a/packages/platform-test-suite/lib/test/karma/bootstrap.js b/packages/platform-test-suite/lib/test/karma/bootstrap.js index 4ed1d836b8a..d76c466bdbc 100644 --- a/packages/platform-test-suite/lib/test/karma/bootstrap.js +++ b/packages/platform-test-suite/lib/test/karma/bootstrap.js @@ -3,6 +3,7 @@ const dirtyChai = require('dirty-chai'); const chaiAsPromised = require('chai-as-promised'); const sinon = require('sinon'); const sinonChai = require('sinon-chai'); +require('setimmediate'); use(chaiAsPromised); use(dirtyChai); diff --git a/packages/platform-test-suite/lib/waitForBlocks.js b/packages/platform-test-suite/lib/waitForBlocks.js index 4f0be6d4bf0..e1f826418ba 100644 --- a/packages/platform-test-suite/lib/waitForBlocks.js +++ b/packages/platform-test-suite/lib/waitForBlocks.js @@ -7,11 +7,11 @@ const wait = require('./wait'); * @return {Promise} */ module.exports = async function waitForBlocks(dapiClient, numberOfBlocks) { - let { chain: { blocksCount: currentBlockHeight } } = await dapiClient.core.getStatus(); + let currentBlockHeight = await dapiClient.core.getBestBlockHeight(); const desiredBlockHeight = currentBlockHeight + numberOfBlocks; do { - ({ chain: { blocksCount: currentBlockHeight } } = await dapiClient.core.getStatus()); + currentBlockHeight = await dapiClient.core.getBestBlockHeight(); if (currentBlockHeight < desiredBlockHeight) { await wait(5000); diff --git a/packages/platform-test-suite/package.json b/packages/platform-test-suite/package.json index 9c3ac419b55..237ca3bc5d4 100644 --- a/packages/platform-test-suite/package.json +++ b/packages/platform-test-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/platform-test-suite", "private": true, - "version": "0.25.21", + "version": "1.0.0-dev.15", "description": "Dash Network end-to-end tests", "scripts": { "test": "yarn exec bin/test.sh", @@ -24,13 +24,14 @@ "homepage": "https://github.com/dashevo/platform-test-suite#readme", "dependencies": { "@dashevo/dapi-client": "workspace:*", - "@dashevo/dashcore-lib": "~0.21.0", + "@dashevo/dashcore-lib": "~0.21.1", "@dashevo/dpns-contract": "workspace:*", "@dashevo/feature-flags-contract": "workspace:*", "@dashevo/grpc-common": "workspace:*", "@dashevo/masternode-reward-shares-contract": "workspace:*", "@dashevo/wallet-lib": "workspace:*", "@dashevo/wasm-dpp": "workspace:*", + "@dashevo/withdrawals-contract": "workspace:*", "assert": "^2.0.0", "assert-browserify": "^2.0.0", "browserify-zlib": "^0.2.0", @@ -62,6 +63,7 @@ "path-browserify": "^1.0.1", "process": "^0.11.10", "semver": "^7.5.3", + "setimmediate": "^1.0.5", "sinon": "^17.0.1", "sinon-chai": "^3.7.0", "stream-browserify": "^3.0.0", @@ -72,7 +74,7 @@ "utf-8-validate": "^5.0.9", "util": "^0.12.4", "webpack": "^5.76.1", - "ws": "^7.5.3" + "ws": "^8.17.1" }, "devDependencies": { "eslint": "^8.53.0", diff --git a/packages/platform-test-suite/test/e2e/contacts.spec.js b/packages/platform-test-suite/test/e2e/contacts.spec.js index df15ff694fc..fe8eaf2fced 100644 --- a/packages/platform-test-suite/test/e2e/contacts.spec.js +++ b/packages/platform-test-suite/test/e2e/contacts.spec.js @@ -1,4 +1,12 @@ -const { Identifier } = require('@dashevo/wasm-dpp'); +const Dash = require('dash'); + +const { + PlatformProtocol: { + Identifier, + IdentityPublicKey, + IdentityPublicKeyWithWitness, + }, +} = Dash; const createClientWithFundedWallet = require('../../lib/test/createClientWithFundedWallet'); const waitForSTPropagated = require('../../lib/waitForSTPropagated'); @@ -49,6 +57,8 @@ describe('e2e', () => { }, contact: { type: 'object', + requiresIdentityEncryptionBoundedKey: 2, + requiresIdentityDecryptionBoundedKey: 2, indices: [ { name: 'onwerIdToUserId', @@ -94,9 +104,9 @@ describe('e2e', () => { describe('Bob', () => { it('should create user wallet and identity', async () => { // Create Bob wallet - bobClient = await createClientWithFundedWallet(400000); + bobClient = await createClientWithFundedWallet(500000); - bobIdentity = await bobClient.platform.identities.register(300000); + bobIdentity = await bobClient.platform.identities.register(400000); // Additional wait time to mitigate testnet latency await waitForSTPropagated(); @@ -149,6 +159,63 @@ describe('e2e', () => { expect(fetchedProfile.toObject()).to.be.deep.equal(profile.toObject()); }); + + it('should add encryption and decryption keys to the identity', async () => { + const account = await bobClient.getWalletAccount(); + + const numKeys = bobIdentity.getPublicKeys().length; + const identityIndex = await account.getUnusedIdentityIndex(); + + const { privateKey: encryptionPrivateKey } = account + .identities + .getIdentityHDKeyByIndex(identityIndex, 1); + + const { privateKey: decryptionPrivateKey } = account + .identities + .getIdentityHDKeyByIndex(identityIndex, 2); + + const encryptionPublicKey = new IdentityPublicKeyWithWitness(1); + encryptionPublicKey.setId(numKeys + 1); + encryptionPublicKey.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.MEDIUM); + encryptionPublicKey.setPurpose(IdentityPublicKey.PURPOSES.ENCRYPTION); + encryptionPublicKey.setContractBounds(dataContract.getId(), 'contact'); + encryptionPublicKey.setData(encryptionPrivateKey.toPublicKey().toBuffer()); + + const decryptionPublicKey = new IdentityPublicKeyWithWitness(1); + decryptionPublicKey.setId(numKeys + 2); + decryptionPublicKey.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.MEDIUM); + decryptionPublicKey.setPurpose(IdentityPublicKey.PURPOSES.DECRYPTION); + decryptionPublicKey.setContractBounds(dataContract.getId(), 'contact'); + decryptionPublicKey.setData(decryptionPrivateKey.toPublicKey().toBuffer()); + + const update = { + add: [encryptionPublicKey, decryptionPublicKey], + }; + + await bobClient.platform.identities.update( + bobIdentity, + update, + { + [encryptionPublicKey.getId()]: encryptionPrivateKey, + [decryptionPublicKey.getId()]: decryptionPrivateKey, + }, + ); + + await waitForSTPropagated(); + + const { identitiesKeys } = await bobClient.getDAPIClient().platform + .getIdentitiesContractKeys( + [bobIdentity.getId()], + dataContract.getId(), + [IdentityPublicKey.PURPOSES.ENCRYPTION, IdentityPublicKey.PURPOSES.DECRYPTION], + 'contact', + ); + + const bobKeys = identitiesKeys[bobIdentity.getId().toString()]; + expect(bobKeys).to.exist(); + expect(bobKeys[IdentityPublicKey.PURPOSES.ENCRYPTION]).to.have.length(1); + expect(bobKeys[IdentityPublicKey.PURPOSES.DECRYPTION]).to.have.length(1); + }); }); describe('Alice', () => { diff --git a/packages/platform-test-suite/test/e2e/dpns.spec.js b/packages/platform-test-suite/test/e2e/dpns.spec.js index e8cc3218a48..af1f275284c 100644 --- a/packages/platform-test-suite/test/e2e/dpns.spec.js +++ b/packages/platform-test-suite/test/e2e/dpns.spec.js @@ -59,7 +59,7 @@ describe('DPNS', () => { before(async () => { ownerClient = await createClientWithFundedWallet( - 10000, + 200000, process.env.DPNS_OWNER_PRIVATE_KEY, ); @@ -67,7 +67,7 @@ describe('DPNS', () => { identity = await ownerClient.platform.identities.get(dpnsOwnerId); expect(identity).to.exist(); - await ownerClient.platform.identities.topUp(dpnsOwnerId, 500); + await ownerClient.platform.identities.topUp(dpnsOwnerId, 60000); }); after(async () => { @@ -92,13 +92,7 @@ describe('DPNS', () => { expect(createdTLD.getData().normalizedParentDomainName).to.equal(''); }); - // TODO(rs-drive-abci): restore - // There are two DataTriggerAction errors now. One is used in rs-drive-abci data trigger (new) - // And other is in dpp data trigger (old). New error is dispatched in this test, - // but it does not have binding yet. - // Decide what to do with rs-dpp data trigger and it's errors, - // and update bindings and test accordingly - it.skip('should not be able to update domain', async () => { + it('should not be able to update domain', async () => { createdTLD.set('label', 'anotherlabel'); let broadcastError; @@ -113,16 +107,10 @@ describe('DPNS', () => { expect(broadcastError).to.exist(); expect(broadcastError.message).to.be.equal('Action is not allowed'); - expect(broadcastError.code).to.equal(4001); + expect(broadcastError.code).to.equal(40500); }); - // TODO(rs-drive-abci): restore - // There are two DataTriggerAction errors now. One is used in rs-drive-abci data trigger (new) - // And other is in dpp data trigger (old). New error is dispatched in this test, - // but it does not have binding yet. - // Decide what to do with rs-dpp data trigger and it's errors, - // and update bindings and test accordingly - it.skip('should not be able to delete domain', async () => { + it('should not be able to delete domain', async () => { let broadcastError; try { @@ -135,7 +123,7 @@ describe('DPNS', () => { expect(broadcastError).to.exist(); expect(broadcastError.message).to.be.equal('Action is not allowed'); - expect(broadcastError.code).to.equal(4001); + expect(broadcastError.code).to.equal(40500); }); }); @@ -152,11 +140,7 @@ describe('DPNS', () => { } }); - // TODO(rs-drive-abci): test randomly returns StateTransition already in chain error, - // but it's happening because of retry attempts for the same ST. - // Underlying issue causing retry is different and should be debugged. - // (console.log error in dapi-client's GrpcTransport for more details) - it.skip('should not be able to register TLD', async () => { + it('should not be able to register TLD', async () => { let broadcastError; try { @@ -169,14 +153,10 @@ describe('DPNS', () => { expect(broadcastError).to.exist(); expect(broadcastError.message).to.be.equal('Can\'t create top level domain for this identity'); - expect(broadcastError.code).to.equal(4001); + expect(broadcastError.code).to.equal(40500); }); - // TODO(rs-drive-abci): test randomly returns StateTransition already in chain error, - // but it's happening because of retry attempts for the same ST. - // Underlying issue causing retry is different and should be debugged. - // (console.log error in dapi-client's GrpcTransport for more details) - it.skip('should be able to register a second level domain', async () => { + it('should be able to register a second level domain', async () => { registeredDomain = await client.platform.names.register(`${secondLevelDomain}0.${topLevelDomain}`, { dashUniqueIdentityId: identity.getId(), }, identity); @@ -185,11 +165,11 @@ describe('DPNS', () => { await waitForSTPropagated(); expect(registeredDomain.getType()).to.equal('domain'); - expect(registeredDomain.getData().label).to.equal(secondLevelDomain); + expect(registeredDomain.getData().label).to.equal(`${secondLevelDomain}0`); expect(registeredDomain.getData().normalizedParentDomainName).to.equal(topLevelDomain); }); - it.skip('should not be able register similar domain name', async () => { + it('should not be able register similar domain name', async () => { let broadcastError; try { @@ -205,19 +185,15 @@ describe('DPNS', () => { } expect(broadcastError).to.exist(); - expect(broadcastError.code).to.be.equal(4009); - expect(broadcastError.message).to.match(/Document \w* has duplicate unique properties \["normalizedLabel", "normalizedParentDomainName"] with other documents/); + expect(broadcastError.code).to.be.equal(40105); + expect(broadcastError.message).to.match(/Document \w* has duplicate unique properties \["normalizedParentDomainName", "normalizedLabel"] with other documents/); }); - // TODO(rs-drive-abci): test randomly returns StateTransition already in chain error, - // but it's happening because of retry attempts for the same ST. - // Underlying issue causing retry is different and should be debugged. - // (console.log error in dapi-client's GrpcTransport for more details) - it.skip('should not be able to register a subdomain for parent domain which is not exist', async () => { + it('should not be able to register a subdomain for parent domain which is not exist', async () => { let broadcastError; try { - const domain = `${getRandomDomain()}.${getRandomDomain()}.${topLevelDomain}`; + const domain = `${getRandomDomain()}.${getRandomDomain()}`; await client.platform.names.register(domain, { dashAliasIdentityId: identity.getId(), @@ -230,11 +206,10 @@ describe('DPNS', () => { expect(broadcastError).to.exist(); expect(broadcastError.message).to.be.equal('Parent domain is not present'); - expect(broadcastError.code).to.equal(4001); + expect(broadcastError.code).to.equal(40500); }); - // TODO(rs-drive-abci): restore - toObject mismatch (happens randomly) - it.skip('should be able to search a domain', async () => { + it('should be able to search a domain', async () => { const documents = await client.platform.names.search(secondLevelDomain, topLevelDomain); expect(documents).to.have.lengthOf(1); @@ -244,15 +219,13 @@ describe('DPNS', () => { expect(document.toObject()).to.deep.equal(registeredDomain.toObject()); }); - // TODO(rs-drive-abci): restore - toObject mismatch (happens randomly) - it.skip('should be able to resolve domain by it\'s name', async () => { - const document = await client.platform.names.resolve(`${secondLevelDomain}.${topLevelDomain}`); + it('should be able to resolve domain by it\'s name', async () => { + const document = await client.platform.names.resolve(`${secondLevelDomain}0.${topLevelDomain}`); expect(document.toObject()).to.deep.equal(registeredDomain.toObject()); }); - // TODO(rs-drive-abci): restore - toObject mismatch (happens randomly) - it.skip('should be able to resolve domain by it\'s record', async () => { + it('should be able to resolve domain by it\'s record', async () => { const [document] = await client.platform.names.resolveByRecord( 'dashUniqueIdentityId', registeredDomain.getData().records.dashUniqueIdentityId, @@ -261,13 +234,7 @@ describe('DPNS', () => { expect(document.toObject()).to.deep.equal(registeredDomain.toObject()); }); - // TODO(rs-drive-abci): restore - // There are two DataTriggerAction errors now. One is used in rs-drive-abci data trigger (new) - // And other is in dpp data trigger (old). New error is dispatched in this test, - // but it does not have binding yet. - // Decide what to do with rs-dpp data trigger and it's errors, - // and update bindings and test accordingly - it.skip('should not be able to update domain', async () => { + it('should not be able to update domain', async () => { registeredDomain.set('label', 'newlabel'); let broadcastError; @@ -284,16 +251,10 @@ describe('DPNS', () => { expect(broadcastError).to.exist(); expect(broadcastError.message).to.be.equal('Action is not allowed'); - expect(broadcastError.code).to.equal(4001); + expect(broadcastError.code).to.equal(40500); }); - // TODO(rs-drive-abci): restore - // There are two DataTriggerAction errors now. One is used in rs-drive-abci data trigger (new) - // And other is in dpp data trigger (old). New error is dispatched in this test, - // but it does not have binding yet. - // Decide what to do with rs-dpp data trigger and it's errors, - // and update bindings and test accordingly - it.skip('should not be able to delete domain', async () => { + it('should not be able to delete domain', async () => { let broadcastError; try { @@ -306,7 +267,7 @@ describe('DPNS', () => { expect(broadcastError).to.exist(); expect(broadcastError.message).to.be.equal('Action is not allowed'); - expect(broadcastError.code).to.equal(4001); + expect(broadcastError.code).to.equal(40500); }); it('should not be able to register two domains with same `dashAliasIdentityId` record'); diff --git a/packages/platform-test-suite/test/e2e/masternodeRewardShares.spec.js b/packages/platform-test-suite/test/e2e/masternodeRewardShares.spec.js deleted file mode 100644 index 24cb356d497..00000000000 --- a/packages/platform-test-suite/test/e2e/masternodeRewardShares.spec.js +++ /dev/null @@ -1,412 +0,0 @@ -const Dash = require('dash'); - -const { - contractId: masternodeRewardSharesContractId, -} = require('@dashevo/masternode-reward-shares-contract/lib/systemIds'); - -const generateRandomIdentifier = require('../../lib/test/utils/generateRandomIdentifier'); - -const createClientWithFundedWallet = require('../../lib/test/createClientWithFundedWallet'); -const waitForSTPropagated = require('../../lib/waitForSTPropagated'); - -const { - Core: { PrivateKey }, - PlatformProtocol: { IdentityPublicKeyWithWitness, IdentityPublicKey }, -} = Dash; - -describe('Masternode Reward Shares', () => { - let failed = false; - let client; - - before(async () => { - client = await createClientWithFundedWallet( - 10000000, - ); - - await client.platform.initialize(); - - const masternodeRewardSharesContract = await client.platform.contracts.get( - masternodeRewardSharesContractId, - ); - - client.getApps().set('masternodeRewardShares', { - contractId: masternodeRewardSharesContractId, - contract: masternodeRewardSharesContract, - }); - }); - - // Skip test if any prior test in this describe failed - beforeEach(function beforeEach() { - if (failed) { - this.skip(); - } - }); - - afterEach(function afterEach() { - failed = this.currentTest.state === 'failed'; - }); - - after(async () => { - if (client) { - await client.disconnect(); - } - }); - - describe('Data Contract', () => { - it('should exists', async () => { - const createdDataContract = await client.platform.contracts.get( - masternodeRewardSharesContractId, - ); - - expect(createdDataContract).to.exist(); - - expect(createdDataContract.getId().toString()).to.equal( - masternodeRewardSharesContractId, - ); - }); - }); - - // TODO(rs-drive-abci): test should be revisited and refined - // because rs-drive-abci does not allow updating masternode shares owner keys anymore - describe.skip('Masternode owner', () => { - let anotherIdentity; - let rewardShare; - let anotherRewardShare; - let masternodeOwnerMasterPrivateKey; - let masternodeOwnerIdentity; - let derivedPrivateKey; - let signaturePublicKeyId; - - before(async function before() { - if (!process.env.MASTERNODE_OWNER_PRO_REG_TX_HASH - || !process.env.MASTERNODE_OWNER_MASTER_PRIVATE_KEY) { - this.skip('masternode owner credentials are not set'); - } - - const masternodeOwnerIdentifier = Buffer.from(process.env.MASTERNODE_OWNER_PRO_REG_TX_HASH, 'hex'); - - masternodeOwnerIdentity = await client.platform.identities.get(masternodeOwnerIdentifier); - - masternodeOwnerMasterPrivateKey = process.env.MASTERNODE_OWNER_MASTER_PRIVATE_KEY; - - // Masternode identity should exist - expect(masternodeOwnerIdentity).to.exist(); - - await client.platform.identities.topUp(masternodeOwnerIdentity.getId(), 2500000); - - // Additional wait time to mitigate testnet latency - await waitForSTPropagated(); - - // Since we cannot create "High" level key for masternode Identities automatically, - // (this key is used to sign state transitions, other than "update") - // we add this key here - - signaturePublicKeyId = masternodeOwnerIdentity.getPublicKeyMaxId() + 1; - - // Get Masternode Rewards Share Contract owner account - const account = await client.platform.client.getWalletAccount(); - - ({ privateKey: derivedPrivateKey } = account - .identities - .getIdentityHDKeyByIndex( - 1000, - signaturePublicKeyId, - )); - - const identityPublicKey = derivedPrivateKey.toPublicKey().toBuffer(); - - const newPublicKey = new IdentityPublicKeyWithWitness( - { - id: signaturePublicKeyId, - type: IdentityPublicKey.TYPES.ECDSA_SECP256K1, - purpose: IdentityPublicKey.PURPOSES.AUTHENTICATION, - securityLevel: IdentityPublicKey.SECURITY_LEVELS.HIGH, - data: identityPublicKey, - readOnly: false, - signature: Buffer.alloc(0), - }, - ); - - const update = { - add: [newPublicKey], - }; - - const stateTransition = client.platform.dpp.identity.createIdentityUpdateTransition( - masternodeOwnerIdentity, - update, - ); - - const signerKey = masternodeOwnerIdentity.getPublicKeys()[0]; - - const updatedKeys = []; - const promises = stateTransition.getPublicKeysToAdd().map(async (publicKey) => { - stateTransition.setSignaturePublicKeyId(signerKey.getId()); - - await stateTransition.signByPrivateKey(derivedPrivateKey.toBuffer(), publicKey.getType()); - - publicKey.setSignature(stateTransition.getSignature()); - updatedKeys.push(publicKey); - - stateTransition.setSignature(undefined); - stateTransition.setSignaturePublicKeyId(undefined); - }); - - await Promise.all(promises); - stateTransition.setPublicKeysToAdd(updatedKeys); - - stateTransition.setSignaturePublicKeyId(0); - await stateTransition.signByPrivateKey( - new PrivateKey(masternodeOwnerMasterPrivateKey).toBuffer(), - IdentityPublicKey.TYPES.ECDSA_SECP256K1, - ); - - await client.platform.broadcastStateTransition( - stateTransition, - ); - - // Additional wait time to mitigate testnet latency - await waitForSTPropagated(); - - // Re-fetch identity after it got updated - masternodeOwnerIdentity = await client.platform.identities.get(masternodeOwnerIdentifier); - }); - - it('should be able to create reward shares with existing identity', async () => { - anotherIdentity = await client.platform.identities.register(100000); - - // Additional wait time to mitigate testnet latency - await waitForSTPropagated(); - - rewardShare = await client.platform.documents.create( - 'masternodeRewardShares.rewardShare', - masternodeOwnerIdentity, - { - payToId: anotherIdentity.getId(), - percentage: 1, - }, - ); - - const stateTransition = client.platform.dpp.document.createStateTransition({ - create: [rewardShare], - }); - - await stateTransition.sign( - masternodeOwnerIdentity.getPublicKeyById(signaturePublicKeyId), - derivedPrivateKey.toBuffer(), - ); - - await client.platform.broadcastStateTransition( - stateTransition, - ); - }); - - it('should not be able to create reward shares with non-existing identity', async () => { - const payToId = await generateRandomIdentifier(); - - const invalidRewardShare = await client.platform.documents.create( - 'masternodeRewardShares.rewardShare', - masternodeOwnerIdentity, - { - payToId, - percentage: 1, - }, - ); - - const stateTransition = client.platform.dpp.document.createStateTransition({ - create: [invalidRewardShare], - }); - - await stateTransition.sign( - masternodeOwnerIdentity.getPublicKeyById(signaturePublicKeyId), - derivedPrivateKey.toBuffer(), - ); - - try { - await client.platform.broadcastStateTransition( - stateTransition, - ); - - expect.fail('should throw broadcast error'); - } catch (e) { - expect(e.message).to.be.equal(`Identity '${payToId}' doesn't exist`); - expect(e.code).to.equal(4001); - } - }); - - it('should be able to update reward shares with existing identity', async () => { - const percentage = 2; - rewardShare.set('percentage', percentage); - - const stateTransition = client.platform.dpp.document.createStateTransition({ - replace: [rewardShare], - }); - - await stateTransition.sign( - masternodeOwnerIdentity.getPublicKeyById(signaturePublicKeyId), - derivedPrivateKey.toBuffer(), - ); - - await client.platform.broadcastStateTransition( - stateTransition, - ); - - // Additional wait time to mitigate testnet latency - await waitForSTPropagated(); - - const [updatedRewardShare] = await client.platform.documents.get('masternodeRewardShares.rewardShare', { - where: [['$id', '==', rewardShare.getId()]], - }); - - expect(updatedRewardShare).to.exists(); - - // TODO: check this case. - // rewardShare.set() can not accept bigint, however rewardShare.get() - // returns bigint. - expect(updatedRewardShare.get('percentage')).equals(BigInt(percentage)); - }); - - it('should not be able to update reward shares with non-existing identity', async () => { - const payToId = await generateRandomIdentifier(); - - [rewardShare] = await client.platform.documents.get( - 'masternodeRewardShares.rewardShare', - { where: [['$id', '==', rewardShare.getId()]] }, - ); - - rewardShare.set('payToId', payToId); - - const stateTransition = client.platform.dpp.document.createStateTransition({ - replace: [rewardShare], - }); - - await stateTransition.sign( - masternodeOwnerIdentity.getPublicKeyById(signaturePublicKeyId), - derivedPrivateKey.toBuffer(), - ); - - try { - await client.platform.broadcastStateTransition( - stateTransition, - ); - - expect.fail('should throw broadcast error'); - } catch (e) { - expect(e.message).to.be.equal(`Identity '${payToId}' doesn't exist`); - expect(e.code).to.equal(4001); - } - }); - - it('should not be able to share more than 100% of rewards', async () => { - anotherIdentity = await client.platform.identities.register(100000); - - // Additional wait time to mitigate testnet latency - await waitForSTPropagated(); - - anotherRewardShare = await client.platform.documents.create( - 'masternodeRewardShares.rewardShare', - masternodeOwnerIdentity, - { - payToId: anotherIdentity.getId(), - percentage: 9999, // it will be 10001 in summary - }, - ); - - const stateTransition = client.platform.dpp.document.createStateTransition({ - create: [anotherRewardShare], - }); - - await stateTransition.sign( - masternodeOwnerIdentity.getPublicKeyById(signaturePublicKeyId), - derivedPrivateKey.toBuffer(), - ); - - try { - await client.platform.broadcastStateTransition( - stateTransition, - ); - - expect.fail('should throw broadcast error'); - } catch (e) { - expect(e.message).to.be.equal('Percentage can not be more than 10000'); - expect(e.code).to.equal(4001); - } - }); - - it('should be able to remove reward shares', async () => { - const stateTransition = client.platform.dpp.document.createStateTransition({ - delete: [rewardShare], - }); - - await stateTransition.sign( - masternodeOwnerIdentity.getPublicKeyById(signaturePublicKeyId), - derivedPrivateKey.toBuffer(), - ); - - await client.platform.broadcastStateTransition( - stateTransition, - ); - - // Additional wait time to mitigate testnet latency - await waitForSTPropagated(); - - const [storedDocument] = await client.platform.documents.get( - 'masternodeRewardShares.rewardShare', - { where: [['$id', '==', rewardShare.getId()]] }, - ); - - expect(storedDocument).to.not.exist(); - }); - }); - - // TODO(rs-drive-abci): restore. Apparently there's a bug that allows - // regular Identities to assign reward shares. - describe.skip('Any Identity', () => { - let identity; - - before(async () => { - identity = await client.platform.identities.register(200000); - - // Additional wait time to mitigate testnet latency - await waitForSTPropagated(); - }); - - it('should not be able to share rewards', async () => { - const rewardShare = await client.platform.documents.create( - 'masternodeRewardShares.rewardShare', - identity, - { - payToId: await generateRandomIdentifier(), - percentage: 1, - }, - ); - const stateTransition = client.platform.dpp.document.createStateTransition({ - create: [rewardShare], - }); - - stateTransition.setSignaturePublicKeyId(1); - - const account = await client.getWalletAccount(); - - const { privateKey } = account.identities.getIdentityHDKeyById( - identity.getId().toString(), - 1, - ); - - await stateTransition.sign( - identity.getPublicKeyById(1), - privateKey.toBuffer(), - ); - - try { - await client.platform.documents.broadcast({ - create: [rewardShare], - }, identity); - - expect.fail('should throw broadcast error'); - } catch (e) { - expect(e.message).to.be.equal('Only masternode identities can share rewards'); - expect(e.code).to.equal(4001); - } - }); - }); -}); diff --git a/packages/platform-test-suite/test/e2e/wallet.spec.js b/packages/platform-test-suite/test/e2e/wallet.spec.js index d988f6b2547..241ba81204b 100644 --- a/packages/platform-test-suite/test/e2e/wallet.spec.js +++ b/packages/platform-test-suite/test/e2e/wallet.spec.js @@ -7,11 +7,12 @@ const waitForBalanceToChange = require('../../lib/test/waitForBalanceToChange'); const { EVENTS } = Dash.WalletLib; -describe('e2e', () => { +describe('e2e', function e2eTest() { + this.bail(true); + describe('Wallet', function main() { this.timeout(950000); - let failed = false; let fundedWallet; let fundedAccount; let emptyWallet; @@ -23,7 +24,16 @@ describe('e2e', () => { let firstTransaction; let secondTransaction; - before(async () => { + before(async function createClients() { + // TODO: temporarily disabled on browser because of header stream is not syncing + // headers at some point. Our theory is that because wallets aren't offloading properly + // and we have too many streams open. + if (typeof window !== 'undefined') { + this.skip('temporarily disabled on browser because of header stream is not syncing' + + ' headers at some point. Our theory is that because wallets aren\'t offloading' + + ' properly and we have too many streams open.'); + } + fundedWallet = await createClientWithFundedWallet(10000); const network = process.env.NETWORK; emptyWallet = new Dash.Client({ @@ -39,17 +49,6 @@ describe('e2e', () => { emptyWalletHeight = storage.getChainStore(storage.application.network).state.chainHeight; }); - // Skip test if any prior test in this describe failed - beforeEach(function beforeEach() { - if (failed) { - this.skip(); - } - }); - - afterEach(function afterEach() { - failed = this.currentTest.state === 'failed'; - }); - after(async () => { if (fundedWallet) { await fundedWallet.disconnect(); diff --git a/packages/platform-test-suite/test/e2e/withdrawals.spec.js b/packages/platform-test-suite/test/e2e/withdrawals.spec.js new file mode 100644 index 00000000000..f168d49669f --- /dev/null +++ b/packages/platform-test-suite/test/e2e/withdrawals.spec.js @@ -0,0 +1,284 @@ +const { expect } = require('chai'); + +const wait = require('@dashevo/dapi-client/lib/utils/wait'); +const { STATUSES: WITHDRAWAL_STATUSES } = require('dash/build/SDK/Client/Platform/methods/identities/creditWithdrawal'); + +const createClientWithFundedWallet = require('../../lib/test/createClientWithFundedWallet'); +const waitForSTPropagated = require('../../lib/waitForSTPropagated'); + +describe('Withdrawals', function withdrawalsTest() { + this.bail(true); + + let client; + let identity; + + before(async function createClients() { + // TODO: temporarily disabled on browser because of header stream is not syncing + // headers at some point. Our theory is that because wallets aren't offloading properly + // and we have too many streams open. + if (typeof window !== 'undefined') { + this.skip('temporarily disabled on browser because of header stream is not syncing' + + ' headers at some point. Our theory is that because wallets aren\'t offloading properly' + + ' and we have too many streams open.'); + } + + client = await createClientWithFundedWallet( + 10000000, + ); + + await client.platform.initialize(); + }); + + after(async () => { + if (client) { + await client.disconnect(); + } + }); + + describe('Any Identity', () => { + const INITIAL_BALANCE = 1000000; + + before(async () => { + identity = await client.platform.identities.register(INITIAL_BALANCE); + + // Additional wait time to mitigate testnet latency + await waitForSTPropagated(); + }); + + it('should be able to withdraw credits', async () => { + const account = await client.getWalletAccount(); + const walletBalanceBefore = account.getTotalBalance(); + const identityBalanceBefore = identity.getBalance(); + const withdrawTo = await account.getUnusedAddress(); + const amountToWithdraw = 1000000; + + await client.platform.identities.withdrawCredits( + identity, + BigInt(amountToWithdraw), + withdrawTo.address, + ); + + // Re-fetch identity to obtain latest core chain lock height + identity = await client.platform.identities.get(identity.getId()); + const identityMetadata = identity.getMetadata().toObject(); + const { coreChainLockedHeight: initialCoreChainLockedHeight } = identityMetadata; + + // Wait for core chain lock update. + // After that drive should update document status to completed. + // (Wait 2 chainlocks on regtest since they are processed quicker, + // and withdrawal might not complete yet) + const chainLocksToWait = process.env.NETWORK === 'regtest' ? 2 : 1; + const { promise } = await client.platform.identities.utils + .waitForCoreChainLockedHeight(initialCoreChainLockedHeight + chainLocksToWait); + await promise; + + // Wait for document completion to propagate + await waitForSTPropagated(); + + // Wait for document status to be changed to COMPLETED. + let withdrawalCompleted = false; + let withdrawalDocument; + for (let i = 0; i < 10; i++) { + const withdrawals = await client.platform + .documents.get( + 'withdrawals.withdrawal', + { + where: [['$ownerId', '==', identity.getId()]], + }, + ); + + withdrawalDocument = withdrawals[withdrawals.length - 1]; + withdrawalCompleted = withdrawalDocument.get('status') === WITHDRAWAL_STATUSES.COMPLETED; + + if (withdrawalCompleted) { + break; + } + + await waitForSTPropagated(); + } + + expect(withdrawalCompleted).to.be.true(); + + const walletBalanceUpdated = account.getTotalBalance(); + + identity = await client.platform.identities.get(identity.getId()); + const identityBalanceUpdated = identity.getBalance(); + + // Should ensure balances are right + expect(walletBalanceUpdated).to.be.greaterThan(walletBalanceBefore); + expect(identityBalanceUpdated).to.be.lessThan(identityBalanceBefore); + + // Should allow deleting of the withdrawal document + await client.platform.documents.broadcast({ + delete: [withdrawalDocument], + }, identity); + }); + + it('should be able to query recent withdrawal updates', async () => { + const account = await client.getWalletAccount(); + const withdrawTo = await account.getUnusedAddress(); + const amountToWithdraw = 1000000; + + const firstWithdrawalTime = Date.now(); + const { height: withdrawalHeight } = await client.platform.identities.withdrawCredits( + identity, + BigInt(amountToWithdraw), + withdrawTo.address, + ); + + let withdrawalBroadcasted = false; + let blocksPassed = 0; + + // Wait for first withdrawal to broadcast + while (!withdrawalBroadcasted && blocksPassed === 0) { + await waitForSTPropagated(); + + const withdrawals = await client.platform + .documents.get( + 'withdrawals.withdrawal', + { + where: [ + ['$ownerId', '==', identity.getId()], + ['$updatedAt', '>', firstWithdrawalTime], + ], + orderBy: [ + ['$updatedAt', 'desc'], + ], + }, + ); + + // We want to ensure that our index works properly with updatedAt + // condition, and we are not receiving the document from previous test + expect(withdrawals.length).to.equal(1); + + const withdrawal = withdrawals[0]; + + withdrawalBroadcasted = withdrawal.get('status') === WITHDRAWAL_STATUSES.BROADCASTED; + + blocksPassed = withdrawal.getMetadata() + .getBlockHeight() - withdrawalHeight; + } + + expect(withdrawalBroadcasted).to.be.true(); + }); + + it('should not be able to withdraw more than balance available', async () => { + const account = await client.getWalletAccount(); + const identityBalanceBefore = identity.getBalance(); + const withdrawTo = await account.getUnusedAddress(); + const amountToWithdraw = identityBalanceBefore * 2; + + await expect(client.platform.identities.withdrawCredits( + identity, + BigInt(amountToWithdraw), + withdrawTo.address, + )).to.be.rejectedWith(`Withdrawal amount "${amountToWithdraw}" is bigger that identity balance "${identityBalanceBefore}"`); + }); + + it('should not allow to create withdrawal with wrong security key type', async () => { + const account = await client.getWalletAccount(); + const identityBalanceBefore = identity.getBalance(); + const withdrawTo = await account.getUnusedAddress(); + const amountToWithdraw = identityBalanceBefore / 2; + + await expect(client.platform.identities.withdrawCredits( + identity, + BigInt(amountToWithdraw), + withdrawTo.address, + { + signingKeyIndex: 1, + }, + )).to.be.rejectedWith('Error conversion not implemented: Invalid public key security level HIGH. The state transition requires one of CRITICAL'); + }); + + it('should not be able to create withdrawal document', async () => { + const withdrawal = await client.platform.documents.create( + 'withdrawals.withdrawal', + identity, + { + amount: 1000, + coreFeePerByte: 1365, + pooling: 0, + outputScript: Buffer.alloc(23), + status: 0, + }, + ); + + try { + await client.platform.documents.broadcast({ + create: [withdrawal], + }, identity); + + expect.fail('should throw broadcast error'); + } catch (e) { + expect(e.message).to.be.equal('Action is not allowed'); + expect(e.code).to.equal(40500); + } + }); + + it('should not be able to delete incomplete withdrawal document', async () => { + const account = await client.getWalletAccount(); + const withdrawTo = await account.getUnusedAddress(); + + await client.platform.identities.withdrawCredits( + identity, + BigInt(1000000), + withdrawTo.address, + ); + + await waitForSTPropagated(); + + let withdrawalBroadcasted = false; + let withdrawalDocument; + // Wait for withdrawal to broadcast, otherwise there's a chance + // that test will try update document at the same time with the drive itself + while (!withdrawalBroadcasted) { + ([withdrawalDocument] = await client.platform + .documents.get( + 'withdrawals.withdrawal', + { + where: [['$ownerId', '==', identity.getId()]], + }, + )); + + withdrawalBroadcasted = withdrawalDocument.get('status') === WITHDRAWAL_STATUSES.BROADCASTED; + + await wait(1000); + } + + try { + await client.platform.documents.broadcast({ + delete: [withdrawalDocument], + }, identity); + + expect.fail('should throw broadcast error'); + } catch (e) { + expect(e.message).to.be.equal('withdrawal deletion is allowed only for COMPLETE statuses'); + expect(e.code).to.equal(40500); + } + }); + + it('should not be able to update withdrawal document', async () => { + const [withdrawalDocument] = await client.platform + .documents.get( + 'withdrawals.withdrawal', + { + where: [['$ownerId', '==', identity.getId()]], + }, + ); + + withdrawalDocument.set('status', 3); + + try { + await client.platform.documents.broadcast({ + replace: [withdrawalDocument], + }, identity); + + expect.fail('should throw broadcast error'); + } catch (e) { + expect(e.message).to.be.equal('Action is not allowed'); + expect(e.code).to.equal(40500); + } + }); + }); +}); diff --git a/packages/platform-test-suite/test/functional/core/getBlock.spec.js b/packages/platform-test-suite/test/functional/core/getBlock.spec.js index 792baa5bf26..8a1de774d7d 100644 --- a/packages/platform-test-suite/test/functional/core/getBlock.spec.js +++ b/packages/platform-test-suite/test/functional/core/getBlock.spec.js @@ -4,7 +4,7 @@ const createClientWithoutWallet = require('../../../lib/test/createClientWithout const { Core: { Block }, Essentials: { Buffer } } = Dash; -describe('Core', () => { +describe.skip('Core', () => { describe('getBlock', () => { let client; @@ -29,8 +29,7 @@ describe('Core', () => { }); it('should get block by height', async () => { - const { chain: { blocksCount: bestBlockHeight } } = await client - .getDAPIClient().core.getStatus(); + const bestBlockHeight = await client.getDAPIClient().core.getBestBlockHeight(); const blockBinary = await client.getDAPIClient().core.getBlockByHeight(bestBlockHeight); diff --git a/packages/platform-test-suite/test/functional/core/getBlockHash.spec.js b/packages/platform-test-suite/test/functional/core/getBlockHash.spec.js index 2c1bbdd61a6..b7df1e3b884 100644 --- a/packages/platform-test-suite/test/functional/core/getBlockHash.spec.js +++ b/packages/platform-test-suite/test/functional/core/getBlockHash.spec.js @@ -8,8 +8,8 @@ describe('Core', () => { before(async () => { client = createClientWithoutWallet(); - ({ chain: { blocksCount: lastBlockHeight } } = await client - .getDAPIClient().core.getStatus()); + lastBlockHeight = await client + .getDAPIClient().core.getBestBlockHeight(); }); after(async () => { diff --git a/packages/platform-test-suite/test/functional/core/getBlockchainStatus.spec.js b/packages/platform-test-suite/test/functional/core/getBlockchainStatus.spec.js new file mode 100644 index 00000000000..780e2da5887 --- /dev/null +++ b/packages/platform-test-suite/test/functional/core/getBlockchainStatus.spec.js @@ -0,0 +1,54 @@ +const { Essentials: { Buffer } } = require('dash'); + +const createClientWithoutWallet = require('../../../lib/test/createClientWithoutWallet'); + +describe('Core', () => { + describe('getBlockchainStatus', function main() { + let client; + + this.timeout(160000); + + before(() => { + client = createClientWithoutWallet(); + }); + + after(async () => { + if (client) { + await client.disconnect(); + } + }); + + it('should return status', async () => { + const result = await client.getDAPIClient().core.getBlockchainStatus(); + + const { + version, time, status, syncProgress, chain, network, + } = result; + + expect(version.protocol).to.be.a('number'); + expect(version.software).to.be.a('number'); + expect(version.agent).to.be.a('string'); + + expect(time.now).to.be.a('number'); + expect(time.offset).to.be.a('number'); + expect(time.median).to.be.a('number'); + + expect(status).to.be.a('string'); + + expect(syncProgress).to.be.a('number'); + + expect(chain.name).to.be.a('string'); + expect(chain.headersCount).to.be.a('number'); + expect(chain.blocksCount).to.be.a('number'); + expect(chain.bestBlockHash).to.be.an.instanceOf(Buffer); + expect(chain.difficulty).to.be.a('number'); + expect(chain.chainWork).to.be.an.instanceOf(Buffer); + expect(chain.isSynced).to.be.a('boolean'); + expect(chain.syncProgress).to.be.a('number'); + + expect(network.peersCount).to.be.a('number'); + expect(network.fee.relay).to.be.a('number'); + expect(network.fee.incremental).to.be.a('number'); + }); + }); +}); diff --git a/packages/platform-test-suite/test/functional/core/getMasternodeStatus.spec.js b/packages/platform-test-suite/test/functional/core/getMasternodeStatus.spec.js new file mode 100644 index 00000000000..eb473c739ca --- /dev/null +++ b/packages/platform-test-suite/test/functional/core/getMasternodeStatus.spec.js @@ -0,0 +1,35 @@ +const { Essentials: { Buffer } } = require('dash'); + +const createClientWithoutWallet = require('../../../lib/test/createClientWithoutWallet'); + +describe.skip('Core', () => { + describe('getMasternodeStatus', function main() { + let client; + + this.timeout(160000); + + before(() => { + client = createClientWithoutWallet(); + }); + + after(async () => { + if (client) { + await client.disconnect(); + } + }); + + it('should return status', async () => { + const result = await client.getDAPIClient().core.getMasternodeStatus(); + + const { + status, proTxHash, posePenalty, isSynced, syncProgress, + } = result; + + expect(status).to.be.a('string'); + expect(proTxHash).to.be.an.instanceOf(Buffer); + expect(posePenalty).to.be.a('number'); + expect(isSynced).to.be.a('boolean'); + expect(syncProgress).to.be.a('number'); + }); + }); +}); diff --git a/packages/platform-test-suite/test/functional/core/getStatus.spec.js b/packages/platform-test-suite/test/functional/core/getStatus.spec.js deleted file mode 100644 index ae8c56aa5b6..00000000000 --- a/packages/platform-test-suite/test/functional/core/getStatus.spec.js +++ /dev/null @@ -1,60 +0,0 @@ -const { Essentials: { Buffer } } = require('dash'); - -const createClientWithoutWallet = require('../../../lib/test/createClientWithoutWallet'); - -describe('Core', () => { - describe('getStatus', function main() { - let client; - - this.timeout(160000); - - before(() => { - client = createClientWithoutWallet(); - }); - - after(async () => { - if (client) { - await client.disconnect(); - } - }); - - it('should return status', async () => { - const result = await client.getDAPIClient().core.getStatus(); - - const { - version, time, status, syncProgress, chain, masternode, network, - } = result; - - expect(version.protocol).to.be.a('number'); - expect(version.software).to.be.a('number'); - expect(version.agent).to.be.a('string'); - - expect(time.now).to.be.a('number'); - expect(time.offset).to.be.a('number'); - expect(time.median).to.be.a('number'); - - expect(status).to.be.a('string'); - - expect(syncProgress).to.be.a('number'); - - expect(chain.name).to.be.a('string'); - expect(chain.headersCount).to.be.a('number'); - expect(chain.blocksCount).to.be.a('number'); - expect(chain.bestBlockHash).to.be.an.instanceOf(Buffer); - expect(chain.difficulty).to.be.a('number'); - expect(chain.chainWork).to.be.an.instanceOf(Buffer); - expect(chain.isSynced).to.be.a('boolean'); - expect(chain.syncProgress).to.be.a('number'); - - expect(masternode.status).to.be.a('string'); - expect(masternode.proTxHash).to.be.an.instanceOf(Buffer); - expect(masternode.posePenalty).to.be.a('number'); - expect(masternode.isSynced).to.be.a('boolean'); - expect(masternode.syncProgress).to.be.a('number'); - - expect(network.peersCount).to.be.a('number'); - expect(network.fee.relay).to.be.a('number'); - expect(network.fee.incremental).to.be.a('number'); - }); - }); -}); diff --git a/packages/platform-test-suite/test/functional/dapi/subscribeToBlockHeadersWithChainLocksHandlerFactory.spec.js b/packages/platform-test-suite/test/functional/dapi/subscribeToBlockHeadersWithChainLocksHandlerFactory.spec.js index ca039d2152f..1ee274c38e1 100644 --- a/packages/platform-test-suite/test/functional/dapi/subscribeToBlockHeadersWithChainLocksHandlerFactory.spec.js +++ b/packages/platform-test-suite/test/functional/dapi/subscribeToBlockHeadersWithChainLocksHandlerFactory.spec.js @@ -7,7 +7,6 @@ const createClientWithFundedWallet = require('../../../lib/test/createClientWith const { Core: { - Block, BlockHeader, ChainLock, }, @@ -76,7 +75,6 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { let sdkClient; const network = process.env.NETWORK; - let bestBlock; let bestBlockHeight; beforeEach(async () => { @@ -85,11 +83,7 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { seeds: getDAPISeeds(), }); - const bestBlockHash = await dapiClient.core.getBestBlockHash(); - bestBlock = new Block( - await dapiClient.core.getBlockByHash(bestBlockHash), - ); - bestBlockHeight = bestBlock.transactions[0].extraPayload.height; + bestBlockHeight = await dapiClient.core.getBestBlockHeight(); }); after(async () => { @@ -133,6 +127,7 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { streamError = e; }); + // TODO: Use promise instead of loop while (!streamEnded) { if (streamError) { throw streamError; @@ -142,18 +137,20 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { expect(streamError).to.not.exist(); expect(streamEnded).to.be.true(); - // TODO: fetching blocks one by one takes too long. Implement getBlockHeaders in dapi-client - const fetchedBlocks = []; - - for (let i = 1; i <= headersAmount; i++) { - const rawBlock = await dapiClient.core.getBlockByHeight(i); - const block = new Block(rawBlock); - - fetchedBlocks.push(block); - } - - expect(historicalBlockHeaders.map((header) => header.hash)) - .to.deep.equal(fetchedBlocks.map((block) => block.header.hash)); + // TODO: Implement getBlockHeaders in dapi-client so we can compare block hashes + // const fetchedBlocks = []; + // + // for (let i = 1; i <= headersAmount; i++) { + // const rawBlock = await dapiClient.core.getBlockByHeight(i); + // const block = new Block(rawBlock); + // + // fetchedBlocks.push(block); + // } + // + // expect(historicalBlockHeaders.map((header) => header.hash)) + // .to.deep.equal(fetchedBlocks.map((block) => block.header.hash)); + + expect(historicalBlockHeaders.length).to.equal(headersAmount); expect(bestChainLock.height).to.exist(); }); @@ -216,6 +213,7 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { await account.broadcastTransaction(transaction); + // TODO: Use promise instead of loop // Wait for stream ending while (!streamEnded) { if (streamError) { @@ -227,19 +225,20 @@ describe('subscribeToBlockHeadersWithChainLocksHandlerFactory', () => { expect(streamError).to.not.exist(); - // TODO: fetching blocks one by one takes too long. Implement getBlockHeaders in dapi-client - const fetchedHistoricalBlocks = []; - - for (let i = bestBlockHeight - historicalBlocksToGet + 1; i <= bestBlockHeight; i++) { - const rawBlock = await dapiClient.core.getBlockByHeight(i); - const block = new Block(rawBlock); - - fetchedHistoricalBlocks.push(block); - } - - for (let i = 0; i < historicalBlocksToGet; i++) { - expect(fetchedHistoricalBlocks[i].header.hash).to.equal([...blockHeadersHashesFromStream][i]); - } + // TODO: Implement getBlockHeaders in dapi-client to compare block hashes + // const fetchedHistoricalBlocks = []; + // + // for (let i = bestBlockHeight - historicalBlocksToGet + 1; i <= bestBlockHeight; i++) { + // const rawBlock = await dapiClient.core.getBlockByHeight(i); + // const block = new Block(rawBlock); + // + // fetchedHistoricalBlocks.push(block); + // } + // + // for (let i = 0; i < historicalBlocksToGet; i++) { + // expect(fetchedHistoricalBlocks[i].header.hash).to.equal( + // [...blockHeadersHashesFromStream][i]); + // } expect(obtainedFreshBlock).to.be.true(); expect(latestChainLock).to.exist(); diff --git a/packages/platform-test-suite/test/functional/platform/DataContract.spec.js b/packages/platform-test-suite/test/functional/platform/DataContract.spec.js index 8623aa0cf18..28fe50b14ec 100644 --- a/packages/platform-test-suite/test/functional/platform/DataContract.spec.js +++ b/packages/platform-test-suite/test/functional/platform/DataContract.spec.js @@ -12,7 +12,7 @@ const { PlatformProtocol: { IdentityNotFoundError, InvalidDataContractVersionError, - IncompatibleDataContractSchemaError, + IncompatibleDocumentTypeSchemaError, }, } = Dash; @@ -25,12 +25,14 @@ describe('Platform', () => { let identity; before(async () => { - dataContractFixture = await getDataContractFixture(); client = await createClientWithFundedWallet(35000000); // Looks like updating the contact and keeping history requires about // 7 million credits in fees. Investigate this further. identity = await client.platform.identities.register(30000000); + const nextNonce = await client.platform + .nonceManager.bumpIdentityNonce(identity.getId()); + dataContractFixture = await getDataContractFixture(nextNonce); }); after(async () => { @@ -42,7 +44,7 @@ describe('Platform', () => { it('should fail to create new data contract with unknown owner', async () => { // if no identity is specified // random is generated within the function - dataContractFixture = await getDataContractFixture(); + dataContractFixture = await getDataContractFixture(1); let broadcastError; @@ -53,7 +55,7 @@ describe('Platform', () => { } expect(broadcastError).to.be.an.instanceOf(StateTransitionBroadcastError); - expect(broadcastError.getCause().getCode()).to.equal(2000); + expect(broadcastError.getCause().getCode()).to.equal(20000); expect(broadcastError.getCause()).to.be.an.instanceOf(IdentityNotFoundError); }); @@ -61,7 +63,9 @@ describe('Platform', () => { // Additional wait time to mitigate testnet latency await waitForSTPropagated(); - dataContractFixture = await getDataContractFixture(identity.getId()); + const identityNonce = await client.platform.nonceManager + .bumpIdentityNonce(identity.getId()); + dataContractFixture = await getDataContractFixture(identityNonce, identity.getId()); await client.platform.contracts.publish(dataContractFixture, identity); }); @@ -97,11 +101,10 @@ describe('Platform', () => { } expect(broadcastError).to.be.an.instanceOf(StateTransitionBroadcastError); - expect(broadcastError.getCause().getCode()).to.equal(1050); + expect(broadcastError.getCause().getCode()).to.equal(10212); expect(broadcastError.getCause()).to.be.an.instanceOf(InvalidDataContractVersionError); }); - // TODO(versioning): this test is not passing it('should not be able to update an existing data contract if schema is not backward compatible', async () => { // Additional wait time to mitigate testnet latency await waitForSTPropagated(); @@ -123,8 +126,8 @@ describe('Platform', () => { } expect(broadcastError).to.be.an.instanceOf(StateTransitionBroadcastError); - expect(broadcastError.getCause().getCode()).to.equal(1051); - expect(broadcastError.getCause()).to.be.an.instanceOf(IncompatibleDataContractSchemaError); + expect(broadcastError.getCause().getCode()).to.equal(10246); + expect(broadcastError.getCause()).to.be.an.instanceOf(IncompatibleDocumentTypeSchemaError); }); it('should be able to update an existing data contract', async () => { diff --git a/packages/platform-test-suite/test/functional/platform/Document.spec.js b/packages/platform-test-suite/test/functional/platform/Document.spec.js index 9d96259d863..55b5c03a489 100644 --- a/packages/platform-test-suite/test/functional/platform/Document.spec.js +++ b/packages/platform-test-suite/test/functional/platform/Document.spec.js @@ -18,6 +18,16 @@ const { }, } = Dash; +const getDocumentObject = (document) => { + const documentObject = document.toObject(); + + // Delete createdAt and updatedAt fields because they could vary slightly + delete documentObject.$createdAt; + delete documentObject.$updatedAt; + + return documentObject; +}; + describe('Platform', () => { describe('Document', function main() { this.timeout(700000); @@ -35,21 +45,26 @@ describe('Platform', () => { // Additional wait time to mitigate testnet latency await waitForSTPropagated(); - dataContractFixture = await getDataContractFixture(identity.getId()); + const identityNonce = await client.platform + .nonceManager.bumpIdentityNonce(identity.getId()); + dataContractFixture = await getDataContractFixture(identityNonce, identity.getId()); await client.platform.contracts.publish(dataContractFixture, identity); // Additional wait time to mitigate testnet latency await waitForSTPropagated(); - client.getApps().set('customContracts', { - contractId: dataContractFixture.getId(), - contract: dataContractFixture, - }); + client.getApps() + .set('customContracts', { + contractId: dataContractFixture.getId(), + contract: dataContractFixture, + }); }); beforeEach(async () => { - dataContractFixture = await getDataContractFixture(identity.getId()); + const identityNonce = await client.platform + .nonceManager.bumpIdentityNonce(identity.getId()); + dataContractFixture = await getDataContractFixture(identityNonce, identity.getId()); }); after(async () => { @@ -60,16 +75,19 @@ describe('Platform', () => { it('should fail to create new document with an unknown type', async () => { // Add undefined document type for - client.getApps().get('customContracts').contract.setDocumentSchema('undefinedType', { - type: 'object', - properties: { - name: { - type: 'string', - position: 0, + client.getApps() + .get('customContracts') + .contract + .setDocumentSchema('undefinedType', { + type: 'object', + properties: { + name: { + type: 'string', + position: 0, + }, }, - }, - additionalProperties: false, - }); + additionalProperties: false, + }); const newDocument = await client.platform.documents.create( 'customContracts.undefinedType', @@ -89,8 +107,16 @@ describe('Platform', () => { broadcastError = e; } - expect(broadcastError).to.be.an.instanceOf(StateTransitionBroadcastError); - expect(broadcastError.getCause()).to.be.an.instanceOf(InvalidDocumentTypeError); + expect(broadcastError) + .to + .be + .an + .instanceOf(StateTransitionBroadcastError); + expect(broadcastError.getCause()) + .to + .be + .an + .instanceOf(InvalidDocumentTypeError); }); it('should fail to create a new document with an unknown owner', async () => { @@ -114,10 +140,14 @@ describe('Platform', () => { broadcastError = e; } - expect(broadcastError).to.exist(); - expect(broadcastError.message).to.equal( - `Identity with ID ${unknownIdentity.getId()} is not associated with wallet, or it's not synced`, - ); + expect(broadcastError) + .to + .exist(); + expect(broadcastError.message) + .to + .equal( + `Identity with ID ${unknownIdentity.getId()} is not associated with wallet, or it's not synced`, + ); }); it('should fail to create a document that violates unique index constraint', async () => { @@ -160,9 +190,16 @@ describe('Platform', () => { broadcastError = e; } - expect(broadcastError).to.exist(); - expect(broadcastError.code).to.be.equal(4009); - expect(broadcastError.message).to.match(/Document \w* has duplicate unique properties \["\$ownerId", "firstName"] with other documents/); + expect(broadcastError) + .to + .exist(); + expect(broadcastError.code) + .to + .be + .equal(40105); + expect(broadcastError.message) + .to + .match(/Document \w* has duplicate unique properties \["\$ownerId", "firstName"] with other documents/); }); it('should be able to create new document', async () => { @@ -189,20 +226,31 @@ describe('Platform', () => { { where: [['$id', '==', document.getId()]] }, ); - expect(fetchedDocument).to.exist(); - expect(document.toObject()).to.deep.equal(fetchedDocument.toObject()); + expect(fetchedDocument) + .to + .exist(); + expect(fetchedDocument.getUpdatedAt()) - .to.be.deep.equal(fetchedDocument.getCreatedAt()); + .to.be.greaterThanOrEqual(document.getUpdatedAt()); + expect(fetchedDocument.getCreatedAt()) + .to.be.greaterThanOrEqual(document.getCreatedAt()); + + expect(getDocumentObject(document)).to.deep.equal(getDocumentObject(fetchedDocument)); + expect(fetchedDocument.getUpdatedAt()).to.be.deep.equal(fetchedDocument.getCreatedAt()); }); it('should be able to fetch created document by created timestamp', async () => { const [fetchedDocument] = await client.platform.documents.get( 'customContracts.indexedDocument', - { where: [['$createdAt', '==', document.getCreatedAt().getTime()]] }, + { + where: [['$createdAt', '>', document.getCreatedAt() + .getTime()]], + orderBy: [['$createdAt', 'desc']], + }, ); expect(fetchedDocument).to.exist(); - expect(document.toObject()).to.deep.equal(fetchedDocument.toObject()); + expect(getDocumentObject(document)).to.deep.equal(getDocumentObject(fetchedDocument)); }); it('should be able to update document', async () => { @@ -226,9 +274,13 @@ describe('Platform', () => { { where: [['$id', '==', document.getId()]] }, ); - expect(fetchedDocument.get('firstName')).to.equal('updatedName'); + expect(fetchedDocument.get('firstName')) + .to + .equal('updatedName'); expect(fetchedDocument.getUpdatedAt()) - .to.be.greaterThan(fetchedDocument.getCreatedAt()); + .to + .be + .greaterThan(fetchedDocument.getCreatedAt()); }); it.skip('should be able to prove that a document was updated', async () => { @@ -261,63 +313,57 @@ describe('Platform', () => { // Additional wait time to mitigate testnet latency await waitForSTPropagated(); - expect(proof.rootTreeProof).to.be.an.instanceof(Uint8Array); - expect(proof.rootTreeProof.length).to.be.greaterThan(0); - - expect(proof.storeTreeProofs).to.exist(); - expect(proof.storeTreeProofs.documentsProof).to.be.an.instanceof(Uint8Array); - expect(proof.storeTreeProofs.documentsProof.length).to.be.greaterThan(0); - - expect(proof.quorumHash).to.be.an.instanceof(Uint8Array); - expect(proof.quorumHash.length).to.be.equal(32); - - expect(proof.signature).to.be.an.instanceof(Uint8Array); - expect(proof.signature.length).to.be.equal(96); - - expect(proof.round).to.be.a('number'); - expect(proof.round).to.be.greaterThanOrEqual(0); - }); - - it('should fail to update document with timestamp in violated time frame', async () => { - const [storedDocument] = await client.platform.documents.get( - 'customContracts.indexedDocument', - { where: [['$id', '==', document.getId()]] }, - ); - - const updatedAt = storedDocument.getUpdatedAt(); - - updatedAt.setMinutes(updatedAt.getMinutes() - 10); - - let broadcastError; - - const documentsBatchTransition = await client.platform.documents.broadcast({ - replace: [storedDocument], - }, identity); - - // Additional wait time to mitigate testnet latency - await waitForSTPropagated(); - - const transitions = documentsBatchTransition.getTransitions(); - transitions[0].setRevision(transitions[0].getRevision() + 1); - transitions[0].setUpdatedAt(updatedAt); - - documentsBatchTransition.setTransitions(transitions); - const signedTransition = await signStateTransition( - client.platform, - documentsBatchTransition, - identity, - 1, - ); - - try { - await client.platform.broadcastStateTransition(signedTransition); - } catch (e) { - broadcastError = e; - } - - expect(broadcastError).to.exist(); - expect(broadcastError.code).to.be.equal(4008); - expect(broadcastError.message).to.match(/Document \w* updatedAt timestamp .* are out of block time window from .* and .*/); + expect(proof.rootTreeProof) + .to + .be + .an + .instanceof(Uint8Array); + expect(proof.rootTreeProof.length) + .to + .be + .greaterThan(0); + + expect(proof.storeTreeProofs) + .to + .exist(); + expect(proof.storeTreeProofs.documentsProof) + .to + .be + .an + .instanceof(Uint8Array); + expect(proof.storeTreeProofs.documentsProof.length) + .to + .be + .greaterThan(0); + + expect(proof.quorumHash) + .to + .be + .an + .instanceof(Uint8Array); + expect(proof.quorumHash.length) + .to + .be + .equal(32); + + expect(proof.signature) + .to + .be + .an + .instanceof(Uint8Array); + expect(proof.signature.length) + .to + .be + .equal(96); + + expect(proof.round) + .to + .be + .a('number'); + expect(proof.round) + .to + .be + .greaterThanOrEqual(0); }); it('should be able to delete a document', async () => { @@ -332,39 +378,10 @@ describe('Platform', () => { { where: [['$id', '==', document.getId()]] }, ); - expect(storedDocument).to.not.exist(); - }); - - it('should fail to create a new document with timestamp in violated time frame', async () => { - document = await client.platform.documents.create( - 'customContracts.indexedDocument', - identity, - { - firstName: 'myName', - lastName: 'lastName', - }, - ); - - const timestamp = document.getCreatedAt(); - - timestamp.setMinutes(timestamp.getMinutes() - 10); - - document.setCreatedAt(timestamp); - document.setUpdatedAt(timestamp); - - let broadcastError; - - try { - await client.platform.documents.broadcast({ - create: [document], - }, identity); - } catch (e) { - broadcastError = e; - } - - expect(broadcastError).to.exist(); - expect(broadcastError.message).to.match(/Document \w* createdAt timestamp .* are out of block time window from .* and .*/); - expect(broadcastError.code).to.be.equal(4008); + expect(storedDocument) + .to + .not + .exist(); }); }); }); diff --git a/packages/platform-test-suite/test/functional/platform/Identity.spec.js b/packages/platform-test-suite/test/functional/platform/Identity.spec.js index 3a1bf18e5af..09dd8b8e01b 100644 --- a/packages/platform-test-suite/test/functional/platform/Identity.spec.js +++ b/packages/platform-test-suite/test/functional/platform/Identity.spec.js @@ -2,10 +2,9 @@ const Dash = require('dash'); const { createFakeInstantLock } = require('dash/build/utils/createFakeIntantLock'); -const { hash } = require('@dashevo/wasm-dpp/lib/utils/hash'); +const { hash, sha256 } = require('@dashevo/wasm-dpp/lib/utils/hash'); const getDataContractFixture = require('../../../lib/test/fixtures/getDataContractFixture'); const createClientWithFundedWallet = require('../../../lib/test/createClientWithFundedWallet'); -const getDAPISeeds = require('../../../lib/test/getDAPISeeds'); const waitForSTPropagated = require('../../../lib/waitForSTPropagated'); const { @@ -23,6 +22,7 @@ const { IdentityPublicKey, InvalidInstantAssetLockProofSignatureError, IdentityAssetLockTransactionOutPointAlreadyExistsError, + IdentityAssetLockTransactionOutPointNotEnoughBalanceError, BasicECDSAError, IdentityPublicKeyWithWitness, IdentityInsufficientBalanceError, @@ -55,6 +55,22 @@ describe('Platform', () => { expect(identity).to.exist(); }); + it('should fail to create an identity if asset lock amount is less than minimal', async () => { + let broadcastError; + + try { + await client.platform.identities.register(197000); + } catch (e) { + broadcastError = e; + } + + expect(broadcastError).to.be.an.instanceOf(StateTransitionBroadcastError); + expect(broadcastError.getCause().getCode()).to.equal(10530); + expect(broadcastError.getCause()).to.be.an.instanceOf( + IdentityAssetLockTransactionOutPointNotEnoughBalanceError, + ); + }); + it('should fail to create an identity if instantLock is not valid', async () => { await client.platform.initialize(); @@ -62,7 +78,7 @@ describe('Platform', () => { transaction, privateKey, outputIndex, - } = await client.platform.identities.utils.createAssetLockTransaction(1); + } = await client.platform.identities.utils.createAssetLockTransaction(200000); const invalidInstantLock = createFakeInstantLock(transaction.hash); const assetLockProof = await client.platform.dpp.identity.createInstantAssetLockProof( @@ -87,7 +103,7 @@ describe('Platform', () => { } expect(broadcastError).to.be.an.instanceOf(StateTransitionBroadcastError); - expect(broadcastError.getCause().getCode()).to.equal(1042); + expect(broadcastError.getCause().getCode()).to.equal(10513); expect(broadcastError.getCause()).to.be.an.instanceOf( InvalidInstantAssetLockProofSignatureError, ); @@ -101,7 +117,7 @@ describe('Platform', () => { transaction, privateKey, outputIndex, - } = await client.platform.identities.utils.createAssetLockTransaction(150000); + } = await client.platform.identities.utils.createAssetLockTransaction(200000); const account = await client.getWalletAccount(); @@ -141,7 +157,7 @@ describe('Platform', () => { } expect(broadcastError).to.be.an.instanceOf(StateTransitionBroadcastError); - expect(broadcastError.getCause().getCode()).to.equal(1033); + expect(broadcastError.getCause().getCode()).to.equal(10504); expect(broadcastError.getCause()).to.be.an.instanceOf( IdentityAssetLockTransactionOutPointAlreadyExistsError, ); @@ -152,7 +168,7 @@ describe('Platform', () => { transaction, privateKey, outputIndex, - } = await client.platform.identities.utils.createAssetLockTransaction(15); + } = await client.platform.identities.utils.createAssetLockTransaction(210000); const account = await client.getWalletAccount(); @@ -192,7 +208,7 @@ describe('Platform', () => { } expect(broadcastError).to.be.an.instanceOf(StateTransitionBroadcastError); - expect(broadcastError.getCause().getCode()).to.equal(2009); + expect(broadcastError.getCause().getCode()).to.equal(20009); expect(broadcastError.getCause()).to.be.an.instanceOf( BasicECDSAError, ); @@ -217,13 +233,13 @@ describe('Platform', () => { }); it('should be able to get newly created identity by it\'s public key', async () => { - const response = await client.getDAPIClient().platform.getIdentitiesByPublicKeyHashes( - [identity.getPublicKeyById(0).hash()], + const response = await client.getDAPIClient().platform.getIdentityByPublicKeyHash( + identity.getPublicKeyById(0).hash(), ); - const [fetchedIdentity] = response.getIdentities(); + const fetchedIdentity = response.getIdentity(); - expect(fetchedIdentity).to.be.not.null(); + expect(fetchedIdentity.length).to.be.greaterThan(0); // TODO(rs-drive-abci): fix. rs-drive-abci now only returning identity bytes without the // asset lock proof. We would also want to do the same in rs-dpp and wasm-dpp, but @@ -245,7 +261,7 @@ describe('Platform', () => { transaction, privateKey, outputIndex, - } = await client.platform.identities.utils.createAssetLockTransaction(150000); + } = await client.platform.identities.utils.createAssetLockTransaction(200000); const account = await client.getWalletAccount(); @@ -309,7 +325,9 @@ describe('Platform', () => { let dataContractFixture; before(async () => { - dataContractFixture = await getDataContractFixture(identity.getId()); + const nextNonce = await client.platform.nonceManager + .bumpIdentityNonce(identity.getId()); + dataContractFixture = await getDataContractFixture(nextNonce, identity.getId()); await client.platform.contracts.publish(dataContractFixture, identity); @@ -323,7 +341,7 @@ describe('Platform', () => { }); it('should fail to create more documents if there are no more credits', async () => { - const lowBalanceIdentity = await client.platform.identities.register(150000); + const lowBalanceIdentity = await client.platform.identities.register(200000); // Additional wait time to mitigate testnet latency await waitForSTPropagated(); @@ -358,7 +376,7 @@ describe('Platform', () => { transaction, privateKey, outputIndex, - } = await client.platform.identities.utils.createAssetLockTransaction(15); + } = await client.platform.identities.utils.createAssetLockTransaction(200000); const instantLock = createFakeInstantLock(transaction.hash); const assetLockProof = await client.platform.dpp.identity @@ -440,7 +458,7 @@ describe('Platform', () => { transaction, privateKey, outputIndex, - } = await client.platform.identities.utils.createAssetLockTransaction(1); + } = await client.platform.identities.utils.createAssetLockTransaction(200000); const account = await client.getWalletAccount(); @@ -457,7 +475,7 @@ describe('Platform', () => { // Creating ST that tries to spend the same output - const anotherIdentity = await client.platform.identities.register(150000); + const anotherIdentity = await client.platform.identities.register(200000); // Additional wait time to mitigate testnet latency await waitForSTPropagated(); @@ -566,7 +584,7 @@ describe('Platform', () => { it('should be able to add public key to the identity', async () => { const identityBeforeUpdate = identity.toObject(); - expect(identityBeforeUpdate.publicKeys[3]).to.not.exist(); + const nextKeyId = identityBeforeUpdate.publicKeys.length; const account = await client.platform.client.getWalletAccount(); const identityIndex = await account.getUnusedIdentityIndex(); @@ -578,7 +596,7 @@ describe('Platform', () => { const identityPublicKey = identityPrivateKey.toPublicKey().toBuffer(); const newPublicKey = new IdentityPublicKeyWithWitness(1); - newPublicKey.setId(3); + newPublicKey.setId(nextKeyId); newPublicKey.setSecurityLevel(IdentityPublicKey.SECURITY_LEVELS.MEDIUM); newPublicKey.setData(identityPublicKey); @@ -604,7 +622,7 @@ describe('Platform', () => { expect(identity.getPublicKeyById(2)).to.exist(); const newPublicKeyObject = newPublicKey.toObject(true); - const expectedPublicKey = identity.getPublicKeyById(3).toObject(true); + const expectedPublicKey = identity.getPublicKeyById(4).toObject(true); delete expectedPublicKey.disabledAt; expect(expectedPublicKey).to.deep.equal( newPublicKeyObject, @@ -641,29 +659,12 @@ describe('Platform', () => { }); }); - // TODO(rs-drive-abci): fix - // fetching by opreatorIdentityId returns empty bytes and serialization fails - describe.skip('Masternodes', () => { - let dapiClient; - const network = process.env.NETWORK; - - beforeEach(() => { - dapiClient = new Dash.DAPIClient({ - network, - seeds: getDAPISeeds(), - }); - }); - + describe('Masternodes', () => { it('should receive masternode identities', async () => { await client.platform.initialize(); - const bestBlockHash = await dapiClient.core.getBestBlockHash(); - const baseBlockHash = await dapiClient.core.getBlockHash(1); - - const { mnList } = await dapiClient.core.getMnListDiff( - baseBlockHash, - bestBlockHash, - ); + const { mnList } = await client.getDAPIClient().dapiAddressProvider + .smlProvider.getSimplifiedMNList(); for (const masternodeEntry of mnList) { if (!masternodeEntry.isValid) { @@ -690,7 +691,7 @@ describe('Platform', () => { if (transaction.extraPayload.operatorReward > 0) { const operatorPubKey = Buffer.from(masternodeEntry.pubKeyOperator, 'hex'); - const operatorIdentityHash = hash( + const operatorIdentityHash = sha256( Buffer.concat([ Buffer.from(masternodeEntry.proRegTxHash, 'hex'), operatorPubKey, diff --git a/packages/platform-test-suite/test/functional/platform/proofs.spec.js b/packages/platform-test-suite/test/functional/platform/proofs.spec.js index 1ce7b4c69e8..d354fb7d4ec 100644 --- a/packages/platform-test-suite/test/functional/platform/proofs.spec.js +++ b/packages/platform-test-suite/test/functional/platform/proofs.spec.js @@ -32,7 +32,7 @@ describe('Platform', () => { let contractId; before(async () => { - dashClient = await createClientWithFundedWallet(500000); + dashClient = await createClientWithFundedWallet(1000000); await dashClient.platform.initialize(); @@ -134,11 +134,11 @@ describe('Platform', () => { let identity8PublicKeyHash; before(async () => { - identityAtKey5 = await dashClient.platform.identities.register(150000); + identityAtKey5 = await dashClient.platform.identities.register(200000); - identityAtKey6 = await dashClient.platform.identities.register(150000); + identityAtKey6 = await dashClient.platform.identities.register(200000); - identityAtKey8 = await dashClient.platform.identities.register(150000); + identityAtKey8 = await dashClient.platform.identities.register(200000); // await waitForBalanceToChange(walletAccount); @@ -233,7 +233,7 @@ describe('Platform', () => { }); // eslint-disable-next max-len - it('should be able to verify that multiple identities exist with getIdentitiesByPublicKeyHashes', async () => { + it.skip('should be able to verify that multiple identities exist with getIdentitiesByPublicKeyHashes', async () => { const publicKeyHashes = [ identity6PublicKeyHash, nonIncludedIdentityPubKeyHash, diff --git a/packages/rs-dapi-client/Cargo.toml b/packages/rs-dapi-client/Cargo.toml index 8137e7c2144..56bd878d984 100644 --- a/packages/rs-dapi-client/Cargo.toml +++ b/packages/rs-dapi-client/Cargo.toml @@ -1,34 +1,30 @@ [package] name = "rs-dapi-client" -version = "0.25.21" +version = "1.0.0-dev.15" edition = "2021" [features] default = ["mocks", "offline-testing"] -mocks = ["dep:serde_json", "dep:sha2", "dep:hex"] +mocks = ["dep:sha2", "dep:hex", "dapi-grpc/mocks"] # dump requests and responses to file -dump = ["mocks", "dep:serde_json", "dep:sha2", "dep:chrono", "dep:hex"] +dump = ["mocks", "dep:chrono"] # skip tests that require connection to the platform; enabled by default offline-testing = [] [dependencies] backon = "0.4.1" -dapi-grpc = { path = "../dapi-grpc", features = ["client"] } +dapi-grpc = { path = "../dapi-grpc" } futures = "0.3.28" http = "0.2.9" rand = { version = "0.8.5", features = ["small_rng"] } -thiserror = "1.0.41" -tonic = "0.9.2" -tracing = "0.1.37" -serde = { version = "1.0.171", default-features = false } -serde_json = { version = "1.0.103", features = [ - "preserve_order", -], optional = true } +thiserror = "1.0.58" +tracing = "0.1.40" tokio = { version = "1.32.0", default-features = false } sha2 = { version = "0.10", optional = true } chrono = { version = "0.4.31", optional = true } hex = { version = "0.4.3", optional = true } +lru = { version = "0.12.3" } [dev-dependencies] tokio = { version = "1.32.0", features = ["macros"] } diff --git a/packages/rs-dapi-client/src/address_list.rs b/packages/rs-dapi-client/src/address_list.rs index 7d6aa6845fd..a56820af2d6 100644 --- a/packages/rs-dapi-client/src/address_list.rs +++ b/packages/rs-dapi-client/src/address_list.rs @@ -1,50 +1,92 @@ -//! Subsystem to manage peers. +//! Subsystem to manage DAPI nodes. +use std::collections::HashSet; +use std::hash::{Hash, Hasher}; +use std::str::FromStr; use std::time; +use std::time::Duration; use http::Uri; use rand::{rngs::SmallRng, seq::IteratorRandom, SeedableRng}; -const DEFAULT_BASE_BAN_PERIOD: time::Duration = time::Duration::from_secs(60); +const DEFAULT_BASE_BAN_PERIOD: Duration = Duration::from_secs(60); -/// Peer's address. -#[derive(Debug)] +/// DAPI address. +#[derive(Debug, Clone, Eq)] pub struct Address { - base_ban_period: time::Duration, ban_count: usize, banned_until: Option, uri: Uri, } +impl PartialEq for Address { + fn eq(&self, other: &Self) -> bool { + self.uri == other.uri + } +} + +impl PartialEq for Address { + fn eq(&self, other: &Uri) -> bool { + self.uri == *other + } +} + +impl Hash for Address { + fn hash(&self, state: &mut H) { + self.uri.hash(state); + } +} + +impl From for Address { + fn from(uri: Uri) -> Self { + Address { + ban_count: 0, + banned_until: None, + uri, + } + } +} + impl Address { /// Ban the [Address] so it won't be available through [AddressList::get_live_address] for some time. - pub fn ban(&mut self) { + fn ban(&mut self, base_ban_period: &Duration) { let coefficient = (self.ban_count as f64).exp(); - let ban_period = - time::Duration::from_secs_f64(self.base_ban_period.as_secs_f64() * coefficient); + let ban_period = Duration::from_secs_f64(base_ban_period.as_secs_f64() * coefficient); self.banned_until = Some(time::Instant::now() + ban_period); self.ban_count += 1; } + /// Check if [Address] is banned. + pub fn is_banned(&self) -> bool { + self.ban_count > 0 + } + /// Clears ban record. - pub fn clear_ban(&mut self) { + fn unban(&mut self) { self.ban_count = 0; self.banned_until = None; } - /// Get [Uri] of a peer. + /// Get [Uri] of a node. pub fn uri(&self) -> &Uri { &self.uri } } -/// A structure to manage peer's addresses to select from +/// [AddressList] errors +#[derive(Debug, thiserror::Error)] +pub enum AddressListError { + #[error("address {0} not found in the list")] + AddressNotFound(Uri), +} + +/// A structure to manage DAPI addresses to select from /// for [DapiRequest](crate::DapiRequest) execution. #[derive(Debug)] pub struct AddressList { - addresses: Vec
, - base_ban_period: time::Duration, + addresses: HashSet
, + base_ban_period: Duration, } impl Default for AddressList { @@ -53,6 +95,12 @@ impl Default for AddressList { } } +impl std::fmt::Display for Address { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.uri.fmt(f) + } +} + impl AddressList { /// Creates an empty [AddressList] with default base ban time. pub fn new() -> Self { @@ -60,38 +108,104 @@ impl AddressList { } /// Creates an empty [AddressList] with adjustable base ban time. - pub fn with_settings(base_ban_period: time::Duration) -> Self { + pub fn with_settings(base_ban_period: Duration) -> Self { AddressList { - addresses: Vec::new(), + addresses: HashSet::new(), base_ban_period, } } + /// Bans address + pub(crate) fn ban_address(&mut self, address: &Address) -> Result<(), AddressListError> { + if !self.addresses.remove(address) { + return Err(AddressListError::AddressNotFound(address.uri.clone())); + }; + + let mut banned_address = address.clone(); + banned_address.ban(&self.base_ban_period); + + self.addresses.insert(banned_address); + + Ok(()) + } + + /// Clears address' ban record + pub(crate) fn unban_address(&mut self, address: &Address) -> Result<(), AddressListError> { + if !self.addresses.remove(address) { + return Err(AddressListError::AddressNotFound(address.uri.clone())); + }; + + let mut unbanned_address = address.clone(); + unbanned_address.unban(); + + self.addresses.insert(unbanned_address); + + Ok(()) + } + + /// Adds a node [Address] to [AddressList] + /// Returns false if the address is already in the list. + pub fn add(&mut self, address: Address) -> bool { + self.addresses.insert(address) + } + // TODO: this is the most simple way to add an address - // however we need to support bulk loading (e.g. providing a network name) - // and also fetch updated from SML. - /// Manually add a peer to [AddressList]. - pub fn add_uri(&mut self, uri: Uri) { - self.addresses.push(Address { - ban_count: 0, - banned_until: None, - base_ban_period: self.base_ban_period, - uri, - }); + // however we need to support bulk loading (e.g. providing a network name) + // and also fetch updated from SML. + /// Add a node [Address] to [AddressList] by [Uri]. + /// Returns false if the address is already in the list. + pub fn add_uri(&mut self, uri: Uri) -> bool { + self.addresses.insert(uri.into()) } /// Randomly select a not banned address. - pub fn get_live_address(&mut self) -> Option<&mut Address> { - let now = time::Instant::now(); + pub fn get_live_address(&self) -> Option<&Address> { let mut rng = SmallRng::from_entropy(); + + self.unbanned().into_iter().choose(&mut rng) + } + + /// Get all addresses that are not banned. + fn unbanned(&self) -> Vec<&Address> { + let now = time::Instant::now(); + self.addresses - .iter_mut() + .iter() .filter(|addr| { addr.banned_until .map(|banned_until| banned_until < now) .unwrap_or(true) }) - .choose(&mut rng) + .collect() + } + + /// Get number of available, not banned addresses. + pub fn available(&self) -> usize { + self.unbanned().len() + } + + /// Get number of all addresses, both banned and not banned. + pub fn len(&self) -> usize { + self.addresses.len() + } + + /// Check if the list is empty. + /// Returns true if there are no addresses in the list. + /// Returns false if there is at least one address in the list. + /// Banned addresses are also counted. + pub fn is_empty(&self) -> bool { + self.addresses.is_empty() + } +} + +impl From<&str> for AddressList { + fn from(value: &str) -> Self { + let uri_list: Vec = value + .split(',') + .map(|uri| Uri::from_str(uri).expect("invalid uri")) + .collect(); + + Self::from_iter(uri_list) } } diff --git a/packages/rs-dapi-client/src/connection_pool.rs b/packages/rs-dapi-client/src/connection_pool.rs new file mode 100644 index 00000000000..5bd5549be5f --- /dev/null +++ b/packages/rs-dapi-client/src/connection_pool.rs @@ -0,0 +1,172 @@ +use std::{ + fmt::Display, + sync::{Arc, Mutex}, +}; + +use http::Uri; +use lru::LruCache; + +use crate::{ + request_settings::AppliedRequestSettings, + transport::{CoreGrpcClient, PlatformGrpcClient}, +}; + +/// ConnectionPool represents pool of connections to DAPI nodes. +/// +/// It can be cloned and shared between threads. +/// Cloning the pool will create a new reference to the same pool. +#[derive(Debug, Clone)] +pub struct ConnectionPool { + inner: Arc>>, +} + +impl ConnectionPool { + /// Create a new pool with a given capacity. + /// The pool will evict the least recently used item when the capacity is reached. + /// + /// # Panics + /// + /// Panics if the capacity is zero. + pub fn new(capacity: usize) -> Self { + Self { + inner: Arc::new(Mutex::new(LruCache::new( + capacity.try_into().expect("must be non-zero"), + ))), + } + } +} + +impl Default for ConnectionPool { + fn default() -> Self { + Self::new(50) + } +} + +impl ConnectionPool { + /// Get item from the pool for the given uri and settings. + /// + /// # Arguments + /// * `prefix` - Prefix for the item in the pool. Used to distinguish between Core and Platform clients. + /// * `uri` - URI of the node. + /// * `settings` - Applied request settings. + pub fn get( + &self, + prefix: PoolPrefix, + uri: &Uri, + settings: Option<&AppliedRequestSettings>, + ) -> Option { + let key = Self::key(prefix, uri, settings); + self.inner.lock().expect("must lock").get(&key).cloned() + } + + /// Get value from cache or create it using provided closure. + /// If value is already in the cache, it will be returned. + /// If value is not in the cache, it will be created by calling `create()` and stored in the cache. + /// + /// # Arguments + /// * `prefix` - Prefix for the item in the pool. Used to distinguish between Core and Platform clients. + /// * `uri` - URI of the node. + /// * `settings` - Applied request settings. + pub fn get_or_create( + &self, + prefix: PoolPrefix, + uri: &Uri, + settings: Option<&AppliedRequestSettings>, + create: impl FnOnce() -> PoolItem, + ) -> PoolItem { + if let Some(cli) = self.get(prefix, uri, settings) { + return cli; + } + + let cli = create(); + self.put(uri, settings, cli.clone()); + cli + } + + /// Put item into the pool for the given uri and settings. + pub fn put(&self, uri: &Uri, settings: Option<&AppliedRequestSettings>, value: PoolItem) { + let key = Self::key(&value, uri, settings); + self.inner.lock().expect("must lock").put(key, value); + } + + fn key>( + class: C, + uri: &Uri, + settings: Option<&AppliedRequestSettings>, + ) -> String { + let prefix: PoolPrefix = class.into(); + format!("{}:{}{:?}", prefix, uri, settings) + } +} + +/// Item stored in the pool. +/// +/// We use an enum as we need to represent two different types of clients. +#[derive(Clone, Debug)] +pub enum PoolItem { + Core(CoreGrpcClient), + Platform(PlatformGrpcClient), +} + +impl From for PoolItem { + fn from(client: PlatformGrpcClient) -> Self { + Self::Platform(client) + } +} +impl From for PoolItem { + fn from(client: CoreGrpcClient) -> Self { + Self::Core(client) + } +} + +impl From for PlatformGrpcClient { + fn from(client: PoolItem) -> Self { + match client { + PoolItem::Platform(client) => client, + _ => { + tracing::error!( + ?client, + "invalid connection fetched from pool: expected platform client" + ); + panic!("ClientType is not Platform: {:?}", client) + } + } + } +} + +impl From for CoreGrpcClient { + fn from(client: PoolItem) -> Self { + match client { + PoolItem::Core(client) => client, + _ => { + tracing::error!( + ?client, + "invalid connection fetched from pool: expected core client" + ); + panic!("ClientType is not Core: {:?}", client) + } + } + } +} + +/// Prefix for the item in the pool. Used to distinguish between Core and Platform clients. +pub enum PoolPrefix { + Core, + Platform, +} +impl Display for PoolPrefix { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + PoolPrefix::Core => write!(f, "Core"), + PoolPrefix::Platform => write!(f, "Platform"), + } + } +} +impl From<&PoolItem> for PoolPrefix { + fn from(item: &PoolItem) -> Self { + match item { + PoolItem::Core(_) => PoolPrefix::Core, + PoolItem::Platform(_) => PoolPrefix::Platform, + } + } +} diff --git a/packages/rs-dapi-client/src/dapi_client.rs b/packages/rs-dapi-client/src/dapi_client.rs index ca50c08666e..4c29819e20d 100644 --- a/packages/rs-dapi-client/src/dapi_client.rs +++ b/packages/rs-dapi-client/src/dapi_client.rs @@ -1,73 +1,71 @@ //! [DapiClient] definition. use backon::{ExponentialBuilder, Retryable}; -use tonic::async_trait; +use dapi_grpc::mock::Mockable; +use dapi_grpc::tonic::async_trait; +use std::sync::{Arc, RwLock}; +use std::time::Duration; use tracing::Instrument; +use crate::address_list::AddressListError; +use crate::connection_pool::ConnectionPool; use crate::{ transport::{TransportClient, TransportRequest}, - AddressList, CanRetry, RequestSettings, + Address, AddressList, CanRetry, RequestSettings, }; /// General DAPI request error type. #[derive(Debug, thiserror::Error)] pub enum DapiClientError { /// The error happened on transport layer - #[error("transport error: {0}")] - Transport(TE), - /// There are no valid peer addresses to use. + #[error("transport error with {1}: {0}")] + Transport(TE, Address), + /// There are no valid DAPI addresses to use. #[error("no available addresses to use")] NoAvailableAddresses, + /// [AddressListError] errors + #[error("address list error: {0}")] + AddressList(AddressListError), + #[cfg(feature = "mocks")] - /// Expectation not found - #[error("mock expectation not found for request: {0}")] - MockExpectationNotFound(String), + #[error("mock error: {0}")] + /// Error happened in mock client + Mock(#[from] crate::mock::MockError), } impl CanRetry for DapiClientError { - fn can_retry(&self) -> bool { + fn is_node_failure(&self) -> bool { use DapiClientError::*; match self { NoAvailableAddresses => false, - Transport(transport_error) => transport_error.can_retry(), + Transport(transport_error, _) => transport_error.is_node_failure(), + AddressList(_) => false, #[cfg(feature = "mocks")] - MockExpectationNotFound(_) => false, + Mock(_) => false, } } } #[async_trait] -/// DAPI client trait. -pub trait Dapi { +/// DAPI client executor trait. +pub trait DapiRequestExecutor { /// Execute request using this DAPI client. async fn execute( - &mut self, - request: R, - settings: RequestSettings, - ) -> Result::Error>> - where - R: TransportRequest; -} - -#[async_trait] -impl Dapi for &mut D { - async fn execute( - &mut self, + &self, request: R, settings: RequestSettings, ) -> Result::Error>> where - R: TransportRequest, - { - (**self).execute(request, settings).await - } + R: TransportRequest + Mockable, + R::Response: Mockable; } /// Access point to DAPI. -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct DapiClient { - address_list: AddressList, + address_list: Arc>, settings: RequestSettings, + pool: ConnectionPool, #[cfg(feature = "dump")] pub(crate) dump_dir: Option, } @@ -75,9 +73,13 @@ pub struct DapiClient { impl DapiClient { /// Initialize new [DapiClient] and optionally override default settings. pub fn new(address_list: AddressList, settings: RequestSettings) -> Self { + // multiply by 3 as we need to store core and platform addresses, and we want some spare capacity just in case + let address_count = 3 * address_list.len(); + Self { - address_list, + address_list: Arc::new(RwLock::new(address_list)), settings, + pool: ConnectionPool::new(address_count), #[cfg(feature = "dump")] dump_dir: None, } @@ -85,15 +87,16 @@ impl DapiClient { } #[async_trait] -impl Dapi for DapiClient { +impl DapiRequestExecutor for DapiClient { /// Execute the [DapiRequest](crate::DapiRequest). async fn execute( - &mut self, + &self, request: R, settings: RequestSettings, ) -> Result::Error>> where - R: TransportRequest, + R: TransportRequest + Mockable, + R::Response: Mockable, { // Join settings of different sources to get final version of the settings for this execution: let applied_settings = self @@ -103,7 +106,12 @@ impl Dapi for DapiClient { .finalize(); // Setup retry policy: - let retry_settings = ExponentialBuilder::default().with_max_times(applied_settings.retries); + let retry_settings = ExponentialBuilder::default() + .with_max_times(applied_settings.retries) + // backon doesn't accept 1.0 + .with_factor(1.001) + .with_min_delay(Duration::from_secs(0)) + .with_max_delay(Duration::from_secs(0)); // Save dump dir for later use, as self is moved into routine #[cfg(feature = "dump")] @@ -115,42 +123,121 @@ impl Dapi for DapiClient { // more once to build new future on each retry. let routine = move || { // Try to get an address to initialize transport on: - let address = self.address_list.get_live_address().ok_or( + + let address_list = self + .address_list + .read() + .expect("can't get address list for read"); + + let address_result = address_list.get_live_address().cloned().ok_or( DapiClientError::<::Error>::NoAvailableAddresses, ); - // Get a transport client requried by the DAPI request from this DAPI client. - // It stays wrapped in `Result` since we want to return - // `impl Future`, not a `Result` itself. - let transport_client = address.map(|addr| R::Client::with_uri(addr.uri().clone())); + drop(address_list); + + let _span = tracing::trace_span!( + "execute request", + address = ?address_result, + settings = ?applied_settings, + method = request.method_name(), + ) + .entered(); + + tracing::trace!( + ?request, + "calling {} with {} request", + request.method_name(), + request.request_name(), + ); let transport_request = request.clone(); + let response_name = request.response_name(); // Create a future using `async` block that will be returned from the closure on // each retry. Could be just a request future, but need to unpack client first. async move { - transport_request - .execute_transport(&mut transport_client?, &applied_settings) + // It stays wrapped in `Result` since we want to return + // `impl Future`, not a `Result` itself. + let address = address_result?; + let pool = self.pool.clone(); + + let mut transport_client = R::Client::with_uri_and_settings( + address.uri().clone(), + &applied_settings, + &pool, + ); + + let response = transport_request + .execute_transport(&mut transport_client, &applied_settings) .await .map_err(|e| { - DapiClientError::<::Error>::Transport(e) - }) + DapiClientError::<::Error>::Transport( + e, + address.clone(), + ) + }); + + match &response { + Ok(_) => { + // Unban the address if it was banned and node responded successfully this time + if address.is_banned() { + let mut address_list = self + .address_list + .write() + .expect("can't get address list for write"); + + address_list.unban_address(&address) + .map_err(DapiClientError::<::Error>::AddressList)?; + } + + tracing::trace!(?response, "received {} response", response_name); + } + Err(error) => { + if error.is_node_failure() { + if applied_settings.ban_failed_address { + let mut address_list = self + .address_list + .write() + .expect("can't get address list for write"); + + address_list.ban_address(&address) + .map_err(DapiClientError::<::Error>::AddressList)?; + } + } else { + tracing::trace!(?error, "received error"); + } + } + }; + + response } }; // Start the routine with retry policy applied: // We allow let_and_return because `result` is used later if dump feature is enabled - #[allow(clippy::let_and_return)] let result = routine .retry(&retry_settings) - .when(|e| e.can_retry()) + .notify(|error, duration| { + tracing::warn!( + ?error, + "retrying error with sleeping {} secs", + duration.as_secs_f32() + ) + }) + .when(|e| e.is_node_failure()) .instrument(tracing::info_span!("request routine")) .await; + if let Err(error) = &result { + if error.is_node_failure() { + tracing::error!(?error, "request failed"); + } + } + // Dump request and response to disk if dump_dir is set: #[cfg(feature = "dump")] - if let Ok(ref result) = &result { - Self::dump_request_response(dump_request, result.clone(), dump_dir); + if let Ok(result) = &result { + Self::dump_request_response(&dump_request, result, dump_dir); } result diff --git a/packages/rs-dapi-client/src/dump.rs b/packages/rs-dapi-client/src/dump.rs index 4abafd6a65a..26f90f57d9c 100644 --- a/packages/rs-dapi-client/src/dump.rs +++ b/packages/rs-dapi-client/src/dump.rs @@ -1,21 +1,100 @@ //! Dumping of requests and responses to disk +use dapi_grpc::mock::Mockable; + use crate::{mock::Key, transport::TransportRequest, DapiClient}; -use std::path::PathBuf; +use std::{any::type_name, path::PathBuf}; -#[derive(serde::Serialize, serde::Deserialize)] /// Data format of dumps created with [DapiClient::dump_dir]. +#[derive(Clone)] pub struct DumpData { /// Request that was sent to DAPI. - pub request: T, + pub serialized_request: Vec, /// Response that was received from DAPI. - pub response: T::Response, + pub serialized_response: Vec, + + phantom: std::marker::PhantomData, +} +impl DumpData { + /// Return deserialized request + pub fn deserialize(&self) -> (T, T::Response) { + let req = T::mock_deserialize(&self.serialized_request).unwrap_or_else(|| { + panic!( + "unable to deserialize mock data of type {}", + type_name::() + ) + }); + let resp = T::Response::mock_deserialize(&self.serialized_response).unwrap_or_else(|| { + panic!( + "unable to deserialize mock data of type {}", + type_name::() + ) + }); + + (req, resp) + } +} + +impl dapi_grpc::mock::Mockable for DumpData +where + T: Mockable, + T::Response: Mockable, +{ + // We use null-delimited JSON as a format for dump data to make it readable. + fn mock_serialize(&self) -> Option> { + // nulls are not allowed in serialized data as we use it as a delimiter + if self.serialized_request.contains(&0) { + panic!("null byte in serialized request"); + } + if self.serialized_response.contains(&0) { + panic!("null byte in serialized response"); + } + + let data = [ + &self.serialized_request, + "\n\0\n".as_bytes(), + &self.serialized_response, + ] + .concat(); + + Some(data) + } + + fn mock_deserialize(buf: &[u8]) -> Option { + // we panic as we expect this to be called only with data serialized by mock_serialize() + + // Split data into request and response + let buf = buf.split(|&b| b == 0).collect::>(); + if buf.len() != 2 { + panic!("invalid mock data format, expected exactly two items separated by null byte"); + } + + let request = buf.first().expect("missing request in mock data"); + let response = buf.last().expect("missing response in mock data"); + + Some(Self { + serialized_request: request.to_vec(), + serialized_response: response.to_vec(), + phantom: std::marker::PhantomData, + }) + } } impl DumpData { /// Create new dump data. - pub fn new(request: T, response: T::Response) -> Self { - Self { request, response } + pub fn new(request: &T, response: &T::Response) -> Self { + let request = request + .mock_serialize() + .expect("unable to serialize request"); + let response = response + .mock_serialize() + .expect("unable to serialize response"); + + Self { + serialized_request: request, + serialized_response: response, + phantom: std::marker::PhantomData, + } } // Return request type (T) name without module prefix @@ -33,7 +112,7 @@ impl DumpData { /// * unique identifier (hash) of the request pub fn filename(&self) -> Result { let now = chrono::Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Nanos, true); - let key = Key::try_new(&self.request)?; + let key = Key::try_new(&self.serialized_request)?; // get request type without underscores (which we use as a file name separator) let request_type = Self::request_type().replace('_', "-"); @@ -51,33 +130,30 @@ impl DumpData { /// Load dump data from file. pub fn load>(file: P) -> Result where - T: for<'de> serde::Deserialize<'de>, - T::Response: for<'de> serde::Deserialize<'de>, + T: Mockable, + T::Response: Mockable, { - let f = std::fs::File::open(file)?; - - let data: Self = serde_json::from_reader(f).map_err(|e| { - std::io::Error::new( - std::io::ErrorKind::InvalidData, - format!("unable to parse json: {}", e), - ) - })?; - - Ok(data) + let data = std::fs::read(file)?; + + Self::mock_deserialize(&data).ok_or(std::io::Error::new( + std::io::ErrorKind::InvalidData, + format!( + "unable to deserialize mock data of type {}", + type_name::() + ), + )) } /// Save dump data to file. pub fn save(&self, file: &std::path::Path) -> Result<(), std::io::Error> where - T: serde::Serialize, - T::Response: serde::Serialize, + T: Mockable, + T::Response: Mockable, { - let encoded = serde_json::to_vec(self).map_err(|e| { - std::io::Error::new( - std::io::ErrorKind::InvalidData, - format!("unable to serialize json: {}", e), - ) - })?; + let encoded = self.mock_serialize().ok_or(std::io::Error::new( + std::io::ErrorKind::InvalidData, + format!("unable to serialize mock data of type {}", type_name::()), + ))?; std::fs::write(file, encoded) } @@ -107,12 +183,12 @@ impl DapiClient { /// /// Any errors are logged on `warn` level and ignored. pub(crate) fn dump_request_response( - request: R, - response: R::Response, + request: &R, + response: &R::Response, dump_dir: Option, ) where - R: serde::Serialize, - R::Response: serde::Serialize, + R: Mockable, + R::Response: Mockable, { let path = match dump_dir { Some(p) => p, diff --git a/packages/rs-dapi-client/src/lib.rs b/packages/rs-dapi-client/src/lib.rs index 0b3c19b74b3..6fe633b2142 100644 --- a/packages/rs-dapi-client/src/lib.rs +++ b/packages/rs-dapi-client/src/lib.rs @@ -3,6 +3,7 @@ #![deny(missing_docs)] mod address_list; +mod connection_pool; mod dapi_client; #[cfg(feature = "dump")] pub mod dump; @@ -11,10 +12,11 @@ pub mod mock; mod request_settings; pub mod transport; -pub use dapi_client::Dapi; +pub use dapi_client::DapiRequestExecutor; use futures::{future::BoxFuture, FutureExt}; pub use http::Uri; +pub use address_list::Address; pub use address_list::AddressList; pub use dapi_client::{DapiClient, DapiClientError}; #[cfg(feature = "dump")] @@ -42,9 +44,9 @@ pub trait DapiRequest { type TransportError; /// Executes the request. - fn execute<'c, D: Dapi>( + fn execute<'c, D: DapiRequestExecutor>( self, - dapi_client: &'c mut D, + dapi_client: &'c D, settings: RequestSettings, ) -> BoxFuture<'c, Result>> where @@ -57,9 +59,9 @@ impl DapiRequest for T { type TransportError = ::Error; - fn execute<'c, D: Dapi>( + fn execute<'c, D: DapiRequestExecutor>( self, - dapi_client: &'c mut D, + dapi_client: &'c D, settings: RequestSettings, ) -> BoxFuture<'c, Result>> where @@ -73,5 +75,5 @@ impl DapiRequest for T { /// try to do a request again. pub trait CanRetry { /// Get boolean flag that indicates if the error is retryable. - fn can_retry(&self) -> bool; + fn is_node_failure(&self) -> bool; } diff --git a/packages/rs-dapi-client/src/mock.rs b/packages/rs-dapi-client/src/mock.rs index 142f7674747..08142b4812a 100644 --- a/packages/rs-dapi-client/src/mock.rs +++ b/packages/rs-dapi-client/src/mock.rs @@ -13,8 +13,10 @@ use crate::{ transport::{TransportClient, TransportRequest}, - Dapi, DapiClientError, RequestSettings, + DapiClientError, DapiRequestExecutor, RequestSettings, }; +use dapi_grpc::mock::Mockable; +use dapi_grpc::tonic::async_trait; use hex::ToHex; use sha2::Digest; use std::{ @@ -22,17 +24,17 @@ use std::{ collections::HashMap, fmt::{Debug, Display}, }; -use tonic::async_trait; /// Mock DAPI client. /// -/// This is a mock implmeneation of [Dapi] that can be used for testing. +/// This is a mock implmeneation of [DapiRequestExecutor] that can be used for testing. /// /// See `tests/mock_dapi_client.rs` for an example. -#[derive(Default)] +#[derive(Default, Debug)] pub struct MockDapiClient { expectations: Expectations, } + impl MockDapiClient { /// Create a new mock client pub fn new() -> Self { @@ -40,11 +42,12 @@ impl MockDapiClient { } /// Add a new expectation for a request - pub fn expect(&mut self, request: &R, response: &R::Response) -> &mut Self + pub fn expect(&mut self, request: &R, response: &R::Response) -> Result<&mut Self, MockError> where - R: TransportRequest, + R: TransportRequest + Mockable, + R::Response: Mockable, { - let key = self.expectations.add(request, response); + let key = self.expectations.add(request, response)?; tracing::trace!( %key, @@ -53,49 +56,55 @@ impl MockDapiClient { "mock added expectation" ); - self + Ok(self) } /// Load expectation from file. /// /// The file must contain JSON structure. /// See [DumpData](crate::DumpData) and [DapiClient::dump_dir()](crate::DapiClient::dump_dir()) more for details. + /// + /// # Panics + /// + /// Panics if the file can't be read or the data can't be parsed. #[cfg(feature = "dump")] pub fn load>( &mut self, file: P, ) -> Result<(T, T::Response), std::io::Error> where - T: for<'de> serde::Deserialize<'de>, - T::Response: for<'de> serde::Deserialize<'de>, + T: Mockable, + T::Response: Mockable, { - let f = std::fs::File::open(file)?; + use crate::DumpData; - #[derive(serde::Deserialize)] - struct Data { - request: R, - response: R::Response, - } + let buf = std::fs::read(file)?; + let data = DumpData::::mock_deserialize(&buf).ok_or({ + std::io::Error::new(std::io::ErrorKind::InvalidData, "unable to parse json") + })?; - let data: Data = serde_json::from_reader(f).map_err(|e| { + let (request, response) = data.deserialize(); + self.expect(&request, &response).map_err(|e| { std::io::Error::new( - std::io::ErrorKind::InvalidData, - format!("unable to parse json: {}", e), + std::io::ErrorKind::InvalidInput, + format!("unable to add expectation: {}", e), ) })?; - - self.expect(&data.request, &data.response); - Ok((data.request, data.response)) + Ok((request, response)) } } #[async_trait] -impl Dapi for MockDapiClient { +impl DapiRequestExecutor for MockDapiClient { async fn execute( - &mut self, + &self, request: R, _settings: RequestSettings, - ) -> Result::Error>> { + ) -> Result::Error>> + where + R: Mockable, + R::Response: Mockable, + { let (key, response) = self.expectations.get(&request); tracing::trace!( @@ -109,15 +118,16 @@ impl Dapi for MockDapiClient { return if let Some(response) = response { Ok(response) } else { - Err(DapiClientError::MockExpectationNotFound(format!( + Err(MockError::MockExpectationNotFound(format!( "unexpected mock request with key {}, use MockDapiClient::expect(): {:?}", key, request - ))) + )) + .into()) }; } } -#[derive(Eq, Hash, PartialEq, PartialOrd, Ord, Clone)] +#[derive(Eq, Hash, PartialEq, PartialOrd, Ord, Clone, Debug)] /// Unique identifier of some serializable object (e.g. request) that can be used as a key in a hashmap. pub struct Key([u8; 32]); @@ -127,34 +137,25 @@ impl Key { /// # Panics /// /// Panics if the object can't be serialized. - pub fn new(request: S) -> Self { + pub fn new(request: &S) -> Self { Self::try_new(request).expect("unable to create a key") } /// Generate unique identifier of some serializable object (e.g. request). - pub fn try_new(request: S) -> Result { - let mut encoded = match serde_json::to_vec(&request) { - Ok(b) => b, - Err(e) => { - return Err(std::io::Error::new( - std::io::ErrorKind::InvalidData, - format!("unable to serialize json: {}", e), - )) - } - }; + pub fn try_new(request: &S) -> Result { // we append type name to the encoded value to make sure that different types // will have different keys let typ = type_name::().replace('&', ""); //remove & from type name + + let mut encoded = S::mock_serialize(request).ok_or(std::io::Error::new( + std::io::ErrorKind::InvalidData, + format!("mocking not supported for object of type {}", typ), + ))?; encoded.append(&mut typ.as_bytes().to_vec()); let mut e = sha2::Sha256::new(); e.update(encoded); - let key = e.finalize().try_into().map_err(|e| { - std::io::Error::new( - std::io::ErrorKind::InvalidData, - format!("invalid key generated: {}", e), - ) - })?; + let key = e.finalize().into(); Ok(Self(key)) } @@ -175,21 +176,35 @@ impl Display for Key { } } +#[derive(Debug, thiserror::Error)] +/// Mock errors +pub enum MockError { + #[error("mock expectation not found for request: {0}")] + /// Expectation not found + MockExpectationNotFound(String), + + #[error("expectation already defined for request: {0}")] + /// Expectation already defined for request + MockExpectationConflict(String), +} + +#[derive(Debug)] +/// Wrapper that encapsulated serialized form of expected response for a request struct ExpectedResponse(Vec); impl ExpectedResponse { - fn serialize(request: &I) -> Self { + fn serialize(request: &I) -> Self { // We use json because bincode sometimes fail to deserialize - Self(serde_json::to_vec(request).expect("encode value")) + Self(request.mock_serialize().expect("encode value")) } - fn deserialize serde::Deserialize<'de>>(&self) -> O { + fn deserialize(&self) -> O { // We use json because bincode sometimes fail to deserialize - serde_json::from_slice(&self.0).expect("deserialize value") + O::mock_deserialize(&self.0).expect("deserialize value") } } -#[derive(Default)] +#[derive(Default, Debug)] /// Requests expected by a mock and their responses. struct Expectations { expectations: HashMap, @@ -198,28 +213,33 @@ struct Expectations { impl Expectations { /// Add expected request and provide given response. /// - /// If the expectation already exists, it will be silently replaced. - pub fn add( + /// If the expectation already exists, error is returned. + pub fn add( &mut self, request: &I, response: &O, - ) -> Key { + ) -> Result { let key = Key::new(request); let value = ExpectedResponse::serialize(response); + if self.expectations.contains_key(&key) { + return Err(MockError::MockExpectationConflict(format!( + "expectation with key {} already defined for {} request", + key, + std::any::type_name::(), + ))); + } + self.expectations.insert(key.clone(), value); - key + Ok(key) } /// Get the response for a given request. /// /// Returns `None` if the request has not been expected. - pub fn get serde::Deserialize<'de> + Debug>( - &self, - request: I, - ) -> (Key, Option) { - let key = Key::new(&request); + pub fn get(&self, request: &I) -> (Key, Option) { + let key = Key::new(request); let response = self.expectations.get(&key).and_then(|v| v.deserialize()); diff --git a/packages/rs-dapi-client/src/request_settings.rs b/packages/rs-dapi-client/src/request_settings.rs index 79d94eb497f..7c900a78290 100644 --- a/packages/rs-dapi-client/src/request_settings.rs +++ b/packages/rs-dapi-client/src/request_settings.rs @@ -2,8 +2,11 @@ use std::time::Duration; +/// Default low-level client timeout +const DEFAULT_CONNECT_TIMEOUT: Option = None; const DEFAULT_TIMEOUT: Duration = Duration::from_secs(10); const DEFAULT_RETRIES: usize = 5; +const DEFAULT_BAN_FAILED_ADDRESS: bool = true; /// DAPI request settings. /// @@ -12,12 +15,16 @@ const DEFAULT_RETRIES: usize = 5; /// 2. [crate::DapiClient] settings; /// 3. [crate::DapiRequest]-specific settings; /// 4. settings for an exact request execution call. -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, Default)] pub struct RequestSettings { + /// Timeout for establishing a connection. + pub connect_timeout: Option, /// Timeout for a request. pub timeout: Option, /// Number of retries until returning the last error. pub retries: Option, + /// Ban DAPI address if node not responded or responded with error. + pub ban_failed_address: Option, } impl RequestSettings { @@ -25,8 +32,10 @@ impl RequestSettings { /// Actually does the same as [Default], but it's `const`. pub const fn default() -> Self { RequestSettings { + connect_timeout: None, timeout: None, retries: None, + ban_failed_address: None, } } @@ -35,16 +44,22 @@ impl RequestSettings { /// 2. in case of two [Some] variants, right hand side argument will overwrite the value. pub fn override_by(self, rhs: RequestSettings) -> Self { RequestSettings { + connect_timeout: rhs.connect_timeout.or(self.connect_timeout), timeout: rhs.timeout.or(self.timeout), retries: rhs.retries.or(self.retries), + ban_failed_address: rhs.ban_failed_address.or(self.ban_failed_address), } } /// Fill in settings defaults. pub fn finalize(self) -> AppliedRequestSettings { AppliedRequestSettings { + connect_timeout: self.connect_timeout.or(DEFAULT_CONNECT_TIMEOUT), timeout: self.timeout.unwrap_or(DEFAULT_TIMEOUT), retries: self.retries.unwrap_or(DEFAULT_RETRIES), + ban_failed_address: self + .ban_failed_address + .unwrap_or(DEFAULT_BAN_FAILED_ADDRESS), } } } @@ -52,8 +67,12 @@ impl RequestSettings { /// DAPI settings ready to use. #[derive(Debug, Clone, Copy)] pub struct AppliedRequestSettings { + /// Timeout for establishing a connection. + pub connect_timeout: Option, /// Timeout for a request. pub timeout: Duration, /// Number of retries until returning the last error. pub retries: usize, + /// Ban DAPI address if node not responded or responded with error. + pub ban_failed_address: bool, } diff --git a/packages/rs-dapi-client/src/transport.rs b/packages/rs-dapi-client/src/transport.rs index 0af60c9bc5e..bf514bf3cc9 100644 --- a/packages/rs-dapi-client/src/transport.rs +++ b/packages/rs-dapi-client/src/transport.rs @@ -2,25 +2,41 @@ pub(crate) mod grpc; +use crate::connection_pool::ConnectionPool; pub use crate::request_settings::AppliedRequestSettings; use crate::{CanRetry, RequestSettings}; +use dapi_grpc::mock::Mockable; pub use futures::future::BoxFuture; pub use grpc::{CoreGrpcClient, PlatformGrpcClient}; use http::Uri; +use std::any; use std::fmt::Debug; /// Generic transport layer request. /// Requires [Clone] as could be retried and a client in general consumes a request. -pub trait TransportRequest: Clone + Send + Sync + Debug + serde::Serialize { +pub trait TransportRequest: Clone + Send + Sync + Debug + Mockable { /// A client specific to this type of transport. type Client: TransportClient; /// Transport layer response. - type Response: TransportResponse; + type Response: Mockable + Send + Debug; /// Settings that will override [DapiClient](crate::DapiClient)'s ones each time the request is executed. const SETTINGS_OVERRIDES: RequestSettings; + /// gRPC request name + fn request_name(&self) -> &'static str { + any::type_name::() + } + + /// gRPC response name + fn response_name(&self) -> &'static str { + any::type_name::() + } + + /// gRPC method name + fn method_name(&self) -> &'static str; + /// Perform transport request asynchronously. fn execute_transport<'c>( self, @@ -29,17 +45,18 @@ pub trait TransportRequest: Clone + Send + Sync + Debug + serde::Serialize { ) -> BoxFuture<'c, Result::Error>>; } -/// Generic transport layer response. -pub trait TransportResponse: - Clone + Send + Sync + Debug + serde::Serialize + for<'de> serde::Deserialize<'de> -{ -} - /// Generic way to create a transport client from provided [Uri]. pub trait TransportClient: Send + Sized { /// Error type for the specific client. type Error: CanRetry + Send + Debug; - /// Build client using peer's url. - fn with_uri(uri: Uri) -> Self; + /// Build client using node's url. + fn with_uri(uri: Uri, pool: &ConnectionPool) -> Self; + + /// Build client using node's url and [AppliedRequestSettings]. + fn with_uri_and_settings( + uri: Uri, + settings: &AppliedRequestSettings, + pool: &ConnectionPool, + ) -> Self; } diff --git a/packages/rs-dapi-client/src/transport/grpc.rs b/packages/rs-dapi-client/src/transport/grpc.rs index 224229a7356..91276fe4d1a 100644 --- a/packages/rs-dapi-client/src/transport/grpc.rs +++ b/packages/rs-dapi-client/src/transport/grpc.rs @@ -2,41 +2,83 @@ use std::time::Duration; +use super::{CanRetry, TransportClient, TransportRequest}; +use crate::connection_pool::{ConnectionPool, PoolPrefix}; +use crate::{request_settings::AppliedRequestSettings, RequestSettings}; use dapi_grpc::core::v0::core_client::CoreClient; +use dapi_grpc::core::v0::{self as core_proto}; use dapi_grpc::platform::v0::{self as platform_proto, platform_client::PlatformClient}; +use dapi_grpc::tonic::Streaming; +use dapi_grpc::tonic::{transport::Channel, IntoRequest}; use futures::{future::BoxFuture, FutureExt, TryFutureExt}; use http::Uri; -use tonic::{transport::Channel, IntoRequest}; - -use super::{CanRetry, TransportClient, TransportRequest, TransportResponse}; -use crate::{request_settings::AppliedRequestSettings, RequestSettings}; /// Platform Client using gRPC transport. pub type PlatformGrpcClient = PlatformClient; /// Core Client using gRPC transport. pub type CoreGrpcClient = CoreClient; +fn create_channel(uri: Uri, settings: Option<&AppliedRequestSettings>) -> Channel { + let mut builder = Channel::builder(uri); + + if let Some(settings) = settings { + if let Some(timeout) = settings.connect_timeout { + builder = builder.connect_timeout(timeout); + } + } + + builder.connect_lazy() +} + impl TransportClient for PlatformGrpcClient { - type Error = tonic::Status; + type Error = dapi_grpc::tonic::Status; + + fn with_uri(uri: Uri, pool: &ConnectionPool) -> Self { + pool.get_or_create(PoolPrefix::Platform, &uri, None, || { + Self::new(create_channel(uri.clone(), None)).into() + }) + .into() + } - fn with_uri(uri: Uri) -> Self { - Self::new(Channel::builder(uri).connect_lazy()) + fn with_uri_and_settings( + uri: Uri, + settings: &AppliedRequestSettings, + pool: &ConnectionPool, + ) -> Self { + pool.get_or_create(PoolPrefix::Platform, &uri, Some(settings), || { + Self::new(create_channel(uri.clone(), Some(settings))).into() + }) + .into() } } impl TransportClient for CoreGrpcClient { - type Error = tonic::Status; + type Error = dapi_grpc::tonic::Status; - fn with_uri(uri: Uri) -> Self { - Self::new(Channel::builder(uri).connect_lazy()) + fn with_uri(uri: Uri, pool: &ConnectionPool) -> Self { + pool.get_or_create(PoolPrefix::Core, &uri, None, || { + Self::new(create_channel(uri.clone(), None)).into() + }) + .into() + } + + fn with_uri_and_settings( + uri: Uri, + settings: &AppliedRequestSettings, + pool: &ConnectionPool, + ) -> Self { + pool.get_or_create(PoolPrefix::Core, &uri, Some(settings), || { + Self::new(create_channel(uri.clone(), Some(settings))).into() + }) + .into() } } -impl CanRetry for tonic::Status { - fn can_retry(&self) -> bool { +impl CanRetry for dapi_grpc::tonic::Status { + fn is_node_failure(&self) -> bool { let code = self.code(); - use tonic::Code::*; + use dapi_grpc::tonic::Code::*; matches!( code, Ok | DataLoss @@ -46,6 +88,7 @@ impl CanRetry for tonic::Status { | ResourceExhausted | Aborted | Internal + | Unavailable ) } } @@ -61,6 +104,10 @@ macro_rules! impl_transport_request_grpc { const SETTINGS_OVERRIDES: RequestSettings = $settings; + fn method_name(&self) -> &'static str { + stringify!($($method)+) + } + fn execute_transport<'c>( self, client: &'c mut Self::Client, @@ -68,7 +115,10 @@ macro_rules! impl_transport_request_grpc { ) -> BoxFuture<'c, Result::Error>> { let mut grpc_request = self.into_request(); - grpc_request.set_timeout(settings.timeout); + + if !settings.timeout.is_zero() { + grpc_request.set_timeout(settings.timeout); + } client .$($method)+(grpc_request) @@ -76,12 +126,13 @@ macro_rules! impl_transport_request_grpc { .boxed() } } - impl TransportResponse for $response {} }; } // Link to each platform gRPC request what client and method to use: +const STREAMING_TIMEOUT: Duration = Duration::from_secs(5 * 60); + impl_transport_request_grpc!( platform_proto::GetIdentityRequest, platform_proto::GetIdentityResponse, @@ -135,20 +186,13 @@ impl_transport_request_grpc!( platform_proto::WaitForStateTransitionResultResponse, PlatformGrpcClient, RequestSettings { - timeout: Some(Duration::from_secs(120)), + timeout: Some(Duration::from_secs(80)), + retries: Some(0), ..RequestSettings::default() }, wait_for_state_transition_result ); -impl_transport_request_grpc!( - platform_proto::GetIdentitiesByPublicKeyHashesRequest, - platform_proto::GetIdentitiesByPublicKeyHashesResponse, - PlatformGrpcClient, - RequestSettings::default(), - get_identities_by_public_key_hashes -); - impl_transport_request_grpc!( platform_proto::GetIdentityByPublicKeyHashRequest, platform_proto::GetIdentityByPublicKeyHashResponse, @@ -165,6 +209,22 @@ impl_transport_request_grpc!( get_identity_balance ); +impl_transport_request_grpc!( + platform_proto::GetIdentityNonceRequest, + platform_proto::GetIdentityNonceResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_identity_nonce +); + +impl_transport_request_grpc!( + platform_proto::GetIdentityContractNonceRequest, + platform_proto::GetIdentityContractNonceResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_identity_contract_nonce +); + impl_transport_request_grpc!( platform_proto::GetIdentityBalanceAndRevisionRequest, platform_proto::GetIdentityBalanceAndRevisionResponse, @@ -173,6 +233,14 @@ impl_transport_request_grpc!( get_identity_balance_and_revision ); +impl_transport_request_grpc!( + platform_proto::GetIdentitiesContractKeysRequest, + platform_proto::GetIdentitiesContractKeysResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_identities_contract_keys +); + impl_transport_request_grpc!( platform_proto::GetIdentityKeysRequest, platform_proto::GetIdentityKeysResponse, @@ -214,8 +282,6 @@ impl_transport_request_grpc!( ); // Link to each core gRPC request what client and method to use: -/* -TODO: Implement serde on Core gRPC requests and responses impl_transport_request_grpc!( core_proto::GetTransactionRequest, @@ -226,11 +292,11 @@ impl_transport_request_grpc!( ); impl_transport_request_grpc!( - core_proto::GetStatusRequest, - core_proto::GetStatusResponse, + core_proto::GetBlockchainStatusRequest, + core_proto::GetBlockchainStatusResponse, CoreGrpcClient, RequestSettings::default(), - get_status + get_blockchain_status ); impl_transport_request_grpc!( @@ -240,4 +306,14 @@ impl_transport_request_grpc!( RequestSettings::default(), broadcast_transaction ); -*/ + +impl_transport_request_grpc!( + core_proto::TransactionsWithProofsRequest, + Streaming, + CoreGrpcClient, + RequestSettings { + timeout: Some(STREAMING_TIMEOUT), + ..RequestSettings::default() + }, + subscribe_to_transactions_with_proofs +); diff --git a/packages/rs-dapi-client/tests/mock_dapi_client.rs b/packages/rs-dapi-client/tests/mock_dapi_client.rs index f5f67dce99c..291feb861b4 100644 --- a/packages/rs-dapi-client/tests/mock_dapi_client.rs +++ b/packages/rs-dapi-client/tests/mock_dapi_client.rs @@ -1,6 +1,6 @@ use dapi_grpc::platform::v0::{GetIdentityRequest, GetIdentityResponse, Proof}; -use rs_dapi_client::{mock::MockDapiClient, Dapi, DapiRequest, RequestSettings}; +use rs_dapi_client::{mock::MockDapiClient, DapiRequest, DapiRequestExecutor, RequestSettings}; #[tokio::test] async fn test_mock_get_identity_dapi_client() { @@ -19,13 +19,13 @@ async fn test_mock_get_identity_dapi_client() { })) }; - dapi.expect(&request, &response); + dapi.expect(&request, &response).expect("expectation added"); let settings = RequestSettings::default(); let result = dapi.execute(request.clone(), settings).await.unwrap(); - let result2 = request.execute(&mut dapi, settings).await.unwrap(); + let result2 = request.execute(&dapi, settings).await.unwrap(); assert_eq!(result, response); assert_eq!(result2, response); diff --git a/packages/rs-dapi-grpc-macros/Cargo.toml b/packages/rs-dapi-grpc-macros/Cargo.toml index 74c9fe88024..c47067dab05 100644 --- a/packages/rs-dapi-grpc-macros/Cargo.toml +++ b/packages/rs-dapi-grpc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc-macros" -version = "0.25.21" +version = "1.0.0-dev.15" edition = "2021" description = "Macros used by dapi-grpc. Internal use only." @@ -11,7 +11,7 @@ proc-macro = true [dependencies] quote = "1.0.33" syn = "2.0.38" -heck = "0.4.1" +heck = "0.5.0" [dev-dependencies] diff --git a/packages/rs-dapi-grpc-macros/src/lib.rs b/packages/rs-dapi-grpc-macros/src/lib.rs index f310de526f2..8d5851e35f4 100644 --- a/packages/rs-dapi-grpc-macros/src/lib.rs +++ b/packages/rs-dapi-grpc-macros/src/lib.rs @@ -115,6 +115,7 @@ pub fn versioned_grpc_response_derive(input: TokenStream) -> TokenStream { quote! { #mod_ident::Version::#version_ident(inner) => match &inner.result { Some(#mod_ident::#version_mod_ident::Result::Proof(proof)) => Ok(proof), + // TODO: this substitutes any error that could be received instead of a proof, not just version-related _ => return Err(::platform_version::error::PlatformVersionError::UnknownVersionError("unknown proof version not known".to_string())), }, } @@ -130,6 +131,7 @@ pub fn versioned_grpc_response_derive(input: TokenStream) -> TokenStream { quote! { #mod_ident::Version::#version_ident(inner) => match inner.result { Some(#mod_ident::#version_mod_ident::Result::Proof(proof)) => Ok(proof), + // TODO: this substitutes any error that could be received instead of a proof, not just version-related _ => return Err(::platform_version::error::PlatformVersionError::UnknownVersionError("unknown proof version not known".to_string())), }, } @@ -138,8 +140,7 @@ pub fn versioned_grpc_response_derive(input: TokenStream) -> TokenStream { let metadata_arms = (0..=versions).map(|version| { let version_ident = format_ident!("V{}", version); quote! { - #mod_ident::Version::#version_ident(inner) => inner.metadata.as_ref().ok_or(platform_version::error::PlatformVersionError:: - UnknownVersionError("result did not have metadata".to_string())), + #mod_ident::Version::#version_ident(inner) => inner.metadata.as_ref().ok_or(platform_version::error::PlatformVersionError:: UnknownVersionError("result did not have metadata".to_string())), } }); @@ -182,3 +183,44 @@ pub fn versioned_grpc_response_derive(input: TokenStream) -> TokenStream { // Return the generated code TokenStream::from(expanded) } + +/// Implement mocking on gRPC messages +/// +/// This adds implementation of [dapi_grpc::mock::Mockable] to the message. +/// If the `mocks` feature is enabled, the implementation uses serde_json to serialize/deserialize the message. +/// Otherwise, it returns None. +/// +/// ## Requirements +/// +/// When `mocks` feature is enabled: +/// +/// * The message must implement [serde::Serialize] and [serde::Deserialize]. +/// * The crate must depend on `serde` and `serde_json` crates. +/// +#[proc_macro_derive(Mockable)] +pub fn mockable_derive(input: TokenStream) -> TokenStream { + // Parse the input tokens into a syntax tree + let input = parse_macro_input!(input as DeriveInput); + + let name = input.ident; + + // Generate the implementation + let expanded = quote! { + impl crate::mock::Mockable for #name { + #[cfg(feature = "mocks")] + fn mock_serialize(&self) -> Option> { + Some(serde_json::to_vec_pretty(self).expect("unable to serialize")) + } + + #[cfg(feature = "mocks")] + fn mock_deserialize(data: &[u8]) -> Option { + Some(serde_json::from_slice(data).expect("unable to deserialize")) + } + } + }; + + // println!("Expanded code: {}", expanded); + + // Return the generated code + TokenStream::from(expanded) +} diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index a1e21130130..da94abc573d 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -1,213 +1,271 @@ [package] name = "dpp" -version = "0.25.21" +version = "1.0.0-dev.15" edition = "2021" -rust-version = "1.73" +rust-version = "1.76" authors = [ - "Anton Suprunchuk ", - "Samuel Westrich ", - "Ivan Shumkov ", - "Djavid Gabibiyan ", - "Igor Markin ", + "Anton Suprunchuk ", + "Samuel Westrich ", + "Ivan Shumkov ", + "Djavid Gabibiyan ", + "Igor Markin ", ] [dependencies] -anyhow = { version = "1.0.70" } -async-trait = { version = "0.1.68" } -base64 = "0.20.0" -bls-signatures = { git = "https://github.com/dashpay/bls-signatures", branch = "develop" } +anyhow = { version = "1.0.81" } +async-trait = { version = "0.1.79" } +base64 = "0.22.0" +bls-signatures = { git = "https://github.com/dashpay/bls-signatures", tag = "v1.3.1", optional = true } bs58 = "0.4.0" byteorder = { version = "1.4" } -chrono = { version = "0.4.20", default-features = false, features = [ - "wasmbind", - "clock", +chrono = { version = "0.4.35", default-features = false, features = [ + "wasmbind", + "clock", ] } ciborium = { git = "https://github.com/qrayven/ciborium", branch = "feat-ser-null-as-undefined", optional = true } dashcore = { git = "https://github.com/dashpay/rust-dashcore", features = [ - "std", - "secp-recovery", - "rand", - "signer", - "serde", + "std", + "secp-recovery", + "rand", + "signer", + "serde", ], default-features = false, branch = "master" } env_logger = { version = "0.9" } -enum-map = { version = "2.5.0" } getrandom = { version = "0.2", features = ["js"] } hex = { version = "0.4" } integer-encoding = { version = "4.0.0" } -itertools = { version = "0.10" } -json-patch = "0.2.6" -jsonptr = "0.1.5" +itertools = { version = "0.12.1" } jsonschema = { git = "https://github.com/fominok/jsonschema-rs", branch = "feat-unevaluated-properties", default-features = false, features = [ - "draft202012", -] } + "draft202012", +], optional = true } +json-schema-faker = { git = "https://github.com/fominok/json-schema-faker-rs", rev = "2dd1cf7", optional = true } lazy_static = { version = "1.4" } log = { version = "0.4.6" } num_enum = "0.5.7" bincode = { version = "2.0.0-rc.3", features = ["serde"] } rand = { version = "0.8.4", features = ["small_rng"] } regex = { version = "1.5" } -serde = { version = "1.0.152", features = ["derive"] } +serde = { version = "1.0.197", features = ["derive"] } serde_json = { version = "1.0", features = ["preserve_order"] } serde_repr = { version = "0.1.7" } sha2 = { version = "0.10" } thiserror = { version = "1.0" } -data-contracts = { path = "../data-contracts" } +data-contracts = { path = "../data-contracts", optional = true } platform-value = { path = "../rs-platform-value" } platform-version = { path = "../rs-platform-version" } platform-versioning = { path = "../rs-platform-versioning" } platform-serialization = { path = "../rs-platform-serialization" } platform-serialization-derive = { path = "../rs-platform-serialization-derive" } derive_more = "0.99.17" -ed25519-dalek = { version = "2.0.0-rc.2", features = ["rand_core"] } +ed25519-dalek = { version = "2.0.0-rc.2", features = [ + "rand_core", +], optional = true } nohash-hasher = "0.2.0" rust_decimal = "1.29.1" rust_decimal_macros = "1.29.1" indexmap = { version = "2.0.2", features = ["serde"] } +strum = { version = "0.25.0", features = ["derive"] } +json-schema-compatibility-validator = { path = '../rs-json-schema-compatibility-validator' } [dev-dependencies] test-case = { version = "2.0" } tokio = { version = "1.17", features = ["full"] } pretty_assertions = { version = "1.3.0" } dpp = { path = ".", features = ["all_features_without_client"] } +assert_matches = "1.5.0" [features] -default = [ - "json-object", - "platform-value", - "system_contracts", - "state-transitions", - "extended-document", -] +default = ["platform-value", "state-transitions"] all_features = [ - "json-object", - "platform-value", - "system_contracts", - "state-transitions", - "extended-document", - "cbor", - "validation", - "identity-hashing", - "identity-serialization", - "ciborium", - "document-serde-conversion", - "document-value-conversion", - "document-json-conversion", - "document-cbor-conversion", - "data-contract-serde-conversion", - "data-contract-value-conversion", - "data-contract-json-conversion", - "data-contract-cbor-conversion", - "identity-serde-conversion", - "identity-value-conversion", - "identity-json-conversion", - "identity-cbor-conversion", - "state-transition-serde-conversion", - "state-transition-value-conversion", - "state-transition-json-conversion", - "state-transition-validation", - "state-transition-signing", - "state-transitions", - "factories", - "fixtures-and-mocks", - "random-public-keys", - "random-identities", - "random-documents", - "random-document-types", - "fee-distribution", - "client", + "json-object", + "platform-value", + "system_contracts", + "state-transitions", + "extended-document", + "bls-signatures", + "cbor", + "validation", + "identity-hashing", + "identity-serialization", + "ciborium", + "document-serde-conversion", + "document-value-conversion", + "document-json-conversion", + "document-cbor-conversion", + "data-contract-serde-conversion", + "data-contract-value-conversion", + "data-contract-json-conversion", + "data-contract-cbor-conversion", + "identity-serde-conversion", + "identity-value-conversion", + "identity-json-conversion", + "identity-cbor-conversion", + "index-serde-conversion", + "state-transition-serde-conversion", + "state-transition-value-conversion", + "state-transition-json-conversion", + "state-transition-validation", + "state-transition-signing", + "state-transitions", + "factories", + "fixtures-and-mocks", + "random-public-keys", + "random-identities", + "random-documents", + "random-document-types", + "fee-distribution", + "client", +] + +dash-sdk-features = [ + "json-object", + "platform-value", + "system_contracts", + "state-transitions", + "validation", + "identity-hashing", + "identity-serialization", + "document-value-conversion", + "data-contract-value-conversion", + "identity-value-conversion", + "state-transition-serde-conversion", + "state-transition-value-conversion", + "state-transition-json-conversion", + "state-transition-validation", + "state-transition-signing", + "state-transitions", + "fee-distribution", + "client", + "platform-value-cbor", ] all_features_without_client = [ - "json-object", - "platform-value", - "system_contracts", - "state-transitions", - "extended-document", - "cbor", - "validation", - "identity-hashing", - "identity-serialization", - "ciborium", - "document-serde-conversion", - "document-value-conversion", - "document-json-conversion", - "document-cbor-conversion", - "data-contract-serde-conversion", - "data-contract-value-conversion", - "data-contract-json-conversion", - "data-contract-cbor-conversion", - "identity-serde-conversion", - "identity-value-conversion", - "identity-json-conversion", - "identity-cbor-conversion", - "state-transition-serde-conversion", - "state-transition-value-conversion", - "state-transition-json-conversion", - "state-transition-validation", - "state-transition-signing", - "state-transitions", - "factories", - "fixtures-and-mocks", - "random-public-keys", - "random-identities", - "random-documents", - "random-document-types", - "fee-distribution", + "json-object", + "platform-value", + "system_contracts", + "state-transitions", + "extended-document", + "cbor", + "validation", + "identity-hashing", + "identity-serialization", + "ciborium", + "document-serde-conversion", + "document-value-conversion", + "document-json-conversion", + "document-cbor-conversion", + "data-contract-serde-conversion", + "data-contract-value-conversion", + "data-contract-json-conversion", + "data-contract-cbor-conversion", + "identity-serde-conversion", + "identity-value-conversion", + "identity-json-conversion", + "identity-cbor-conversion", + "index-serde-conversion", + "state-transition-serde-conversion", + "state-transition-value-conversion", + "state-transition-json-conversion", + "state-transition-validation", + "state-transition-signing", + "state-transitions", + "factories", + "fixtures-and-mocks", + "random-public-keys", + "random-identities", + "random-documents", + "random-document-types", + "fee-distribution", ] -drive = ["state-transitions", "fee-distribution", "system_contracts"] abci = [ - "state-transitions", - "state-transition-validation", - "validation", - "random-public-keys", - "identity-serialization", + "state-transitions", + "state-transition-validation", + "validation", + "random-public-keys", + "identity-serialization", + "platform-value-cbor", ] cbor = ["ciborium"] validation = [ - "platform-value", - "document-value-conversion", - "state-transition-serde-conversion", + "json-schema-validation", + "platform-value", + "document-value-conversion", + "state-transition-serde-conversion", + "ed25519-dalek", ] -json-object = ["platform-value"] +platform-value-json = ["platform-value/json"] +platform-value-cbor = ["platform-value/cbor"] +json-schema-validation = ["jsonschema", "platform-value-json"] +json-object = ["platform-value", "platform-value-json"] platform-value = [] identity-hashing = ["identity-serialization"] +message-signing = [] +message-signature-verification = ["bls-signatures"] document-serde-conversion = [] document-value-conversion = ["document-serde-conversion"] -document-json-conversion = ["document-value-conversion"] -document-cbor-conversion = ["document-value-conversion"] +document-json-conversion = ["document-value-conversion", "platform-value-json"] +document-cbor-conversion = [ + "document-value-conversion", + "cbor", + "platform-value-cbor", +] data-contract-serde-conversion = [] data-contract-value-conversion = ["data-contract-serde-conversion"] -data-contract-json-conversion = ["data-contract-value-conversion"] -data-contract-cbor-conversion = ["data-contract-value-conversion"] +data-contract-json-conversion = [ + "data-contract-value-conversion", + "platform-value-json", +] +data-contract-cbor-conversion = [ + "data-contract-value-conversion", + "cbor", + "platform-value-cbor", +] identity-serialization = [] identity-serde-conversion = [] identity-value-conversion = ["identity-serde-conversion"] -identity-json-conversion = ["identity-value-conversion"] -identity-cbor-conversion = ["identity-value-conversion", "cbor"] +identity-json-conversion = ["identity-value-conversion", "platform-value-json"] +identity-cbor-conversion = [ + "identity-value-conversion", + "cbor", + "platform-value-cbor", +] +index-serde-conversion = [] state-transition-serde-conversion = ["data-contract-serde-conversion"] state-transition-value-conversion = [ - "platform-value", - "state-transition-serde-conversion", - "data-contract-value-conversion", + "platform-value", + "state-transition-serde-conversion", + "data-contract-value-conversion", ] state-transition-json-conversion = [ - "json-object", - "data-contract-json-conversion", + "json-object", + "state-transition-value-conversion", + "data-contract-json-conversion", + "platform-value-json", +] +state-transition-validation = [ + "state-transitions", + "message-signature-verification", +] +state-transition-signing = [ + "state-transitions", + "message-signing", + "state-transition-validation", ] -state-transition-validation = [] -state-transition-signing = [] state-transitions = [] -system_contracts = ["factories"] -fixtures-and-mocks = [] -random-public-keys = [] +system_contracts = ["factories", "data-contracts", "platform-value-json"] +fixtures-and-mocks = ["system_contracts", "platform-value/json"] +random-public-keys = ["bls-signatures", "ed25519-dalek"] random-identities = ["random-public-keys"] random-documents = [] -random-document-types = [] +random-document-types = ["platform-value-json"] fee-distribution = [] extended-document = [ - "document-serde-conversion", - "data-contract-serde-conversion", - "data-contract-json-conversion", + "document-serde-conversion", + "data-contract-serde-conversion", + "data-contract-json-conversion", ] -client = [] + factories = [] +client = ["factories", "state-transitions"] + +# Faker feature requires `npm` and `javy` to be installed at build time +documents-faker = ["dep:json-schema-faker", "document-serde-conversion"] diff --git a/packages/rs-dpp/schema/meta_schemas/document/v0/document-meta.json b/packages/rs-dpp/schema/meta_schemas/document/v0/document-meta.json index e802b7825af..e25b17af3d8 100644 --- a/packages/rs-dpp/schema/meta_schemas/document/v0/document-meta.json +++ b/packages/rs-dpp/schema/meta_schemas/document/v0/document-meta.json @@ -481,6 +481,43 @@ ], "description": "Public key security level. 0 - Master, 1 - Critical, 2 - High, 3 - Medium. If none specified, High level is used" }, + "documentsKeepHistory": { + "type": "boolean", + "description": "True if the documents keep all their history, default is false" + }, + "documentsMutable": { + "type": "boolean", + "description": "True if the documents are mutable, default is true" + }, + "canBeDeleted": { + "type": "boolean", + "description": "True if the documents can be deleted, default is true" + }, + "transferable": { + "type": "integer", + "enum": [ + 0, + 1 + ], + "description": "Transferable without a marketplace sell. 0 - Never, 1 - Always" + }, + "tradeMode": { + "type": "integer", + "enum": [ + 0, + 1 + ], + "description": "Built in marketplace system. 0 - None, 1 - Direct purchase (The user can buy the item without the need for an approval)" + }, + "creationRestrictionMode": { + "type": "integer", + "enum": [ + 0, + 1, + 2 + ], + "description": "Restrictions of document creation. 0 - No restrictions, 1 - Owner only, 2 - No creation (System Only)" + }, "requiresIdentityEncryptionBoundedKey": { "type": "integer", "enum": [ @@ -515,7 +552,14 @@ "$ownerId": true, "$revision": true, "$createdAt": true, - "$updatedAt": true + "$updatedAt": true, + "$transferredAt": true, + "$createdAtBlockHeight": true, + "$updatedAtBlockHeight": true, + "$transferredAtBlockHeight": true, + "$createdAtCoreBlockHeight": true, + "$updatedAtCoreBlockHeight": true, + "$transferredAtCoreBlockHeight": true }, "propertyNames": { "oneOf": [ @@ -530,7 +574,14 @@ "$ownerId", "$revision", "$createdAt", - "$updatedAt" + "$updatedAt", + "$transferredAt", + "$createdAtBlockHeight", + "$updatedAtBlockHeight", + "$transferredAtBlockHeight", + "$createdAtCoreBlockHeight", + "$updatedAtCoreBlockHeight", + "$transferredAtCoreBlockHeight" ] } ] diff --git a/packages/rs-dpp/src/asset_lock/mod.rs b/packages/rs-dpp/src/asset_lock/mod.rs new file mode 100644 index 00000000000..5133348df5b --- /dev/null +++ b/packages/rs-dpp/src/asset_lock/mod.rs @@ -0,0 +1,16 @@ +use crate::asset_lock::reduced_asset_lock_value::AssetLockValue; + +pub mod reduced_asset_lock_value; + +pub type PastAssetLockStateTransitionHashes = Vec>; + +/// An enumeration of the possible states when querying platform to get the stored state of an outpoint +/// representing if the asset lock was already used or not. +pub enum StoredAssetLockInfo { + /// The asset lock was fully consumed in the past + FullyConsumed, + /// The asset lock was partially consumed, and we stored the asset lock value in the state + PartiallyConsumed(AssetLockValue), + /// The asset lock is not yet known to Platform + NotPresent, +} diff --git a/packages/rs-dpp/src/asset_lock/reduced_asset_lock_value/mod.rs b/packages/rs-dpp/src/asset_lock/reduced_asset_lock_value/mod.rs new file mode 100644 index 00000000000..5b18311013a --- /dev/null +++ b/packages/rs-dpp/src/asset_lock/reduced_asset_lock_value/mod.rs @@ -0,0 +1,111 @@ +use crate::asset_lock::reduced_asset_lock_value::v0::AssetLockValueV0; +use crate::fee::Credits; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use derive_more::From; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Bytes32; +use platform_version::version::PlatformVersion; + +mod v0; + +pub use v0::{AssetLockValueGettersV0, AssetLockValueSettersV0}; + +#[derive(Debug, Clone, Encode, Decode, PlatformSerialize, PlatformDeserialize, From, PartialEq)] +#[platform_serialize(unversioned)] +pub enum AssetLockValue { + V0(AssetLockValueV0), +} + +impl AssetLockValue { + pub fn new( + initial_credit_value: Credits, + tx_out_script: Vec, + remaining_credit_value: Credits, + used_tags: Vec, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .asset_lock_versions + .reduced_asset_lock_value + .default_current_version + { + 0 => Ok(AssetLockValue::V0(AssetLockValueV0 { + initial_credit_value, + tx_out_script, + remaining_credit_value, + used_tags, + })), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "ReducedAssetLockValue::new".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} + +impl AssetLockValueGettersV0 for AssetLockValue { + fn initial_credit_value(&self) -> Credits { + match self { + AssetLockValue::V0(v0) => v0.initial_credit_value, + } + } + + fn tx_out_script(&self) -> &Vec { + match self { + AssetLockValue::V0(v0) => &v0.tx_out_script, + } + } + + fn tx_out_script_owned(self) -> Vec { + match self { + AssetLockValue::V0(v0) => v0.tx_out_script, + } + } + + fn remaining_credit_value(&self) -> Credits { + match self { + AssetLockValue::V0(v0) => v0.remaining_credit_value, + } + } + + fn used_tags_ref(&self) -> &Vec { + match self { + AssetLockValue::V0(v0) => &v0.used_tags, + } + } +} + +impl AssetLockValueSettersV0 for AssetLockValue { + fn set_initial_credit_value(&mut self, value: Credits) { + match self { + AssetLockValue::V0(v0) => v0.initial_credit_value = value, + } + } + + fn set_tx_out_script(&mut self, value: Vec) { + match self { + AssetLockValue::V0(v0) => v0.tx_out_script = value, + } + } + + fn set_remaining_credit_value(&mut self, value: Credits) { + match self { + AssetLockValue::V0(v0) => v0.remaining_credit_value = value, + } + } + + fn set_used_tags(&mut self, tags: Vec) { + match self { + AssetLockValue::V0(v0) => v0.used_tags = tags, + } + } + + fn add_used_tag(&mut self, tag: Bytes32) { + match self { + AssetLockValue::V0(v0) => v0.used_tags.push(tag), + } + } +} diff --git a/packages/rs-dpp/src/asset_lock/reduced_asset_lock_value/v0/mod.rs b/packages/rs-dpp/src/asset_lock/reduced_asset_lock_value/v0/mod.rs new file mode 100644 index 00000000000..bc733e03f48 --- /dev/null +++ b/packages/rs-dpp/src/asset_lock/reduced_asset_lock_value/v0/mod.rs @@ -0,0 +1,33 @@ +use crate::fee::Credits; +use bincode::{Decode, Encode}; +use platform_value::Bytes32; + +#[derive(Debug, Clone, Encode, Decode, PartialEq)] +pub struct AssetLockValueV0 { + pub(super) initial_credit_value: Credits, + pub(super) tx_out_script: Vec, + pub(super) remaining_credit_value: Credits, + /// The used tags can represent any token of that we want to say has been used + /// In practice for Platform this means that we are storing the asset lock transactions + /// to prevent replay attacks. + pub(super) used_tags: Vec, +} + +pub trait AssetLockValueGettersV0 { + fn initial_credit_value(&self) -> Credits; + fn tx_out_script(&self) -> &Vec; + + fn tx_out_script_owned(self) -> Vec; + fn remaining_credit_value(&self) -> Credits; + + fn used_tags_ref(&self) -> &Vec; +} + +pub trait AssetLockValueSettersV0 { + fn set_initial_credit_value(&mut self, value: Credits); + fn set_tx_out_script(&mut self, value: Vec); + fn set_remaining_credit_value(&mut self, value: Credits); + + fn set_used_tags(&mut self, tags: Vec); + fn add_used_tag(&mut self, tag: Bytes32); +} diff --git a/packages/rs-dpp/src/balances/credits.rs b/packages/rs-dpp/src/balances/credits.rs index 6febee1005e..d0f9e2805b9 100644 --- a/packages/rs-dpp/src/balances/credits.rs +++ b/packages/rs-dpp/src/balances/credits.rs @@ -12,6 +12,9 @@ use crate::ProtocolError; use integer_encoding::VarInt; use std::convert::TryFrom; +/// Duffs type +pub type Duffs = u64; + /// Credits type pub type Credits = u64; @@ -25,6 +28,8 @@ pub type SignedCredits = i64; pub const MAX_CREDITS: Credits = 9223372036854775807 as Credits; //i64 Max +pub const CREDITS_PER_DUFF: Credits = 1000; + /// Trait for signed and unsigned credits pub trait Creditable { diff --git a/packages/rs-dpp/src/block/block_info/mod.rs b/packages/rs-dpp/src/block/block_info/mod.rs index d2da67b9848..6f43eefc1bd 100644 --- a/packages/rs-dpp/src/block/block_info/mod.rs +++ b/packages/rs-dpp/src/block/block_info/mod.rs @@ -1,4 +1,5 @@ use crate::block::epoch::{Epoch, EPOCH_0}; +use crate::prelude::{BlockHeight, CoreBlockHeight, TimestampMillis}; use bincode::{Decode, Encode}; use serde::{Deserialize, Serialize}; @@ -13,16 +14,16 @@ pub const DEFAULT_BLOCK_INFO: BlockInfo = BlockInfo { // Extended block info however is not immutable // @immutable /// Block information -#[derive(Clone, Default, Debug, PartialEq, Eq, Encode, Decode, Serialize, Deserialize)] +#[derive(Clone, Copy, Default, Debug, PartialEq, Eq, Encode, Decode, Serialize, Deserialize)] pub struct BlockInfo { /// Block time in milliseconds - pub time_ms: u64, + pub time_ms: TimestampMillis, /// Block height - pub height: u64, + pub height: BlockHeight, /// Core height - pub core_height: u32, + pub core_height: CoreBlockHeight, /// Current fee epoch pub epoch: Epoch, diff --git a/packages/rs-dpp/src/block/epoch/mod.rs b/packages/rs-dpp/src/block/epoch/mod.rs index 060836954a3..e7fe4aef555 100644 --- a/packages/rs-dpp/src/block/epoch/mod.rs +++ b/packages/rs-dpp/src/block/epoch/mod.rs @@ -5,6 +5,9 @@ use serde::{Deserialize, Serialize}; /// Epoch key offset pub const EPOCH_KEY_OFFSET: u16 = 256; +/// The Highest allowed Epoch +pub const MAX_EPOCH: u16 = u16::MAX - EPOCH_KEY_OFFSET; + /// Epoch index type pub type EpochIndex = u16; @@ -39,3 +42,11 @@ impl Epoch { }) } } + +impl TryFrom for Epoch { + type Error = ProtocolError; + + fn try_from(value: EpochIndex) -> Result { + Self::new(value) + } +} diff --git a/packages/rs-dpp/src/block/extended_epoch_info/mod.rs b/packages/rs-dpp/src/block/extended_epoch_info/mod.rs index e414591f0c6..48e9057ea38 100644 --- a/packages/rs-dpp/src/block/extended_epoch_info/mod.rs +++ b/packages/rs-dpp/src/block/extended_epoch_info/mod.rs @@ -3,10 +3,10 @@ pub mod v0; use crate::block::epoch::EpochIndex; use crate::block::extended_epoch_info::v0::{ExtendedEpochInfoV0, ExtendedEpochInfoV0Getters}; use crate::protocol_error::ProtocolError; +use crate::util::deserializer::ProtocolVersion; use bincode::{Decode, Encode}; use derive_more::From; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; -use platform_version::version::PlatformVersion; use serde::{Deserialize, Serialize}; /// Extended Block information @@ -57,4 +57,10 @@ impl ExtendedEpochInfoV0Getters for ExtendedEpochInfo { ExtendedEpochInfo::V0(v0) => v0.fee_multiplier, } } + + fn protocol_version(&self) -> ProtocolVersion { + match self { + ExtendedEpochInfo::V0(v0) => v0.protocol_version, + } + } } diff --git a/packages/rs-dpp/src/block/extended_epoch_info/v0/mod.rs b/packages/rs-dpp/src/block/extended_epoch_info/v0/mod.rs index e99b8e11325..a5e6987b361 100644 --- a/packages/rs-dpp/src/block/extended_epoch_info/v0/mod.rs +++ b/packages/rs-dpp/src/block/extended_epoch_info/v0/mod.rs @@ -1,4 +1,5 @@ use crate::block::epoch::EpochIndex; +use crate::util::deserializer::ProtocolVersion; use bincode::{Decode, Encode}; use serde::{Deserialize, Serialize}; @@ -15,6 +16,8 @@ pub struct ExtendedEpochInfoV0 { pub first_core_block_height: u32, /// Fee multiplier pub fee_multiplier: f64, + /// Protocol version + pub protocol_version: u32, } /// Trait defining getters for `ExtendedEpochInfoV0`. @@ -33,4 +36,7 @@ pub trait ExtendedEpochInfoV0Getters { /// Returns the fee multiplier. fn fee_multiplier(&self) -> f64; + + /// Protocol version + fn protocol_version(&self) -> ProtocolVersion; } diff --git a/packages/rs-dpp/src/bls.rs b/packages/rs-dpp/src/bls.rs deleted file mode 100644 index a91deb9dc33..00000000000 --- a/packages/rs-dpp/src/bls.rs +++ /dev/null @@ -1,67 +0,0 @@ -use crate::{ProtocolError, PublicKeyValidationError}; -#[cfg(not(target_arch = "wasm32"))] -use anyhow::anyhow; -use bls_signatures::{PrivateKey, PublicKey}; -use std::convert::TryInto; - -pub trait BlsModule { - fn validate_public_key(&self, pk: &[u8]) -> Result<(), PublicKeyValidationError>; - fn verify_signature( - &self, - signature: &[u8], - data: &[u8], - public_key: &[u8], - ) -> Result; - fn private_key_to_public_key(&self, private_key: &[u8]) -> Result, ProtocolError>; - fn sign(&self, data: &[u8], private_key: &[u8]) -> Result, ProtocolError>; -} - -// TODO: write tests for the native BLS module - -#[derive(Default)] -#[cfg(not(target_arch = "wasm32"))] -pub struct NativeBlsModule; - -#[cfg(not(target_arch = "wasm32"))] -impl BlsModule for NativeBlsModule { - fn validate_public_key(&self, pk: &[u8]) -> Result<(), PublicKeyValidationError> { - match PublicKey::from_bytes(pk) { - Ok(_) => Ok(()), - Err(e) => Err(PublicKeyValidationError::new(e.to_string())), - } - } - - fn verify_signature( - &self, - signature: &[u8], - data: &[u8], - public_key: &[u8], - ) -> Result { - let public_key = PublicKey::from_bytes(public_key).map_err(anyhow::Error::msg)?; - let signature = - bls_signatures::Signature::from_bytes(signature).map_err(anyhow::Error::msg)?; - match public_key.verify(&signature, data) { - true => Ok(true), - // TODO change to specific error type - false => Err(anyhow!("Verification failed").into()), - } - } - - fn private_key_to_public_key(&self, private_key: &[u8]) -> Result, ProtocolError> { - let fixed_len_key: [u8; 32] = private_key - .try_into() - .map_err(|_| anyhow!("the BLS private key must be 32 bytes long"))?; - let pk = PrivateKey::from_bytes(&fixed_len_key, false).map_err(anyhow::Error::msg)?; - let public_key = pk.g1_element().map_err(anyhow::Error::msg)?; - let public_key_bytes = public_key.to_bytes().to_vec(); - Ok(public_key_bytes) - } - - fn sign(&self, data: &[u8], private_key: &[u8]) -> Result, ProtocolError> { - let fixed_len_key: [u8; 32] = private_key - .try_into() - .map_err(|_| anyhow!("the BLS private key must be 32 bytes long"))?; - let pk = PrivateKey::from_bytes(&fixed_len_key, false).map_err(anyhow::Error::msg)?; - Ok(pk.sign(data).to_bytes().to_vec()) - } -} diff --git a/packages/rs-dpp/src/bls/mod.rs b/packages/rs-dpp/src/bls/mod.rs new file mode 100644 index 00000000000..8b825531c02 --- /dev/null +++ b/packages/rs-dpp/src/bls/mod.rs @@ -0,0 +1,16 @@ +#[cfg(all(not(target_arch = "wasm32"), feature = "bls-signatures"))] +pub mod native_bls; + +use crate::{ProtocolError, PublicKeyValidationError}; + +pub trait BlsModule { + fn validate_public_key(&self, pk: &[u8]) -> Result<(), PublicKeyValidationError>; + fn verify_signature( + &self, + signature: &[u8], + data: &[u8], + public_key: &[u8], + ) -> Result; + fn private_key_to_public_key(&self, private_key: &[u8]) -> Result, ProtocolError>; + fn sign(&self, data: &[u8], private_key: &[u8]) -> Result, ProtocolError>; +} diff --git a/packages/rs-dpp/src/bls/native_bls.rs b/packages/rs-dpp/src/bls/native_bls.rs new file mode 100644 index 00000000000..f6132842662 --- /dev/null +++ b/packages/rs-dpp/src/bls/native_bls.rs @@ -0,0 +1,48 @@ +use crate::{BlsModule, ProtocolError, PublicKeyValidationError}; +use anyhow::anyhow; +use bls_signatures::{PrivateKey, PublicKey}; + +#[derive(Default)] +pub struct NativeBlsModule; +impl BlsModule for NativeBlsModule { + fn validate_public_key(&self, pk: &[u8]) -> Result<(), PublicKeyValidationError> { + match PublicKey::from_bytes(pk) { + Ok(_) => Ok(()), + Err(e) => Err(PublicKeyValidationError::new(e.to_string())), + } + } + + fn verify_signature( + &self, + signature: &[u8], + data: &[u8], + public_key: &[u8], + ) -> Result { + let public_key = PublicKey::from_bytes(public_key).map_err(anyhow::Error::msg)?; + let signature = + bls_signatures::Signature::from_bytes(signature).map_err(anyhow::Error::msg)?; + match public_key.verify(&signature, data) { + true => Ok(true), + // TODO change to specific error type + false => Err(anyhow!("Verification failed").into()), + } + } + + fn private_key_to_public_key(&self, private_key: &[u8]) -> Result, ProtocolError> { + let fixed_len_key: [u8; 32] = private_key + .try_into() + .map_err(|_| anyhow!("the BLS private key must be 32 bytes long"))?; + let pk = PrivateKey::from_bytes(&fixed_len_key, false).map_err(anyhow::Error::msg)?; + let public_key = pk.g1_element().map_err(anyhow::Error::msg)?; + let public_key_bytes = public_key.to_bytes().to_vec(); + Ok(public_key_bytes) + } + + fn sign(&self, data: &[u8], private_key: &[u8]) -> Result, ProtocolError> { + let fixed_len_key: [u8; 32] = private_key + .try_into() + .map_err(|_| anyhow!("the BLS private key must be 32 bytes long"))?; + let pk = PrivateKey::from_bytes(&fixed_len_key, false).map_err(anyhow::Error::msg)?; + Ok(pk.sign(data).to_bytes().to_vec()) + } +} diff --git a/packages/rs-dpp/src/data_contract/accessors/mod.rs b/packages/rs-dpp/src/data_contract/accessors/mod.rs index 344de28e3f2..b5958395882 100644 --- a/packages/rs-dpp/src/data_contract/accessors/mod.rs +++ b/packages/rs-dpp/src/data_contract/accessors/mod.rs @@ -4,9 +4,10 @@ use crate::data_contract::document_type::{DocumentType, DocumentTypeRef}; use crate::data_contract::DocumentName; use crate::metadata::Metadata; use crate::prelude::DataContract; -use crate::ProtocolError; + use platform_value::Identifier; +use crate::data_contract::errors::DataContractError; use std::collections::BTreeMap; pub mod v0; @@ -36,13 +37,13 @@ impl DataContractV0Getters for DataContract { } } - fn document_type_cloned_for_name(&self, name: &str) -> Result { + fn document_type_cloned_for_name(&self, name: &str) -> Result { match self { DataContract::V0(v0) => v0.document_type_cloned_for_name(name), } } - fn document_type_for_name(&self, name: &str) -> Result { + fn document_type_for_name(&self, name: &str) -> Result { match self { DataContract::V0(v0) => v0.document_type_for_name(name), } @@ -72,6 +73,12 @@ impl DataContractV0Getters for DataContract { } } + fn document_types_mut(&mut self) -> &mut BTreeMap { + match self { + DataContract::V0(v0) => v0.document_types_mut(), + } + } + fn metadata(&self) -> Option<&Metadata> { match self { DataContract::V0(v0) => v0.metadata(), diff --git a/packages/rs-dpp/src/data_contract/accessors/v0/mod.rs b/packages/rs-dpp/src/data_contract/accessors/v0/mod.rs index f5b276d1cf6..aa03cf94f2b 100644 --- a/packages/rs-dpp/src/data_contract/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/accessors/v0/mod.rs @@ -1,8 +1,9 @@ use crate::data_contract::config::DataContractConfig; use crate::data_contract::document_type::{DocumentType, DocumentTypeRef}; +use crate::data_contract::errors::DataContractError; use crate::data_contract::DocumentName; use crate::metadata::Metadata; -use crate::ProtocolError; + use platform_value::Identifier; use std::collections::BTreeMap; @@ -17,10 +18,10 @@ pub trait DataContractV0Getters { /// Returns the identifier of the contract owner. fn owner_id(&self) -> Identifier; - fn document_type_cloned_for_name(&self, name: &str) -> Result; + fn document_type_cloned_for_name(&self, name: &str) -> Result; /// Returns the document type for the given document name. - fn document_type_for_name(&self, name: &str) -> Result; + fn document_type_for_name(&self, name: &str) -> Result; fn document_type_optional_for_name(&self, name: &str) -> Option; fn document_type_cloned_optional_for_name(&self, name: &str) -> Option; @@ -30,6 +31,9 @@ pub trait DataContractV0Getters { /// Returns a mapping of document names to their corresponding document types. fn document_types(&self) -> &BTreeMap; + /// Returns a mapping of document names to their corresponding document types as mutable. + fn document_types_mut(&mut self) -> &mut BTreeMap; + /// Returns optional metadata associated with the contract. fn metadata(&self) -> Option<&Metadata>; diff --git a/packages/rs-dpp/src/data_contract/config/fields.rs b/packages/rs-dpp/src/data_contract/config/fields.rs index 255c8b1eda1..200c0402e07 100644 --- a/packages/rs-dpp/src/data_contract/config/fields.rs +++ b/packages/rs-dpp/src/data_contract/config/fields.rs @@ -1,10 +1,9 @@ -use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; - pub const DEFAULT_CONTRACT_KEEPS_HISTORY: bool = false; pub const DEFAULT_CONTRACT_CAN_BE_DELETED: bool = false; pub const DEFAULT_CONTRACT_MUTABILITY: bool = true; pub const DEFAULT_CONTRACT_DOCUMENTS_KEEPS_HISTORY: bool = false; pub const DEFAULT_CONTRACT_DOCUMENT_MUTABILITY: bool = true; +pub const DEFAULT_CONTRACT_DOCUMENTS_CAN_BE_DELETED: bool = true; pub mod property { pub const CAN_BE_DELETED: &str = "canBeDeleted"; @@ -12,6 +11,8 @@ pub mod property { pub const KEEPS_HISTORY: &str = "keepsHistory"; pub const DOCUMENTS_KEEP_HISTORY_CONTRACT_DEFAULT: &str = "documentsKeepHistoryContractDefault"; pub const DOCUMENTS_MUTABLE_CONTRACT_DEFAULT: &str = "documentsMutableContractDefault"; + pub const DOCUMENTS_CAN_BE_DELETED_CONTRACT_DEFAULT: &str = + "documentsCanBeDeletedContractDefault"; pub const REQUIRES_IDENTITY_ENCRYPTION_BOUNDED_KEY: &str = "requiresIdentityEncryptionBoundedKey"; pub const REQUIRES_IDENTITY_DECRYPTION_BOUNDED_KEY: &str = diff --git a/packages/rs-dpp/src/data_contract/config/methods/mod.rs b/packages/rs-dpp/src/data_contract/config/methods/mod.rs index a78cbd18517..1af1fba5226 100644 --- a/packages/rs-dpp/src/data_contract/config/methods/mod.rs +++ b/packages/rs-dpp/src/data_contract/config/methods/mod.rs @@ -1 +1 @@ -mod validate_config_update; +mod validate_update; diff --git a/packages/rs-dpp/src/data_contract/config/methods/validate_config_update/mod.rs b/packages/rs-dpp/src/data_contract/config/methods/validate_config_update/mod.rs deleted file mode 100644 index 9372a892716..00000000000 --- a/packages/rs-dpp/src/data_contract/config/methods/validate_config_update/mod.rs +++ /dev/null @@ -1,30 +0,0 @@ -use crate::data_contract::config::DataContractConfig; -use crate::validation::SimpleConsensusValidationResult; -use crate::ProtocolError; -use platform_value::Identifier; -use platform_version::version::PlatformVersion; - -mod v0; - -impl DataContractConfig { - pub fn validate_config_update( - &self, - new_config: &DataContractConfig, - contract_id: Identifier, - platform_version: &PlatformVersion, - ) -> Result { - match platform_version - .dpp - .validation - .data_contract - .validate_config_update - { - 0 => Ok(self.validate_config_update_v0(new_config, contract_id)), - version => Err(ProtocolError::UnknownVersionMismatch { - method: "DataContractConfig::from_value".to_string(), - known_versions: vec![0], - received: version, - }), - } - } -} diff --git a/packages/rs-dpp/src/data_contract/config/methods/validate_config_update/v0/mod.rs b/packages/rs-dpp/src/data_contract/config/methods/validate_config_update/v0/mod.rs deleted file mode 100644 index 9087683dcb8..00000000000 --- a/packages/rs-dpp/src/data_contract/config/methods/validate_config_update/v0/mod.rs +++ /dev/null @@ -1,108 +0,0 @@ -use crate::consensus::state::data_contract::data_contract_config_update_error::DataContractConfigUpdateError; -use crate::consensus::state::data_contract::data_contract_is_readonly_error::DataContractIsReadonlyError; -use crate::data_contract::config::v0::DataContractConfigGettersV0; -use crate::data_contract::config::DataContractConfig; -use crate::validation::SimpleConsensusValidationResult; -use platform_value::Identifier; - -impl DataContractConfig { - pub(super) fn validate_config_update_v0( - &self, - new_config: &DataContractConfig, - contract_id: Identifier, - ) -> SimpleConsensusValidationResult { - if self.readonly() { - return SimpleConsensusValidationResult::new_with_error( - DataContractIsReadonlyError::new(contract_id).into(), - ); - } - - if new_config.readonly() { - return SimpleConsensusValidationResult::new_with_error( - DataContractConfigUpdateError::new( - contract_id, - "contract can not be changed to readonly", - ) - .into(), - ); - } - - if new_config.keeps_history() != self.keeps_history() { - return SimpleConsensusValidationResult::new_with_error( - DataContractConfigUpdateError::new( - contract_id, - format!( - "contract can not change whether it keeps history: changing from {} to {}", - self.keeps_history(), - new_config.keeps_history() - ), - ) - .into(), - ); - } - - if new_config.can_be_deleted() != self.can_be_deleted() { - return SimpleConsensusValidationResult::new_with_error( - DataContractConfigUpdateError::new( - contract_id, - format!( - "contract can not change whether it can be delete: changing from {} to {}", - self.can_be_deleted(), - new_config.can_be_deleted() - ), - ) - .into(), - ); - } - - if new_config.documents_keep_history_contract_default() - != self.documents_keep_history_contract_default() - { - return SimpleConsensusValidationResult::new_with_error( - DataContractConfigUpdateError::new( - contract_id, - "contract can not change the default of whether documents keeps history", - ) - .into(), - ); - } - - if new_config.documents_mutable_contract_default() - != self.documents_mutable_contract_default() - { - return SimpleConsensusValidationResult::new_with_error( - DataContractConfigUpdateError::new( - contract_id, - "contract can not change the default of whether documents are mutable", - ) - .into(), - ); - } - - if new_config.requires_identity_encryption_bounded_key() - != self.requires_identity_encryption_bounded_key() - { - return SimpleConsensusValidationResult::new_with_error( - DataContractConfigUpdateError::new( - contract_id, - "contract can not change the requirement of needing a document encryption bounded key", - ) - .into(), - ); - } - - if new_config.requires_identity_decryption_bounded_key() - != self.requires_identity_decryption_bounded_key() - { - return SimpleConsensusValidationResult::new_with_error( - DataContractConfigUpdateError::new( - contract_id, - "contract can not change the requirement of needing a document decryption bounded key", - ) - .into(), - ); - } - - SimpleConsensusValidationResult::new() - } -} diff --git a/packages/rs-dpp/src/data_contract/config/methods/validate_update/mod.rs b/packages/rs-dpp/src/data_contract/config/methods/validate_update/mod.rs new file mode 100644 index 00000000000..1df2ee3d726 --- /dev/null +++ b/packages/rs-dpp/src/data_contract/config/methods/validate_update/mod.rs @@ -0,0 +1,30 @@ +use crate::data_contract::config::DataContractConfig; +use crate::validation::SimpleConsensusValidationResult; +use crate::ProtocolError; +use platform_value::Identifier; +use platform_version::version::PlatformVersion; + +mod v0; + +impl DataContractConfig { + pub fn validate_update( + &self, + new_config: &DataContractConfig, + contract_id: Identifier, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .validation + .data_contract + .validate_config_update + { + 0 => Ok(self.validate_update_v0(new_config, contract_id)), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "validate_update".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/data_contract/config/methods/validate_update/v0/mod.rs b/packages/rs-dpp/src/data_contract/config/methods/validate_update/v0/mod.rs new file mode 100644 index 00000000000..224f7586f60 --- /dev/null +++ b/packages/rs-dpp/src/data_contract/config/methods/validate_update/v0/mod.rs @@ -0,0 +1,139 @@ +use crate::consensus::state::data_contract::data_contract_config_update_error::DataContractConfigUpdateError; +use crate::consensus::state::data_contract::data_contract_is_readonly_error::DataContractIsReadonlyError; +use crate::data_contract::config::v0::DataContractConfigGettersV0; +use crate::data_contract::config::DataContractConfig; +use crate::validation::SimpleConsensusValidationResult; +use platform_value::Identifier; + +impl DataContractConfig { + #[inline(always)] + pub(super) fn validate_update_v0( + &self, + new_config: &DataContractConfig, + contract_id: Identifier, + ) -> SimpleConsensusValidationResult { + // Validate: Old contract is not read_only + + if self.readonly() { + return SimpleConsensusValidationResult::new_with_error( + DataContractIsReadonlyError::new(contract_id).into(), + ); + } + + // Validate: New contract is not read_only + + if new_config.readonly() { + return SimpleConsensusValidationResult::new_with_error( + DataContractConfigUpdateError::new( + contract_id, + "contract can not be changed to readonly", + ) + .into(), + ); + } + + // Validate: Keeps history did not change + + if new_config.keeps_history() != self.keeps_history() { + return SimpleConsensusValidationResult::new_with_error( + DataContractConfigUpdateError::new( + contract_id, + format!( + "contract can not change whether it keeps history: changing from {} to {}", + self.keeps_history(), + new_config.keeps_history() + ), + ) + .into(), + ); + } + + // Validate: Can be deleted did not change + + if new_config.can_be_deleted() != self.can_be_deleted() { + return SimpleConsensusValidationResult::new_with_error( + DataContractConfigUpdateError::new( + contract_id, + format!( + "contract can not change whether it can be delete: changing from {} to {}", + self.can_be_deleted(), + new_config.can_be_deleted() + ), + ) + .into(), + ); + } + + // Validate: Documents keep history did not change + + if new_config.documents_keep_history_contract_default() + != self.documents_keep_history_contract_default() + { + return SimpleConsensusValidationResult::new_with_error( + DataContractConfigUpdateError::new( + contract_id, + "contract can not change the default of whether documents keeps history", + ) + .into(), + ); + } + + // Validate: Documents mutable contract default did not change + + if new_config.documents_mutable_contract_default() + != self.documents_mutable_contract_default() + { + return SimpleConsensusValidationResult::new_with_error( + DataContractConfigUpdateError::new( + contract_id, + "contract can not change the default of whether documents are mutable", + ) + .into(), + ); + } + + // Validate: Documents can be deleted contract default did not change + + if new_config.documents_can_be_deleted_contract_default() + != self.documents_can_be_deleted_contract_default() + { + return SimpleConsensusValidationResult::new_with_error( + DataContractConfigUpdateError::new( + contract_id, + "contract can not change the default of whether documents can be deleted", + ) + .into(), + ); + } + + // Validate: Requires identity encryption bounded key did not change + + if new_config.requires_identity_encryption_bounded_key() + != self.requires_identity_encryption_bounded_key() + { + return SimpleConsensusValidationResult::new_with_error( + DataContractConfigUpdateError::new( + contract_id, + "contract can not change the requirement of needing a document encryption bounded key", + ) + .into(), + ); + } + + // Validate: Requires identity decryption bounded key did not change + + if new_config.requires_identity_decryption_bounded_key() + != self.requires_identity_decryption_bounded_key() + { + return SimpleConsensusValidationResult::new_with_error( + DataContractConfigUpdateError::new( + contract_id, + "contract can not change the requirement of needing a document decryption bounded key", + ) + .into(), + ); + } + + SimpleConsensusValidationResult::new() + } +} diff --git a/packages/rs-dpp/src/data_contract/config/mod.rs b/packages/rs-dpp/src/data_contract/config/mod.rs index 26aaba3636b..2f2a2c825a2 100644 --- a/packages/rs-dpp/src/data_contract/config/mod.rs +++ b/packages/rs-dpp/src/data_contract/config/mod.rs @@ -117,6 +117,12 @@ impl DataContractConfigGettersV0 for DataContractConfig { } } + fn documents_can_be_deleted_contract_default(&self) -> bool { + match self { + DataContractConfig::V0(v0) => v0.documents_can_be_deleted_contract_default, + } + } + /// Encryption key storage requirements fn requires_identity_encryption_bounded_key(&self) -> Option { match self { @@ -127,7 +133,7 @@ impl DataContractConfigGettersV0 for DataContractConfig { /// Decryption key storage requirements fn requires_identity_decryption_bounded_key(&self) -> Option { match self { - DataContractConfig::V0(v0) => v0.requires_identity_encryption_bounded_key, + DataContractConfig::V0(v0) => v0.requires_identity_decryption_bounded_key, } } } @@ -157,6 +163,12 @@ impl DataContractConfigSettersV0 for DataContractConfig { } } + fn set_documents_can_be_deleted_contract_default(&mut self, value: bool) { + match self { + DataContractConfig::V0(v0) => v0.documents_can_be_deleted_contract_default = value, + } + } + fn set_documents_mutable_contract_default(&mut self, value: bool) { match self { DataContractConfig::V0(v0) => v0.documents_mutable_contract_default = value, diff --git a/packages/rs-dpp/src/data_contract/config/v0/mod.rs b/packages/rs-dpp/src/data_contract/config/v0/mod.rs index e4d6eb9c981..329361befe4 100644 --- a/packages/rs-dpp/src/data_contract/config/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/config/v0/mod.rs @@ -1,8 +1,8 @@ use crate::data_contract::config; use crate::data_contract::config::{ - DataContractConfig, DEFAULT_CONTRACT_CAN_BE_DELETED, DEFAULT_CONTRACT_DOCUMENTS_KEEPS_HISTORY, - DEFAULT_CONTRACT_DOCUMENT_MUTABILITY, DEFAULT_CONTRACT_KEEPS_HISTORY, - DEFAULT_CONTRACT_MUTABILITY, + DataContractConfig, DEFAULT_CONTRACT_CAN_BE_DELETED, DEFAULT_CONTRACT_DOCUMENTS_CAN_BE_DELETED, + DEFAULT_CONTRACT_DOCUMENTS_KEEPS_HISTORY, DEFAULT_CONTRACT_DOCUMENT_MUTABILITY, + DEFAULT_CONTRACT_KEEPS_HISTORY, DEFAULT_CONTRACT_MUTABILITY, }; use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; use crate::ProtocolError; @@ -27,10 +27,14 @@ pub struct DataContractConfigV0 { /// Do documents in the contract keep history. This is a default for all documents in /// the contract, but can be overridden by the document itself pub documents_keep_history_contract_default: bool, - /// Are documents in the contract mutable. This specifies whether the document can be - /// changed or deleted. This is a default for all documents in the contract, but can be - /// overridden by the document itself + /// Are documents in the contract mutable? This specifies whether the documents can be + /// changed. This is a default for all document types in the contract, but can be + /// overridden by the document type config. pub documents_mutable_contract_default: bool, + /// Can documents in the contract be deleted? This specifies whether the documents can be + /// deleted. This is a default for all document types in the contract, but can be + /// overridden by the document types itself. + pub documents_can_be_deleted_contract_default: bool, /// Encryption key storage requirements pub requires_identity_encryption_bounded_key: Option, /// Decryption key storage requirements @@ -53,6 +57,7 @@ pub trait DataContractConfigGettersV0 { /// Returns whether documents in the contract are mutable by default. fn documents_mutable_contract_default(&self) -> bool; + fn documents_can_be_deleted_contract_default(&self) -> bool; /// Encryption key storage requirements fn requires_identity_encryption_bounded_key(&self) -> Option; @@ -78,6 +83,9 @@ pub trait DataContractConfigSettersV0 { /// Sets whether documents in the contract are mutable by default. fn set_documents_mutable_contract_default(&mut self, value: bool); + /// Sets whether documents in the contract can be deleted by default. + fn set_documents_can_be_deleted_contract_default(&mut self, value: bool); + /// Sets Encryption key storage requirements. fn set_requires_identity_encryption_bounded_key( &mut self, @@ -99,6 +107,7 @@ impl std::default::Default for DataContractConfigV0 { keeps_history: DEFAULT_CONTRACT_KEEPS_HISTORY, documents_keep_history_contract_default: DEFAULT_CONTRACT_DOCUMENTS_KEEPS_HISTORY, documents_mutable_contract_default: DEFAULT_CONTRACT_DOCUMENT_MUTABILITY, + documents_can_be_deleted_contract_default: DEFAULT_CONTRACT_DOCUMENTS_CAN_BE_DELETED, requires_identity_encryption_bounded_key: None, requires_identity_decryption_bounded_key: None, } @@ -134,6 +143,7 @@ impl DataContractConfigV0 { /// /// * `Result`: On success, a ContractConfig. /// On failure, a ProtocolError. + #[inline(always)] pub(super) fn get_contract_configuration_properties_v0( contract: &BTreeMap, ) -> Result { @@ -156,6 +166,10 @@ impl DataContractConfigV0 { .get_optional_bool(config::property::DOCUMENTS_MUTABLE_CONTRACT_DEFAULT)? .unwrap_or(DEFAULT_CONTRACT_DOCUMENT_MUTABILITY); + let documents_can_be_deleted_contract_default = contract + .get_optional_bool(config::property::DOCUMENTS_CAN_BE_DELETED_CONTRACT_DEFAULT)? + .unwrap_or(DEFAULT_CONTRACT_DOCUMENTS_CAN_BE_DELETED); + let requires_identity_encryption_bounded_key = contract .get_optional_integer::(config::property::REQUIRES_IDENTITY_ENCRYPTION_BOUNDED_KEY)? .map(|int| int.try_into()) @@ -172,6 +186,7 @@ impl DataContractConfigV0 { keeps_history, documents_keep_history_contract_default, documents_mutable_contract_default, + documents_can_be_deleted_contract_default, requires_identity_encryption_bounded_key, requires_identity_decryption_bounded_key, }) diff --git a/packages/rs-dpp/src/data_contract/conversion/cbor/mod.rs b/packages/rs-dpp/src/data_contract/conversion/cbor/mod.rs index bc9e08ecf52..541fabd5bae 100644 --- a/packages/rs-dpp/src/data_contract/conversion/cbor/mod.rs +++ b/packages/rs-dpp/src/data_contract/conversion/cbor/mod.rs @@ -12,7 +12,7 @@ impl DataContractCborConversionMethodsV0 for DataContract { fn from_cbor_with_id( cbor_bytes: impl AsRef<[u8]>, contract_id: Option, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -23,7 +23,7 @@ impl DataContractCborConversionMethodsV0 for DataContract { 0 => Ok(DataContractV0::from_cbor_with_id( cbor_bytes, contract_id, - validate, + full_validation, platform_version, )? .into()), @@ -37,7 +37,7 @@ impl DataContractCborConversionMethodsV0 for DataContract { fn from_cbor( cbor_bytes: impl AsRef<[u8]>, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -45,7 +45,9 @@ impl DataContractCborConversionMethodsV0 for DataContract { .contract_versions .contract_structure_version { - 0 => Ok(DataContractV0::from_cbor(cbor_bytes, validate, platform_version)?.into()), + 0 => Ok( + DataContractV0::from_cbor(cbor_bytes, full_validation, platform_version)?.into(), + ), version => Err(ProtocolError::UnknownVersionMismatch { method: "DataContract::from_cbor".to_string(), known_versions: vec![0], diff --git a/packages/rs-dpp/src/data_contract/conversion/cbor/v0/mod.rs b/packages/rs-dpp/src/data_contract/conversion/cbor/v0/mod.rs index 5ceaec81c53..273f9709b49 100644 --- a/packages/rs-dpp/src/data_contract/conversion/cbor/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/conversion/cbor/v0/mod.rs @@ -7,14 +7,14 @@ pub trait DataContractCborConversionMethodsV0 { fn from_cbor_with_id( cbor_bytes: impl AsRef<[u8]>, contract_id: Option, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where Self: Sized; fn from_cbor( cbor_bytes: impl AsRef<[u8]>, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where diff --git a/packages/rs-dpp/src/data_contract/conversion/json/mod.rs b/packages/rs-dpp/src/data_contract/conversion/json/mod.rs index 6edf1037855..b06f6ff2ff9 100644 --- a/packages/rs-dpp/src/data_contract/conversion/json/mod.rs +++ b/packages/rs-dpp/src/data_contract/conversion/json/mod.rs @@ -10,7 +10,7 @@ use serde_json::Value as JsonValue; impl DataContractJsonConversionMethodsV0 for DataContract { fn from_json( json_value: JsonValue, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where @@ -21,7 +21,9 @@ impl DataContractJsonConversionMethodsV0 for DataContract { .contract_versions .contract_structure_version { - 0 => Ok(DataContractV0::from_json(json_value, validate, platform_version)?.into()), + 0 => Ok( + DataContractV0::from_json(json_value, full_validation, platform_version)?.into(), + ), version => Err(ProtocolError::UnknownVersionMismatch { method: "DataContract::from_json_object".to_string(), known_versions: vec![0], diff --git a/packages/rs-dpp/src/data_contract/conversion/json/v0/mod.rs b/packages/rs-dpp/src/data_contract/conversion/json/v0/mod.rs index 28d3b6621b8..459ed3b4598 100644 --- a/packages/rs-dpp/src/data_contract/conversion/json/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/conversion/json/v0/mod.rs @@ -5,7 +5,7 @@ use serde_json::Value as JsonValue; pub trait DataContractJsonConversionMethodsV0 { fn from_json( json_value: JsonValue, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where diff --git a/packages/rs-dpp/src/data_contract/conversion/serde/mod.rs b/packages/rs-dpp/src/data_contract/conversion/serde/mod.rs index 7cc5c22c77c..43e558b17ab 100644 --- a/packages/rs-dpp/src/data_contract/conversion/serde/mod.rs +++ b/packages/rs-dpp/src/data_contract/conversion/serde/mod.rs @@ -29,7 +29,12 @@ impl<'de> Deserialize<'de> for DataContract { let current_version = PlatformVersion::get_current().map_err(|e| serde::de::Error::custom(e.to_string()))?; // when deserializing from json/platform_value/cbor we always want to validate (as this is not coming from the state) - DataContract::try_from_platform_versioned(serialization_format, true, current_version) - .map_err(serde::de::Error::custom) + DataContract::try_from_platform_versioned( + serialization_format, + true, + &mut vec![], + current_version, + ) + .map_err(serde::de::Error::custom) } } diff --git a/packages/rs-dpp/src/data_contract/conversion/value/mod.rs b/packages/rs-dpp/src/data_contract/conversion/value/mod.rs index d33f2077170..bc54e6e80a1 100644 --- a/packages/rs-dpp/src/data_contract/conversion/value/mod.rs +++ b/packages/rs-dpp/src/data_contract/conversion/value/mod.rs @@ -10,7 +10,7 @@ use platform_value::Value; impl DataContractValueConversionMethodsV0 for DataContract { fn from_value( raw_object: Value, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -18,7 +18,9 @@ impl DataContractValueConversionMethodsV0 for DataContract { .contract_versions .contract_structure_version { - 0 => Ok(DataContractV0::from_value(raw_object, validate, platform_version)?.into()), + 0 => Ok( + DataContractV0::from_value(raw_object, full_validation, platform_version)?.into(), + ), version => Err(ProtocolError::UnknownVersionMismatch { method: "DataContract::from_object".to_string(), known_versions: vec![0], diff --git a/packages/rs-dpp/src/data_contract/conversion/value/v0/mod.rs b/packages/rs-dpp/src/data_contract/conversion/value/v0/mod.rs index 684bf051eb4..614330cdb99 100644 --- a/packages/rs-dpp/src/data_contract/conversion/value/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/conversion/value/v0/mod.rs @@ -5,7 +5,7 @@ use platform_value::Value; pub trait DataContractValueConversionMethodsV0 { fn from_value( raw_object: Value, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where diff --git a/packages/rs-dpp/src/data_contract/created_data_contract/fields.rs b/packages/rs-dpp/src/data_contract/created_data_contract/fields.rs index bf38cb789eb..94373609317 100644 --- a/packages/rs-dpp/src/data_contract/created_data_contract/fields.rs +++ b/packages/rs-dpp/src/data_contract/created_data_contract/fields.rs @@ -1,4 +1,4 @@ pub mod property_names { pub const DATA_CONTRACT: &str = "dataContract"; - pub const ENTROPY: &str = "entropy"; + pub const IDENTITY_NONCE: &str = "identityNonce"; } diff --git a/packages/rs-dpp/src/data_contract/created_data_contract/mod.rs b/packages/rs-dpp/src/data_contract/created_data_contract/mod.rs index 4d3447ef557..0e9880679dc 100644 --- a/packages/rs-dpp/src/data_contract/created_data_contract/mod.rs +++ b/packages/rs-dpp/src/data_contract/created_data_contract/mod.rs @@ -4,7 +4,7 @@ pub mod v0; use crate::data_contract::created_data_contract::v0::{ CreatedDataContractInSerializationFormatV0, CreatedDataContractV0, }; -use crate::prelude::DataContract; +use crate::prelude::{DataContract, IdentityNonce}; use crate::version::PlatformVersion; use crate::ProtocolError; use bincode::{Decode, Encode}; @@ -16,7 +16,8 @@ use crate::serialization::{ PlatformSerializableWithPlatformVersion, }; use crate::ProtocolError::{PlatformDeserializationError, PlatformSerializationError}; -use platform_value::{Bytes32, Value}; +#[cfg(feature = "data-contract-value-conversion")] +use platform_value::Value; use platform_version::TryIntoPlatformVersioned; /// The created data contract is a intermediate structure that can be consumed by a @@ -49,7 +50,7 @@ impl PlatformSerializableWithPlatformVersion for CreatedDataContract { self, platform_version: &PlatformVersion, ) -> Result, ProtocolError> { - let (data_contract, entropy) = self.data_contract_and_entropy_owned(); + let (data_contract, identity_nonce) = self.data_contract_and_identity_nonce(); let data_contract_serialization_format: DataContractInSerializationFormat = data_contract.try_into_platform_versioned(platform_version)?; let created_data_contract_in_serialization_format = match platform_version @@ -60,7 +61,7 @@ impl PlatformSerializableWithPlatformVersion for CreatedDataContract { 0 => Ok(CreatedDataContractInSerializationFormat::V0( CreatedDataContractInSerializationFormatV0 { data_contract: data_contract_serialization_format, - entropy_used: entropy, + identity_nonce, }, )), version => Err(ProtocolError::UnknownVersionMismatch { @@ -81,7 +82,7 @@ impl PlatformSerializableWithPlatformVersion for CreatedDataContract { impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for CreatedDataContract { fn versioned_deserialize( data: &[u8], - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where @@ -99,11 +100,12 @@ impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for Cre )) })? .0; - let (data_contract_in_serialization_format, entropy) = - created_data_contract_in_serialization_format.data_contract_and_entropy_owned(); + let (data_contract_in_serialization_format, identity_nonce) = + created_data_contract_in_serialization_format.data_contract_and_identity_nonce_owned(); let data_contract = DataContract::try_from_platform_versioned( data_contract_in_serialization_format, - validate, + full_validation, + &mut vec![], platform_version, )?; match platform_version @@ -113,7 +115,7 @@ impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for Cre { 0 => Ok(CreatedDataContract::V0(CreatedDataContractV0 { data_contract, - entropy_used: entropy, + identity_nonce, })), version => Err(ProtocolError::UnknownVersionMismatch { method: "CreatedDataContract::versioned_deserialize".to_string(), @@ -139,9 +141,9 @@ impl CreatedDataContract { } } - pub fn data_contract_and_entropy_owned(self) -> (DataContract, Bytes32) { + pub fn data_contract_and_identity_nonce(self) -> (DataContract, IdentityNonce) { match self { - CreatedDataContract::V0(v0) => (v0.data_contract, v0.entropy_used), + CreatedDataContract::V0(v0) => (v0.data_contract, v0.identity_nonce), } } @@ -157,28 +159,22 @@ impl CreatedDataContract { } } - pub fn entropy_used_owned(self) -> Bytes32 { + pub fn identity_nonce(&self) -> IdentityNonce { match self { - CreatedDataContract::V0(v0) => v0.entropy_used, - } - } - - pub fn entropy_used(&self) -> &Bytes32 { - match self { - CreatedDataContract::V0(v0) => &v0.entropy_used, + CreatedDataContract::V0(v0) => v0.identity_nonce, } } #[cfg(test)] - pub fn set_entropy_used(&mut self, entropy_used: Bytes32) { + pub fn set_identity_nonce(&mut self, identity_nonce: IdentityNonce) { match self { - CreatedDataContract::V0(v0) => v0.entropy_used = entropy_used, + CreatedDataContract::V0(v0) => v0.identity_nonce = identity_nonce, } } - pub fn from_contract_and_entropy( + pub fn from_contract_and_identity_nonce( data_contract: DataContract, - entropy: Bytes32, + identity_nonce: IdentityNonce, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -188,7 +184,7 @@ impl CreatedDataContract { { 0 => Ok(CreatedDataContractV0 { data_contract, - entropy_used: entropy, + identity_nonce, } .into()), version => Err(ProtocolError::UnknownVersionMismatch { @@ -202,7 +198,7 @@ impl CreatedDataContract { #[cfg(feature = "data-contract-value-conversion")] pub fn from_object( raw_object: Value, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -210,9 +206,12 @@ impl CreatedDataContract { .contract_versions .created_data_contract_structure { - 0 => Ok( - CreatedDataContractV0::from_object(raw_object, validate, platform_version)?.into(), - ), + 0 => Ok(CreatedDataContractV0::from_object( + raw_object, + full_validation, + platform_version, + )? + .into()), version => Err(ProtocolError::UnknownVersionMismatch { method: "CreatedDataContract::from_object".to_string(), known_versions: vec![0], @@ -223,9 +222,13 @@ impl CreatedDataContract { } impl CreatedDataContractInSerializationFormat { - pub fn data_contract_and_entropy_owned(self) -> (DataContractInSerializationFormat, Bytes32) { + pub fn data_contract_and_identity_nonce_owned( + self, + ) -> (DataContractInSerializationFormat, IdentityNonce) { match self { - CreatedDataContractInSerializationFormat::V0(v0) => (v0.data_contract, v0.entropy_used), + CreatedDataContractInSerializationFormat::V0(v0) => { + (v0.data_contract, v0.identity_nonce) + } } } } diff --git a/packages/rs-dpp/src/data_contract/created_data_contract/v0/mod.rs b/packages/rs-dpp/src/data_contract/created_data_contract/v0/mod.rs index 5b27c4b65b4..d47dc3b894c 100644 --- a/packages/rs-dpp/src/data_contract/created_data_contract/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/created_data_contract/v0/mod.rs @@ -1,33 +1,38 @@ use crate::data_contract::DataContract; use bincode::{Decode, Encode}; -#[cfg(feature = "data-contract-value-conversion")] -use crate::data_contract::conversion::value::v0::DataContractValueConversionMethodsV0; -use crate::data_contract::created_data_contract::fields::property_names::{DATA_CONTRACT, ENTROPY}; use crate::data_contract::serialized_version::DataContractInSerializationFormat; -use crate::version::PlatformVersion; -use crate::ProtocolError; -use platform_value::btreemap_extensions::BTreeValueRemoveFromMapHelper; -use platform_value::{Bytes32, Error, Value}; +use crate::prelude::IdentityNonce; +#[cfg(feature = "data-contract-value-conversion")] +use crate::{ + data_contract::{ + conversion::value::v0::DataContractValueConversionMethodsV0, + created_data_contract::fields::property_names::{DATA_CONTRACT, IDENTITY_NONCE}, + }, + version::PlatformVersion, + ProtocolError, +}; +#[cfg(feature = "data-contract-value-conversion")] +use platform_value::{btreemap_extensions::BTreeValueRemoveFromMapHelper, Error, Value}; // TODO: Decide on what we need ExtendedDataContract with metadata or CreatedDataContract or both. #[derive(Clone, Debug, PartialEq)] pub struct CreatedDataContractV0 { pub data_contract: DataContract, - pub entropy_used: Bytes32, + pub identity_nonce: IdentityNonce, } #[derive(Clone, Debug, Encode, Decode)] pub struct CreatedDataContractInSerializationFormatV0 { pub data_contract: DataContractInSerializationFormat, - pub entropy_used: Bytes32, + pub identity_nonce: IdentityNonce, } impl CreatedDataContractV0 { #[cfg(feature = "data-contract-value-conversion")] pub fn from_object( raw_object: Value, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { let mut raw_map = raw_object @@ -38,16 +43,16 @@ impl CreatedDataContractV0 { Error::StructureError("unable to remove property dataContract".to_string()) })?; - let entropy_used = raw_map - .remove_bytes_32(ENTROPY) + let identity_nonce = raw_map + .remove_integer(IDENTITY_NONCE) .map_err(ProtocolError::ValueError)?; let data_contract = - DataContract::from_value(raw_data_contract, validate, platform_version)?; + DataContract::from_value(raw_data_contract, full_validation, platform_version)?; Ok(Self { data_contract, - entropy_used, + identity_nonce, }) } } diff --git a/packages/rs-dpp/src/data_contract/data_contract_facade.rs b/packages/rs-dpp/src/data_contract/data_contract_facade.rs index d07991b9247..d1f606622e3 100644 --- a/packages/rs-dpp/src/data_contract/data_contract_facade.rs +++ b/packages/rs-dpp/src/data_contract/data_contract_facade.rs @@ -1,12 +1,11 @@ use crate::data_contract::{DataContract, DataContractFactory}; use crate::data_contract::created_data_contract::CreatedDataContract; -use crate::prelude::Identifier; +use crate::prelude::{Identifier, IdentityNonce}; #[cfg(feature = "state-transitions")] use crate::state_transition::data_contract_create_transition::DataContractCreateTransition; #[cfg(feature = "state-transitions")] use crate::state_transition::data_contract_update_transition::DataContractUpdateTransition; -use crate::util::entropy_generator::EntropyGenerator; use crate::ProtocolError; use platform_value::Value; @@ -29,12 +28,9 @@ pub struct DataContractFacade { } impl DataContractFacade { - pub fn new( - protocol_version: u32, - entropy_generator: Option>, - ) -> Result { + pub fn new(protocol_version: u32) -> Result { Ok(Self { - factory: DataContractFactory::new(protocol_version, entropy_generator)?, + factory: DataContractFactory::new(protocol_version)?, }) } @@ -42,15 +38,22 @@ impl DataContractFacade { pub fn create( &self, owner_id: Identifier, + identity_nonce: IdentityNonce, documents: Value, config: Option, definitions: Option, ) -> Result { - self.factory - .create_with_value_config(owner_id, documents, config, definitions) + self.factory.create_with_value_config( + owner_id, + identity_nonce, + documents, + config, + definitions, + ) } /// Create Data Contract from plain object + #[cfg(all(feature = "identity-serialization", feature = "client"))] pub fn create_from_object( &self, raw_data_contract: Value, @@ -61,6 +64,7 @@ impl DataContractFacade { } /// Create Data Contract from buffer + #[cfg(all(feature = "identity-serialization", feature = "client"))] pub fn create_from_buffer( &self, buffer: Vec, @@ -84,8 +88,9 @@ impl DataContractFacade { pub fn create_data_contract_update_transition( &self, data_contract: DataContract, + identity_contract_nonce: IdentityNonce, ) -> Result { self.factory - .create_data_contract_update_transition(data_contract) + .create_data_contract_update_transition(data_contract, identity_contract_nonce) } } diff --git a/packages/rs-dpp/src/data_contract/document_type/accessors/mod.rs b/packages/rs-dpp/src/data_contract/document_type/accessors/mod.rs index 3b9c92e1034..3dea66c6915 100644 --- a/packages/rs-dpp/src/data_contract/document_type/accessors/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/accessors/mod.rs @@ -7,10 +7,13 @@ use crate::data_contract::document_type::{DocumentType, DocumentTypeMutRef, Docu use platform_value::{Identifier, Value}; +use crate::data_contract::document_type::restricted_creation::CreationRestrictionMode; use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; +use crate::document::transfer::Transferable; use crate::identity::SecurityLevel; +use crate::nft::TradeMode; use indexmap::IndexMap; -use std::collections::{BTreeMap, BTreeSet}; +use std::collections::BTreeSet; pub use v0::*; impl DocumentTypeV0Getters for DocumentType { @@ -86,6 +89,30 @@ impl DocumentTypeV0Getters for DocumentType { } } + fn documents_can_be_deleted(&self) -> bool { + match self { + DocumentType::V0(v0) => v0.documents_can_be_deleted(), + } + } + + fn trade_mode(&self) -> TradeMode { + match self { + DocumentType::V0(v0) => v0.trade_mode(), + } + } + + fn creation_restriction_mode(&self) -> CreationRestrictionMode { + match self { + DocumentType::V0(v0) => v0.creation_restriction_mode(), + } + } + + fn documents_transferable(&self) -> Transferable { + match self { + DocumentType::V0(v0) => v0.documents_transferable(), + } + } + fn data_contract_id(&self) -> Identifier { match self { DocumentType::V0(v0) => v0.data_contract_id(), @@ -184,6 +211,30 @@ impl<'a> DocumentTypeV0Getters for DocumentTypeRef<'a> { } } + fn documents_can_be_deleted(&self) -> bool { + match self { + DocumentTypeRef::V0(v0) => v0.documents_can_be_deleted(), + } + } + + fn documents_transferable(&self) -> Transferable { + match self { + DocumentTypeRef::V0(v0) => v0.documents_transferable(), + } + } + + fn trade_mode(&self) -> TradeMode { + match self { + DocumentTypeRef::V0(v0) => v0.trade_mode(), + } + } + + fn creation_restriction_mode(&self) -> CreationRestrictionMode { + match self { + DocumentTypeRef::V0(v0) => v0.creation_restriction_mode(), + } + } + fn data_contract_id(&self) -> Identifier { match self { DocumentTypeRef::V0(v0) => v0.data_contract_id(), @@ -282,6 +333,30 @@ impl<'a> DocumentTypeV0Getters for DocumentTypeMutRef<'a> { } } + fn documents_can_be_deleted(&self) -> bool { + match self { + DocumentTypeMutRef::V0(v0) => v0.documents_can_be_deleted(), + } + } + + fn documents_transferable(&self) -> Transferable { + match self { + DocumentTypeMutRef::V0(v0) => v0.documents_transferable(), + } + } + + fn trade_mode(&self) -> TradeMode { + match self { + DocumentTypeMutRef::V0(v0) => v0.trade_mode(), + } + } + + fn creation_restriction_mode(&self) -> CreationRestrictionMode { + match self { + DocumentTypeMutRef::V0(v0) => v0.creation_restriction_mode(), + } + } + fn data_contract_id(&self) -> Identifier { match self { DocumentTypeMutRef::V0(v0) => v0.data_contract_id(), diff --git a/packages/rs-dpp/src/data_contract/document_type/accessors/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/accessors/v0/mod.rs index a87802cf6f8..c5770296685 100644 --- a/packages/rs-dpp/src/data_contract/document_type/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/accessors/v0/mod.rs @@ -4,10 +4,13 @@ use crate::data_contract::document_type::property::DocumentProperty; use platform_value::{Identifier, Value}; +use crate::data_contract::document_type::restricted_creation::CreationRestrictionMode; use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; +use crate::document::transfer::Transferable; use crate::identity::SecurityLevel; +use crate::nft::TradeMode; use indexmap::IndexMap; -use std::collections::{BTreeMap, BTreeSet}; +use std::collections::BTreeSet; pub trait DocumentTypeV0Getters { /// Returns the name of the document type. @@ -44,6 +47,18 @@ pub trait DocumentTypeV0Getters { /// Returns the documents mutable flag of the document type. fn documents_mutable(&self) -> bool; + /// Returns the documents can be deleted flag of the document type. + fn documents_can_be_deleted(&self) -> bool; + + /// Returns the documents transferable flag of the document type. + fn documents_transferable(&self) -> Transferable; + + /// Returns the documents trade mode flag of the document type. + fn trade_mode(&self) -> TradeMode; + + /// Returns the creation restriction mode. + fn creation_restriction_mode(&self) -> CreationRestrictionMode; + /// Returns the data contract id of the document type. fn data_contract_id(&self) -> Identifier; diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/mod.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/mod.rs index ed7c970e3b3..c397054446e 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/mod.rs @@ -3,6 +3,7 @@ mod v0; use crate::data_contract::document_type::v0::DocumentTypeV0; use crate::data_contract::document_type::DocumentType; use crate::data_contract::DocumentName; +use crate::validation::operations::ProtocolValidationOperation; use crate::version::PlatformVersion; use crate::ProtocolError; use platform_value::{Identifier, Value}; @@ -38,7 +39,9 @@ impl DocumentType { schema_defs: Option<&BTreeMap>, documents_keep_history_contract_default: bool, documents_mutable_contract_default: bool, - validate: bool, + documents_can_be_deleted_contract_default: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result, ProtocolError> { match platform_version @@ -54,7 +57,9 @@ impl DocumentType { schema_defs, documents_keep_history_contract_default, documents_mutable_contract_default, - validate, + documents_can_be_deleted_contract_default, + full_validation, + validation_operations, platform_version, ), version => Err(ProtocolError::UnknownVersionMismatch { @@ -65,3 +70,41 @@ impl DocumentType { } } } + +#[cfg(test)] +mod tests { + use super::*; + + use crate::consensus::basic::data_contract::DocumentTypesAreMissingError; + use crate::consensus::basic::BasicError; + use crate::consensus::ConsensusError; + use crate::data_contract::errors::DataContractError; + use assert_matches::assert_matches; + use platform_value::Identifier; + use std::ops::Deref; + + #[test] + pub fn should_not_allow_creating_document_types_with_empty_schema() { + let id = Identifier::random(); + + let result = DocumentType::create_document_types_from_document_schemas( + id, + Default::default(), + None, + false, + false, + false, + false, + &mut vec![], + PlatformVersion::latest(), + ); + + assert_matches!(result, Err(ProtocolError::ConsensusError(e)) => { + assert_matches!(e.deref(), ConsensusError::BasicError(BasicError::ContractError( + DataContractError::DocumentTypesAreMissingError( + DocumentTypesAreMissingError { .. } + ) + ))); + }); + } +} diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs index 6ca8fefa149..c02bc00306f 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs @@ -1,6 +1,9 @@ +use crate::consensus::basic::data_contract::DocumentTypesAreMissingError; +use crate::data_contract::document_type::class_methods::consensus_or_protocol_data_contract_error; use crate::data_contract::document_type::v0::DocumentTypeV0; use crate::data_contract::document_type::DocumentType; use crate::data_contract::DocumentName; +use crate::validation::operations::ProtocolValidationOperation; use crate::version::PlatformVersion; use crate::ProtocolError; use platform_value::{Identifier, Value}; @@ -13,11 +16,19 @@ impl DocumentTypeV0 { schema_defs: Option<&BTreeMap>, documents_keep_history_contract_default: bool, documents_mutable_contract_default: bool, - validate: bool, + documents_can_be_deleted_contract_default: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result, ProtocolError> { let mut contract_document_types: BTreeMap = BTreeMap::new(); + if document_schemas.is_empty() { + return Err(consensus_or_protocol_data_contract_error( + DocumentTypesAreMissingError::new(data_contract_id).into(), + )); + } + for (name, schema) in document_schemas.into_iter() { let document_type = match platform_version .dpp @@ -32,7 +43,9 @@ impl DocumentTypeV0 { schema_defs, documents_keep_history_contract_default, documents_mutable_contract_default, - validate, + documents_can_be_deleted_contract_default, + full_validation, + validation_operations, platform_version, )?, version => { diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/mod.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/mod.rs index 169b5bedf9b..4f8220661fb 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/mod.rs @@ -1,2 +1,37 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::data_contract::errors::DataContractError; +use crate::ProtocolError; + mod create_document_types_from_document_schemas; mod try_from_schema; + +#[inline] +fn consensus_or_protocol_data_contract_error( + data_contract_error: DataContractError, +) -> ProtocolError { + #[cfg(feature = "validation")] + { + ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::ContractError(data_contract_error)).into(), + ) + } + #[cfg(not(feature = "validation"))] + { + ProtocolError::DataContractError(data_contract_error) + } +} + +#[inline] +fn consensus_or_protocol_value_error(platform_value_error: platform_value::Error) -> ProtocolError { + #[cfg(feature = "validation")] + { + ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::ValueError(platform_value_error.into())).into(), + ) + } + #[cfg(not(feature = "validation"))] + { + ProtocolError::ValueError(platform_value_error.into()) + } +} diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs index c8935442564..d56fad8f84e 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs @@ -1,5 +1,6 @@ use crate::data_contract::document_type::v0::DocumentTypeV0; use crate::data_contract::document_type::DocumentType; +use crate::validation::operations::ProtocolValidationOperation; use crate::ProtocolError; use platform_value::{Identifier, Value}; use platform_version::version::PlatformVersion; @@ -15,7 +16,9 @@ impl DocumentType { schema_defs: Option<&BTreeMap>, default_keeps_history: bool, default_mutability: bool, - validate: bool, + default_can_be_deleted: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -32,7 +35,9 @@ impl DocumentType { schema_defs, default_keeps_history, default_mutability, - validate, + default_can_be_deleted, + full_validation, + validation_operations, platform_version, ) .map(|document_type| document_type.into()), diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs index ec06bff4366..97534fe049e 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs @@ -1,15 +1,10 @@ -use crate::data_contract::document_type::v0::DocumentTypeV0; #[cfg(feature = "validation")] -use crate::data_contract::document_type::v0::StatelessJsonSchemaLazyValidator; -use indexmap::IndexMap; -use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashSet}; -use std::convert::TryInto; - use crate::consensus::basic::data_contract::{ DuplicateIndexNameError, InvalidIndexPropertyTypeError, InvalidIndexedPropertyConstraintError, SystemPropertyIndexAlreadyPresentError, UndefinedIndexPropertyError, UniqueIndicesLimitReachedError, }; +#[cfg(feature = "validation")] use crate::consensus::ConsensusError; use crate::data_contract::document_type::array::ArrayItemType; use crate::data_contract::document_type::index::Index; @@ -20,17 +15,38 @@ use crate::data_contract::document_type::schema::{ byte_array_has_no_items_as_parent_validator, pattern_is_valid_regex_validator, traversal_validator, validate_max_depth, }; +use crate::data_contract::document_type::v0::DocumentTypeV0; +#[cfg(feature = "validation")] +use crate::data_contract::document_type::v0::StatelessJsonSchemaLazyValidator; +use indexmap::IndexMap; +#[cfg(feature = "validation")] +use std::collections::HashSet; +use std::collections::{BTreeMap, BTreeSet}; +use std::convert::TryInto; +#[cfg(any(test, feature = "validation"))] +use crate::consensus::basic::data_contract::InvalidDocumentTypeNameError; +#[cfg(feature = "validation")] +use crate::consensus::basic::data_contract::InvalidDocumentTypeRequiredSecurityLevelError; +#[cfg(feature = "validation")] use crate::consensus::basic::document::MissingPositionsInDocumentTypePropertiesError; +#[cfg(feature = "validation")] use crate::consensus::basic::BasicError; -use crate::data_contract::document_type::schema::enrich_with_base_schema; +use crate::data_contract::document_type::class_methods::{ + consensus_or_protocol_data_contract_error, consensus_or_protocol_value_error, +}; +use crate::data_contract::document_type::property_names::{ + CAN_BE_DELETED, CREATION_RESTRICTION_MODE, DOCUMENTS_KEEP_HISTORY, DOCUMENTS_MUTABLE, + TRADE_MODE, TRANSFERABLE, +}; use crate::data_contract::document_type::{property_names, DocumentType}; -use crate::data_contract::errors::{DataContractError, StructureError}; +use crate::data_contract::errors::DataContractError; use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; use crate::identity::SecurityLevel; use crate::util::json_schema::resolve_uri; #[cfg(feature = "validation")] use crate::validation::meta_validators::DOCUMENT_META_SCHEMA_V0; +use crate::validation::operations::ProtocolValidationOperation; use crate::version::PlatformVersion; use crate::ProtocolError; use platform_value::btreemap_extensions::BTreeValueMapHelper; @@ -39,7 +55,19 @@ use platform_value::{Identifier, Value}; const UNIQUE_INDEX_LIMIT_V0: usize = 16; const NOT_ALLOWED_SYSTEM_PROPERTIES: [&str; 1] = ["$id"]; -const SYSTEM_PROPERTIES: [&str; 4] = ["$id", "$ownerId", "$createdAt", "$updatedAt"]; +const SYSTEM_PROPERTIES: [&str; 11] = [ + "$id", + "$ownerId", + "$createdAt", + "$updatedAt", + "$transferredAt", + "$createdAtBlockHeight", + "$updatedAtBlockHeight", + "$transferredAtBlockHeight", + "$createdAtCoreBlockHeight", + "$updatedAtCoreBlockHeight", + "$transferredAtCoreBlockHeight", +]; const MAX_INDEXED_STRING_PROPERTY_LENGTH: u16 = 63; const MAX_INDEXED_BYTE_ARRAY_PROPERTY_LENGTH: u16 = 255; @@ -47,6 +75,7 @@ const MAX_INDEXED_ARRAY_ITEMS: usize = 1024; impl DocumentTypeV0 { // TODO: Split into multiple functions + #[allow(unused_variables)] pub(crate) fn try_from_schema_v0( data_contract_id: Identifier, name: &str, @@ -54,18 +83,22 @@ impl DocumentTypeV0 { schema_defs: Option<&BTreeMap>, default_keeps_history: bool, default_mutability: bool, - validate: bool, // we don't need to validate if loaded from state + default_can_be_deleted: bool, + full_validation: bool, // we don't need to validate if loaded from state + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result { // Create a full root JSON Schema from shorten contract document type schema - let root_schema = enrich_with_base_schema( + let root_schema = DocumentType::enrich_with_base_schema( schema.clone(), schema_defs.map(|defs| Value::from(defs.clone())), platform_version, )?; #[cfg(not(feature = "validation"))] - if validate { + if full_validation { + // TODO we are silently dropping this error when we shouldn't be + // but returning this error causes tests to fail; investigate more. ProtocolError::CorruptedCodeExecution( "validation is not enabled but is being called on try_from_schema_v0".to_string(), ); @@ -75,22 +108,18 @@ impl DocumentTypeV0 { let json_schema_validator = StatelessJsonSchemaLazyValidator::new(); #[cfg(feature = "validation")] - if validate { - // Make sure JSON Schema is compilable - let root_json_schema = root_schema - .try_to_validating_json() - .map_err(ProtocolError::ValueError)?; - - json_schema_validator.compile(&root_json_schema, platform_version)?; - - // Validate against JSON Schema - DOCUMENT_META_SCHEMA_V0 - .validate( - &root_schema - .try_to_validating_json() - .map_err(ProtocolError::ValueError)?, - ) - .map_err(|mut errs| ConsensusError::from(errs.next().unwrap()))?; + if full_validation { + // Make sure a document type name is compliant + if !name + .chars() + .all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '-') + || name.is_empty() + || name.len() > 64 + { + return Err(ProtocolError::ConsensusError(Box::new( + InvalidDocumentTypeNameError::new(name.to_string()).into(), + ))); + } // Validate document schema depth let mut result = validate_max_depth(&root_schema, platform_version)?; @@ -98,57 +127,124 @@ impl DocumentTypeV0 { if !result.is_valid() { let error = result.errors.remove(0); + let schema_size = result.into_data()?.size; + + validation_operations.push( + ProtocolValidationOperation::DocumentTypeSchemaValidationForSize(schema_size), + ); + return Err(ProtocolError::ConsensusError(Box::new(error))); } + let schema_size = result.into_data()?.size; + + validation_operations.push( + ProtocolValidationOperation::DocumentTypeSchemaValidationForSize(schema_size), + ); + + // Make sure JSON Schema is compilable + let root_json_schema = root_schema.try_to_validating_json().map_err(|e| { + ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::ValueError(e.into())).into(), + ) + })?; + + json_schema_validator.compile(&root_json_schema, platform_version)?; + + // Validate against JSON Schema + DOCUMENT_META_SCHEMA_V0 + .validate(&root_schema.try_to_validating_json().map_err(|e| { + ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::ValueError(e.into())).into(), + ) + })?) + .map_err(|mut errs| ConsensusError::from(errs.next().unwrap()))?; + // TODO: Are we still aiming to use RE2 with linear time complexity to protect from ReDoS attacks? // If not we can remove this validation // Validate reg exp compatibility with RE2 and byteArray usage - result.merge(traversal_validator( + let mut traversal_validator_result = traversal_validator( &root_schema, &[ pattern_is_valid_regex_validator, byte_array_has_no_items_as_parent_validator, ], platform_version, - )?); + )?; - if !result.is_valid() { - let error = result.errors.remove(0); + if !traversal_validator_result.is_valid() { + let error = traversal_validator_result.errors.remove(0); return Err(ProtocolError::ConsensusError(Box::new(error))); } } + // This has already been validated, but we leave the map_err here for consistency let schema_map = schema.to_map().map_err(|err| { - ProtocolError::DataContractError(DataContractError::InvalidContractStructure(format!( - "document schema must be an object: {err}" - ))) + consensus_or_protocol_data_contract_error(DataContractError::InvalidContractStructure( + format!("document schema must be an object: {err}"), + )) })?; - // TODO: These properties aren't defined in JSON meta schema // Do documents of this type keep history? (Overrides contract value) let documents_keep_history: bool = - Value::inner_optional_bool_value(schema_map, "documentsKeepHistory") - .map_err(ProtocolError::ValueError)? + Value::inner_optional_bool_value(schema_map, DOCUMENTS_KEEP_HISTORY) + .map_err(consensus_or_protocol_value_error)? .unwrap_or(default_keeps_history); // Are documents of this type mutable? (Overrides contract value) let documents_mutable: bool = - Value::inner_optional_bool_value(schema_map, "documentsMutable") - .map_err(ProtocolError::ValueError)? + Value::inner_optional_bool_value(schema_map, DOCUMENTS_MUTABLE) + .map_err(consensus_or_protocol_value_error)? .unwrap_or(default_mutability); + // Can documents of this type be deleted? (Overrides contract value) + let documents_can_be_deleted: bool = + Value::inner_optional_bool_value(schema_map, CAN_BE_DELETED) + .map_err(consensus_or_protocol_value_error)? + .unwrap_or(default_can_be_deleted); + + // Are documents of this type transferable? + let documents_transferable_u8: u8 = + Value::inner_optional_integer_value(schema_map, TRANSFERABLE) + .map_err(consensus_or_protocol_value_error)? + .unwrap_or_default(); + + let documents_transferable = documents_transferable_u8.try_into()?; + + // What is the trade mode of these documents + let documents_trade_mode_u8: u8 = + Value::inner_optional_integer_value(schema_map, TRADE_MODE) + .map_err(consensus_or_protocol_value_error)? + .unwrap_or_default(); + + let trade_mode = documents_trade_mode_u8.try_into()?; + + // What is the creation restriction mode of this document type? + let documents_creation_restriction_mode_u8: u8 = + Value::inner_optional_integer_value(schema_map, CREATION_RESTRICTION_MODE) + .map_err(consensus_or_protocol_value_error)? + .unwrap_or_default(); + + let creation_restriction_mode = documents_creation_restriction_mode_u8.try_into()?; + // Extract the properties let property_values = Value::inner_optional_index_map::( schema_map, property_names::PROPERTIES, property_names::POSITION, - )? + ) + .map_err(consensus_or_protocol_value_error)? .unwrap_or_default(); #[cfg(feature = "validation")] - if validate { + if full_validation { + validation_operations.push( + ProtocolValidationOperation::DocumentTypeSchemaPropertyValidation( + property_values.values().len() as u64, + ), + ); + // We should validate that the positions are continuous for (pos, value) in property_values.values().enumerate() { if value.get_integer::(property_names::POSITION)? != pos as u32 { @@ -188,7 +284,8 @@ impl DocumentTypeV0 { property_key.clone(), property_value, &root_schema, - )?; + ) + .map_err(consensus_or_protocol_data_contract_error)?; insert_values_nested( &mut document_properties, @@ -196,14 +293,18 @@ impl DocumentTypeV0 { property_key, property_value, &root_schema, - )?; + ) + .map_err(consensus_or_protocol_data_contract_error)?; } // Initialize indices let index_values = - Value::inner_optional_array_slice_value(schema_map, property_names::INDICES)?; + Value::inner_optional_array_slice_value(schema_map, property_names::INDICES) + .map_err(consensus_or_protocol_value_error)?; + #[cfg(feature = "validation")] let mut index_names: HashSet = HashSet::new(); + #[cfg(feature = "validation")] let mut unique_indices_count = 0; let indices: Vec = index_values @@ -212,17 +313,21 @@ impl DocumentTypeV0 { .iter() .map(|index_value| { let index: Index = index_value - .as_map() - .ok_or(ProtocolError::DataContractError( - DataContractError::InvalidContractStructure( - "index definition is not a map as expected".to_string(), - ), - ))? + .to_map() + .map_err(consensus_or_protocol_value_error)? .as_slice() - .try_into()?; + .try_into() + .map_err(consensus_or_protocol_data_contract_error)?; #[cfg(feature = "validation")] - if validate { + if full_validation { + validation_operations.push( + ProtocolValidationOperation::DocumentTypeSchemaIndexValidation( + index.properties.len() as u64, + index.unique, + ), + ); + // Unique indices produces significant load on the system during state validation // so we need to limit their number to prevent of spikes and DoS attacks if index.unique { @@ -361,18 +466,35 @@ impl DocumentTypeV0 { )?; let security_level_requirement = schema - .get_optional_integer::(property_names::SECURITY_LEVEL_REQUIREMENT)? + .get_optional_integer::(property_names::SECURITY_LEVEL_REQUIREMENT) + .map_err(consensus_or_protocol_value_error)? .map(SecurityLevel::try_from) .transpose()? .unwrap_or(SecurityLevel::HIGH); + #[cfg(feature = "validation")] + if full_validation && security_level_requirement == SecurityLevel::MASTER { + return Err(ConsensusError::BasicError( + BasicError::InvalidDocumentTypeRequiredSecurityLevelError( + InvalidDocumentTypeRequiredSecurityLevelError::new( + security_level_requirement, + data_contract_id, + name.to_string(), + ), + ), + ) + .into()); + } + let requires_identity_encryption_bounded_key = schema - .get_optional_integer::(property_names::REQUIRES_IDENTITY_ENCRYPTION_BOUNDED_KEY)? + .get_optional_integer::(property_names::REQUIRES_IDENTITY_ENCRYPTION_BOUNDED_KEY) + .map_err(consensus_or_protocol_value_error)? .map(StorageKeyRequirements::try_from) .transpose()?; let requires_identity_decryption_bounded_key = schema - .get_optional_integer::(property_names::REQUIRES_IDENTITY_DECRYPTION_BOUNDED_KEY)? + .get_optional_integer::(property_names::REQUIRES_IDENTITY_DECRYPTION_BOUNDED_KEY) + .map_err(consensus_or_protocol_value_error)? .map(StorageKeyRequirements::try_from) .transpose()?; @@ -388,6 +510,10 @@ impl DocumentTypeV0 { required_fields, documents_keep_history, documents_mutable, + documents_can_be_deleted, + documents_transferable, + trade_mode, + creation_restriction_mode, data_contract_id, requires_identity_encryption_bounded_key, requires_identity_decryption_bounded_key, @@ -405,7 +531,7 @@ fn insert_values( property_key: String, property_value: &Value, root_schema: &Value, -) -> Result<(), ProtocolError> { +) -> Result<(), DataContractError> { let mut to_visit: Vec<(Option, String, &Value)> = vec![(prefix, property_key, property_value)]; @@ -417,20 +543,13 @@ fn insert_values( let mut inner_properties = property_value.to_btree_ref_string_map()?; - if let Some(schema_ref) = inner_properties - .get_optional_str(property_names::REF) - .map_err(ProtocolError::ValueError)? - { - let referenced_sub_schema = resolve_uri(root_schema, schema_ref).map_err(|err| { - ProtocolError::Generic(format!("invalid schema reference url: {err}")) - })?; + if let Some(schema_ref) = inner_properties.get_optional_str(property_names::REF)? { + let referenced_sub_schema = resolve_uri(root_schema, schema_ref)?; inner_properties = referenced_sub_schema.to_btree_ref_string_map()? } - let type_value = inner_properties - .get_str(property_names::TYPE) - .map_err(ProtocolError::ValueError)?; + let type_value = inner_properties.get_str(property_names::TYPE)?; let is_required = known_required.contains(&prefixed_property_key); let field_type: DocumentPropertyType; @@ -445,10 +564,7 @@ fn insert_values( match inner_properties .get_optional_str(property_names::CONTENT_MEDIA_TYPE)? { - Some(content_media_type) - if content_media_type - == "application/x.dash.dpp.identifier" => - { + Some("application/x.dash.dpp.identifier") => { DocumentPropertyType::Identifier } Some(_) | None => DocumentPropertyType::ByteArray( @@ -459,10 +575,8 @@ fn insert_values( ), } } else { - return Err(ProtocolError::DataContractError( - DataContractError::InvalidContractStructure( - "byteArray should always be true if defined".to_string(), - ), + return Err(DataContractError::InvalidContractStructure( + "byteArray should always be true if defined".to_string(), )); } } @@ -487,16 +601,16 @@ fn insert_values( let properties = properties_as_value .as_map() - .ok_or(ProtocolError::StructureError( - StructureError::ValueWrongType("properties must be a map"), + .ok_or(DataContractError::ValueWrongType( + "properties must be a map".to_string(), ))?; for (object_property_key, object_property_value) in properties.iter() { let object_property_string = object_property_key .as_text() - .ok_or(ProtocolError::StructureError(StructureError::KeyWrongType( - "property key must be a string", - )))? + .ok_or(DataContractError::KeyWrongType( + "property key must be a string".to_string(), + ))? .to_string(); to_visit.push(( Some(prefixed_property_key.clone()), @@ -543,53 +657,36 @@ fn insert_values_nested( property_key: String, property_value: &Value, root_schema: &Value, -) -> Result<(), ProtocolError> { +) -> Result<(), DataContractError> { let mut inner_properties = property_value.to_btree_ref_string_map()?; - if let Some(schema_ref) = inner_properties - .get_optional_str(property_names::REF) - .map_err(ProtocolError::ValueError)? - { - let referenced_sub_schema = resolve_uri(root_schema, schema_ref).map_err(|err| { - ProtocolError::Generic(format!("invalid schema reference url: {err}")) - })?; + if let Some(schema_ref) = inner_properties.get_optional_str(property_names::REF)? { + let referenced_sub_schema = resolve_uri(root_schema, schema_ref)?; inner_properties = referenced_sub_schema.to_btree_ref_string_map()?; } - let type_value = inner_properties - .get_str(property_names::TYPE) - .map_err(ProtocolError::ValueError)?; + let type_value = inner_properties.get_str(property_names::TYPE)?; let is_required = known_required.contains(&property_key); - let field_type: DocumentPropertyType; - - match type_value { - "integer" => { - field_type = DocumentPropertyType::Integer; - } - "number" => { - field_type = DocumentPropertyType::Number; - } - "string" => { - field_type = DocumentPropertyType::String( - inner_properties.get_optional_integer(property_names::MIN_LENGTH)?, - inner_properties.get_optional_integer(property_names::MAX_LENGTH)?, - ); - } + let field_type = match type_value { + "integer" => DocumentPropertyType::Integer, + "number" => DocumentPropertyType::Number, + "string" => DocumentPropertyType::String( + inner_properties.get_optional_integer(property_names::MIN_LENGTH)?, + inner_properties.get_optional_integer(property_names::MAX_LENGTH)?, + ), "array" => { // Only handling bytearrays for v1 // Return an error if it is not a byte array - field_type = match inner_properties.get_optional_bool(property_names::BYTE_ARRAY)? { + match inner_properties.get_optional_bool(property_names::BYTE_ARRAY)? { Some(inner_bool) => { if inner_bool { match inner_properties .get_optional_str(property_names::CONTENT_MEDIA_TYPE)? { - Some(content_media_type) - if content_media_type == "application/x.dash.dpp.identifier" => - { + Some("application/x.dash.dpp.identifier") => { DocumentPropertyType::Identifier } Some(_) | None => DocumentPropertyType::ByteArray( @@ -598,10 +695,8 @@ fn insert_values_nested( ), } } else { - return Err(ProtocolError::DataContractError( - DataContractError::InvalidContractStructure( - "byteArray should always be true if defined".to_string(), - ), + return Err(DataContractError::InvalidContractStructure( + "byteArray should always be true if defined".to_string(), )); } } @@ -610,7 +705,7 @@ fn insert_values_nested( // This is a temporary workaround to bring back v0.22 behavior and should be // replaced with a proper array support in future versions None => DocumentPropertyType::Array(ArrayItemType::Boolean), - }; + } } "object" => { let mut nested_properties = IndexMap::new(); @@ -618,8 +713,8 @@ fn insert_values_nested( let properties = properties_as_value .as_map() - .ok_or(ProtocolError::StructureError( - StructureError::ValueWrongType("properties must be a map"), + .ok_or(DataContractError::ValueWrongType( + "properties must be a map".to_string(), ))?; let mut sorted_properties: Vec<_> = properties.iter().collect(); @@ -649,9 +744,9 @@ fn insert_values_nested( for (object_property_key, object_property_value) in properties.iter() { let object_property_string = object_property_key .as_text() - .ok_or(ProtocolError::StructureError(StructureError::KeyWrongType( - "property key must be a string", - )))? + .ok_or(DataContractError::KeyWrongType( + "property key must be a string".to_string(), + ))? .to_string(); insert_values_nested( @@ -663,20 +758,17 @@ fn insert_values_nested( )?; } } - field_type = DocumentPropertyType::Object(nested_properties); document_properties.insert( property_key, DocumentProperty { - property_type: field_type, + property_type: DocumentPropertyType::Object(nested_properties), required: is_required, }, ); return Ok(()); } - _ => { - field_type = DocumentPropertyType::try_from_name(type_value)?; - } - } + _ => DocumentPropertyType::try_from_name(type_value)?, + }; document_properties.insert( property_key, @@ -688,3 +780,192 @@ fn insert_values_nested( Ok(()) } + +#[cfg(test)] +mod tests { + use super::*; + use assert_matches::assert_matches; + use platform_value::platform_value; + + mod document_type_name { + use super::*; + + #[test] + fn should_be_valid() { + let platform_version = PlatformVersion::latest(); + + let schema = platform_value!({ + "type": "object", + "properties": { + "valid_name": { + "type": "string", + "position": 0 + } + }, + "additionalProperties": false + }); + + let _result = DocumentTypeV0::try_from_schema_v0( + Identifier::new([1; 32]), + "valid_name-a-b-123", + schema, + None, + false, + false, + false, + true, + &mut vec![], + platform_version, + ) + .expect("should be valid"); + } + + #[test] + fn should_no_be_empty() { + let platform_version = PlatformVersion::latest(); + + let schema = platform_value!({ + "type": "object", + "properties": { + "valid_name": { + "type": "string", + "position": 0 + } + }, + "additionalProperties": false + }); + + let result = DocumentTypeV0::try_from_schema_v0( + Identifier::new([1; 32]), + "", + schema, + None, + false, + false, + false, + true, + &mut vec![], + platform_version, + ); + + assert_matches!( + result, + Err(ProtocolError::ConsensusError(boxed)) => { + assert_matches!( + boxed.as_ref(), + ConsensusError::BasicError( + BasicError::InvalidDocumentTypeNameError(InvalidDocumentTypeNameError { .. }) + ) + ) + } + ); + } + + #[test] + fn should_no_be_longer_than_64_chars() { + let platform_version = PlatformVersion::latest(); + + let schema = platform_value!({ + "type": "object", + "properties": { + "valid_name": { + "type": "string", + "position": 0 + } + }, + "additionalProperties": false + }); + + let result = DocumentTypeV0::try_from_schema_v0( + Identifier::new([1; 32]), + &"a".repeat(65), + schema, + None, + false, + false, + false, + true, + &mut vec![], + platform_version, + ); + + assert_matches!( + result, + Err(ProtocolError::ConsensusError(boxed)) => { + assert_matches!( + boxed.as_ref(), + ConsensusError::BasicError( + BasicError::InvalidDocumentTypeNameError(InvalidDocumentTypeNameError { .. }) + ) + ) + } + ); + } + + #[test] + fn should_no_be_alphanumeric() { + let platform_version = PlatformVersion::latest(); + + let schema = platform_value!({ + "type": "object", + "properties": { + "valid_name": { + "type": "string", + "position": 0 + } + }, + "additionalProperties": false + }); + + let result = DocumentTypeV0::try_from_schema_v0( + Identifier::new([1; 32]), + "invalid name", + schema.clone(), + None, + false, + false, + false, + true, + &mut vec![], + platform_version, + ); + + assert_matches!( + result, + Err(ProtocolError::ConsensusError(boxed)) => { + assert_matches!( + boxed.as_ref(), + ConsensusError::BasicError( + BasicError::InvalidDocumentTypeNameError(InvalidDocumentTypeNameError { .. }) + ) + ) + } + ); + + let result = DocumentTypeV0::try_from_schema_v0( + Identifier::new([1; 32]), + "invalid&name", + schema, + None, + false, + false, + false, + true, + &mut vec![], + platform_version, + ); + + assert_matches!( + result, + Err(ProtocolError::ConsensusError(boxed)) => { + assert_matches!( + boxed.as_ref(), + ConsensusError::BasicError( + BasicError::InvalidDocumentTypeNameError(InvalidDocumentTypeNameError { .. }) + ) + ) + } + ); + } + } +} diff --git a/packages/rs-dpp/src/data_contract/document_type/index/mod.rs b/packages/rs-dpp/src/data_contract/document_type/index/mod.rs index 21db11aba41..cfdcf0f6c42 100644 --- a/packages/rs-dpp/src/data_contract/document_type/index/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/index/mod.rs @@ -8,7 +8,7 @@ pub enum OrderBy { Desc, } -use crate::data_contract::errors::{DataContractError, StructureError}; +use crate::data_contract::errors::DataContractError; use crate::ProtocolError; use anyhow::anyhow; @@ -21,6 +21,7 @@ pub mod random_index; // Indices documentation: https://dashplatform.readme.io/docs/reference-data-contracts#document-indices #[derive(Clone, Debug, PartialEq, Eq)] +#[cfg_attr(feature = "index-serde-conversion", derive(Serialize, Deserialize))] pub struct Index { pub name: String, pub properties: Vec, @@ -54,6 +55,7 @@ impl Index { } #[derive(Clone, Debug, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "index-serde-conversion", derive(Serialize, Deserialize))] pub struct IndexProperty { pub name: String, pub ascending: bool, @@ -174,7 +176,7 @@ impl Index { } impl TryFrom<&[(Value, Value)]> for Index { - type Error = ProtocolError; + type Error = DataContractError; fn try_from(index_type_value_map: &[(Value, Value)]) -> Result { // Decouple the map @@ -188,20 +190,16 @@ impl TryFrom<&[(Value, Value)]> for Index { let mut index_properties: Vec = Vec::new(); for (key_value, value_value) in index_type_value_map { - let key = key_value.to_str().map_err(ProtocolError::ValueError)?; + let key = key_value.to_str()?; match key { "name" => { name = Some( value_value .as_text() - .ok_or({ - ProtocolError::DataContractError( - DataContractError::InvalidContractStructure( - "index name should be a string".to_string(), - ), - ) - })? + .ok_or(DataContractError::InvalidContractStructure( + "index name should be a string".to_string(), + ))? .to_owned(), ); } @@ -212,25 +210,26 @@ impl TryFrom<&[(Value, Value)]> for Index { } "properties" => { let properties = - value_value.as_array().ok_or(ProtocolError::StructureError( - StructureError::ValueWrongType("properties value should be an array"), - ))?; + value_value + .as_array() + .ok_or(DataContractError::ValueWrongType( + "properties value should be an array".to_string(), + ))?; // Iterate over this and get the index properties for property in properties { - let property_map = property.as_map().ok_or( - ProtocolError::StructureError(StructureError::ValueWrongType( - "each property of an index should be a map", - )), - )?; + let property_map = + property.as_map().ok_or(DataContractError::ValueWrongType( + "each property of an index should be a map".to_string(), + ))?; let index_property = IndexProperty::from_platform_value(property_map)?; index_properties.push(index_property); } } _ => { - return Err(ProtocolError::StructureError( - StructureError::ValueWrongType("unexpected property name"), + return Err(DataContractError::ValueWrongType( + "unexpected property name".to_string(), )) } } @@ -251,20 +250,20 @@ impl TryFrom<&[(Value, Value)]> for Index { impl IndexProperty { pub fn from_platform_value( index_property_map: &[(Value, Value)], - ) -> Result { + ) -> Result { let property = &index_property_map[0]; let key = property .0 // key .as_text() - .ok_or(ProtocolError::DataContractError( - DataContractError::KeyWrongType("key should be of type string"), + .ok_or(DataContractError::KeyWrongType( + "key should be of type string".to_string(), ))?; let value = property .1 // value .as_text() - .ok_or(ProtocolError::DataContractError( - DataContractError::ValueWrongType("value should be of type string"), + .ok_or(DataContractError::ValueWrongType( + "value should be of type string".to_string(), ))?; let ascending = value == "asc"; diff --git a/packages/rs-dpp/src/data_contract/document_type/index/random_index.rs b/packages/rs-dpp/src/data_contract/document_type/index/random_index.rs index 269fa14ac20..49c6953e00b 100644 --- a/packages/rs-dpp/src/data_contract/document_type/index/random_index.rs +++ b/packages/rs-dpp/src/data_contract/document_type/index/random_index.rs @@ -27,7 +27,7 @@ impl Index { .drain(..) .map(|field_name| IndexProperty { name: field_name, - ascending: rng.gen(), + ascending: true, }) .collect::>(); diff --git a/packages/rs-dpp/src/data_contract/document_type/index_level/mod.rs b/packages/rs-dpp/src/data_contract/document_type/index_level/mod.rs index 036eb13faba..517b2b2dd16 100644 --- a/packages/rs-dpp/src/data_contract/document_type/index_level/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/index_level/mod.rs @@ -1,7 +1,11 @@ +#[cfg(feature = "validation")] +use crate::consensus::basic::data_contract::DataContractInvalidIndexDefinitionUpdateError; use crate::consensus::basic::data_contract::DuplicateIndexError; use crate::consensus::basic::BasicError; use crate::consensus::ConsensusError; use crate::data_contract::document_type::Index; +#[cfg(feature = "validation")] +use crate::validation::SimpleConsensusValidationResult; use crate::version::PlatformVersion; use crate::ProtocolError; use std::collections::BTreeMap; @@ -158,4 +162,271 @@ impl IndexLevel { Ok(index_level) } + + #[cfg(feature = "validation")] + pub fn validate_update( + &self, + document_type_name: &str, + new_indices: &Self, + ) -> SimpleConsensusValidationResult { + // There is no changes. All good + if self == new_indices { + return SimpleConsensusValidationResult::new(); + } + + // We do not allow any index modifications now, but we want to figure out + // what changed, so we compare one way then the other + + // If the new contract document type doesn't contain all previous indexes + if let Some(non_subset_path) = new_indices.contains_subset_first_non_subset_path(self) { + return SimpleConsensusValidationResult::new_with_error( + DataContractInvalidIndexDefinitionUpdateError::new( + document_type_name.to_string(), + non_subset_path, + ) + .into(), + ); + } + + // If the old contract document type doesn't contain all new indexes + if let Some(non_subset_path) = self.contains_subset_first_non_subset_path(new_indices) { + return SimpleConsensusValidationResult::new_with_error( + DataContractInvalidIndexDefinitionUpdateError::new( + document_type_name.to_string(), + non_subset_path, + ) + .into(), + ); + } + + SimpleConsensusValidationResult::new() + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::data_contract::document_type::IndexProperty; + use assert_matches::assert_matches; + + #[test] + fn should_pass_if_indices_are_the_same() { + let platform_version = PlatformVersion::latest(); + let document_type_name = "test"; + + let old_indices = vec![Index { + name: "test".to_string(), + properties: vec![IndexProperty { + name: "test".to_string(), + ascending: false, + }], + unique: false, + }]; + + let old_index_structure = + IndexLevel::try_from_indices(&old_indices, document_type_name, platform_version) + .expect("failed to create old index level"); + + let new_index_structure = old_index_structure.clone(); + + let result = old_index_structure.validate_update(document_type_name, &new_index_structure); + + assert!(result.is_valid()); + } + + #[test] + fn should_pass_if_new_index_with_only_new_field_is_add() { + let platform_version = PlatformVersion::latest(); + let document_type_name = "test"; + + let old_indices = vec![Index { + name: "test".to_string(), + properties: vec![IndexProperty { + name: "test".to_string(), + ascending: false, + }], + unique: false, + }]; + + let new_indices = vec![ + Index { + name: "test".to_string(), + properties: vec![IndexProperty { + name: "test".to_string(), + ascending: false, + }], + unique: false, + }, + Index { + name: "test2".to_string(), + properties: vec![IndexProperty { + name: "test2".to_string(), + ascending: false, + }], + unique: false, + }, + ]; + + let old_index_structure = + IndexLevel::try_from_indices(&old_indices, document_type_name, platform_version) + .expect("failed to create old index level"); + + let new_index_structure = + IndexLevel::try_from_indices(&new_indices, document_type_name, platform_version) + .expect("failed to create old index level"); + + let result = old_index_structure.validate_update(document_type_name, &new_index_structure); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::DataContractInvalidIndexDefinitionUpdateError(e) + )] if e.index_path() == "test2" + ); + } + + #[test] + fn should_return_invalid_result_if_some_indices_are_removed() { + let platform_version = PlatformVersion::latest(); + let document_type_name = "test"; + + let old_indices = vec![ + Index { + name: "test".to_string(), + properties: vec![IndexProperty { + name: "test".to_string(), + ascending: false, + }], + unique: false, + }, + Index { + name: "test2".to_string(), + properties: vec![IndexProperty { + name: "test2".to_string(), + ascending: false, + }], + unique: false, + }, + ]; + + let new_indices = vec![Index { + name: "test".to_string(), + properties: vec![IndexProperty { + name: "test".to_string(), + ascending: false, + }], + unique: false, + }]; + + let old_index_structure = + IndexLevel::try_from_indices(&old_indices, document_type_name, platform_version) + .expect("failed to create old index level"); + + let new_index_structure = + IndexLevel::try_from_indices(&new_indices, document_type_name, platform_version) + .expect("failed to create old index level"); + + let result = old_index_structure.validate_update(document_type_name, &new_index_structure); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::DataContractInvalidIndexDefinitionUpdateError(e) + )] if e.index_path() == "test2" + ); + } + + #[test] + fn should_return_invalid_result_if_additional_property_is_added_to_existing_index() { + let platform_version = PlatformVersion::latest(); + let document_type_name = "test"; + + let old_indices = vec![Index { + name: "test".to_string(), + properties: vec![IndexProperty { + name: "test".to_string(), + ascending: false, + }], + unique: false, + }]; + + let new_indices = vec![Index { + name: "test".to_string(), + properties: vec![ + IndexProperty { + name: "test".to_string(), + ascending: false, + }, + IndexProperty { + name: "test2".to_string(), + ascending: false, + }, + ], + unique: false, + }]; + + let old_index_structure = + IndexLevel::try_from_indices(&old_indices, document_type_name, platform_version) + .expect("failed to create old index level"); + + let new_index_structure = + IndexLevel::try_from_indices(&new_indices, document_type_name, platform_version) + .expect("failed to create old index level"); + + let result = old_index_structure.validate_update(document_type_name, &new_index_structure); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::DataContractInvalidIndexDefinitionUpdateError(e) + )] if e.index_path() == "test -> test2" + ); + } + + #[test] + fn should_return_invalid_result_if_property_is_removed_to_existing_index() { + let platform_version = PlatformVersion::latest(); + let document_type_name = "test"; + + let old_indices = vec![Index { + name: "test".to_string(), + properties: vec![ + IndexProperty { + name: "test".to_string(), + ascending: false, + }, + IndexProperty { + name: "test2".to_string(), + ascending: false, + }, + ], + unique: false, + }]; + + let new_indices = vec![Index { + name: "test".to_string(), + properties: vec![IndexProperty { + name: "test".to_string(), + ascending: false, + }], + unique: false, + }]; + + let old_index_structure = + IndexLevel::try_from_indices(&old_indices, document_type_name, platform_version) + .expect("failed to create old index level"); + + let new_index_structure = + IndexLevel::try_from_indices(&new_indices, document_type_name, platform_version) + .expect("failed to create old index level"); + + let result = old_index_structure.validate_update(document_type_name, &new_index_structure); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::DataContractInvalidIndexDefinitionUpdateError(e) + )] if e.index_path() == "test -> test2" + ); + } } diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/create_document_from_data/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/create_document_from_data/v0/mod.rs index ae392b645da..3242e1db19c 100644 --- a/packages/rs-dpp/src/data_contract/document_type/methods/create_document_from_data/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/methods/create_document_from_data/v0/mod.rs @@ -1,8 +1,14 @@ use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; -use crate::data_contract::document_type::property_names::{CREATED_AT, UPDATED_AT}; +use crate::data_contract::document_type::methods::DocumentTypeV0Methods; use crate::data_contract::document_type::v0::DocumentTypeV0; +use crate::document::property_names::{ + CREATED_AT, CREATED_AT_BLOCK_HEIGHT, CREATED_AT_CORE_BLOCK_HEIGHT, TRANSFERRED_AT, + TRANSFERRED_AT_BLOCK_HEIGHT, TRANSFERRED_AT_CORE_BLOCK_HEIGHT, UPDATED_AT, + UPDATED_AT_BLOCK_HEIGHT, UPDATED_AT_CORE_BLOCK_HEIGHT, +}; use crate::document::{Document, DocumentV0, INITIAL_REVISION}; use crate::identity::TimestampMillis; +use crate::prelude::{BlockHeight, CoreBlockHeight}; use crate::version::PlatformVersion; use crate::ProtocolError; use chrono::Utc; @@ -14,6 +20,8 @@ impl DocumentTypeV0 { &self, data: Value, owner_id: Identifier, + block_height: BlockHeight, + core_block_height: CoreBlockHeight, document_entropy: [u8; 32], platform_version: &PlatformVersion, ) -> Result { @@ -24,7 +32,7 @@ impl DocumentTypeV0 { &document_entropy, ); - let revision = if self.documents_mutable() { + let revision = if self.requires_revision() { Some(INITIAL_REVISION) } else { None @@ -40,11 +48,58 @@ impl DocumentTypeV0 { .get_optional_integer(UPDATED_AT) .map_err(ProtocolError::ValueError)?; + let mut transferred_at: Option = data + .get_optional_integer(TRANSFERRED_AT) + .map_err(ProtocolError::ValueError)?; + + let mut created_at_block_height: Option = data + .get_optional_integer(CREATED_AT_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut updated_at_block_height: Option = data + .get_optional_integer(UPDATED_AT_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut transferred_at_block_height: Option = data + .get_optional_integer(TRANSFERRED_AT_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut created_at_core_block_height: Option = data + .get_optional_integer(CREATED_AT_CORE_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut updated_at_core_block_height: Option = data + .get_optional_integer(UPDATED_AT_CORE_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut transferred_at_core_block_height: Option = data + .get_optional_integer(TRANSFERRED_AT_CORE_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + let is_created_at_required = self.required_fields().contains(CREATED_AT); let is_updated_at_required = self.required_fields().contains(UPDATED_AT); + let is_transferred_at_required = self.required_fields().contains(TRANSFERRED_AT); + + let is_created_at_block_height_required = + self.required_fields().contains(CREATED_AT_BLOCK_HEIGHT); + let is_updated_at_block_height_required = + self.required_fields().contains(UPDATED_AT_BLOCK_HEIGHT); + let is_transferred_at_block_height_required = + self.required_fields().contains(TRANSFERRED_AT_BLOCK_HEIGHT); + + let is_created_at_core_block_height_required = self + .required_fields() + .contains(CREATED_AT_CORE_BLOCK_HEIGHT); + let is_updated_at_core_block_height_required = self + .required_fields() + .contains(UPDATED_AT_CORE_BLOCK_HEIGHT); + let is_transferred_at_core_block_height_required = self + .required_fields() + .contains(TRANSFERRED_AT_CORE_BLOCK_HEIGHT); if (is_created_at_required && created_at.is_none()) - || (is_updated_at_required && updated_at.is_none()) + || (is_updated_at_required && updated_at.is_none() + || (is_transferred_at_required && transferred_at.is_none())) { //we want only one call to get current time let now = Utc::now().timestamp_millis() as TimestampMillis; @@ -56,6 +111,35 @@ impl DocumentTypeV0 { if is_updated_at_required { updated_at = updated_at.or(Some(now)); }; + + if is_transferred_at_required { + transferred_at = transferred_at.or(Some(now)); + }; + }; + + if is_created_at_block_height_required { + created_at_block_height = created_at_block_height.or(Some(block_height)); + }; + + if is_updated_at_block_height_required { + updated_at_block_height = updated_at_block_height.or(Some(block_height)); + }; + + if is_transferred_at_block_height_required { + transferred_at_block_height = transferred_at_block_height.or(Some(block_height)); + }; + + if is_created_at_core_block_height_required { + created_at_core_block_height = created_at_core_block_height.or(Some(core_block_height)); + }; + + if is_updated_at_core_block_height_required { + updated_at_core_block_height = updated_at_core_block_height.or(Some(core_block_height)); + }; + + if is_transferred_at_core_block_height_required { + transferred_at_core_block_height = + transferred_at_core_block_height.or(Some(core_block_height)); }; match platform_version @@ -73,6 +157,13 @@ impl DocumentTypeV0 { revision, created_at, updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, }; document diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/create_document_with_prevalidated_properties/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/create_document_with_prevalidated_properties/v0/mod.rs index a24dfe3c77d..d0ab0243e15 100644 --- a/packages/rs-dpp/src/data_contract/document_type/methods/create_document_with_prevalidated_properties/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/methods/create_document_with_prevalidated_properties/v0/mod.rs @@ -1,13 +1,20 @@ -use crate::data_contract::document_type::property_names::{CREATED_AT, UPDATED_AT}; use crate::document::{Document, DocumentV0}; -use crate::prelude::TimestampMillis; +use crate::prelude::{BlockHeight, CoreBlockHeight}; use crate::ProtocolError; use chrono::Utc; use platform_value::Value; +use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; +use crate::data_contract::document_type::methods::DocumentTypeV0Methods; use crate::data_contract::document_type::v0::DocumentTypeV0; +use crate::document::property_names::{ + CREATED_AT_BLOCK_HEIGHT, CREATED_AT_CORE_BLOCK_HEIGHT, TRANSFERRED_AT, + TRANSFERRED_AT_BLOCK_HEIGHT, TRANSFERRED_AT_CORE_BLOCK_HEIGHT, UPDATED_AT_BLOCK_HEIGHT, + UPDATED_AT_CORE_BLOCK_HEIGHT, +}; use crate::document::INITIAL_REVISION; use crate::version::PlatformVersion; +use platform_value::btreemap_extensions::BTreeValueMapHelper; use platform_value::Identifier; use std::collections::BTreeMap; @@ -18,22 +25,119 @@ impl DocumentTypeV0 { &self, id: Identifier, owner_id: Identifier, + block_height: BlockHeight, + core_block_height: CoreBlockHeight, properties: BTreeMap, platform_version: &PlatformVersion, ) -> Result { - let created_at = if self.required_fields.contains(CREATED_AT) { - Some(Utc::now().timestamp_millis() as TimestampMillis) - } else { - None + // Set timestamps if they are required and not exist + let mut created_at: Option = properties + .get_optional_integer(crate::document::property_names::CREATED_AT) + .map_err(ProtocolError::ValueError)?; + + let mut updated_at: Option = properties + .get_optional_integer(crate::document::property_names::UPDATED_AT) + .map_err(ProtocolError::ValueError)?; + + let mut transferred_at: Option = properties + .get_optional_integer(TRANSFERRED_AT) + .map_err(ProtocolError::ValueError)?; + + let mut created_at_block_height: Option = properties + .get_optional_integer(CREATED_AT_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut updated_at_block_height: Option = properties + .get_optional_integer(UPDATED_AT_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut transferred_at_block_height: Option = properties + .get_optional_integer(TRANSFERRED_AT_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut created_at_core_block_height: Option = properties + .get_optional_integer(CREATED_AT_CORE_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut updated_at_core_block_height: Option = properties + .get_optional_integer(UPDATED_AT_CORE_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let mut transferred_at_core_block_height: Option = properties + .get_optional_integer(TRANSFERRED_AT_CORE_BLOCK_HEIGHT) + .map_err(ProtocolError::ValueError)?; + + let is_created_at_required = self + .required_fields() + .contains(crate::document::property_names::CREATED_AT); + let is_updated_at_required = self + .required_fields() + .contains(crate::document::property_names::UPDATED_AT); + let is_transferred_at_required = self.required_fields().contains(TRANSFERRED_AT); + + let is_created_at_block_height_required = + self.required_fields().contains(CREATED_AT_BLOCK_HEIGHT); + let is_updated_at_block_height_required = + self.required_fields().contains(UPDATED_AT_BLOCK_HEIGHT); + let is_transferred_at_block_height_required = + self.required_fields().contains(TRANSFERRED_AT_BLOCK_HEIGHT); + + let is_created_at_core_block_height_required = self + .required_fields() + .contains(CREATED_AT_CORE_BLOCK_HEIGHT); + let is_updated_at_core_block_height_required = self + .required_fields() + .contains(UPDATED_AT_CORE_BLOCK_HEIGHT); + let is_transferred_at_core_block_height_required = self + .required_fields() + .contains(TRANSFERRED_AT_CORE_BLOCK_HEIGHT); + + if (is_created_at_required && created_at.is_none()) + || (is_updated_at_required && updated_at.is_none() + || (is_transferred_at_required && transferred_at.is_none())) + { + //we want only one call to get current time + let now = Utc::now().timestamp_millis() as crate::identity::TimestampMillis; + + if is_created_at_required { + created_at = created_at.or(Some(now)); + }; + + if is_updated_at_required { + updated_at = updated_at.or(Some(now)); + }; + + if is_transferred_at_required { + transferred_at = transferred_at.or(Some(now)); + }; }; - let updated_at = if self.required_fields.contains(UPDATED_AT) { - Some(Utc::now().timestamp_millis() as TimestampMillis) - } else { - None + if is_created_at_block_height_required { + created_at_block_height = created_at_block_height.or(Some(block_height)); + }; + + if is_updated_at_block_height_required { + updated_at_block_height = updated_at_block_height.or(Some(block_height)); + }; + + if is_transferred_at_block_height_required { + transferred_at_block_height = transferred_at_block_height.or(Some(block_height)); + }; + + if is_created_at_core_block_height_required { + created_at_core_block_height = created_at_core_block_height.or(Some(core_block_height)); + }; + + if is_updated_at_core_block_height_required { + updated_at_core_block_height = updated_at_core_block_height.or(Some(core_block_height)); + }; + + if is_transferred_at_core_block_height_required { + transferred_at_core_block_height = + transferred_at_core_block_height.or(Some(core_block_height)); }; - let revision = if self.documents_mutable { + let revision = if self.requires_revision() { Some(INITIAL_REVISION) } else { None @@ -51,6 +155,13 @@ impl DocumentTypeV0 { revision, created_at, updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, } .into()), version => Err(ProtocolError::UnknownVersionMismatch { diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/mod.rs index 337128e099d..4e44f04917f 100644 --- a/packages/rs-dpp/src/data_contract/document_type/methods/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/methods/mod.rs @@ -4,6 +4,8 @@ mod estimated_size; mod index_for_types; mod max_size; mod serialize_value_for_key; +#[cfg(feature = "validation")] +mod validate_update; use std::collections::BTreeMap; @@ -13,7 +15,7 @@ use crate::data_contract::document_type::index_level::IndexLevel; use crate::data_contract::document_type::v0::DocumentTypeV0; use crate::document::Document; use crate::document::INITIAL_REVISION; -use crate::prelude::Revision; +use crate::prelude::{BlockHeight, CoreBlockHeight, Revision}; use crate::version::PlatformVersion; use crate::ProtocolError; @@ -63,16 +65,48 @@ pub trait DocumentTypeV0Methods { &self, data: Value, owner_id: Identifier, + block_height: BlockHeight, + core_block_height: CoreBlockHeight, document_entropy: [u8; 32], platform_version: &PlatformVersion, ) -> Result; - /// Creates a document at the current time based on document type information - /// Properties set here must be pre validated + /// Creates a document at the current time based on specified document type information. + /// This function requires that all properties provided are pre-validated according to + /// the document's schema requirements. + /// + /// # Parameters: + /// - `id`: An identifier for the document. Unique within the context of the document's type. + /// - `owner_id`: The identifier of the entity that will own this document. + /// - `block_height`: The block height at which this document is considered to have been created. + /// While this value is recorded in the document, it is ignored when the document is broadcasted + /// to the network. This is because the actual block height at the time of broadcast may differ. + /// This parameter is included to fulfill schema requirements that specify a block height; you may + /// use the current block height, a placeholder value of 0, or any other value as necessary. + /// - `core_block_height`: Similar to `block_height`, this represents the core network's block height + /// at the document's creation time. It is handled the same way as `block_height` regarding broadcast + /// and schema requirements. + /// - `properties`: A collection of properties for the document, structured as a `BTreeMap`. + /// These must be pre-validated to match the document's schema definitions. + /// - `platform_version`: A reference to the current version of the platform for which the document is created. + /// + /// # Returns: + /// A `Result`, which is `Ok` if the document was successfully created, or an error + /// indicating what went wrong during the creation process. + /// + /// # Note: + /// The `block_height` and `core_block_height` are primarily included for schema compliance and local record-keeping. + /// These values are not used when the document is broadcasted to the network, as the network assigns its own block + /// heights upon receipt and processing of the document. After broadcasting, it is recommended to update these fields + /// in their created_at/updated_at variants as well as the base created_at/updated_at in the client-side + /// representation of the document to reflect the values returned by the network. The base created_at/updated_at + /// uses current time when creating the local document and is also ignored as it is also set network side. fn create_document_with_prevalidated_properties( &self, id: Identifier, owner_id: Identifier, + block_height: BlockHeight, + core_block_height: CoreBlockHeight, properties: BTreeMap, platform_version: &PlatformVersion, ) -> Result; @@ -174,7 +208,7 @@ impl DocumentTypeV0Methods for DocumentTypeV0 { } fn initial_revision(&self) -> Option { - if self.documents_mutable { + if self.requires_revision() { Some(INITIAL_REVISION) } else { None @@ -183,12 +217,14 @@ impl DocumentTypeV0Methods for DocumentTypeV0 { fn requires_revision(&self) -> bool { self.documents_mutable + || self.documents_transferable.is_transferable() + || self.trade_mode.seller_sets_price() } fn top_level_indices(&self) -> Vec<&IndexProperty> { let mut index_properties: Vec<&IndexProperty> = Vec::with_capacity(self.indices.len()); for index in &self.indices { - if let Some(property) = index.properties.get(0) { + if let Some(property) = index.properties.first() { index_properties.push(property); } } @@ -199,6 +235,8 @@ impl DocumentTypeV0Methods for DocumentTypeV0 { &self, data: Value, owner_id: Identifier, + block_height: BlockHeight, + core_block_height: CoreBlockHeight, document_entropy: [u8; 32], platform_version: &PlatformVersion, ) -> Result { @@ -212,6 +250,8 @@ impl DocumentTypeV0Methods for DocumentTypeV0 { 0 => self.create_document_from_data_v0( data, owner_id, + block_height, + core_block_height, document_entropy, platform_version, ), @@ -227,6 +267,8 @@ impl DocumentTypeV0Methods for DocumentTypeV0 { &self, id: Identifier, owner_id: Identifier, + block_height: BlockHeight, + core_block_height: CoreBlockHeight, properties: BTreeMap, platform_version: &PlatformVersion, ) -> Result { @@ -240,6 +282,8 @@ impl DocumentTypeV0Methods for DocumentTypeV0 { 0 => self.create_document_with_prevalidated_properties_v0( id, owner_id, + block_height, + core_block_height, properties, platform_version, ), diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/serialize_value_for_key/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/serialize_value_for_key/v0/mod.rs index 3539b7615ed..92890cb647a 100644 --- a/packages/rs-dpp/src/data_contract/document_type/methods/serialize_value_for_key/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/methods/serialize_value_for_key/v0/mod.rs @@ -21,16 +21,28 @@ impl DocumentTypeV0 { if bytes.len() != DEFAULT_HASH_SIZE { Err(ProtocolError::DataContractError( DataContractError::FieldRequirementUnmet( - "expected system value to be 32 bytes long", + "expected system value to be 32 bytes long".to_string(), ), )) } else { Ok(bytes) } } - "$createdAt" | "$updatedAt" => DocumentPropertyType::encode_date_timestamp( + "$createdAt" | "$updatedAt" | "$transferredAt" => { + Ok(DocumentPropertyType::encode_date_timestamp( + value.to_integer().map_err(ProtocolError::ValueError)?, + )) + } + "$createdAtBlockHeight" | "$updatedAtBlockHeight" | "$transferredAtBlockHeight" => { + Ok(DocumentPropertyType::encode_u64( + value.to_integer().map_err(ProtocolError::ValueError)?, + )) + } + "$createdAtCoreBlockHeight" + | "$updatedAtCoreBlockHeight" + | "$transferredAtCoreBlockHeight" => Ok(DocumentPropertyType::encode_u32( value.to_integer().map_err(ProtocolError::ValueError)?, - ), + )), _ => { let property = self.flattened_properties.get(key).ok_or_else(|| { DataContractError::DocumentTypeFieldNotFound(format!("expected contract to have field: {key}, contract fields are {} on document type {}", self.flattened_properties.keys().join(" | "), self.name)) @@ -39,7 +51,7 @@ impl DocumentTypeV0 { if bytes.len() > MAX_INDEX_SIZE { Err(ProtocolError::DataContractError( DataContractError::FieldRequirementUnmet( - "value must be less than 256 bytes long", + "value must be less than 256 bytes long".to_string(), ), )) } else { diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/validate_update/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/validate_update/mod.rs new file mode 100644 index 00000000000..78f27035a90 --- /dev/null +++ b/packages/rs-dpp/src/data_contract/document_type/methods/validate_update/mod.rs @@ -0,0 +1,30 @@ +use crate::data_contract::document_type::DocumentTypeRef; +use crate::validation::SimpleConsensusValidationResult; +use crate::ProtocolError; +use platform_version::version::PlatformVersion; + +mod v0; + +impl<'a> DocumentTypeRef<'a> { + /// Verify that the update to the document type is valid. + /// We assume that new document type is valid + pub fn validate_update( + &self, + new_document_type: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .validation + .document_type + .validate_update + { + 0 => self.validate_update_v0(new_document_type, platform_version), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "validate_update".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/validate_update/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/validate_update/v0/mod.rs new file mode 100644 index 00000000000..fe3980e0aa7 --- /dev/null +++ b/packages/rs-dpp/src/data_contract/document_type/methods/validate_update/v0/mod.rs @@ -0,0 +1,1018 @@ +use crate::consensus::basic::data_contract::IncompatibleDocumentTypeSchemaError; +use crate::consensus::state::data_contract::document_type_update_error::DocumentTypeUpdateError; +use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; +use crate::data_contract::document_type::schema::validate_schema_compatibility; +use crate::data_contract::document_type::DocumentTypeRef; +use crate::data_contract::errors::DataContractError; +use crate::validation::SimpleConsensusValidationResult; +use crate::ProtocolError; +use platform_version::version::PlatformVersion; + +impl<'a> DocumentTypeRef<'a> { + #[inline(always)] + pub(super) fn validate_update_v0( + &self, + new_document_type: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + // Validate configuration + let result = self.validate_config(new_document_type); + + if !result.is_valid() { + return Ok(result); + } + + // Validate indices + let result = self + .index_structure() + .validate_update(self.name(), new_document_type.index_structure()); + + if !result.is_valid() { + return Ok(result); + } + + // Validate schema compatibility + self.validate_schema(new_document_type, platform_version) + } + + fn validate_config( + &self, + new_document_type: DocumentTypeRef, + ) -> SimpleConsensusValidationResult { + if new_document_type.creation_restriction_mode() != self.creation_restriction_mode() { + return SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.data_contract_id(), + self.name(), + format!( + "document type can not change creation restriction mode: changing from {} to {}", + self.creation_restriction_mode(), + new_document_type.creation_restriction_mode() + ), + ) + .into(), + ); + } + + if new_document_type.trade_mode() != self.trade_mode() { + return SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.data_contract_id(), + self.name(), + format!( + "document type can not change trade mode: changing from {} to {}", + self.trade_mode(), + new_document_type.trade_mode() + ), + ) + .into(), + ); + } + + if new_document_type.documents_transferable() != self.documents_transferable() { + return SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.data_contract_id(), + self.name(), + format!( + "document type can not change whether its documents are transferable: changing from {} to {}", + self.documents_transferable(), + new_document_type.documents_transferable() + ), + ) + .into(), + ); + } + + if new_document_type.documents_can_be_deleted() != self.documents_can_be_deleted() { + return SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.data_contract_id(), + self.name(), + format!( + "document type can not change whether its documents can be deleted: changing from {} to {}", + self.documents_can_be_deleted(), + new_document_type.documents_can_be_deleted() + ), + ) + .into(), + ); + } + + if new_document_type.documents_keep_history() != self.documents_keep_history() { + return SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.data_contract_id(), + self.name(), + format!( + "document type can not change whether it keeps history: changing from {} to {}", + self.documents_keep_history(), + new_document_type.documents_keep_history() + ), + ) + .into(), + ); + } + + if new_document_type.documents_mutable() != self.documents_mutable() { + return SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.data_contract_id(), + self.name(), + format!( + "document type can not change whether its documents are mutable: changing from {} to {}", + self.documents_mutable(), + new_document_type.documents_mutable() + ), + ) + .into(), + ); + } + + if new_document_type.requires_identity_encryption_bounded_key() + != self.requires_identity_encryption_bounded_key() + { + return SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.data_contract_id(), + self.name(), + format!( + "document type can not change whether it required an identity encryption bounded key: changing from {:?} to {:?}", + self.requires_identity_encryption_bounded_key(), + new_document_type.requires_identity_encryption_bounded_key() + ), + ) + .into(), + ); + } + + if new_document_type.requires_identity_decryption_bounded_key() + != self.requires_identity_decryption_bounded_key() + { + return SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.data_contract_id(), + self.name(), + format!( + "document type can not change whether it required an identity decryption bounded key: changing from {:?} to {:?}", + self.requires_identity_decryption_bounded_key(), + new_document_type.requires_identity_decryption_bounded_key() + ), + ) + .into(), + ); + } + + if new_document_type.security_level_requirement() != self.security_level_requirement() { + return SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.data_contract_id(), + self.name(), + format!( + "document type can not change the security level requirement for its updates: changing from {:?} to {:?}", + self.security_level_requirement(), + new_document_type.security_level_requirement() + ), + ) + .into(), + ); + } + + SimpleConsensusValidationResult::new() + } + + fn validate_schema( + &self, + new_document_type: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + // All good if schema is the same + if self.schema() == new_document_type.schema() { + return Ok(SimpleConsensusValidationResult::new()); + } + + let old_document_schema_json = match self.schema().try_to_validating_json() { + Ok(json_value) => json_value, + Err(e) => { + return Ok(SimpleConsensusValidationResult::new_with_error( + DataContractError::ValueDecodingError(format!( + "invalid existing json schema structure for document type {}: {e}", + self.name() + )) + .into(), + )); + } + }; + + let new_document_schema_json = match new_document_type.schema().try_to_validating_json() { + Ok(json_value) => json_value, + Err(e) => { + return Ok(SimpleConsensusValidationResult::new_with_error( + DataContractError::ValueDecodingError(format!( + "invalid new json schema structure for document type {}: {e}", + self.name() + )) + .into(), + )); + } + }; + + let compatibility_validation_result = validate_schema_compatibility( + &old_document_schema_json, + &new_document_schema_json, + platform_version, + )?; + + // Convert the compatibility errors to consensus errors + let errors = compatibility_validation_result + .errors + .into_iter() + .map(|operation| { + IncompatibleDocumentTypeSchemaError::new( + self.name().clone(), + operation.name, + operation.path, + ) + .into() + }) + .collect(); + + Ok(SimpleConsensusValidationResult::new_with_errors(errors)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + use crate::consensus::state::state_error::StateError; + use crate::consensus::ConsensusError; + use crate::data_contract::document_type::DocumentType; + use assert_matches::assert_matches; + use platform_value::platform_value; + use platform_value::Identifier; + + mod validate_config { + use super::*; + + #[test] + fn should_return_invalid_result_when_creation_restriction_mode_is_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "creationRestrictionMode": 1, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "creationRestrictionMode": 0, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_config(new_document_type.as_ref()); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change creation restriction mode: changing from Owner Only to No Restrictions" + ); + } + + #[test] + fn should_return_invalid_result_when_trade_mode_is_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "tradeMode": 1, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "tradeMode": 0, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_config(new_document_type.as_ref()); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change trade mode: changing from Direct Purchase to No Trading" + ); + } + + #[test] + fn should_return_invalid_result_when_documents_transferable_is_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "transferable": 1, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "transferable": 0, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_config(new_document_type.as_ref()); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change whether its documents are transferable: changing from Always to Never" + ); + } + + #[test] + fn should_return_invalid_result_when_documents_can_be_deleted_is_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "canBeDeleted": true, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "canBeDeleted": false, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_config(new_document_type.as_ref()); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change whether its documents can be deleted: changing from true to false" + ); + } + + #[test] + fn should_return_invalid_result_when_documents_keep_history_is_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "documentsKeepHistory": true, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "documentsKeepHistory": false, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_config(new_document_type.as_ref()); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change whether it keeps history: changing from true to false" + ); + } + + #[test] + fn should_return_invalid_result_when_documents_mutable_is_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "documentsMutable": true, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "documentsMutable": false, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_config(new_document_type.as_ref()); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change whether its documents are mutable: changing from true to false" + ); + } + + #[test] + fn should_return_invalid_result_when_requires_identity_encryption_bounded_key_is_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "requiresIdentityEncryptionBoundedKey": 0, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "requiresIdentityEncryptionBoundedKey": 1, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_config(new_document_type.as_ref()); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change whether it required an identity encryption bounded key: changing from Some(Unique) to Some(Multiple)" + ); + } + + #[test] + fn should_return_invalid_result_when_requires_identity_decryption_bounded_key_is_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "requiresIdentityDecryptionBoundedKey": 0, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "requiresIdentityDecryptionBoundedKey": 2, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_config(new_document_type.as_ref()); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change whether it required an identity decryption bounded key: changing from Some(Unique) to Some(MultipleReferenceToLatest)" + ); + } + + #[test] + fn should_return_invalid_result_when_security_level_requirement_is_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "signatureSecurityLevelRequirement": 0, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "signatureSecurityLevelRequirement": 1, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_config(new_document_type.as_ref()); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change the security level requirement for its updates: changing from MASTER to CRITICAL" + ); + } + } + + mod validate_schema { + use super::*; + use crate::consensus::basic::BasicError; + + #[test] + fn should_pass_when_schema_is_not_changed() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "signatureSecurityLevelRequirement": 0, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema.clone(), + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_schema(new_document_type.as_ref(), platform_version) + .expect("failed to validate schema compatibility"); + + assert!(result.is_valid()); + } + + #[test] + fn should_return_invalid_result_when_schemas_are_not_backward_compatible() { + let platform_version = PlatformVersion::latest(); + let data_contract_id = Identifier::random(); + let document_type_name = "test"; + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "string", + "position": 0, + } + }, + "signatureSecurityLevelRequirement": 0, + "additionalProperties": false, + }); + + let old_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema.clone(), + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create old document type"); + + let schema = platform_value!({ + "type": "object", + "properties": { + "test": { + "type": "number", + "position": 0, + } + }, + "signatureSecurityLevelRequirement": 0, + "additionalProperties": false, + }); + + let new_document_type = DocumentType::try_from_schema( + data_contract_id, + document_type_name, + schema, + None, + false, + false, + false, + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to create new document type"); + + let result = old_document_type + .as_ref() + .validate_schema(new_document_type.as_ref(), platform_version) + .expect("failed to validate schema compatibility"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::IncompatibleDocumentTypeSchemaError(e) + )] if e.operation() == "replace" && e.property_path() == "/properties/test/type" + ); + } + } +} diff --git a/packages/rs-dpp/src/data_contract/document_type/mod.rs b/packages/rs-dpp/src/data_contract/document_type/mod.rs index 1ab0eeb300c..c37c7fc252b 100644 --- a/packages/rs-dpp/src/data_contract/document_type/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/mod.rs @@ -10,22 +10,29 @@ pub use index_level::IndexLevel; #[cfg(feature = "random-documents")] pub mod random_document; +pub mod restricted_creation; pub mod schema; pub mod v0; use crate::data_contract::document_type::methods::DocumentTypeV0Methods; use crate::data_contract::document_type::v0::DocumentTypeV0; use crate::document::Document; -use crate::prelude::Revision; +use crate::prelude::{BlockHeight, CoreBlockHeight, Revision}; use crate::version::PlatformVersion; use crate::ProtocolError; use derive_more::From; use platform_value::{Identifier, Value}; use std::collections::BTreeMap; -pub(self) mod property_names { +mod property_names { pub const DOCUMENTS_KEEP_HISTORY: &str = "documentsKeepHistory"; pub const DOCUMENTS_MUTABLE: &str = "documentsMutable"; + + pub const CAN_BE_DELETED: &str = "canBeDeleted"; + pub const TRANSFERABLE: &str = "transferable"; + pub const TRADE_MODE: &str = "tradeMode"; + + pub const CREATION_RESTRICTION_MODE: &str = "creationRestrictionMode"; pub const SECURITY_LEVEL_REQUIREMENT: &str = "signatureSecurityLevelRequirement"; pub const REQUIRES_IDENTITY_ENCRYPTION_BOUNDED_KEY: &str = "requiresIdentityEncryptionBoundedKey"; @@ -39,6 +46,7 @@ pub(self) mod property_names { pub const REF: &str = "$ref"; pub const CREATED_AT: &str = "$createdAt"; pub const UPDATED_AT: &str = "$updatedAt"; + pub const TRANSFERRED_AT: &str = "$transferredAt"; pub const MIN_ITEMS: &str = "minItems"; pub const MAX_ITEMS: &str = "maxItems"; pub const MIN_LENGTH: &str = "minLength"; @@ -162,13 +170,20 @@ impl<'a> DocumentTypeV0Methods for DocumentTypeRef<'a> { &self, data: Value, owner_id: Identifier, + block_height: BlockHeight, + core_block_height: CoreBlockHeight, document_entropy: [u8; 32], platform_version: &PlatformVersion, ) -> Result { match self { - DocumentTypeRef::V0(v0) => { - v0.create_document_from_data(data, owner_id, document_entropy, platform_version) - } + DocumentTypeRef::V0(v0) => v0.create_document_from_data( + data, + owner_id, + block_height, + core_block_height, + document_entropy, + platform_version, + ), } } @@ -176,6 +191,8 @@ impl<'a> DocumentTypeV0Methods for DocumentTypeRef<'a> { &self, id: Identifier, owner_id: Identifier, + block_height: BlockHeight, + core_block_height: CoreBlockHeight, properties: BTreeMap, platform_version: &PlatformVersion, ) -> Result { @@ -183,6 +200,8 @@ impl<'a> DocumentTypeV0Methods for DocumentTypeRef<'a> { DocumentTypeRef::V0(v0) => v0.create_document_with_prevalidated_properties( id, owner_id, + block_height, + core_block_height, properties, platform_version, ), diff --git a/packages/rs-dpp/src/data_contract/document_type/property/array.rs b/packages/rs-dpp/src/data_contract/document_type/property/array.rs index 2e45caf15e3..fd4e533fd2b 100644 --- a/packages/rs-dpp/src/data_contract/document_type/property/array.rs +++ b/packages/rs-dpp/src/data_contract/document_type/property/array.rs @@ -122,6 +122,6 @@ impl ArrayItemType { fn get_field_type_matching_error() -> ProtocolError { ProtocolError::DataContractError(DataContractError::ValueWrongType( - "document field type doesn't match document value for array", + "document field type doesn't match document value for array".to_string(), )) } diff --git a/packages/rs-dpp/src/data_contract/document_type/property/mod.rs b/packages/rs-dpp/src/data_contract/document_type/property/mod.rs index 0b7f1cac73e..e3a4003239b 100644 --- a/packages/rs-dpp/src/data_contract/document_type/property/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/property/mod.rs @@ -1,10 +1,10 @@ -use std::collections::BTreeMap; use std::convert::TryInto; use std::io::{BufReader, Read}; use crate::data_contract::errors::DataContractError; +use crate::consensus::basic::decode::DecodingError; use crate::prelude::TimestampMillis; use crate::ProtocolError; use array::ArrayItemType; @@ -15,21 +15,21 @@ use platform_value::Value; use rand::distributions::{Alphanumeric, Standard}; use rand::rngs::StdRng; use rand::Rng; -use serde::{Deserialize, Serialize}; +use serde::Serialize; pub mod array; // This struct will be changed in future to support more validation logic and serialization // It will become versioned and it will be introduced by a new document type version // @append_only -#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Clone, Serialize)] pub struct DocumentProperty { pub property_type: DocumentPropertyType, pub required: bool, } // @append_only -#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Clone, Serialize)] pub enum DocumentPropertyType { ///Todo decompose integer Integer, @@ -45,14 +45,16 @@ pub enum DocumentPropertyType { } impl DocumentPropertyType { - pub fn try_from_name(name: &str) -> Result { + pub fn try_from_name(name: &str) -> Result { match name { "integer" => Ok(DocumentPropertyType::Integer), "number" => Ok(DocumentPropertyType::Number), "boolean" => Ok(DocumentPropertyType::Boolean), "date" => Ok(DocumentPropertyType::Date), "identifier" => Ok(DocumentPropertyType::Identifier), - _ => Err(DataContractError::ValueWrongType("invalid type").into()), + _ => Err(DataContractError::ValueWrongType( + "invalid type".to_string(), + )), } } @@ -364,20 +366,20 @@ impl DocumentPropertyType { } } - fn read_varint_value(buf: &mut BufReader<&[u8]>) -> Result, ProtocolError> { + fn read_varint_value(buf: &mut BufReader<&[u8]>) -> Result, DataContractError> { let bytes: usize = buf.read_varint().map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading varint length from serialized document", - )) + DataContractError::CorruptedSerialization( + "error reading varint length from serialized document".to_string(), + ) })?; if bytes == 0 { Ok(vec![]) } else { let mut value: Vec = vec![0u8; bytes]; buf.read_exact(&mut value).map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading varint from serialized document", - )) + DataContractError::CorruptedSerialization( + "error reading varint from serialized document".to_string(), + ) })?; Ok(value) } @@ -389,7 +391,7 @@ impl DocumentPropertyType { &self, buf: &mut BufReader<&[u8]>, required: bool, - ) -> Result<(Option, bool), ProtocolError> { + ) -> Result<(Option, bool), DataContractError> { if !required { let marker = buf.read_u8().ok(); match marker { @@ -402,33 +404,33 @@ impl DocumentPropertyType { DocumentPropertyType::String(_, _) => { let bytes = Self::read_varint_value(buf)?; let string = String::from_utf8(bytes).map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading string from serialized document", - )) + DataContractError::CorruptedSerialization( + "error reading string from serialized document".to_string(), + ) })?; Ok((Some(Value::Text(string)), false)) } DocumentPropertyType::Date | DocumentPropertyType::Number => { let date = buf.read_f64::().map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading date/number from serialized document", - )) + DataContractError::CorruptedSerialization( + "error reading date/number from serialized document".to_string(), + ) })?; Ok((Some(Value::Float(date)), false)) } DocumentPropertyType::Integer => { let integer = buf.read_i64::().map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading integer from serialized document", - )) + DataContractError::CorruptedSerialization( + "error reading integer from serialized document".to_string(), + ) })?; Ok((Some(Value::I64(integer)), false)) } DocumentPropertyType::Boolean => { let value = buf.read_u8().map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading bool from serialized document", - )) + DataContractError::CorruptedSerialization( + "error reading bool from serialized document".to_string(), + ) })?; match value { 0 => Ok((Some(Value::Bool(false)), false)), @@ -442,9 +444,10 @@ impl DocumentPropertyType { let len = *min as usize; let mut bytes = vec![0; len]; buf.read_exact(&mut bytes).map_err(|_| { - ProtocolError::DecodingError( - "error reading 32 byte non main identifier".to_string(), - ) + DataContractError::DecodingContractError(DecodingError::new(format!( + "expected to read {} bytes (min size for byte array)", + len + ))) })?; // To save space we use predefined types for most popular blob sizes // so we don't need to store the size of the blob @@ -465,9 +468,9 @@ impl DocumentPropertyType { DocumentPropertyType::Identifier => { let mut id = [0; 32]; buf.read_exact(&mut id).map_err(|_| { - ProtocolError::DecodingError( - "error reading 32 byte non main identifier".to_string(), - ) + DataContractError::DecodingContractError(DecodingError::new( + "expected to read 32 bytes (identifier)".to_string(), + )) })?; //dbg!(hex::encode(&id)); Ok((Some(Value::Identifier(id)), false)) @@ -475,15 +478,15 @@ impl DocumentPropertyType { DocumentPropertyType::Object(inner_fields) => { let object_byte_len: usize = buf.read_varint().map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading varint of object length", - )) + DataContractError::CorruptedSerialization( + "error reading varint of object length".to_string(), + ) })?; let mut object_bytes = vec![0u8; object_byte_len]; buf.read_exact(&mut object_bytes).map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading object bytes", - )) + DataContractError::CorruptedSerialization( + "error reading object bytes".to_string(), + ) })?; // Wrap the bytes in a BufReader let mut object_buf_reader = BufReader::new(&object_bytes[..]); @@ -493,10 +496,8 @@ impl DocumentPropertyType { .filter_map(|(key, field)| { if finished_buffer { return if field.required { - Some(Err(ProtocolError::DataContractError( - DataContractError::CorruptedSerialization( - "required field after finished buffer in object", - ), + Some(Err(DataContractError::CorruptedSerialization( + "required field after finished buffer in object".to_string(), ))) } else { None @@ -517,20 +518,18 @@ impl DocumentPropertyType { Err(e) => Some(Err(e)), } }) - .collect::, ProtocolError>>()?; + .collect::, DataContractError>>()?; if values.is_empty() { Ok((None, false)) } else { Ok((Some(Value::Map(values)), false)) } } - DocumentPropertyType::Array(_array_field_type) => { - Err(ProtocolError::DataContractError( - DataContractError::Unsupported("serialization of arrays not yet supported"), - )) - } - DocumentPropertyType::VariableTypeArray(_) => Err(ProtocolError::DataContractError( - DataContractError::Unsupported("serialization of arrays not yet supported"), + DocumentPropertyType::Array(_array_field_type) => Err(DataContractError::Unsupported( + "serialization of arrays not yet supported".to_string(), + )), + DocumentPropertyType::VariableTypeArray(_) => Err(DataContractError::Unsupported( + "serialization of variable type arrays not yet supported".to_string(), )), } } @@ -551,7 +550,7 @@ impl DocumentPropertyType { r_vec.extend(vec); Ok(r_vec) } else { - Err(get_field_type_matching_error()) + Err(get_field_type_matching_error().into()) } } DocumentPropertyType::Date => { @@ -641,7 +640,7 @@ impl DocumentPropertyType { len_prepended_vec.append(&mut r_vec); Ok(len_prepended_vec) } else { - Err(get_field_type_matching_error()) + Err(get_field_type_matching_error().into()) } } DocumentPropertyType::Array(array_field_type) => { @@ -656,12 +655,12 @@ impl DocumentPropertyType { })?; Ok(r_vec) } else { - Err(get_field_type_matching_error()) + Err(get_field_type_matching_error().into()) } } DocumentPropertyType::VariableTypeArray(_) => Err(ProtocolError::DataContractError( DataContractError::Unsupported( - "serialization of variable type arrays not yet supported", + "serialization of variable type arrays not yet supported".to_string(), ), )), } @@ -727,7 +726,7 @@ impl DocumentPropertyType { } DocumentPropertyType::Object(inner_fields) => { let Some(value_map) = value.as_map() else { - return Err(get_field_type_matching_error()); + return Err(get_field_type_matching_error().into()); }; let value_map = Value::map_ref_into_btree_string_map(value_map)?; let mut r_vec = vec![]; @@ -769,12 +768,14 @@ impl DocumentPropertyType { })?; Ok(r_vec) } else { - Err(get_field_type_matching_error()) + Err(get_field_type_matching_error().into()) } } DocumentPropertyType::VariableTypeArray(_) => Err(ProtocolError::DataContractError( - DataContractError::Unsupported("serialization of arrays not yet supported"), + DataContractError::Unsupported( + "serialization of arrays not yet supported".to_string(), + ), )), }; } @@ -795,13 +796,13 @@ impl DocumentPropertyType { Ok(vec) } } - DocumentPropertyType::Date => DocumentPropertyType::encode_date_timestamp( + DocumentPropertyType::Date => Ok(DocumentPropertyType::encode_date_timestamp( value.to_integer().map_err(ProtocolError::ValueError)?, - ), + )), DocumentPropertyType::Integer => { let value_as_i64 = value.to_integer().map_err(ProtocolError::ValueError)?; - DocumentPropertyType::encode_signed_integer(value_as_i64) + Ok(DocumentPropertyType::encode_i64(value_as_i64)) } DocumentPropertyType::Number => Ok(Self::encode_float( value.to_float().map_err(ProtocolError::ValueError)?, @@ -822,13 +823,13 @@ impl DocumentPropertyType { } DocumentPropertyType::Object(_) => Err(ProtocolError::DataContractError( DataContractError::EncodingDataStructureNotSupported( - "we should never try encoding an object", + "we should never try encoding an object".to_string(), ), )), DocumentPropertyType::Array(_) | DocumentPropertyType::VariableTypeArray(_) => { Err(ProtocolError::DataContractError( DataContractError::EncodingDataStructureNotSupported( - "we should never try encoding an array", + "we should never try encoding an array".to_string(), ), )) } @@ -836,60 +837,59 @@ impl DocumentPropertyType { } // Given a field type and a value this function chooses and executes the right encoding method - pub fn value_from_string(&self, str: &str) -> Result { + pub fn value_from_string(&self, str: &str) -> Result { match self { DocumentPropertyType::String(min, max) => { if let Some(min) = min { if str.len() < *min as usize { - return Err(ProtocolError::DataContractError( - DataContractError::FieldRequirementUnmet("string is too small"), + return Err(DataContractError::FieldRequirementUnmet( + "string is too small".to_string(), )); } } if let Some(max) = max { if str.len() > *max as usize { - return Err(ProtocolError::DataContractError( - DataContractError::FieldRequirementUnmet("string is too big"), + return Err(DataContractError::FieldRequirementUnmet( + "string is too big".to_string(), )); } } Ok(Value::Text(str.to_string())) } DocumentPropertyType::Integer => str.parse::().map(Value::I128).map_err(|_| { - ProtocolError::DataContractError(DataContractError::ValueWrongType( - "value is not an integer from string", - )) + DataContractError::ValueWrongType("value is not an integer from string".to_string()) }), DocumentPropertyType::Number | DocumentPropertyType::Date => { str.parse::().map(Value::Float).map_err(|_| { - ProtocolError::DataContractError(DataContractError::ValueWrongType( - "value is not a float from string", - )) + DataContractError::ValueWrongType( + "value is not a float from string".to_string(), + ) }) } DocumentPropertyType::ByteArray(min, max) => { if let Some(min) = min { if str.len() / 2 < *min as usize { - return Err(ProtocolError::DataContractError( - DataContractError::FieldRequirementUnmet("byte array is too small"), + return Err(DataContractError::FieldRequirementUnmet( + "byte array is too small".to_string(), )); } } if let Some(max) = max { if str.len() / 2 > *max as usize { - return Err(ProtocolError::DataContractError( - DataContractError::FieldRequirementUnmet("byte array is too big"), + return Err(DataContractError::FieldRequirementUnmet( + "byte array is too big".to_string(), )); } } Ok(Value::Bytes(hex::decode(str).map_err(|_| { - ProtocolError::DataContractError(DataContractError::ValueDecodingError( - "could not parse hex bytes", - )) + DataContractError::ValueDecodingError("could not parse hex bytes".to_string()) })?)) } DocumentPropertyType::Identifier => Ok(Value::Identifier( - Value::Text(str.to_owned()).to_identifier()?.into_buffer(), + Value::Text(str.to_owned()) + .to_identifier() + .map_err(|e| DataContractError::ValueDecodingError(format!("{:?}", e)))? + .into_buffer(), )), DocumentPropertyType::Boolean => { if str.to_lowercase().as_str() == "true" { @@ -897,33 +897,29 @@ impl DocumentPropertyType { } else if str.to_lowercase().as_str() == "false" { Ok(Value::Bool(false)) } else { - Err(ProtocolError::DataContractError( - DataContractError::ValueDecodingError( - "could not parse a boolean to a value", - ), + Err(DataContractError::ValueDecodingError( + "could not parse a boolean to a value".to_string(), )) } } - DocumentPropertyType::Object(_) => Err(ProtocolError::DataContractError( - DataContractError::EncodingDataStructureNotSupported( - "we should never try encoding an object", - ), - )), + DocumentPropertyType::Object(_) => { + Err(DataContractError::EncodingDataStructureNotSupported( + "we should never try encoding an object".to_string(), + )) + } DocumentPropertyType::Array(_) | DocumentPropertyType::VariableTypeArray(_) => { - Err(ProtocolError::DataContractError( - DataContractError::EncodingDataStructureNotSupported( - "we should never try encoding an array", - ), + Err(DataContractError::EncodingDataStructureNotSupported( + "we should never try encoding an array".to_string(), )) } } } - pub fn encode_date_timestamp(val: TimestampMillis) -> Result, ProtocolError> { - Self::encode_unsigned_integer(val) + pub fn encode_date_timestamp(val: TimestampMillis) -> Vec { + Self::encode_u64(val) } - pub fn encode_unsigned_integer(val: u64) -> Result, ProtocolError> { + pub fn encode_u64(val: u64) -> Vec { // Positive integers are represented in binary with the signed bit set to 0 // Negative integers are represented in 2's complement form @@ -945,10 +941,35 @@ impl DocumentPropertyType { // change was uniform across all elements wtr[0] ^= 0b1000_0000; - Ok(wtr) + wtr + } + + pub fn encode_u32(val: u32) -> Vec { + // Positive integers are represented in binary with the signed bit set to 0 + // Negative integers are represented in 2's complement form + + // Encode the integer in big endian form + // This ensures that most significant bits are compared first + // a bigger positive number would be greater than a smaller one + // and a bigger negative number would be greater than a smaller one + // maintains sort order for each domain + let mut wtr = vec![]; + wtr.write_u32::(val).unwrap(); + + // Flip the sign bit + // to deal with interaction between the domains + // 2's complement values have the sign bit set to 1 + // this makes them greater than the positive domain in terms of sort order + // to fix this, we just flip the sign bit + // so positive integers have the high bit and negative integers have the low bit + // the relative order of elements in each domain is still maintained, as the + // change was uniform across all elements + wtr[0] ^= 0b1000_0000; + + wtr } - pub fn encode_signed_integer(val: i64) -> Result, ProtocolError> { + pub fn encode_i64(val: i64) -> Vec { // Positive integers are represented in binary with the signed bit set to 0 // Negative integers are represented in 2's complement form @@ -970,7 +991,7 @@ impl DocumentPropertyType { // change was uniform across all elements wtr[0] ^= 0b1000_0000; - Ok(wtr) + wtr } pub fn encode_float(val: f64) -> Vec { @@ -1013,8 +1034,8 @@ impl DocumentPropertyType { } } -fn get_field_type_matching_error() -> ProtocolError { - ProtocolError::DataContractError(DataContractError::ValueWrongType( - "document field type doesn't match document value", - )) +fn get_field_type_matching_error() -> DataContractError { + DataContractError::ValueWrongType( + "document field type doesn't match document value".to_string(), + ) } diff --git a/packages/rs-dpp/src/data_contract/document_type/random_document.rs b/packages/rs-dpp/src/data_contract/document_type/random_document.rs index 3b8f542a7a7..258b58d79bb 100644 --- a/packages/rs-dpp/src/data_contract/document_type/random_document.rs +++ b/packages/rs-dpp/src/data_contract/document_type/random_document.rs @@ -1,11 +1,18 @@ +#[cfg(feature = "documents-faker")] +use std::collections::BTreeMap; + +use bincode::{Decode, Encode}; +#[cfg(feature = "documents-faker")] +use platform_value::Value; +use platform_value::{Bytes32, Identifier}; +use rand::prelude::StdRng; + use crate::data_contract::document_type::{DocumentType, DocumentTypeRef}; use crate::document::Document; use crate::identity::Identity; +use crate::prelude::{BlockHeight, CoreBlockHeight, TimestampMillis}; use crate::version::PlatformVersion; use crate::ProtocolError; -use bincode::{Decode, Encode}; -use platform_value::{Bytes32, Identifier}; -use rand::prelude::StdRng; #[derive(Clone, Copy, Debug, Eq, PartialEq, Encode, Decode)] pub enum DocumentFieldFillType { @@ -28,38 +35,109 @@ pub enum DocumentFieldFillSize { // TODO The factory is used in benchmark and tests. Probably it should be available under the test feature /// Functions for creating various types of random documents. pub trait CreateRandomDocument { - /// Random documents with DoNotFillIfNotRequired and AnyDocumentFillSize - fn random_documents( + #[cfg(feature = "documents-faker")] + /// Create random documents using json-schema-faker-rs + fn random_documents_faker( &self, + owner_id: Identifier, + entropy: &Bytes32, count: u32, - seed: Option, platform_version: &PlatformVersion, + substitutions: &BTreeMap<&str, Value>, ) -> Result, ProtocolError>; - /// Random documents with rng - fn random_documents_with_rng( + + /// Generates a single random document, employing default behavior for document field + /// filling where fields that are not required will not be filled (`DoNotFillIfNotRequired`) and + /// any fill size that is contractually allowed may be used (`AnyDocumentFillSize`). + /// This method provides a straightforward way to create a document with random data, with an + /// optional seed for deterministic randomness. + /// + /// # Parameters: + /// - `seed`: An optional seed value for initializing the random number generator for deterministic outcomes. + /// - `platform_version`: The version of the platform for which the document is being generated. + /// + /// # Returns: + /// A `Result`, which is `Ok` containing the document if successful, or an error + /// if the operation fails. + fn random_document( &self, - count: u32, - rng: &mut StdRng, + seed: Option, platform_version: &PlatformVersion, - ) -> Result, ProtocolError>; - /// Creates `count` Documents with random data using the random number generator given. - fn random_documents_with_params( + ) -> Result; + + /// Generates a single random document using a specified random number generator. Applies default behavior + /// for filling document fields, not filling those that are not required and using any fill size allowed by + /// the contract. + /// + /// # Parameters: + /// - `rng`: A mutable reference to an `StdRng` random number generator. + /// - `platform_version`: The version of the platform for which the document is being generated. + /// + /// # Returns: + /// A `Result`, which is `Ok` containing the document if successful, or an error + /// if the operation fails. + fn random_document_with_rng( &self, - count: u32, - identities: &Vec, - time_ms: u64, - document_field_fill_type: DocumentFieldFillType, - document_field_fill_size: DocumentFieldFillSize, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result, ProtocolError>; - /// Random document - fn random_document( + ) -> Result; + + /// Generates a specified number of random documents, employing default behavior for document field + /// filling where fields that are not required will not be filled (`DoNotFillIfNotRequired`) and + /// any fill size that is contractually allowed may be used (`AnyDocumentFillSize`). This method + /// is particularly useful for generating test documents or simulating documents in a variety of + /// sizes and completeness. + /// + /// # Parameters: + /// - `count`: The number of random documents to generate. + /// - `seed`: An optional seed value for initializing the random number generator for deterministic outcomes. + /// - `platform_version`: The version of the platform for which these documents are being generated. + /// + /// # Returns: + /// A `Result, ProtocolError>`, which is `Ok` containing a vector of documents if successful, + /// or an error if the operation fails. + fn random_documents( &self, + count: u32, seed: Option, platform_version: &PlatformVersion, - ) -> Result; - /// Creates a document with a random id, owner id, and properties using StdRng. + ) -> Result, ProtocolError>; + + /// Generates a specified number of random documents using a specific random number generator (`rng`). + /// Default document field filling behavior is applied, where not required fields are not filled and any + /// fill size allowed by the contract may be used. This allows for controlled randomness in the document + /// generation process. + /// + /// # Parameters: + /// - `count`: The number of random documents to generate. + /// - `rng`: A mutable reference to an `StdRng` random number generator. + /// - `platform_version`: The version of the platform for which these documents are being generated. + /// + /// # Returns: + /// A `Result, ProtocolError>`, which is `Ok` containing a vector of documents if successful, + /// or an error if the operation fails. + fn random_documents_with_rng( + &self, + count: u32, + rng: &mut StdRng, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError>; + + /// Generates a single random document with a specified identifier and entropy values, using a given + /// random number generator. Defaults to not filling non-required fields and allowing any fill size, + /// unless specified otherwise through `document_field_fill_type` and `document_field_fill_size`. + /// + /// # Parameters: + /// - `rng`: A mutable reference to an `StdRng` random number generator. + /// - `owner_id`: The identifier for the owner of the document. + /// - `entropy`: A Bytes32 value to influence the randomness. + /// - `document_field_fill_type`: Specifies how document fields should be filled. + /// - `document_field_fill_size`: Specifies the size of the content to fill document fields with. + /// - `platform_version`: The version of the platform for which the document is being generated. + /// + /// # Returns: + /// A `Result`, which is `Ok` containing the document if successful, or an error + /// if the operation fails. fn random_document_with_identifier_and_entropy( &self, rng: &mut StdRng, @@ -69,88 +147,147 @@ pub trait CreateRandomDocument { document_field_fill_size: DocumentFieldFillSize, platform_version: &PlatformVersion, ) -> Result; - /// Random document with rng - fn random_document_with_rng( - &self, - rng: &mut StdRng, - platform_version: &PlatformVersion, - ) -> Result; - /// Creates a document with a random id, owner id, and properties using StdRng. + + /// Generates a single random document with specified parameters for customization, using a given + /// random number generator. Defaults to not filling non-required fields and allowing any fill size + /// unless explicitly specified through `document_field_fill_type` and `document_field_fill_size`. + /// + /// # Parameters: + /// - `owner_id`: The identifier for the owner of the document. + /// - `entropy`: A Bytes32 value to influence the randomness. + /// - `time_ms`: An optional timestamp in milliseconds. + /// - `block_height`: An optional block height to be used in created_at_block_height/updated_at_block_height. Will default to 0 if required but not provided. + /// - `core_block_height`: An optional core block height to be used in created_at_core_block_height/updated_at_core_block_height. Will default to 0 if required but not provided. + /// - `document_field_fill_type`: Specifies how document fields should be filled. + /// - `document_field_fill_size`: Specifies the size of the content to fill document fields with. + /// - `rng`: A mutable reference to an `StdRng` random number generator. + /// - `platform_version`: The version of the platform for which the document is being generated. + /// + /// # Returns: + /// A `Result`, which is `Ok` containing the document if successful, or an error + /// if the operation fails. fn random_document_with_params( &self, owner_id: Identifier, entropy: Bytes32, - time_ms: u64, + time_ms: Option, + block_height: Option, + core_block_height: Option, document_field_fill_type: DocumentFieldFillType, document_field_fill_size: DocumentFieldFillSize, rng: &mut StdRng, platform_version: &PlatformVersion, ) -> Result; + + /// Generates a specified number of random documents with additional parameters for customization, including + /// identities, timestamps, block heights, and specific document field filling strategies. + /// + /// # Parameters: + /// - `count`: The number of random documents to generate. + /// - `identities`: An array of `Identity` objects to associate with the documents. + /// - `time_ms`: An optional timestamp in milliseconds. + /// - `block_height`: An optional block height to be used in created_at_block_height/updated_at_block_height. Will default to 0 if required but not provided. + /// - `core_block_height`: An optional core block height to be used in created_at_core_block_height/updated_at_core_block_height. Will default to 0 if required but not provided. + /// - `document_field_fill_type`: Specifies how document fields should be filled. + /// - `document_field_fill_size`: Specifies the size of the content to fill document fields with. + /// - `rng`: A mutable reference to an `StdRng` random number generator. + /// - `platform_version`: The version of the platform for which these documents are being generated. + /// + /// # Returns: + /// A `Result, ProtocolError>` which is `Ok` containing a vector of tuples + /// if successful, each tuple consisting of a Document, its associated Identity, and a Bytes32 value, or an error + /// if the operation fails. + fn random_documents_with_params( + &self, + count: u32, + identities: &[Identity], + time_ms: Option, + block_height: Option, + core_block_height: Option, + document_field_fill_type: DocumentFieldFillType, + document_field_fill_size: DocumentFieldFillSize, + rng: &mut StdRng, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError>; } impl CreateRandomDocument for DocumentType { - fn random_documents( + #[cfg(feature = "documents-faker")] + fn random_documents_faker( &self, + owner_id: Identifier, + entropy: &Bytes32, count: u32, - seed: Option, platform_version: &PlatformVersion, + substitutions: &BTreeMap<&str, Value>, ) -> Result, ProtocolError> { match self { - DocumentType::V0(v0) => v0.random_documents(count, seed, platform_version), + DocumentType::V0(v0) => { + v0.random_documents_faker(owner_id, entropy, count, platform_version, substitutions) + } } } - fn random_documents_with_rng( + fn random_document( &self, - count: u32, - rng: &mut StdRng, + seed: Option, platform_version: &PlatformVersion, - ) -> Result, ProtocolError> { + ) -> Result { match self { - DocumentType::V0(v0) => v0.random_documents_with_rng(count, rng, platform_version), + DocumentType::V0(v0) => v0.random_document(seed, platform_version), } } - fn random_documents_with_params( + fn random_document_with_rng( &self, - count: u32, - identities: &Vec, - time_ms: u64, - document_field_fill_type: DocumentFieldFillType, - document_field_fill_size: DocumentFieldFillSize, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result, ProtocolError> { + ) -> Result { match self { - DocumentType::V0(v0) => v0.random_documents_with_params( - count, - identities, - time_ms, - document_field_fill_type, - document_field_fill_size, - rng, - platform_version, - ), // Add more cases as necessary for other variants + DocumentType::V0(v0) => v0.random_document_with_rng(rng, platform_version), } } - fn random_document( + fn random_documents( &self, + count: u32, seed: Option, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result, ProtocolError> { match self { - DocumentType::V0(v0) => v0.random_document(seed, platform_version), + DocumentType::V0(v0) => v0.random_documents(count, seed, platform_version), } } - fn random_document_with_rng( + fn random_documents_with_rng( + &self, + count: u32, + rng: &mut StdRng, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + match self { + DocumentType::V0(v0) => v0.random_documents_with_rng(count, rng, platform_version), + } + } + + fn random_document_with_identifier_and_entropy( &self, rng: &mut StdRng, + owner_id: Identifier, + entropy: Bytes32, + document_field_fill_type: DocumentFieldFillType, + document_field_fill_size: DocumentFieldFillSize, platform_version: &PlatformVersion, ) -> Result { match self { - DocumentType::V0(v0) => v0.random_document_with_rng(rng, platform_version), + DocumentType::V0(v0) => v0.random_document_with_identifier_and_entropy( + rng, + owner_id, + entropy, + document_field_fill_type, + document_field_fill_size, + platform_version, + ), } } @@ -158,7 +295,9 @@ impl CreateRandomDocument for DocumentType { &self, owner_id: Identifier, entropy: Bytes32, - time_ms: u64, + time_ms: Option, + block_height: Option, + core_block_height: Option, document_field_fill_type: DocumentFieldFillType, document_field_fill_size: DocumentFieldFillSize, rng: &mut StdRng, @@ -169,6 +308,8 @@ impl CreateRandomDocument for DocumentType { owner_id, entropy, time_ms, + block_height, + core_block_height, document_field_fill_type, document_field_fill_size, rng, @@ -176,22 +317,28 @@ impl CreateRandomDocument for DocumentType { ), // Add more cases as necessary for other variants } } - fn random_document_with_identifier_and_entropy( + fn random_documents_with_params( &self, - rng: &mut StdRng, - owner_id: Identifier, - entropy: Bytes32, + count: u32, + identities: &[Identity], + time_ms: Option, + block_height: Option, + core_block_height: Option, document_field_fill_type: DocumentFieldFillType, document_field_fill_size: DocumentFieldFillSize, + rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result, ProtocolError> { match self { - DocumentType::V0(v0) => v0.random_document_with_identifier_and_entropy( - rng, - owner_id, - entropy, + DocumentType::V0(v0) => v0.random_documents_with_params( + count, + identities, + time_ms, + block_height, + core_block_height, document_field_fill_type, document_field_fill_size, + rng, platform_version, ), } @@ -199,68 +346,82 @@ impl CreateRandomDocument for DocumentType { } impl<'a> CreateRandomDocument for DocumentTypeRef<'a> { - fn random_documents( + #[cfg(feature = "documents-faker")] + fn random_documents_faker( &self, + owner_id: Identifier, + entropy: &Bytes32, count: u32, - seed: Option, platform_version: &PlatformVersion, + substitutions: &BTreeMap<&str, Value>, ) -> Result, ProtocolError> { match self { - DocumentTypeRef::V0(v0) => v0.random_documents(count, seed, platform_version), + DocumentTypeRef::V0(v0) => { + v0.random_documents_faker(owner_id, entropy, count, platform_version, substitutions) + } } } - fn random_documents_with_rng( + fn random_document( &self, - count: u32, - rng: &mut StdRng, + seed: Option, platform_version: &PlatformVersion, - ) -> Result, ProtocolError> { + ) -> Result { match self { - DocumentTypeRef::V0(v0) => v0.random_documents_with_rng(count, rng, platform_version), + DocumentTypeRef::V0(v0) => v0.random_document(seed, platform_version), } } - fn random_documents_with_params( + fn random_document_with_rng( &self, - count: u32, - identities: &Vec, - time_ms: u64, - document_field_fill_type: DocumentFieldFillType, - document_field_fill_size: DocumentFieldFillSize, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result, ProtocolError> { + ) -> Result { match self { - DocumentTypeRef::V0(v0) => v0.random_documents_with_params( - count, - identities, - time_ms, - document_field_fill_type, - document_field_fill_size, - rng, - platform_version, - ), // Add more cases as necessary for other variants + DocumentTypeRef::V0(v0) => v0.random_document_with_rng(rng, platform_version), } } - fn random_document( + fn random_documents( &self, + count: u32, seed: Option, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result, ProtocolError> { match self { - DocumentTypeRef::V0(v0) => v0.random_document(seed, platform_version), + DocumentTypeRef::V0(v0) => v0.random_documents(count, seed, platform_version), } } - fn random_document_with_rng( + fn random_documents_with_rng( + &self, + count: u32, + rng: &mut StdRng, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + match self { + DocumentTypeRef::V0(v0) => v0.random_documents_with_rng(count, rng, platform_version), + } + } + + fn random_document_with_identifier_and_entropy( &self, rng: &mut StdRng, + owner_id: Identifier, + entropy: Bytes32, + document_field_fill_type: DocumentFieldFillType, + document_field_fill_size: DocumentFieldFillSize, platform_version: &PlatformVersion, ) -> Result { match self { - DocumentTypeRef::V0(v0) => v0.random_document_with_rng(rng, platform_version), + DocumentTypeRef::V0(v0) => v0.random_document_with_identifier_and_entropy( + rng, + owner_id, + entropy, + document_field_fill_type, + document_field_fill_size, + platform_version, + ), } } @@ -268,7 +429,9 @@ impl<'a> CreateRandomDocument for DocumentTypeRef<'a> { &self, owner_id: Identifier, entropy: Bytes32, - time_ms: u64, + time_ms: Option, + block_height: Option, + core_block_height: Option, document_field_fill_type: DocumentFieldFillType, document_field_fill_size: DocumentFieldFillSize, rng: &mut StdRng, @@ -279,6 +442,8 @@ impl<'a> CreateRandomDocument for DocumentTypeRef<'a> { owner_id, entropy, time_ms, + block_height, + core_block_height, document_field_fill_type, document_field_fill_size, rng, @@ -287,24 +452,67 @@ impl<'a> CreateRandomDocument for DocumentTypeRef<'a> { } } - fn random_document_with_identifier_and_entropy( + fn random_documents_with_params( &self, - rng: &mut StdRng, - owner_id: Identifier, - entropy: Bytes32, + count: u32, + identities: &[Identity], + time_ms: Option, + block_height: Option, + core_block_height: Option, document_field_fill_type: DocumentFieldFillType, document_field_fill_size: DocumentFieldFillSize, + rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result, ProtocolError> { match self { - DocumentTypeRef::V0(v0) => v0.random_document_with_identifier_and_entropy( - rng, - owner_id, - entropy, + DocumentTypeRef::V0(v0) => v0.random_documents_with_params( + count, + identities, + time_ms, + block_height, + core_block_height, document_field_fill_type, document_field_fill_size, + rng, platform_version, - ), + ), // Add more cases as necessary for other variants } } } + +#[cfg(all(test, feature = "documents-faker"))] +mod faker_tests { + use data_contracts::SystemDataContract; + use platform_version::TryIntoPlatformVersioned; + use rand::SeedableRng; + + use crate::{ + data_contract::accessors::v0::DataContractV0Getters, + system_data_contracts::load_system_data_contract, + }; + + use super::*; + + #[test] + fn test_random_document_faker() { + let data_contract = + load_system_data_contract(SystemDataContract::DPNS, &PlatformVersion::latest()) + .unwrap(); + let mut rng = StdRng::from_entropy(); + let entropy = Bytes32::random_with_rng(&mut rng); + + let _random_documents = data_contract + .document_types() + .iter() + .next() + .unwrap() + .1 + .random_documents_faker( + Identifier::random(), + &entropy, + 2, + &PlatformVersion::latest(), + &Default::default(), + ); + } +} diff --git a/packages/rs-dpp/src/data_contract/document_type/restricted_creation/mod.rs b/packages/rs-dpp/src/data_contract/document_type/restricted_creation/mod.rs new file mode 100644 index 00000000000..81194382f46 --- /dev/null +++ b/packages/rs-dpp/src/data_contract/document_type/restricted_creation/mod.rs @@ -0,0 +1,44 @@ +use crate::consensus::basic::data_contract::UnknownDocumentCreationRestrictionModeError; +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::identity::state_transition::asset_lock_proof::{Decode, Encode}; +use crate::ProtocolError; +use std::fmt; +use std::fmt::{Display, Formatter}; + +#[derive(Debug, PartialEq, Clone, Copy, Eq, Encode, Decode)] +pub enum CreationRestrictionMode { + NoRestrictions, + OwnerOnly, + NoCreationAllowed, +} + +impl Display for CreationRestrictionMode { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + match self { + CreationRestrictionMode::NoRestrictions => write!(f, "No Restrictions"), + CreationRestrictionMode::OwnerOnly => write!(f, "Owner Only"), + CreationRestrictionMode::NoCreationAllowed => write!(f, "No Creation Allowed"), + } + } +} + +impl TryFrom for CreationRestrictionMode { + type Error = ProtocolError; + + fn try_from(value: u8) -> Result { + match value { + 0 => Ok(Self::NoRestrictions), + 1 => Ok(Self::OwnerOnly), + 2 => Ok(Self::NoCreationAllowed), + value => Err(ProtocolError::ConsensusError( + ConsensusError::BasicError( + BasicError::UnknownDocumentCreationRestrictionModeError( + UnknownDocumentCreationRestrictionModeError::new(vec![0, 1, 2], value), + ), + ) + .into(), + )), + } + } +} diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/mod.rs index 1cda5bc717b..dc7019cf7a2 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/mod.rs @@ -1,26 +1,37 @@ mod v0; +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::data_contract::document_type::DocumentType; use crate::ProtocolError; use platform_value::Value; use platform_version::version::PlatformVersion; -pub fn enrich_with_base_schema( - schema: Value, - schema_defs: Option, - platform_version: &PlatformVersion, -) -> Result { - match platform_version - .dpp - .contract_versions - .document_type_versions - .schema - .enrich_with_base_schema - { - 0 => v0::enrich_with_base_schema_v0(schema, schema_defs), - version => Err(ProtocolError::UnknownVersionMismatch { - method: "enrich_with_base_schema".to_string(), - known_versions: vec![0], - received: version, - }), +impl DocumentType { + pub fn enrich_with_base_schema( + schema: Value, + schema_defs: Option, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .contract_versions + .document_type_versions + .schema + .enrich_with_base_schema + { + 0 => Ok( + v0::enrich_with_base_schema_v0(schema, schema_defs).map_err(|e| { + ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::ContractError(e)).into(), + ) + })?, + ), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "enrich_with_base_schema".to_string(), + known_versions: vec![0], + received: version, + }), + } } } diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/v0/mod.rs index 87730098b36..71ebe9771ed 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/v0/mod.rs @@ -1,7 +1,6 @@ use crate::data_contract::document_type::property_names; use crate::data_contract::errors::DataContractError; use crate::data_contract::serialized_version::v0::property_names as contract_property_names; -use crate::ProtocolError; use platform_value::{Value, ValueMapHelper}; pub const DATA_CONTRACT_SCHEMA_URI_V0: &str = @@ -9,24 +8,33 @@ pub const DATA_CONTRACT_SCHEMA_URI_V0: &str = pub const PROPERTY_SCHEMA: &str = "$schema"; -const TIMESTAMPS: [&str; 2] = ["$createdAt", "$updatedAt"]; +const SYSTEM_GENERATED_FIELDS: [&str; 9] = [ + "$createdAt", + "$updatedAt", + "$transferredAt", + "$createdAtBlockHeight", + "$updatedAtBlockHeight", + "$transferredAtBlockHeight", + "$createdAtCoreBlockHeight", + "$updatedAtCoreBlockHeight", + "$transferredAtCoreBlockHeight", +]; -pub fn enrich_with_base_schema_v0( +#[inline(always)] +pub(super) fn enrich_with_base_schema_v0( mut schema: Value, schema_defs: Option, -) -> Result { +) -> Result { let schema_map = schema.to_map_mut().map_err(|err| { - ProtocolError::DataContractError(DataContractError::InvalidContractStructure(format!( + DataContractError::InvalidContractStructure(format!( "document schema must be an object: {err}" - ))) + )) })?; // Add $schema if schema_map.get_optional_key(PROPERTY_SCHEMA).is_some() { - return Err(ProtocolError::DataContractError( - DataContractError::InvalidContractStructure( - "document schema shouldn't contain '$schema' property".to_string(), - ), + return Err(DataContractError::InvalidContractStructure( + "document schema shouldn't contain '$schema' property".to_string(), )); } @@ -40,20 +48,19 @@ pub fn enrich_with_base_schema_v0( .get_optional_key(contract_property_names::DEFINITIONS) .is_some() { - return Err(ProtocolError::DataContractError( - DataContractError::InvalidContractStructure( - "document schema shouldn't contain '$schema' property".to_string(), - ), + return Err(DataContractError::InvalidContractStructure( + "document schema shouldn't contain '$defs' property".to_string(), )); } - // Remove $createdAt and $updatedAt from JSON Schema since they aren't part of + // Remove $createdAt, $updatedAt and $transferredAt and their height and core height variants + // from JSON Schema since they aren't part of // dynamic (user defined) document data which is validating against the schema if let Some(required) = schema_map.get_optional_key_mut(property_names::REQUIRED) { if let Some(required_array) = required.as_array_mut() { required_array.retain(|field_value| { if let Some(field) = field_value.as_text() { - !TIMESTAMPS.contains(&field) + !SYSTEM_GENERATED_FIELDS.contains(&field) } else { true } diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/find_identifier_and_binary_paths/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/find_identifier_and_binary_paths/mod.rs index 7eeda7217e1..a8f97466e78 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/find_identifier_and_binary_paths/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/find_identifier_and_binary_paths/mod.rs @@ -4,7 +4,7 @@ use crate::data_contract::document_type::DocumentType; use crate::version::dpp_versions::DocumentTypeVersions; use crate::ProtocolError; use indexmap::IndexMap; -use std::collections::{BTreeMap, BTreeSet}; +use std::collections::BTreeSet; mod v0; diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/find_identifier_and_binary_paths/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/find_identifier_and_binary_paths/v0/mod.rs index f2a0b4a209b..35fb76650d1 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/find_identifier_and_binary_paths/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/find_identifier_and_binary_paths/v0/mod.rs @@ -3,15 +3,17 @@ use crate::data_contract::document_type::property::{DocumentProperty, DocumentPr use crate::data_contract::document_type::v0::DocumentTypeV0; use indexmap::IndexMap; -use std::collections::{BTreeMap, BTreeSet}; +use std::collections::BTreeSet; impl DocumentTypeV0 { + #[inline(always)] pub(super) fn find_identifier_and_binary_paths_v0( properties: &IndexMap, ) -> (BTreeSet, BTreeSet) { Self::find_identifier_and_binary_paths_inner(properties, "") } + #[inline(always)] fn find_identifier_and_binary_paths_inner( properties: &IndexMap, current_path: &str, diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/mod.rs index 7016579b690..169953690a5 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/mod.rs @@ -1,8 +1,6 @@ mod enrich_with_base_schema; -pub use enrich_with_base_schema::*; mod find_identifier_and_binary_paths; -pub use find_identifier_and_binary_paths::*; #[cfg(feature = "validation")] mod recursive_schema_validator; diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/byte_array_has_no_items_as_parent_validator/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/byte_array_has_no_items_as_parent_validator/v0/mod.rs index 1cdde43291e..40d97cbfd4c 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/byte_array_has_no_items_as_parent_validator/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/byte_array_has_no_items_as_parent_validator/v0/mod.rs @@ -5,7 +5,8 @@ use crate::consensus::ConsensusError; use crate::validation::SimpleConsensusValidationResult; use platform_value::Value; -pub fn byte_array_has_no_items_as_parent_validator_v0( +#[inline(always)] +pub(super) fn byte_array_has_no_items_as_parent_validator_v0( path: &str, key: &str, parent: &Value, diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/mod.rs index 15a5377cd91..1d497176e9a 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/mod.rs @@ -7,14 +7,14 @@ pub use traversal_validator::*; #[cfg(test)] mod test { + use super::*; use crate::consensus::basic::BasicError; use crate::consensus::codes::ErrorWithCode; use crate::consensus::ConsensusError; + use assert_matches::assert_matches; use platform_value::{platform_value, Value}; use platform_version::version::PlatformVersion; - use super::*; - fn init() { let _ = env_logger::builder() .filter_level(log::LevelFilter::Debug) @@ -49,14 +49,14 @@ mod test { let first_error = get_basic_error(result.errors.pop().unwrap()); let second_error = get_basic_error(result.errors.pop().unwrap()); - assert!(matches!( + assert_matches!( first_error, - BasicError::JsonSchemaCompilationError(msg) if msg.compilation_error().starts_with("invalid path: '/properties/bar': byteArray cannot"), - )); - assert!(matches!( + BasicError::JsonSchemaCompilationError(msg) if msg.compilation_error().starts_with("invalid path: '/properties/bar': byteArray cannot") + ); + assert_matches!( second_error, - BasicError::JsonSchemaCompilationError(msg) if msg.compilation_error().starts_with("invalid path: '/properties': byteArray cannot"), - )); + BasicError::JsonSchemaCompilationError(msg) if msg.compilation_error().starts_with("invalid path: '/properties': byteArray cannot") + ); } #[test] @@ -105,7 +105,7 @@ mod test { PlatformVersion::first(), ) .expect("expected traversal validator to succeed"); - let consensus_error = result.errors.get(0).expect("the error should be returned"); + let consensus_error = result.errors.first().expect("the error should be returned"); match consensus_error { ConsensusError::BasicError(BasicError::IncompatibleRe2PatternError(err)) => { @@ -114,7 +114,7 @@ mod test { err.pattern(), "^((?!-|_)[a-zA-Z0-9-_]{0,62}[a-zA-Z0-9])$".to_string() ); - assert_eq!(consensus_error.code(), 1009); + assert_eq!(consensus_error.code(), 10202); } _ => panic!("Expected error to be IncompatibleRe2PatternError"), } @@ -145,7 +145,7 @@ mod test { PlatformVersion::first(), ) .expect("expected traversal validator to exist for first protocol version"); - let consensus_error = result.errors.get(0).expect("the error should be returned"); + let consensus_error = result.errors.first().expect("the error should be returned"); match consensus_error { ConsensusError::BasicError(BasicError::IncompatibleRe2PatternError(err)) => { @@ -157,7 +157,7 @@ mod test { err.pattern(), "^((?!-|_)[a-zA-Z0-9-_]{0,62}[a-zA-Z0-9])$".to_string() ); - assert_eq!(consensus_error.code(), 1009); + assert_eq!(consensus_error.code(), 10202); } _ => panic!("Expected error to be IncompatibleRe2PatternError"), } @@ -175,7 +175,7 @@ mod test { PlatformVersion::first(), ) .expect("expected traversal validator to exist for first protocol version"); - let consensus_error = result.errors.get(0).expect("the error should be returned"); + let consensus_error = result.errors.first().expect("the error should be returned"); match consensus_error { ConsensusError::BasicError(BasicError::IncompatibleRe2PatternError(err)) => { @@ -187,7 +187,7 @@ mod test { err.pattern(), "^((?!-|_)[a-zA-Z0-9-_]{0,62}[a-zA-Z0-9])$".to_string() ); - assert_eq!(consensus_error.code(), 1009); + assert_eq!(consensus_error.code(), 10202); } _ => panic!("Expected error to be IncompatibleRe2PatternError"), } diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/pattern_is_valid_regex_validator/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/pattern_is_valid_regex_validator/v0/mod.rs index 523de0662f9..111c54f6ab8 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/pattern_is_valid_regex_validator/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/pattern_is_valid_regex_validator/v0/mod.rs @@ -3,7 +3,8 @@ use crate::validation::SimpleConsensusValidationResult; use platform_value::Value; use regex::Regex; -pub fn pattern_is_valid_regex_validator_v0( +#[inline(always)] +pub(super) fn pattern_is_valid_regex_validator_v0( path: &str, key: &str, _parent: &Value, diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/traversal_validator/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/traversal_validator/v0/mod.rs index e4acc21e956..5e4891d5c18 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/traversal_validator/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/recursive_schema_validator/traversal_validator/v0/mod.rs @@ -15,7 +15,8 @@ pub type SubValidator = fn( platform_version: &PlatformVersion, ) -> Result<(), ProtocolError>; -pub fn traversal_validator_v0( +#[inline(always)] +pub(super) fn traversal_validator_v0( raw_data_contract: &Value, validators: &[SubValidator], platform_version: &PlatformVersion, diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/validate_max_depth/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/validate_max_depth/mod.rs index b407987498c..df6ef724d8a 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/validate_max_depth/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/validate_max_depth/mod.rs @@ -1,14 +1,20 @@ -use crate::validation::SimpleConsensusValidationResult; +use crate::validation::ConsensusValidationResult; use crate::ProtocolError; use platform_value::Value; use platform_version::version::PlatformVersion; mod v0; +#[derive(Debug, Copy, Clone, PartialEq)] +pub struct MaxDepthValidationResult { + pub depth: u16, + pub size: u64, +} + pub fn validate_max_depth( value: &Value, platform_version: &PlatformVersion, -) -> Result { +) -> Result, ProtocolError> { match platform_version .dpp .contract_versions @@ -16,7 +22,7 @@ pub fn validate_max_depth( .schema .validate_max_depth { - 0 => Ok(v0::validate_max_depth_v0(value)), + 0 => Ok(v0::validate_max_depth_v0(value, platform_version)), version => Err(ProtocolError::UnknownVersionMismatch { method: "validate_max_depth".to_string(), known_versions: vec![0], diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/validate_max_depth/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/validate_max_depth/v0/mod.rs index 613e55bd87b..990f5cf15cf 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/validate_max_depth/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/validate_max_depth/v0/mod.rs @@ -1,65 +1,86 @@ use platform_value::Value; +use platform_version::version::PlatformVersion; use std::collections::BTreeSet; use crate::consensus::basic::data_contract::data_contract_max_depth_exceed_error::DataContractMaxDepthExceedError; use crate::consensus::basic::data_contract::InvalidJsonSchemaRefError; use crate::consensus::basic::BasicError; +use crate::data_contract::document_type::schema::MaxDepthValidationResult; use crate::util::json_schema::resolve_uri; -use crate::validation::SimpleConsensusValidationResult; +use crate::validation::ConsensusValidationResult; -const MAX_DEPTH: usize = 500; - -pub fn validate_max_depth_v0(value: &Value) -> SimpleConsensusValidationResult { - let mut result = SimpleConsensusValidationResult::default(); - let schema_depth = match calculate_max_depth(value) { - Ok(depth) => depth, - Err(err) => { - result.add_error(err); - return result; - } - }; - - if schema_depth > MAX_DEPTH { - result.add_error(BasicError::DataContractMaxDepthExceedError( - DataContractMaxDepthExceedError::new(schema_depth, MAX_DEPTH), - )); - } - result -} - -fn calculate_max_depth(platform_value: &Value) -> Result { +#[inline(always)] +pub(super) fn validate_max_depth_v0( + platform_value: &Value, + platform_version: &PlatformVersion, +) -> ConsensusValidationResult { + let max_allowed_depth = platform_version + .dpp + .contract_versions + .document_type_versions + .schema + .max_depth as usize; let mut values_depth_queue: Vec<(&Value, usize)> = vec![(platform_value, 0)]; - let mut max_depth: usize = 0; + let mut max_reached_depth: usize = 0; let mut visited: BTreeSet<*const Value> = BTreeSet::new(); let ref_value = Value::Text("$ref".to_string()); + let mut size: u64 = 1; // we start at 1, because we are a value + while let Some((value, depth)) = values_depth_queue.pop() { match value { Value::Map(map) => { let new_depth = depth + 1; - if max_depth < new_depth { - max_depth = new_depth + if new_depth > max_allowed_depth { + return ConsensusValidationResult::new_with_error( + BasicError::DataContractMaxDepthExceedError( + DataContractMaxDepthExceedError::new(max_allowed_depth), + ) + .into(), + ); + } + if max_reached_depth < new_depth { + max_reached_depth = new_depth } for (property_name, v) in map { + size += 1; // handling the internal references if property_name == &ref_value { if let Some(uri) = v.as_str() { - let resolved = resolve_uri(platform_value, uri).map_err(|e| { + let resolved = match resolve_uri(platform_value, uri).map_err(|e| { BasicError::InvalidJsonSchemaRefError( InvalidJsonSchemaRefError::new(format!( "invalid ref for max depth '{}': {}", uri, e )), ) - })?; + }) { + Ok(resolved) => resolved, + Err(e) => { + return ConsensusValidationResult::new_with_data_and_errors( + MaxDepthValidationResult { + depth: max_reached_depth as u16, // Not possible this is bigger than u16 max + size, + }, + vec![e.into()], + ); + } + }; if visited.contains(&(resolved as *const Value)) { - return Err(BasicError::InvalidJsonSchemaRefError( - InvalidJsonSchemaRefError::new(format!( - "the ref '{}' contains cycles", - uri - )), - )); + return ConsensusValidationResult::new_with_data_and_errors( + MaxDepthValidationResult { + depth: max_reached_depth as u16, // Not possible this is bigger than u16 max + size, + }, + vec![BasicError::InvalidJsonSchemaRefError( + InvalidJsonSchemaRefError::new(format!( + "the ref '{}' contains cycles", + uri + )), + ) + .into()], + ); } visited.insert(resolved as *const Value); @@ -75,10 +96,11 @@ fn calculate_max_depth(platform_value: &Value) -> Result { } Value::Array(array) => { let new_depth = depth + 1; - if max_depth < new_depth { - max_depth = new_depth + if max_reached_depth < new_depth { + max_reached_depth = new_depth } for v in array { + size += 1; if v.is_map() || v.is_array() { values_depth_queue.push((v, new_depth)) } @@ -88,7 +110,10 @@ fn calculate_max_depth(platform_value: &Value) -> Result { } } - Ok(max_depth) + ConsensusValidationResult::new_with_data(MaxDepthValidationResult { + depth: max_reached_depth as u16, // Not possible this is bigger than u16 max + size, + }) } #[cfg(test)] @@ -125,12 +150,13 @@ mod test { } ) .into(); - let result = calculate_max_depth(&schema); - let err = get_ref_error(result); + let result = validate_max_depth_v0(&schema, PlatformVersion::first()); + + let err = result.errors.first().expect("expected an error"); assert_eq!( - err.message(), - "the ref '#/$defs/object' contains cycles".to_string() + err.to_string(), + "Invalid JSON Schema $ref: the ref '#/$defs/object' contains cycles".to_string() ); } @@ -161,8 +187,10 @@ mod test { } ) .into(); - let result = calculate_max_depth(&schema); - assert!(matches!(result, Ok(5))); + let result = validate_max_depth_v0(&schema, PlatformVersion::first()) + .data + .expect("expected data"); + assert_eq!(result, MaxDepthValidationResult { depth: 5, size: 19 }); } #[test] @@ -185,12 +213,12 @@ mod test { } ) .into(); - let result = calculate_max_depth(&schema); + let result = validate_max_depth_v0(&schema, PlatformVersion::first()); - let err = get_ref_error(result); + let err = result.errors.first().expect("expected an error"); assert_eq!( - err.message(), - "invalid ref for max depth '#/$defs/object': value error: structure error: unable to get property $defs in $defs.object" + err.to_string(), + "Invalid JSON Schema $ref: invalid ref for max depth '#/$defs/object': value decoding error: StructureError(\"unable to get property $defs in $defs.object\")" .to_string() ); } @@ -215,12 +243,12 @@ mod test { } ) .into(); - let result = calculate_max_depth(&schema); + let result = validate_max_depth_v0(&schema, PlatformVersion::first()); - let err = get_ref_error(result); + let err = result.errors.first().expect("expected an error"); assert_eq!( - err.message(), - "invalid ref for max depth 'https://json-schema.org/some': Generic Error: only local references are allowed" + err.to_string(), + "Invalid JSON Schema $ref: invalid ref for max depth 'https://json-schema.org/some': invalid uri error: only local uri references are allowed" .to_string() ); } @@ -245,12 +273,12 @@ mod test { } ) .into(); - let result = calculate_max_depth(&schema); + let result = validate_max_depth_v0(&schema, PlatformVersion::first()); - let err = get_ref_error(result); + let err = result.errors.first().expect("expected an error"); assert_eq!( - err.message(), - "invalid ref for max depth '': Generic Error: only local references are allowed" + err.to_string(), + "Invalid JSON Schema $ref: invalid ref for max depth '': invalid uri error: only local uri references are allowed" .to_string() ); } @@ -272,13 +300,21 @@ mod test { } ) .into(); - assert!(matches!(calculate_max_depth(&schema), Ok(3))); + let found_depth = validate_max_depth_v0(&schema, PlatformVersion::first()) + .data + .expect("expected data") + .depth; + assert_eq!(found_depth, 3); } #[test] fn should_calculate_valid_depth_for_empty_json() { let schema: Value = json!({}).into(); - assert!(matches!(calculate_max_depth(&schema), Ok(1))); + let found_depth = validate_max_depth_v0(&schema, PlatformVersion::first()) + .data + .expect("expected data") + .depth; + assert_eq!(found_depth, 1); } #[test] @@ -296,16 +332,12 @@ mod test { }) .into(); - assert!(matches!(calculate_max_depth(&schema), Ok(4))); - } - pub fn get_ref_error(result: Result) -> InvalidJsonSchemaRefError { - match result { - Ok(_) => panic!("expected to have validation error"), - Err(e) => match e { - BasicError::InvalidJsonSchemaRefError(err) => err, - _ => panic!("expected error to be a InvalidJsonSchemaRefError"), - }, - } + let found_depth = validate_max_depth_v0(&schema, PlatformVersion::first()) + .data + .expect("expected data") + .depth; + + assert_eq!(found_depth, 4); } } diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/validate_schema_compatibility/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/validate_schema_compatibility/mod.rs index 41ddc7b3d69..182f8082581 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/validate_schema_compatibility/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/validate_schema_compatibility/mod.rs @@ -4,14 +4,19 @@ use platform_version::version::PlatformVersion; mod v0; -use crate::data_contract::document_type::schema::validate_schema_compatibility::v0::IncompatibleOperations; -pub use v0::EMPTY_JSON; +use crate::validation::SimpleValidationResult; + +#[derive(Debug, Clone)] +pub struct IncompatibleJsonSchemaOperation { + pub name: String, + pub path: String, +} pub fn validate_schema_compatibility( original_schema: &JsonValue, new_schema: &JsonValue, platform_version: &PlatformVersion, -) -> Result { +) -> Result, ProtocolError> { match platform_version .dpp .contract_versions @@ -19,7 +24,7 @@ pub fn validate_schema_compatibility( .schema .validate_schema_compatibility { - 0 => v0::validate_schema_compatibility(original_schema, new_schema), + 0 => v0::validate_schema_compatibility_v0(original_schema, new_schema), version => Err(ProtocolError::UnknownVersionMismatch { method: "validate_schema_compatibility".to_string(), known_versions: vec![0], @@ -27,16 +32,3 @@ pub fn validate_schema_compatibility( }), } } - -pub fn get_operation_and_property_name_json( - p: &json_patch::PatchOperation, -) -> (&'static str, &str) { - match &p { - json_patch::PatchOperation::Add(ref o) => ("add json", o.path.as_str()), - json_patch::PatchOperation::Copy(ref o) => ("copy json", o.path.as_str()), - json_patch::PatchOperation::Remove(ref o) => ("remove json", o.path.as_str()), - json_patch::PatchOperation::Replace(ref o) => ("replace json", o.path.as_str()), - json_patch::PatchOperation::Move(ref o) => ("move json", o.path.as_str()), - json_patch::PatchOperation::Test(ref o) => ("test json", o.path.as_str()), - } -} diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/validate_schema_compatibility/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/validate_schema_compatibility/v0/mod.rs index b9dd5baafe2..fd583b0b548 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/validate_schema_compatibility/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/validate_schema_compatibility/v0/mod.rs @@ -1,397 +1,30 @@ -use std::collections::BTreeMap; -/// The Schema compatibility validator is a port of a JavaScript version -/// https://bitbucket.org/atlassian/json-schema-diff-validator/src/master/ -/// -/// The functionality has been ported 'as is' without any logic improvements and optimizations -use std::convert::TryFrom; - -use crate::data_contract::DocumentName; +use crate::data_contract::document_type::schema::IncompatibleJsonSchemaOperation; +use crate::data_contract::errors::{DataContractError, JsonSchemaError}; +use crate::data_contract::JsonValue; +use crate::validation::SimpleValidationResult; use crate::ProtocolError; -use anyhow::Context; -use itertools::Itertools; -use json_patch::PatchOperation; -use jsonptr::{Pointer, Resolve}; -use lazy_static::lazy_static; -use serde_json::{json, Value as JsonValue}; - -lazy_static! { - pub static ref EMPTY_JSON: JsonValue = json!({}); -} - -mod property_names { - pub const REQUIRED: &str = "required"; - pub const DEFINITIONS: &str = "definitions"; - pub const PROPERTIES: &str = "properties"; - pub const REF: &str = "$ref"; - pub const MIN_ITEMS: &str = "minItems"; -} - -#[derive(Default, Debug, Clone)] -pub struct ValidationOptions { - pub allow_new_one_of: bool, - pub allow_new_enum_value: bool, - pub allow_reorder: bool, - pub deprecated_items: Vec, -} - -struct RemovedItem { - name: String, - operation: PatchOperation, -} - -pub type IncompatibleOperations = Vec; - -pub fn any_schema_changes( - old_schema: &BTreeMap, - new_schema: &JsonValue, -) -> bool { - let changes = old_schema - .into_iter() - .filter(|(document_type, original_schema)| { - let new_document_schema = new_schema.get(document_type).unwrap_or(&EMPTY_JSON); - let diff = json_patch::diff(original_schema, new_document_schema); - !diff.0.is_empty() - }) - .count(); - - changes > 0 -} - -pub fn validate_schema_compatibility( - original_schema: &JsonValue, - new_schema: &JsonValue, -) -> Result { - validate_schema_compatibility_with_options( - original_schema, - new_schema, - ValidationOptions::default(), - ) -} +use json_schema_compatibility_validator::validate_schemas_compatibility; -pub fn validate_schema_compatibility_with_options( +pub(super) fn validate_schema_compatibility_v0( original_schema: &JsonValue, new_schema: &JsonValue, - opts: ValidationOptions, -) -> Result { - let patch = json_patch::diff(original_schema, new_schema); - let mut diffs: Vec = vec![]; - let mut removed: Vec = vec![]; - let mut inserted: Vec = vec![]; - - for operation in patch.0.into_iter() { - match operation { - PatchOperation::Move(ref op_move) => { - if is_operation_move_remove_compatible( - op_move.path.as_str(), - original_schema, - &opts, - )? { - continue; - } - diffs.push(operation); - } - - PatchOperation::Remove(ref op_remove) => { - if is_operation_move_remove_compatible( - op_remove.path.as_str(), - original_schema, - &opts, - )? { - continue; - } - diffs.push(operation); - } - - PatchOperation::Replace(ref op_replace) => { - let is_min_items = is_min_items(&op_replace.path); - let json_pointer = - Pointer::try_from(op_replace.path.as_str()).with_context(|| { - format!("unable to create a json pointer from '{}'", op_replace.path) - })?; - let old_value = original_schema.resolve(&json_pointer).with_context(|| { - format!("cannot find the '{}' in original schema", op_replace.path) - })?; - - if is_min_items && old_value.as_i64() > op_replace.value.as_i64() { - continue; - } - - if !opts.allow_reorder { - diffs.push(operation) - } else { - inserted.push(op_replace.value.to_string()); - removed.push(RemovedItem { - name: old_value.to_string(), - operation, - }); - } - } - PatchOperation::Add(ref op_add) => { - let is_new_any_of_item = is_anyof_path(&op_add.path); - let is_new_enum_value = is_enum_path(&op_add.path); - let path_two_last_levels = - get_second_last_sub_path(&op_add.path).with_context(|| { - format!("the second subpath doesn't exist in '{}'", op_add.path) - })?; - - if path_two_last_levels == property_names::REQUIRED { - diffs.push(operation); - continue; - } - if [property_names::PROPERTIES, property_names::DEFINITIONS] - .contains(&path_two_last_levels) - { - continue; - } - - if is_new_any_of_item && opts.allow_reorder { - inserted.push( - op_add - .value - .get(property_names::REF) - .with_context(|| { - format!("the property '{}' doesn't exist", property_names::REF) - })? - .to_string(), - ) - } else if (is_new_any_of_item && opts.allow_new_one_of) - || (is_new_enum_value && opts.allow_new_enum_value) - { - continue; - } else { - diffs.push(operation) - } - } - _ => continue, - } - } - - if opts.allow_reorder { - // When reordering is allowed, we want ot make sure that any item that - // was replaces is also inserted somewhere else - let filtered_removed = removed.into_iter().filter_map(|node| { - if inserted.contains(&node.name) { - Some(node.operation) - } else { - None - } - }); - - diffs.extend(filtered_removed); - } - - Ok(diffs) -} - -// checks if operation `move` or `remove` is backward compatible -fn is_operation_move_remove_compatible( - path: &str, - original_schema: &JsonValue, - opts: &ValidationOptions, -) -> Result { - let is_min_items = path.ends_with(property_names::MIN_ITEMS); - if get_second_last_sub_path(path) == Some(property_names::REQUIRED) || is_min_items { - return Ok(true); - } - - // Check if the removed node is deprecated - let is_any_of_item = is_anyof_path(path); - if is_any_of_item { - let json_pointer: Pointer = Pointer::try_from(path) - .with_context(|| format!("Unable to crate a Json Pointer from '{}'", path))?; - let value = original_schema - .resolve(&json_pointer) - .with_context(|| format!("Cannot find the '{}' in the original schema", path))?; - - if let Some(ref_value) = value.get("$ref") { - let ref_value_string = ref_value.to_string(); - let last_subpath = get_last_sub_path(&ref_value_string).with_context(|| { - format!("The last subpath doesn't exist in '{}'", ref_value_string) - })?; - - if opts.deprecated_items.iter().any(|i| i == last_subpath) { - return Ok(true); - } - } - } else { - let last_subpath = get_last_sub_path(path).unwrap(); - if opts.deprecated_items.iter().any(|i| i == last_subpath) { - return Ok(true); - } - } - - Ok(false) -} - -fn is_min_items(path: &str) -> bool { - path.ends_with(property_names::MIN_ITEMS) -} - -// checks if property path has form: '.../anyOf/[usize]' -fn is_anyof_path(path: &str) -> bool { - is_path_of_type(path, "anyOf") -} - -// checks if property path has form: '.../enum/[usize]' -fn is_enum_path(path: &str) -> bool { - is_path_of_type(path, "enum") -} - -// checks if property path has form: '.../[name]/[usize]' -fn is_path_of_type(path: &str, path_type: &str) -> bool { - let arr = path.split('/').collect_vec(); - if arr.len() < 2 { - return false; - } - if arr[arr.len() - 1].parse::().is_err() { - return false; - } - if arr[arr.len() - 2] != path_type { - return false; - } - true -} - -fn get_second_last_sub_path(path: &str) -> Option<&str> { - let arr = path.split('/').collect_vec(); - if arr.len() > 1 { - Some(arr[arr.len() - 2]) - } else { - None - } -} - -fn get_last_sub_path(path: &str) -> Option<&str> { - let arr = path.split('/').collect_vec(); - if !arr.is_empty() { - Some(arr[arr.len() - 1]) - } else { - None - } -} - -#[cfg(test)] -mod test { - - use super::*; - use lazy_static::lazy_static; - use serde_json::json; - - lazy_static! { - static ref DATA_SCHEMA: JsonValue = serde_json::from_str(include_str!( - "./../../../../../tests/payloads/schema/data.json" - )) - .unwrap(); - static ref DATA_SCHEMA_V2: JsonValue = serde_json::from_str(include_str!( - "./../../../../../tests/payloads/schema/data_v2.json" - )) - .unwrap(); - } - - #[test] - fn test_is_any_of_item() { - let any_of_item = "/anyOf/0"; - assert!(is_path_of_type(any_of_item, "anyOf")); - - let any_of_item = "/alpha/anyOf/0"; - assert!(is_path_of_type(any_of_item, "anyOf")); - - let is_not_any_of_item = ""; - assert!(!is_path_of_type(is_not_any_of_item, "anyOf")); - - let is_not_any_of_item = "/anyOf/o"; - assert!(!is_path_of_type(is_not_any_of_item, "anyOf")); - - let is_not_any_of_item = "/alpha/anyOf/o"; - assert!(!is_path_of_type(is_not_any_of_item, "anyOf")); - - let is_not_any_of_item = "/alpha/anyof/1"; - assert!(!is_path_of_type(is_not_any_of_item, "anyOf")); - } - - #[test] - fn should_return_ok_if_data_is_the_same() { - let result = validate_schema_compatibility_with_options( - &DATA_SCHEMA.clone(), - &DATA_SCHEMA.clone(), - ValidationOptions::default(), - ); - assert!(matches!(result, Ok(operations) if operations.len() == 0)); - } - - #[test] - fn should_return_err_on_remove() { - let result = validate_schema_compatibility_with_options( - &DATA_SCHEMA.clone(), - &DATA_SCHEMA_V2.clone(), - ValidationOptions::default(), - ); - assert!(matches!( - result, - Ok(operations) if operations.len() == 1 - )); - } - - #[test] - fn should_return_ok_if_new_field_is_added_but_not_required() { - let mut new_data_schema = DATA_SCHEMA.clone(); - new_data_schema["definitions"]["mntent"]["properties"]["field"] = - json!({"type" : "number"}); - - let result = validate_schema_compatibility_with_options( - &DATA_SCHEMA.clone(), - &new_data_schema, - ValidationOptions::default(), - ); - - assert!(matches!(result, Ok(operations) if operations.len() == 0)); - } - - #[test] - fn should_return_ok_if_field_becomes_optional() { - let mut new_data_schema = DATA_SCHEMA.clone(); - new_data_schema[property_names::REQUIRED] = json!(["/"]); - - let result = validate_schema_compatibility_with_options( - &DATA_SCHEMA.clone(), - &new_data_schema, - ValidationOptions::default(), - ); - - assert!(matches!(result, Ok(operations) if operations.len() == 0)); - } - - #[test] - fn should_return_err_if_field_becomes_required() { - let mut old_data_schema = DATA_SCHEMA.clone(); - old_data_schema[property_names::REQUIRED] = json!(["/"]); - - let result = validate_schema_compatibility_with_options( - &old_data_schema, - &DATA_SCHEMA.clone(), - ValidationOptions::default(), - ); - - assert!(matches!( - result, - Ok(operations) if operations.len() == 1 - )); - } - - #[test] - fn should_return_err_if_field_changes_its_type() { - let mut new_data_schema = DATA_SCHEMA.clone(); - new_data_schema["definitions"]["mntent"] = json!({"type" : "number"}); - - let result = validate_schema_compatibility_with_options( - &DATA_SCHEMA.clone(), - &new_data_schema, - ValidationOptions::default(), - ); - - assert!(matches!( - result, - Ok(operations) if operations.len() > 0 - )); - } +) -> Result, ProtocolError> { + validate_schemas_compatibility(original_schema, new_schema) + .map(|result| { + let errors = result + .into_changes() + .into_iter() + .map(|change| IncompatibleJsonSchemaOperation { + name: change.name().to_string(), + path: change.path().to_string(), + }) + .collect::>(); + + SimpleValidationResult::new_with_errors(errors) + }) + .map_err(|error| { + ProtocolError::DataContractError(DataContractError::JsonSchema( + JsonSchemaError::SchemaCompatibilityValidationError(error.to_string()), + )) + }) } diff --git a/packages/rs-dpp/src/data_contract/document_type/v0/accessors.rs b/packages/rs-dpp/src/data_contract/document_type/v0/accessors.rs index 208ebc1ff82..ad0cb272b3e 100644 --- a/packages/rs-dpp/src/data_contract/document_type/v0/accessors.rs +++ b/packages/rs-dpp/src/data_contract/document_type/v0/accessors.rs @@ -6,10 +6,13 @@ use crate::data_contract::document_type::v0::DocumentTypeV0; use platform_value::{Identifier, Value}; +use crate::data_contract::document_type::restricted_creation::CreationRestrictionMode; use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; +use crate::document::transfer::Transferable; use crate::identity::SecurityLevel; +use crate::nft::TradeMode; use indexmap::IndexMap; -use std::collections::{BTreeMap, BTreeSet}; +use std::collections::BTreeSet; impl DocumentTypeV0Getters for DocumentTypeV0 { fn name(&self) -> &String { @@ -60,6 +63,22 @@ impl DocumentTypeV0Getters for DocumentTypeV0 { self.documents_mutable } + fn documents_can_be_deleted(&self) -> bool { + self.documents_can_be_deleted + } + + fn documents_transferable(&self) -> Transferable { + self.documents_transferable + } + + fn trade_mode(&self) -> TradeMode { + self.trade_mode + } + + fn creation_restriction_mode(&self) -> CreationRestrictionMode { + self.creation_restriction_mode + } + fn data_contract_id(&self) -> Identifier { self.data_contract_id } diff --git a/packages/rs-dpp/src/data_contract/document_type/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/v0/mod.rs index cce01ea1b4e..147614713ca 100644 --- a/packages/rs-dpp/src/data_contract/document_type/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/v0/mod.rs @@ -1,5 +1,5 @@ use indexmap::IndexMap; -use std::collections::{BTreeMap, BTreeSet}; +use std::collections::BTreeSet; use crate::data_contract::document_type::index::Index; use crate::data_contract::document_type::index_level::IndexLevel; @@ -9,7 +9,10 @@ use crate::data_contract::storage_requirements::keys_for_document_type::StorageK #[cfg(feature = "validation")] pub(in crate::data_contract) use validator::StatelessJsonSchemaLazyValidator; +use crate::data_contract::document_type::restricted_creation::CreationRestrictionMode; +use crate::document::transfer::Transferable; use crate::identity::SecurityLevel; +use crate::nft::TradeMode; use platform_value::{Identifier, Value}; mod accessors; @@ -53,6 +56,15 @@ pub struct DocumentTypeV0 { pub(in crate::data_contract) documents_keep_history: bool, /// Are documents mutable? pub(in crate::data_contract) documents_mutable: bool, + /// Can documents of this type be deleted? + pub(in crate::data_contract) documents_can_be_deleted: bool, + /// Can documents be transferred without a trade? + pub(in crate::data_contract) documents_transferable: Transferable, + /// How are these documents traded? + pub(in crate::data_contract) trade_mode: TradeMode, + /// Is document creation restricted? + pub(in crate::data_contract) creation_restriction_mode: CreationRestrictionMode, + /// The data contract id pub(in crate::data_contract) data_contract_id: Identifier, /// Encryption key storage requirements pub(in crate::data_contract) requires_identity_encryption_bounded_key: @@ -64,3 +76,10 @@ pub struct DocumentTypeV0 { #[cfg(feature = "validation")] pub(in crate::data_contract) json_schema_validator: StatelessJsonSchemaLazyValidator, } + +impl DocumentTypeV0 { + // Public method to set the data_contract_id + pub fn set_data_contract_id(&mut self, new_id: Identifier) { + self.data_contract_id = new_id; + } +} diff --git a/packages/rs-dpp/src/data_contract/document_type/v0/random_document.rs b/packages/rs-dpp/src/data_contract/document_type/v0/random_document.rs index 9b7b0ede625..cfaeece5255 100644 --- a/packages/rs-dpp/src/data_contract/document_type/v0/random_document.rs +++ b/packages/rs-dpp/src/data_contract/document_type/v0/random_document.rs @@ -3,83 +3,145 @@ //! This module defines the CreateRandomDocument trait and its functions, which //! create various types of random documents. //! +//! + +#[cfg(feature = "documents-faker")] +use std::collections::BTreeMap; +use std::time::{SystemTime, UNIX_EPOCH}; + +#[cfg(feature = "documents-faker")] +use platform_value::Value; +use platform_value::{Bytes32, Identifier}; +use rand::rngs::StdRng; +use rand::{Rng, SeedableRng}; -use crate::data_contract::document_type::property_names::{CREATED_AT, UPDATED_AT}; +use crate::data_contract::document_type::methods::DocumentTypeV0Methods; use crate::data_contract::document_type::random_document::{ CreateRandomDocument, DocumentFieldFillSize, DocumentFieldFillType, }; use crate::data_contract::document_type::v0::DocumentTypeV0; - -use crate::document::{Document, DocumentV0}; +use crate::document::property_names::{ + CREATED_AT, CREATED_AT_BLOCK_HEIGHT, CREATED_AT_CORE_BLOCK_HEIGHT, UPDATED_AT, + UPDATED_AT_BLOCK_HEIGHT, UPDATED_AT_CORE_BLOCK_HEIGHT, +}; +use crate::document::{Document, DocumentV0, INITIAL_REVISION}; use crate::identity::accessors::IdentityGettersV0; use crate::identity::Identity; +use crate::prelude::{BlockHeight, CoreBlockHeight, TimestampMillis}; use crate::version::PlatformVersion; use crate::ProtocolError; -use platform_value::{Bytes32, Identifier}; -use rand::rngs::StdRng; -use rand::{Rng, SeedableRng}; -use std::time::{SystemTime, UNIX_EPOCH}; impl CreateRandomDocument for DocumentTypeV0 { - /// Creates `count` Documents with random data using a seed if given, otherwise entropy. - fn random_documents( + /// Create random documents using json-schema-faker-rs + #[cfg(feature = "documents-faker")] + fn random_documents_faker( &self, + owner_id: Identifier, + entropy: &Bytes32, count: u32, - seed: Option, platform_version: &PlatformVersion, + substitutions: &BTreeMap<&str, Value>, ) -> Result, ProtocolError> { - let mut rng = match seed { - None => StdRng::from_entropy(), - Some(seed_value) => StdRng::seed_from_u64(seed_value), + use anyhow::Context; + + use crate::document::{ + extended_document_property_names::FEATURE_VERSION, + property_names::{ID, OWNER_ID, REVISION}, + serialization_traits::DocumentPlatformValueMethodsV0, }; - self.random_documents_with_rng(count, &mut rng, platform_version) - } - /// Creates `count` Documents with random data using the random number generator given. - fn random_documents_with_rng( - &self, - count: u32, - rng: &mut StdRng, - platform_version: &PlatformVersion, - ) -> Result, ProtocolError> { - let mut vec: Vec = vec![]; - for _i in 0..count { - vec.push(self.random_document_with_rng(rng, platform_version)?); - } - Ok(vec) - } + let json_schema = &self.schema.clone().try_into()?; + let json_documents = json_schema_faker::generate(json_schema, count as u16) + .context("cannot generate a random document with json-schema-faker-rs")?; - /// Creates `count` Documents with random data using the random number generator given. - fn random_documents_with_params( - &self, - count: u32, - identities: &Vec, - time_ms: u64, - document_field_fill_type: DocumentFieldFillType, - document_field_fill_size: DocumentFieldFillSize, - rng: &mut StdRng, - platform_version: &PlatformVersion, - ) -> Result, ProtocolError> { - let mut vec = vec![]; - for _i in 0..count { - let identity_num = rng.gen_range(0..identities.len()); - let identity = identities.get(identity_num).unwrap().clone(); - let entropy = Bytes32::random_with_rng(rng); - vec.push(( - self.random_document_with_params( - identity.id(), - entropy, - time_ms, - document_field_fill_type, - document_field_fill_size, - rng, - platform_version, - )?, - identity, - entropy, - )); - } - Ok(vec) + let fix_document = |mut document: platform_value::Value| { + let id = Document::generate_document_id_v0( + &self.data_contract_id, + &owner_id, + self.name.as_str(), + entropy.as_slice(), + ); + let now = SystemTime::now(); + let duration_since_epoch = now.duration_since(UNIX_EPOCH).expect("Time went backwards"); + let time_ms = duration_since_epoch.as_millis() as u64; + + if self.documents_mutable { + document.as_map_mut().into_iter().for_each(|d| { + d.push((REVISION.into(), 1.into())); + }); + } + document.as_map_mut().into_iter().for_each(|d| { + d.push((ID.into(), id.into())); + }); + document.as_map_mut().into_iter().for_each(|d| { + d.push((OWNER_ID.into(), owner_id.into())); + }); + if self.required_fields.contains(FEATURE_VERSION) { + document.as_map_mut().into_iter().for_each(|d| { + d.push((FEATURE_VERSION.into(), "0".into())); + }); + } + if self.required_fields.contains(CREATED_AT) { + document.as_map_mut().into_iter().for_each(|d| { + d.push((CREATED_AT.into(), time_ms.into())); + }); + } + if self.required_fields.contains(UPDATED_AT) { + document.as_map_mut().into_iter().for_each(|d| { + d.push((UPDATED_AT.into(), time_ms.into())); + }); + } + + document + }; + + json_documents + .into_iter() + .map(|d| { + let p_value: Value = d.into(); + let fixed_value = fix_document(p_value); + + // TODO: tl;dr use PlatformDeserialize instead of Deserialize for Documents + // + // `properties` is a `BTreeMap` with `platform_value::Value` as values, since + // `Document::from_platform_value` does deserialization through Serde's data model + // it losts some information like distinction between `Value::Bytes` and `Value::Bytes32`; + // The solution here is to let deserialize a `Document`, but put `properties` unprocessed + // since they were `platform_value::Value` and will be the same type again and no deserialization + // is needed, especially that lossy kind. + let mut properties = fixed_value + .to_map_ref() + .ok() + .and_then(|m| Value::map_into_btree_string_map(m.clone()).ok()) + .unwrap_or_default(); + let mut document = Document::from_platform_value(fixed_value, platform_version); + if let Ok(Document::V0(d)) = document.as_mut() { + // This moves stored properties back to the document so it could skip unnecessary + // and wrong deserialization part + d.properties.iter_mut().for_each(|(k, v)| { + substitutions + .get(k.as_str()) + .cloned() + .or(properties.remove(k)) + .into_iter() + .for_each(|prop| { + // TODO: schema and internal DocumentType representations are incompatible + // Properties are tweaked though, because the only integer type supported by + // DPP is i64, while `platform_value::Value` distincts them, and json schema is + // even more permissive; however, we want our proofs to work and proofs use the + // DPP model. + *v = match prop { + Value::U64(x) => Value::I64(x as i64), + Value::U32(x) => Value::I64(x as i64), + Value::I32(x) => Value::I64(x as i64), + x => x, + }; + }) + }); + } + document + }) + .collect() } /// Creates a random Document using a seed if given, otherwise entropy. @@ -96,46 +158,73 @@ impl CreateRandomDocument for DocumentTypeV0 { } /// Creates a document with a random id, owner id, and properties using StdRng. - fn random_document_with_identifier_and_entropy( + fn random_document_with_rng( &self, rng: &mut StdRng, - owner_id: Identifier, - entropy: Bytes32, - document_field_fill_type: DocumentFieldFillType, - document_field_fill_size: DocumentFieldFillSize, platform_version: &PlatformVersion, ) -> Result { - let now = SystemTime::now(); - let duration_since_epoch = now.duration_since(UNIX_EPOCH).expect("Time went backwards"); - let milliseconds = duration_since_epoch.as_millis() as u64; + let owner_id = Identifier::random_with_rng(rng); + let entropy = Bytes32::random_with_rng(rng); + self.random_document_with_params( owner_id, entropy, - milliseconds, - document_field_fill_type, - document_field_fill_size, + None, + None, + None, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, rng, platform_version, ) } + /// Creates `count` Documents with random data using a seed if given, otherwise entropy. + fn random_documents( + &self, + count: u32, + seed: Option, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + let mut rng = match seed { + None => StdRng::from_entropy(), + Some(seed_value) => StdRng::seed_from_u64(seed_value), + }; + self.random_documents_with_rng(count, &mut rng, platform_version) + } + + /// Creates `count` Documents with random data using the random number generator given. + fn random_documents_with_rng( + &self, + count: u32, + rng: &mut StdRng, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + let mut vec: Vec = vec![]; + for _i in 0..count { + vec.push(self.random_document_with_rng(rng, platform_version)?); + } + Ok(vec) + } + /// Creates a document with a random id, owner id, and properties using StdRng. - fn random_document_with_rng( + fn random_document_with_identifier_and_entropy( &self, rng: &mut StdRng, + owner_id: Identifier, + entropy: Bytes32, + document_field_fill_type: DocumentFieldFillType, + document_field_fill_size: DocumentFieldFillSize, platform_version: &PlatformVersion, ) -> Result { - let owner_id = Identifier::random_with_rng(rng); - let entropy = Bytes32::random_with_rng(rng); - let now = SystemTime::now(); - let duration_since_epoch = now.duration_since(UNIX_EPOCH).expect("Time went backwards"); - let milliseconds = duration_since_epoch.as_millis() as u64; self.random_document_with_params( owner_id, entropy, - milliseconds, - DocumentFieldFillType::FillIfNotRequired, - DocumentFieldFillSize::AnyDocumentFillSize, + None, + None, + None, + document_field_fill_type, + document_field_fill_size, rng, platform_version, ) @@ -146,7 +235,9 @@ impl CreateRandomDocument for DocumentTypeV0 { &self, owner_id: Identifier, entropy: Bytes32, - time_ms: u64, + time_ms: Option, + block_height: Option, + core_block_height: Option, document_field_fill_type: DocumentFieldFillType, document_field_fill_size: DocumentFieldFillSize, rng: &mut StdRng, @@ -184,24 +275,84 @@ impl CreateRandomDocument for DocumentTypeV0 { }) .collect(); - let revision = if self.documents_mutable { - Some(1) + let revision = if self.requires_revision() { + Some(INITIAL_REVISION) } else { None }; let created_at = if self.required_fields.contains(CREATED_AT) { - Some(time_ms) + if time_ms.is_some() { + time_ms + } else { + let now = SystemTime::now(); + let duration_since_epoch = + now.duration_since(UNIX_EPOCH).expect("Time went backwards"); + let milliseconds = duration_since_epoch.as_millis() as u64; + Some(milliseconds) + } } else { None }; let updated_at = if self.required_fields.contains(UPDATED_AT) { - Some(time_ms) + if time_ms.is_some() { + time_ms + } else if created_at.is_some() { + created_at + } else { + let now = SystemTime::now(); + let duration_since_epoch = + now.duration_since(UNIX_EPOCH).expect("Time went backwards"); + let milliseconds = duration_since_epoch.as_millis() as u64; + Some(milliseconds) + } } else { None }; + let created_at_block_height = if self.required_fields.contains(CREATED_AT_BLOCK_HEIGHT) { + if block_height.is_some() { + block_height + } else { + Some(0) + } + } else { + None + }; + + let updated_at_block_height = if self.required_fields.contains(UPDATED_AT_BLOCK_HEIGHT) { + if block_height.is_some() { + block_height + } else { + Some(0) + } + } else { + None + }; + + let created_at_core_block_height = + if self.required_fields.contains(CREATED_AT_CORE_BLOCK_HEIGHT) { + if core_block_height.is_some() { + core_block_height + } else { + Some(0) + } + } else { + None + }; + + let updated_at_core_block_height = + if self.required_fields.contains(UPDATED_AT_CORE_BLOCK_HEIGHT) { + if core_block_height.is_some() { + core_block_height + } else { + Some(0) + } + } else { + None + }; + match platform_version .dpp .document_versions @@ -214,6 +365,13 @@ impl CreateRandomDocument for DocumentTypeV0 { revision, created_at, updated_at, + transferred_at: None, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height: None, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height: None, } .into()), version => Err(ProtocolError::UnknownVersionMismatch { @@ -223,4 +381,41 @@ impl CreateRandomDocument for DocumentTypeV0 { }), } } + + /// Creates `count` Documents with random data using the random number generator given. + fn random_documents_with_params( + &self, + count: u32, + identities: &[Identity], + time_ms: Option, + block_height: Option, + core_block_height: Option, + document_field_fill_type: DocumentFieldFillType, + document_field_fill_size: DocumentFieldFillSize, + rng: &mut StdRng, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + let mut vec = vec![]; + for _i in 0..count { + let identity_num = rng.gen_range(0..identities.len()); + let identity = identities.get(identity_num).unwrap().clone(); + let entropy = Bytes32::random_with_rng(rng); + vec.push(( + self.random_document_with_params( + identity.id(), + entropy, + time_ms, + block_height, + core_block_height, + document_field_fill_type, + document_field_fill_size, + rng, + platform_version, + )?, + identity, + entropy, + )); + } + Ok(vec) + } } diff --git a/packages/rs-dpp/src/data_contract/document_type/v0/random_document_type.rs b/packages/rs-dpp/src/data_contract/document_type/v0/random_document_type.rs index 26c84d2c316..3e46c291ea1 100644 --- a/packages/rs-dpp/src/data_contract/document_type/v0/random_document_type.rs +++ b/packages/rs-dpp/src/data_contract/document_type/v0/random_document_type.rs @@ -72,6 +72,7 @@ pub struct RandomDocumentTypeParameters { pub field_bounds: FieldMinMaxBounds, pub keep_history_chance: f64, pub documents_mutable_chance: f64, + pub documents_can_be_deleted_chance: f64, } impl RandomDocumentTypeParameters { @@ -97,20 +98,28 @@ impl RandomDocumentTypeParameters { } } +use crate::data_contract::document_type::array::ArrayItemType; use crate::data_contract::document_type::index_level::IndexLevel; -use crate::data_contract::document_type::v0::{DocumentTypeV0, StatelessJsonSchemaLazyValidator}; +use crate::data_contract::document_type::restricted_creation::CreationRestrictionMode; +#[cfg(feature = "validation")] +use crate::data_contract::document_type::v0::StatelessJsonSchemaLazyValidator; use crate::data_contract::document_type::{ - DocumentProperty, DocumentPropertyType, DocumentType, Index, + v0::DocumentTypeV0, DocumentProperty, DocumentPropertyType, DocumentType, Index, }; +use crate::document::transfer::Transferable; use crate::identity::SecurityLevel; +use crate::nft::TradeMode; use crate::version::PlatformVersion; use crate::ProtocolError; use bincode::{Decode, Encode}; use indexmap::IndexMap; -use platform_value::{Identifier, Value}; +use itertools::Itertools; +use platform_value::{platform_value, Identifier}; use rand::rngs::StdRng; +use rand::seq::SliceRandom; use rand::Rng; -use std::collections::{BTreeMap, BTreeSet}; +use serde_json::json; +use std::collections::BTreeSet; use std::ops::Range; impl DocumentTypeV0 { @@ -136,17 +145,13 @@ impl DocumentTypeV0 { let random_weight = rng.gen_range(0..total_weight); let document_type = if random_weight < field_weights.string_weight { let has_min_len = rng.gen_bool(parameters.field_bounds.string_has_min_len_chance); - let has_max_len = rng.gen_bool(parameters.field_bounds.string_has_max_len_chance); let min_len = if has_min_len { Some(rng.gen_range(parameters.field_bounds.string_min_len.clone())) } else { None }; - let max_len = if has_max_len { - Some(rng.gen_range(parameters.field_bounds.string_max_len.clone())) - } else { - None - }; + // If a string property is used in an index it must have maxLength 63 or less (v1.0-dev) + let max_len = Some(63); DocumentPropertyType::String(min_len, max_len) } else if random_weight < field_weights.string_weight + field_weights.integer_weight { DocumentPropertyType::Integer @@ -174,19 +179,331 @@ impl DocumentTypeV0 { } else { let has_min_len = rng.gen_bool(parameters.field_bounds.byte_array_has_min_len_chance); - let has_max_len = - rng.gen_bool(parameters.field_bounds.byte_array_has_max_len_chance); let min_len = if has_min_len { Some(rng.gen_range(parameters.field_bounds.byte_array_min_len.clone())) } else { None }; - let max_len = if has_max_len { - Some(rng.gen_range(parameters.field_bounds.byte_array_max_len.clone())) + // Indexed arrays must have maxItems 255 or less (v1.0-dev) + let max_len = Some(255); + DocumentPropertyType::ByteArray(min_len, max_len) + }; + + DocumentProperty { + property_type: document_type, + required, + } + }; + + let optional_field_count = if parameters.new_fields_optional_count_range.is_empty() { + 0 + } else { + rng.gen_range(parameters.new_fields_optional_count_range.clone()) + }; + + let required_field_count = if parameters.new_fields_required_count_range.is_empty() { + 0 + } else { + rng.gen_range(parameters.new_fields_required_count_range.clone()) + }; + + let mut properties = IndexMap::new(); + let mut required_fields = BTreeSet::new(); + + for _ in 0..optional_field_count { + let field_name = format!("field_{}", rng.gen::()); + properties.insert(field_name, random_field(false, rng)); + } + + for _ in 0..required_field_count { + let field_name = format!("field_{}", rng.gen::()); + properties.insert(field_name.clone(), random_field(true, rng)); + required_fields.insert(field_name); + } + + let index_count = if parameters.new_indexes_count_range.is_empty() { + 0 + } else { + rng.gen_range(parameters.new_indexes_count_range.clone()) + }; + + let field_names: Vec = properties.keys().cloned().collect(); + // DPP only allows 10 properties per index (v1.0-dev) + let ten_field_names = field_names + .choose_multiple(&mut rand::thread_rng(), 10) + .cloned() + .collect_vec(); + + let mut indices = Vec::with_capacity(index_count as usize); + + for _ in 0..index_count { + match Index::random(&ten_field_names, &indices, rng) { + Ok(index) => indices.push(index), + Err(_) => break, + } + } + + let documents_keep_history = rng.gen_bool(parameters.keep_history_chance); + let documents_mutable = rng.gen_bool(parameters.documents_mutable_chance); + let documents_can_be_deleted = rng.gen_bool(parameters.documents_can_be_deleted_chance); + + let name = format!("doc_type_{}", rng.gen::()); + + let index_structure = + IndexLevel::try_from_indices(indices.as_slice(), name.as_str(), platform_version)?; + let (identifier_paths, binary_paths) = DocumentType::find_identifier_and_binary_paths( + &properties, + &PlatformVersion::latest() + .dpp + .contract_versions + .document_type_versions, + )?; + + // Generate properties JSON schema + let mut position_counter = 0; + let properties_json_schema = properties.iter().map(|(key, prop)| { + let mut schema_part = match &prop.property_type { + DocumentPropertyType::String(min, max) => { + let mut schema = serde_json::Map::new(); + schema.insert("type".to_string(), serde_json::Value::String("string".to_owned())); + if let Some(min_len) = min { + schema.insert("minLength".to_string(), serde_json::Value::Number(serde_json::Number::from(*min_len))); + } + if let Some(max_len) = max { + schema.insert("maxLength".to_string(), serde_json::Value::Number(serde_json::Number::from(*max_len))); + } + serde_json::Value::Object(schema) + }, + DocumentPropertyType::Integer => { + let mut schema = serde_json::Map::new(); + schema.insert("type".to_string(), serde_json::Value::String("integer".to_owned())); + // Add min and max if specified in parameters + let integer_min = parameters.field_bounds.integer_min.start; + let integer_max = parameters.field_bounds.integer_max.end; + schema.insert("minimum".to_string(), serde_json::Value::Number(serde_json::Number::from(integer_min))); + schema.insert("maximum".to_string(), serde_json::Value::Number(serde_json::Number::from(integer_max))); + serde_json::Value::Object(schema) + }, + DocumentPropertyType::Number => { + let mut schema = serde_json::Map::new(); + schema.insert("type".to_string(), serde_json::Value::String("number".to_owned())); + // Add min and max if specified in parameters + let float_min = parameters.field_bounds.float_min.start; + let float_max = parameters.field_bounds.float_max.end; + schema.insert("minimum".to_string(), serde_json::Value::Number(serde_json::Number::from_f64(float_min).unwrap())); + schema.insert("maximum".to_string(), serde_json::Value::Number(serde_json::Number::from_f64(float_max).unwrap())); + serde_json::Value::Object(schema) + }, + DocumentPropertyType::Date => { + let mut schema = serde_json::Map::new(); + schema.insert("type".to_string(), serde_json::Value::String("string".to_owned())); + schema.insert("format".to_string(), serde_json::Value::String("date-time".to_owned())); + // There's a maxLength constraint in DPP, not sure what it is. Just putting 10 for now. + schema.insert("maxLength".to_string(), serde_json::Value::Number(serde_json::Number::from(10))); + serde_json::Value::Object(schema) + }, + DocumentPropertyType::Boolean => { + serde_json::json!({"type": "boolean"}) + }, + DocumentPropertyType::ByteArray(min, max) => { + let mut schema = serde_json::Map::new(); + schema.insert("type".to_string(), serde_json::Value::String("array".to_owned())); + if let Some(min_len) = min { + schema.insert("minItems".to_string(), serde_json::Value::Number(serde_json::Number::from(*min_len))); + } + if let Some(max_len) = max { + schema.insert("maxItems".to_string(), serde_json::Value::Number(serde_json::Number::from(*max_len))); + } + schema.insert("byteArray".to_string(), serde_json::Value::Bool(true)); + serde_json::Value::Object(schema) + }, + DocumentPropertyType::Identifier => { + json!({ + "type": "array", + "items": { + "type": "string", + "pattern": "^[0-9a-fA-F]{64}$" + }, + "minItems": 1, + "maxItems": 1, + "byteArray": true, + }) + }, + DocumentPropertyType::Object(sub_properties) => { + let sub_props_schema = sub_properties.iter().map(|(sub_key, _sub_prop)| { + (sub_key.clone(), serde_json::json!({"type": "string"})) + }).collect::>(); + + json!({ + "type": "object", + "properties": sub_props_schema, + "additionalProperties": false + }) + }, + DocumentPropertyType::Array(item_type) => { + let items_schema = match *item_type { + ArrayItemType::String(min, max) => json!({"type": "string", "minLength": min, "maxLength": max}), + ArrayItemType::Integer => json!({"type": "integer"}), + ArrayItemType::Number => json!({"type": "number"}), + ArrayItemType::ByteArray(min, max) => { + json!({"type": "array", "items": {"type": "byte"}, "minItems": min, "maxItems": max}) + }, + ArrayItemType::Identifier => json!({"type": "array"}), + ArrayItemType::Boolean => json!({"type": "bool"}), + ArrayItemType::Date => json!({"type": "date"}), + }; + + json!({ + "type": "array", + "items": items_schema, + "byteArray": true, + }) + }, + DocumentPropertyType::VariableTypeArray(types) => { + let types_schema = types.iter().map(|t| { + match t { + ArrayItemType::String(_, _) => json!({"type": "string"}), + _ => json!({}) + } + }).collect::>(); + + json!({ + "type": "array", + "items": { + "oneOf": types_schema + } + }) + }, + }; + + if let serde_json::Value::Object(ref mut schema) = schema_part { + schema.insert("position".to_string(), serde_json::Value::Number(serde_json::Number::from(position_counter))); + } + position_counter += 1; + + (key.clone(), schema_part) + }).collect::>(); + + // Generate indices + let indices_json_schema = indices + .iter() + .map(|index| { + let properties_schema = index + .properties + .iter() + .map(|prop| { + // Only "asc" is allowed for now (v1.0-dev) + json!({ ::clone(&prop.name): "asc" }) + }) + .collect::>(); + + json!({ + "name": index.name, + "properties": properties_schema, + "unique": index.unique, + }) + }) + .collect::>(); + + // Combine everything into the final schema + let schema = json!({ + "type": "object", + "properties": properties_json_schema, + "required": required_fields.iter().cloned().collect::>(), + "indices": indices_json_schema, + "additionalProperties": false, + }); + + // TODO: It might not work properly + Ok(DocumentTypeV0 { + name, + schema: schema.into(), + indices, + index_structure, + flattened_properties: properties.clone(), + properties, + identifier_paths, + binary_paths, + required_fields, + documents_keep_history, + documents_mutable, + documents_can_be_deleted, + documents_transferable: Transferable::Never, + trade_mode: TradeMode::None, + creation_restriction_mode: CreationRestrictionMode::NoRestrictions, + data_contract_id, + requires_identity_encryption_bounded_key: None, + requires_identity_decryption_bounded_key: None, + security_level_requirement: SecurityLevel::HIGH, + #[cfg(feature = "validation")] + json_schema_validator: StatelessJsonSchemaLazyValidator::new(), + }) + } + + /// This is used to create an invalid random document type, often for testing + pub fn invalid_random_document_type( + parameters: RandomDocumentTypeParameters, + data_contract_id: Identifier, + rng: &mut StdRng, + platform_version: &PlatformVersion, + ) -> Result { + // Call the validation function at the beginning + parameters.validate_parameters()?; + + let field_weights = ¶meters.field_weights; + + let total_weight = field_weights.string_weight + + field_weights.float_weight + + field_weights.integer_weight + + field_weights.date_weight + + field_weights.boolean_weight + + field_weights.byte_array_weight; + + let random_field = |required: bool, rng: &mut StdRng| -> DocumentProperty { + let random_weight = rng.gen_range(0..total_weight); + let document_type = if random_weight < field_weights.string_weight { + let has_min_len = rng.gen_bool(parameters.field_bounds.string_has_min_len_chance); + let min_len = if has_min_len { + Some(rng.gen_range(parameters.field_bounds.string_min_len.clone())) } else { None }; - + // If a string property is used in an index it must have maxLength 63 or less (v1.0-dev) + let max_len = Some(63); + DocumentPropertyType::String(min_len, max_len) + } else if random_weight < field_weights.string_weight + field_weights.integer_weight { + DocumentPropertyType::Integer + } else if random_weight + < field_weights.string_weight + + field_weights.integer_weight + + field_weights.float_weight + { + DocumentPropertyType::Number + } else if random_weight + < field_weights.string_weight + + field_weights.integer_weight + + field_weights.float_weight + + field_weights.date_weight + { + DocumentPropertyType::Date + } else if random_weight + < field_weights.string_weight + + field_weights.integer_weight + + field_weights.float_weight + + field_weights.date_weight + + field_weights.boolean_weight + { + DocumentPropertyType::Boolean + } else { + let has_min_len = + rng.gen_bool(parameters.field_bounds.byte_array_has_min_len_chance); + let min_len = if has_min_len { + Some(rng.gen_range(parameters.field_bounds.byte_array_min_len.clone())) + } else { + None + }; + // Indexed arrays must have maxItems 255 or less (v1.0-dev) + let max_len = Some(255); DocumentPropertyType::ByteArray(min_len, max_len) }; @@ -196,10 +513,17 @@ impl DocumentTypeV0 { } }; - let optional_field_count = - rng.gen_range(parameters.new_fields_optional_count_range.clone()); - let required_field_count = - rng.gen_range(parameters.new_fields_required_count_range.clone()); + let optional_field_count = if parameters.new_fields_optional_count_range.is_empty() { + 0 + } else { + rng.gen_range(parameters.new_fields_optional_count_range.clone()) + }; + + let required_field_count = if parameters.new_fields_required_count_range.is_empty() { + 0 + } else { + rng.gen_range(parameters.new_fields_required_count_range.clone()) + }; let mut properties = IndexMap::new(); let mut required_fields = BTreeSet::new(); @@ -215,12 +539,23 @@ impl DocumentTypeV0 { required_fields.insert(field_name); } - let index_count = rng.gen_range(parameters.new_indexes_count_range.clone()); + let index_count = if parameters.new_indexes_count_range.is_empty() { + 0 + } else { + rng.gen_range(parameters.new_indexes_count_range.clone()) + }; + let field_names: Vec = properties.keys().cloned().collect(); + // DPP only allows 10 properties per index (v1.0-dev) + let ten_field_names = field_names + .choose_multiple(&mut rand::thread_rng(), 10) + .cloned() + .collect_vec(); + let mut indices = Vec::with_capacity(index_count as usize); for _ in 0..index_count { - match Index::random(&field_names, &indices, rng) { + match Index::random(&ten_field_names, &indices, rng) { Ok(index) => indices.push(index), Err(_) => break, } @@ -228,6 +563,7 @@ impl DocumentTypeV0 { let documents_keep_history = rng.gen_bool(parameters.keep_history_chance); let documents_mutable = rng.gen_bool(parameters.documents_mutable_chance); + let documents_can_be_deleted = rng.gen_bool(parameters.documents_can_be_deleted_chance); let name = format!("doc_type_{}", rng.gen::()); @@ -241,10 +577,15 @@ impl DocumentTypeV0 { .document_type_versions, )?; + // Combine everything into the final schema + let schema = platform_value!({ + "invalid": "yo", + }); + // TODO: It might not work properly Ok(DocumentTypeV0 { name, - schema: Value::Null, + schema, indices, index_structure, flattened_properties: properties.clone(), @@ -254,10 +595,15 @@ impl DocumentTypeV0 { required_fields, documents_keep_history, documents_mutable, + documents_can_be_deleted, + documents_transferable: Transferable::Never, + trade_mode: TradeMode::None, + creation_restriction_mode: CreationRestrictionMode::NoRestrictions, data_contract_id, requires_identity_encryption_bounded_key: None, requires_identity_decryption_bounded_key: None, security_level_requirement: SecurityLevel::HIGH, + #[cfg(feature = "validation")] json_schema_validator: StatelessJsonSchemaLazyValidator::new(), }) } diff --git a/packages/rs-dpp/src/data_contract/document_type/v0/validator.rs b/packages/rs-dpp/src/data_contract/document_type/v0/validator.rs index 99327ef15d9..447d000fd26 100644 --- a/packages/rs-dpp/src/data_contract/document_type/v0/validator.rs +++ b/packages/rs-dpp/src/data_contract/document_type/v0/validator.rs @@ -28,11 +28,8 @@ impl PartialEq for StatelessJsonSchemaLazyValidator { fn eq(&self, _other: &Self) -> bool { true } - - fn ne(&self, other: &Self) -> bool { - !self.eq(other) - } } + impl Clone for StatelessJsonSchemaLazyValidator { fn clone(&self) -> Self { StatelessJsonSchemaLazyValidator::new() diff --git a/packages/rs-dpp/src/data_contract/errors/contract.rs b/packages/rs-dpp/src/data_contract/errors/contract.rs index c4d601063ed..5b152a0a6b1 100644 --- a/packages/rs-dpp/src/data_contract/errors/contract.rs +++ b/packages/rs-dpp/src/data_contract/errors/contract.rs @@ -1,71 +1,102 @@ +use crate::consensus::basic::data_contract::DocumentTypesAreMissingError; +use crate::consensus::basic::decode::DecodingError; +use crate::consensus::basic::BasicError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; use thiserror::Error; -use crate::data_contract::DataContract; - use crate::consensus::basic::document::InvalidDocumentTypeError; +use crate::consensus::ConsensusError; use crate::data_contract::errors::json_schema_error::JsonSchemaError; -use crate::errors::consensus::ConsensusError; +use crate::ProtocolError; // @append_only -#[derive(Error, Debug)] +#[derive(Error, Debug, PlatformSerialize, PlatformDeserialize, Encode, Decode, Clone)] pub enum DataContractError { - #[error("Data Contract already exists")] - DataContractAlreadyExistsError, + #[error(transparent)] + DecodingContractError(DecodingError), - #[error("Invalid Data Contract: {errors:?}")] - InvalidDataContractError { - errors: Vec, - raw_data_contract: DataContract, - }, + #[error(transparent)] + DecodingDocumentError(DecodingError), #[error(transparent)] InvalidDocumentTypeError(InvalidDocumentTypeError), + #[error(transparent)] + DocumentTypesAreMissingError(DocumentTypesAreMissingError), + #[error("missing required key: {0}")] MissingRequiredKey(String), #[error("field requirement unmet: {0}")] - FieldRequirementUnmet(&'static str), + FieldRequirementUnmet(String), #[error("key wrong type error: {0}")] - KeyWrongType(&'static str), + KeyWrongType(String), #[error("value wrong type error: {0}")] - ValueWrongType(&'static str), + ValueWrongType(String), + + #[error("invalid uri error: {0}")] + InvalidURI(String), + + /// Key wrong bounds error + #[error("key out of bounds error: {0}")] + KeyWrongBounds(String), + + /// A key value pair must exist + #[error("key value must exist: {0}")] + KeyValueMustExist(String), #[error("value decoding error: {0}")] - ValueDecodingError(&'static str), + ValueDecodingError(String), #[error("encoding data structure not supported error: {0}")] - EncodingDataStructureNotSupported(&'static str), + EncodingDataStructureNotSupported(String), #[error("invalid contract structure: {0}")] InvalidContractStructure(String), #[error("document type not found: {0}")] - DocumentTypeNotFound(&'static str), + DocumentTypeNotFound(String), #[error("document type field not found: {0}")] DocumentTypeFieldNotFound(String), #[error("reference definition not found error: {0}")] - ReferenceDefinitionNotFound(&'static str), + ReferenceDefinitionNotFound(String), #[error("document owner id missing error: {0}")] - DocumentOwnerIdMissing(&'static str), + DocumentOwnerIdMissing(String), #[error("document id missing error: {0}")] - DocumentIdMissing(&'static str), + DocumentIdMissing(String), #[error("Operation not supported: {0}")] - Unsupported(&'static str), + Unsupported(String), #[error("Corrupted Serialization: {0}")] - CorruptedSerialization(&'static str), - - #[error("Corrupted Code Execution: {0}")] - CorruptedCodeExecution(&'static str), + CorruptedSerialization(String), #[error("Corrupted Code Execution: {0}")] JsonSchema(JsonSchemaError), } + +impl From for DataContractError { + fn from(value: platform_value::Error) -> Self { + DataContractError::ValueDecodingError(format!("{:?}", value)) + } +} + +impl From<(platform_value::Error, &str)> for DataContractError { + fn from(value: (platform_value::Error, &str)) -> Self { + DataContractError::ValueDecodingError(format!("{}: {:?}", value.1, value.0)) + } +} + +impl From for ConsensusError { + fn from(e: DataContractError) -> Self { + ConsensusError::BasicError(BasicError::ContractError(e)) + } +} diff --git a/packages/rs-dpp/src/data_contract/errors/invalid_data_contract_error.rs b/packages/rs-dpp/src/data_contract/errors/invalid_data_contract_error.rs deleted file mode 100644 index 05ea1636d49..00000000000 --- a/packages/rs-dpp/src/data_contract/errors/invalid_data_contract_error.rs +++ /dev/null @@ -1,34 +0,0 @@ -use crate::consensus::ConsensusError; -use crate::ProtocolError; -use platform_value::Value; -use thiserror::Error; - -// @append_only -#[derive(Error, Debug)] -#[error("Invalid Data Contract: {errors:?}")] -pub struct InvalidDataContractError { - pub errors: Vec, - raw_data_contract: Value, -} - -impl InvalidDataContractError { - pub fn new(errors: Vec, raw_data_contract: Value) -> Self { - Self { - errors, - raw_data_contract, - } - } - - pub fn errors(&self) -> &[ConsensusError] { - &self.errors - } - pub fn raw_data_contract(&self) -> Value { - self.raw_data_contract.clone() - } -} - -impl From for ProtocolError { - fn from(err: InvalidDataContractError) -> Self { - Self::InvalidDataContractError(err) - } -} diff --git a/packages/rs-dpp/src/data_contract/errors/json_schema_error.rs b/packages/rs-dpp/src/data_contract/errors/json_schema_error.rs index ea959b1d0ff..2d376157976 100644 --- a/packages/rs-dpp/src/data_contract/errors/json_schema_error.rs +++ b/packages/rs-dpp/src/data_contract/errors/json_schema_error.rs @@ -1,8 +1,14 @@ +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; use thiserror::Error; // @append_only -#[derive(Error, Debug)] +#[derive(Error, Debug, PlatformSerialize, PlatformDeserialize, Encode, Decode, Clone)] pub enum JsonSchemaError { #[error("can't create json schema: {0}")] - CreateSchemaError(&'static str), + CreateSchemaError(String), + + #[error("schema compatibility validation failed: {0}")] + SchemaCompatibilityValidationError(String), } diff --git a/packages/rs-dpp/src/data_contract/errors/mod.rs b/packages/rs-dpp/src/data_contract/errors/mod.rs index 55ee0433471..dd860ad6fe7 100644 --- a/packages/rs-dpp/src/data_contract/errors/mod.rs +++ b/packages/rs-dpp/src/data_contract/errors/mod.rs @@ -1,15 +1,11 @@ mod contract; mod data_contract_not_present_error; mod identity_not_present_error; -mod invalid_data_contract_error; mod invalid_document_type_error; mod json_schema_error; -mod structure; pub use contract::DataContractError; pub use data_contract_not_present_error::*; pub use identity_not_present_error::*; -pub use invalid_data_contract_error::*; pub use invalid_document_type_error::*; pub use json_schema_error::JsonSchemaError; -pub use structure::StructureError; diff --git a/packages/rs-dpp/src/data_contract/errors/structure.rs b/packages/rs-dpp/src/data_contract/errors/structure.rs deleted file mode 100644 index effe7abc63c..00000000000 --- a/packages/rs-dpp/src/data_contract/errors/structure.rs +++ /dev/null @@ -1,23 +0,0 @@ -// @append_only -/// structure errors -#[derive(Debug, thiserror::Error)] -pub enum StructureError { - /// Invalid protocol version error - #[error("invalid protocol version error: {0}")] - InvalidProtocolVersion(&'static str), - /// Invalid CBOR error - #[error("invalid cbor error: {0}")] - InvalidCBOR(&'static str), - /// Key wrong type error - #[error("key wrong type error: {0}")] - KeyWrongType(&'static str), - /// Key wrong bounds error - #[error("key out of bounds error: {0}")] - KeyWrongBounds(&'static str), - /// Value wrong type error - #[error("value wrong type error: {0}")] - ValueWrongType(&'static str), - /// A key value pair must exist - #[error("key value must exist: {0}")] - KeyValueMustExist(&'static str), -} diff --git a/packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs b/packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs index cdf5f9b2266..99d211d3cf7 100644 --- a/packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs +++ b/packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs @@ -11,6 +11,7 @@ mod test { use crate::serialization::PlatformDeserializableWithPotentialValidationFromVersionedStructure; use crate::serialization::PlatformSerializableWithPlatformVersion; use crate::tests::json_document::json_document_to_contract; + use assert_matches::assert_matches; use platform_version::version::PlatformVersion; type IndexName = &'static str; @@ -217,6 +218,9 @@ mod test { contract .config .set_documents_mutable_contract_default(false); + contract + .config + .set_documents_can_be_deleted_contract_default(false); contract .config .set_documents_keep_history_contract_default(true); @@ -227,7 +231,7 @@ mod test { let deserialized_contract = DataContract::from_cbor(contract_cbor, true, platform_version) .expect("deserialization shouldn't fail"); - assert!(matches!( + assert_matches!( deserialized_contract.config(), DataContractConfig::V0(DataContractConfigV0 { can_be_deleted: false, @@ -235,10 +239,11 @@ mod test { keeps_history: true, documents_mutable_contract_default: false, documents_keep_history_contract_default: true, + documents_can_be_deleted_contract_default: false, requires_identity_encryption_bounded_key: None, requires_identity_decryption_bounded_key: None, }) - )); + ); } #[test] @@ -264,6 +269,9 @@ mod test { contract_v0 .config .set_documents_mutable_contract_default(false); + contract_v0 + .config + .set_documents_can_be_deleted_contract_default(false); contract_v0 .config .set_documents_keep_history_contract_default(true); @@ -285,6 +293,7 @@ mod test { documents_keep_history_contract_default: true, requires_identity_encryption_bounded_key: None, requires_identity_decryption_bounded_key: None, + documents_can_be_deleted_contract_default: false, }) ); } diff --git a/packages/rs-dpp/src/data_contract/factory/mod.rs b/packages/rs-dpp/src/data_contract/factory/mod.rs index 833f2e6735b..ff3a11ec2e1 100644 --- a/packages/rs-dpp/src/data_contract/factory/mod.rs +++ b/packages/rs-dpp/src/data_contract/factory/mod.rs @@ -3,13 +3,13 @@ mod v0; use crate::data_contract::created_data_contract::CreatedDataContract; use crate::data_contract::DataContract; -use crate::util::entropy_generator::EntropyGenerator; use crate::version::PlatformVersion; use crate::ProtocolError; use derive_more::From; use platform_value::{Identifier, Value}; use crate::data_contract::config::DataContractConfig; +use crate::prelude::IdentityNonce; #[cfg(all(feature = "state-transitions", feature = "client"))] use crate::state_transition::data_contract_create_transition::DataContractCreateTransition; #[cfg(all(feature = "state-transitions", feature = "client"))] @@ -36,16 +36,13 @@ pub enum DataContractFactory { impl DataContractFactory { /// Create a new data contract factory knowing versions - pub fn new( - protocol_version: u32, - entropy_generator: Option>, - ) -> Result { + pub fn new(protocol_version: u32) -> Result { let platform_version = PlatformVersion::get(protocol_version)?; match platform_version .platform_architecture .data_contract_factory_structure_version { - 0 => Ok(DataContractFactoryV0::new(protocol_version, entropy_generator).into()), + 0 => Ok(DataContractFactoryV0::new(protocol_version).into()), version => Err(ProtocolError::UnknownVersionMismatch { method: "DataContractFactory::new".to_string(), known_versions: vec![0], @@ -58,14 +55,19 @@ impl DataContractFactory { pub fn create_with_value_config( &self, owner_id: Identifier, + identity_nonce: IdentityNonce, documents: Value, config: Option, definitions: Option, ) -> Result { match self { - DataContractFactory::V0(v0) => { - v0.create_with_value_config(owner_id, documents, config, definitions) - } + DataContractFactory::V0(v0) => v0.create_with_value_config( + owner_id, + identity_nonce, + documents, + config, + definitions, + ), } } @@ -73,12 +75,15 @@ impl DataContractFactory { pub fn create( &self, owner_id: Identifier, + identity_nonce: IdentityNonce, documents: Value, config: Option, definitions: Option, ) -> Result { match self { - DataContractFactory::V0(v0) => v0.create(owner_id, documents, config, definitions), + DataContractFactory::V0(v0) => { + v0.create(owner_id, identity_nonce, documents, config, definitions) + } } } @@ -141,11 +146,13 @@ impl DataContractFactory { pub fn create_data_contract_update_transition( &self, data_contract: DataContract, + identity_contract_nonce: IdentityNonce, ) -> Result { match self { - DataContractFactory::V0(v0) => { - v0.create_unsigned_data_contract_update_transition(data_contract) - } + DataContractFactory::V0(v0) => v0.create_unsigned_data_contract_update_transition( + data_contract, + identity_contract_nonce, + ), } } } diff --git a/packages/rs-dpp/src/data_contract/factory/v0/mod.rs b/packages/rs-dpp/src/data_contract/factory/v0/mod.rs index 2c5196ab234..7b9949e5f88 100644 --- a/packages/rs-dpp/src/data_contract/factory/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/factory/v0/mod.rs @@ -1,4 +1,4 @@ -use platform_value::{Bytes32, Value}; +use platform_value::Value; use platform_version::TryFromPlatformVersioned; use crate::consensus::basic::decode::SerializedObjectParsingError; @@ -9,17 +9,18 @@ use crate::data_contract::config::DataContractConfig; #[cfg(feature = "data-contract-value-conversion")] use crate::data_contract::conversion::value::v0::DataContractValueConversionMethodsV0; use crate::data_contract::created_data_contract::CreatedDataContract; +#[cfg(feature = "data-contract-value-conversion")] use crate::data_contract::data_contract::DataContractV0; use crate::data_contract::serialized_version::v0::DataContractInSerializationFormatV0; use crate::data_contract::serialized_version::DataContractInSerializationFormat; -use crate::data_contract::DataContract; +use crate::data_contract::{DataContract, INITIAL_DATA_CONTRACT_VERSION}; use crate::serialization::PlatformDeserializableWithPotentialValidationFromVersionedStructure; #[cfg(feature = "state-transitions")] use crate::state_transition::data_contract_create_transition::DataContractCreateTransition; #[cfg(feature = "state-transitions")] use crate::state_transition::data_contract_update_transition::DataContractUpdateTransition; -use crate::util::entropy_generator::{DefaultEntropyGenerator, EntropyGenerator}; +use crate::prelude::IdentityNonce; use crate::version::PlatformVersion; use crate::{errors::ProtocolError, prelude::Identifier}; @@ -30,26 +31,18 @@ use crate::{errors::ProtocolError, prelude::Identifier}; pub struct DataContractFactoryV0 { /// The feature version used by this factory. protocol_version: u32, - - /// An EntropyGenerator for generating entropy during data contract creation. - entropy_generator: Box, } impl DataContractFactoryV0 { - pub fn new( - protocol_version: u32, - entropy_generator: Option>, - ) -> Self { - Self { - protocol_version, - entropy_generator: entropy_generator.unwrap_or(Box::new(DefaultEntropyGenerator)), - } + pub fn new(protocol_version: u32) -> Self { + Self { protocol_version } } /// Create Data Contract pub fn create_with_value_config( &self, owner_id: Identifier, + identity_nonce: IdentityNonce, documents: Value, config: Option, definitions: Option, @@ -60,23 +53,22 @@ impl DataContractFactoryV0 { let config = config .map(|config_value| DataContractConfig::from_value(config_value, platform_version)) .transpose()?; - self.create(owner_id, documents, config, definitions) + self.create(owner_id, identity_nonce, documents, config, definitions) } /// Create Data Contract pub fn create( &self, owner_id: Identifier, + identity_nonce: IdentityNonce, documents: Value, config: Option, definitions: Option, ) -> Result { - let entropy = Bytes32::new(self.entropy_generator.generate()?); - let platform_version = PlatformVersion::get(self.protocol_version)?; let data_contract_id = - DataContract::generate_data_contract_id_v0(owner_id.to_buffer(), entropy.to_buffer()); + DataContract::generate_data_contract_id_v0(owner_id.to_buffer(), identity_nonce); let defs = definitions .map(|defs| defs.into_btree_string_map()) @@ -90,16 +82,20 @@ impl DataContractFactoryV0 { let format = DataContractInSerializationFormat::V0(DataContractInSerializationFormatV0 { id: data_contract_id, config: config.unwrap_or(DataContractConfig::default_for_version(platform_version)?), - version: 1, + version: INITIAL_DATA_CONTRACT_VERSION, owner_id, document_schemas: documents_map, schema_defs: defs, }); let data_contract = - DataContract::try_from_platform_versioned(format, true, platform_version)?; + DataContract::try_from_platform_versioned(format, true, &mut vec![], platform_version)?; - CreatedDataContract::from_contract_and_entropy(data_contract, entropy, platform_version) + CreatedDataContract::from_contract_and_identity_nonce( + data_contract, + identity_nonce, + platform_version, + ) } #[cfg(feature = "data-contract-value-conversion")] @@ -107,7 +103,7 @@ impl DataContractFactoryV0 { pub fn create_from_object( &self, data_contract_object: Value, - validate: bool, + full_validation: bool, ) -> Result { let platform_version = PlatformVersion::get(self.protocol_version)?; match platform_version @@ -115,10 +111,12 @@ impl DataContractFactoryV0 { .contract_versions .contract_structure_version { - 0 => Ok( - DataContractV0::from_value(data_contract_object, validate, platform_version)? - .into(), - ), + 0 => Ok(DataContractV0::from_value( + data_contract_object, + full_validation, + platform_version, + )? + .into()), version => Err(ProtocolError::UnknownVersionMismatch { method: "DataContractFactoryV0::create_from_object".to_string(), known_versions: vec![0], @@ -192,9 +190,10 @@ impl DataContractFactoryV0 { pub fn create_unsigned_data_contract_update_transition( &self, data_contract: DataContract, + identity_contract_nonce: IdentityNonce, ) -> Result { DataContractUpdateTransition::try_from_platform_versioned( - data_contract, + (data_contract, identity_contract_nonce), PlatformVersion::get(self.protocol_version)?, ) } @@ -220,14 +219,14 @@ mod tests { fn get_test_data() -> TestData { let platform_version = PlatformVersion::latest(); let created_data_contract = - get_data_contract_fixture(None, platform_version.protocol_version); + get_data_contract_fixture(None, 0, platform_version.protocol_version); let raw_data_contract = created_data_contract .data_contract() .to_value(platform_version) .unwrap(); - let factory = DataContractFactoryV0::new(platform_version.protocol_version, None); + let factory = DataContractFactoryV0::new(platform_version.protocol_version); TestData { created_data_contract, raw_data_contract, @@ -258,6 +257,7 @@ mod tests { let result = factory .create_with_value_config( data_contract.owner_id(), + 1, raw_documents, None, Some(raw_defs), @@ -339,11 +339,15 @@ mod tests { .expect("Data Contract Transition should be created"); assert_eq!(0, result.state_transition_protocol_version()); - assert_eq!(&created_data_contract.entropy_used(), &result.entropy()); + assert_eq!( + created_data_contract.identity_nonce(), + result.identity_nonce() + ); let contract_value = DataContract::try_from_platform_versioned( result.data_contract().to_owned(), false, + &mut vec![], platform_version, ) .unwrap() diff --git a/packages/rs-dpp/src/data_contract/generate_data_contract.rs b/packages/rs-dpp/src/data_contract/generate_data_contract.rs index fa6caea7d17..0280124e115 100644 --- a/packages/rs-dpp/src/data_contract/generate_data_contract.rs +++ b/packages/rs-dpp/src/data_contract/generate_data_contract.rs @@ -1,18 +1,19 @@ use crate::data_contract::DataContract; +use crate::prelude::IdentityNonce; use platform_value::Identifier; use std::io::Write; -use crate::util::hash::hash; +use crate::util::hash::hash_double; impl DataContract { - /// Generate data contract id based on owner id and entropy + /// Generate data contract id based on owner id and identity nonce pub fn generate_data_contract_id_v0( owner_id: impl AsRef<[u8]>, - entropy: impl AsRef<[u8]>, + identity_nonce: IdentityNonce, ) -> Identifier { let mut b: Vec = vec![]; let _ = b.write(owner_id.as_ref()); - let _ = b.write(entropy.as_ref()); - Identifier::from(hash(b)) + let _ = b.write(identity_nonce.to_be_bytes().as_slice()); + Identifier::from(hash_double(b)) } } diff --git a/packages/rs-dpp/src/data_contract/methods/mod.rs b/packages/rs-dpp/src/data_contract/methods/mod.rs index 83e4933421c..d9bde273a7d 100644 --- a/packages/rs-dpp/src/data_contract/methods/mod.rs +++ b/packages/rs-dpp/src/data_contract/methods/mod.rs @@ -1,3 +1,5 @@ pub mod schema; #[cfg(feature = "validation")] -pub mod validation; +pub mod validate_document; +#[cfg(feature = "validation")] +pub mod validate_update; diff --git a/packages/rs-dpp/src/data_contract/methods/schema/mod.rs b/packages/rs-dpp/src/data_contract/methods/schema/mod.rs index c8ee5c7afac..63748fb45f8 100644 --- a/packages/rs-dpp/src/data_contract/methods/schema/mod.rs +++ b/packages/rs-dpp/src/data_contract/methods/schema/mod.rs @@ -3,6 +3,7 @@ pub use v0::*; use crate::data_contract::{DefinitionName, DocumentName}; use crate::prelude::DataContract; +use crate::validation::operations::ProtocolValidationOperation; use crate::ProtocolError; use platform_value::Value; use platform_version::version::PlatformVersion; @@ -13,13 +14,18 @@ impl DataContractSchemaMethodsV0 for DataContract { &mut self, schemas: BTreeMap, defs: Option>, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError> { match self { - DataContract::V0(v0) => { - v0.set_document_schemas(schemas, defs, validate, platform_version) - } + DataContract::V0(v0) => v0.set_document_schemas( + schemas, + defs, + full_validation, + validation_operations, + platform_version, + ), } } @@ -27,13 +33,18 @@ impl DataContractSchemaMethodsV0 for DataContract { &mut self, name: &str, schema: Value, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError> { match self { - DataContract::V0(v0) => { - v0.set_document_schema(name, schema, validate, platform_version) - } + DataContract::V0(v0) => v0.set_document_schema( + name, + schema, + full_validation, + validation_operations, + platform_version, + ), } } @@ -52,11 +63,17 @@ impl DataContractSchemaMethodsV0 for DataContract { fn set_schema_defs( &mut self, defs: Option>, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError> { match self { - DataContract::V0(v0) => v0.set_schema_defs(defs, validate, platform_version), + DataContract::V0(v0) => v0.set_schema_defs( + defs, + full_validation, + validation_operations, + platform_version, + ), } } } diff --git a/packages/rs-dpp/src/data_contract/methods/schema/v0/mod.rs b/packages/rs-dpp/src/data_contract/methods/schema/v0/mod.rs index a509d90d7e0..ff7bfcb5101 100644 --- a/packages/rs-dpp/src/data_contract/methods/schema/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/methods/schema/v0/mod.rs @@ -1,4 +1,5 @@ use crate::data_contract::{DefinitionName, DocumentName}; +use crate::validation::operations::ProtocolValidationOperation; use crate::ProtocolError; use platform_value::Value; use platform_version::version::PlatformVersion; @@ -9,7 +10,8 @@ pub trait DataContractSchemaMethodsV0 { &mut self, schemas: BTreeMap, defs: Option>, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError>; @@ -17,7 +19,8 @@ pub trait DataContractSchemaMethodsV0 { &mut self, name: &str, schema: Value, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError>; @@ -26,7 +29,8 @@ pub trait DataContractSchemaMethodsV0 { fn set_schema_defs( &mut self, defs: Option>, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError>; } diff --git a/packages/rs-dpp/src/data_contract/methods/validate_document/mod.rs b/packages/rs-dpp/src/data_contract/methods/validate_document/mod.rs new file mode 100644 index 00000000000..acf0bc2b34a --- /dev/null +++ b/packages/rs-dpp/src/data_contract/methods/validate_document/mod.rs @@ -0,0 +1,53 @@ +use crate::prelude::DataContract; +use platform_value::Value; +use platform_version::version::PlatformVersion; + +mod v0; +use crate::document::Document; +use crate::validation::SimpleConsensusValidationResult; +use crate::ProtocolError; +pub use v0::*; + +impl DataContractDocumentValidationMethodsV0 for DataContract { + fn validate_document( + &self, + name: &str, + document: &Document, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .contract_versions + .methods + .validate_document + { + 0 => self.validate_document_v0(name, document, platform_version), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DataContract::validate_document".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + + fn validate_document_properties( + &self, + name: &str, + properties: Value, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .contract_versions + .methods + .validate_document + { + 0 => self.validate_document_properties_v0(name, properties, platform_version), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DataContract::validate_document_properties".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/data_contract/methods/validate_document/v0/mod.rs b/packages/rs-dpp/src/data_contract/methods/validate_document/v0/mod.rs new file mode 100644 index 00000000000..423f5375696 --- /dev/null +++ b/packages/rs-dpp/src/data_contract/methods/validate_document/v0/mod.rs @@ -0,0 +1,117 @@ +use crate::data_contract::accessors::v0::DataContractV0Getters; +use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; +use crate::data_contract::document_type::{DocumentType, DocumentTypeRef}; + +use crate::consensus::basic::document::{InvalidDocumentTypeError, MissingDocumentTypeError}; +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::data_contract::schema::DataContractSchemaMethodsV0; +use crate::data_contract::DataContract; +use crate::document::{property_names, Document, DocumentV0Getters}; +use crate::validation::SimpleConsensusValidationResult; +use crate::ProtocolError; +use platform_value::Value; +use platform_version::version::PlatformVersion; +use std::ops::Deref; + +pub trait DataContractDocumentValidationMethodsV0 { + fn validate_document( + &self, + name: &str, + document: &Document, + platform_version: &PlatformVersion, + ) -> Result; + + fn validate_document_properties( + &self, + name: &str, + value: Value, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl DataContract { + #[inline(always)] + pub(super) fn validate_document_properties_v0( + &self, + name: &str, + value: Value, + platform_version: &PlatformVersion, + ) -> Result { + let Some(document_type) = self.document_type_optional_for_name(name) else { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTypeError::new(name.to_owned(), self.id()).into(), + )); + }; + + let validator = match document_type { + DocumentTypeRef::V0(v0) => v0.json_schema_validator.deref(), + }; + + let json_value = match value.try_into_validating_json() { + Ok(json_value) => json_value, + Err(e) => { + return Ok(SimpleConsensusValidationResult::new_with_error( + ConsensusError::BasicError(BasicError::ValueError(e.into())), + )) + } + }; + + // Compile json schema validator if it's not yet compiled + if !validator.is_compiled(platform_version)? { + // It is normal that we get a protocol error here, since the document type is coming + // from the state + let root_schema = DocumentType::enrich_with_base_schema( + // TODO: I just wondering if we could you references here + // instead of cloning + document_type.schema().clone(), + self.schema_defs().map(|defs| Value::from(defs.clone())), + platform_version, + )?; + + let root_json_schema = root_schema + .try_to_validating_json() + .map_err(ProtocolError::ValueError)?; + + validator.compile_and_validate(&root_json_schema, &json_value, platform_version) + } else { + validator.validate(&json_value, platform_version) + } + } + + // TODO: Move to document + #[inline(always)] + pub(super) fn validate_document_v0( + &self, + name: &str, + document: &Document, + platform_version: &PlatformVersion, + ) -> Result { + // Make sure that the document type is defined in the contract + let Some(document_type) = self.document_type_optional_for_name(name) else { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTypeError::new(name.to_string(), self.id()).into(), + )); + }; + + // Make sure that timestamps are present if required + let required_fields = document_type.required_fields(); + + if required_fields.contains(property_names::CREATED_AT) && document.created_at().is_none() { + // TODO: Create a special consensus error for this + return Ok(SimpleConsensusValidationResult::new_with_error( + MissingDocumentTypeError::new().into(), + )); + } + + if required_fields.contains(property_names::UPDATED_AT) && document.updated_at().is_none() { + // TODO: Create a special consensus error for this + return Ok(SimpleConsensusValidationResult::new_with_error( + MissingDocumentTypeError::new().into(), + )); + } + + // Validate user defined properties + self.validate_document_properties_v0(name, document.properties().into(), platform_version) + } +} diff --git a/packages/rs-dpp/src/data_contract/methods/validate_update/mod.rs b/packages/rs-dpp/src/data_contract/methods/validate_update/mod.rs new file mode 100644 index 00000000000..e40ea1cb625 --- /dev/null +++ b/packages/rs-dpp/src/data_contract/methods/validate_update/mod.rs @@ -0,0 +1,29 @@ +use crate::prelude::DataContract; +use platform_version::version::PlatformVersion; + +mod v0; +use crate::validation::SimpleConsensusValidationResult; +use crate::ProtocolError; +pub use v0::*; + +impl DataContractUpdateValidationMethodsV0 for DataContract { + fn validate_update( + &self, + data_contract: &DataContract, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .contract_versions + .methods + .validate_update + { + 0 => self.validate_update_v0(data_contract, platform_version), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DataContract::validate_update".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs b/packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs new file mode 100644 index 00000000000..fed077b7128 --- /dev/null +++ b/packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs @@ -0,0 +1,404 @@ +use crate::data_contract::accessors::v0::DataContractV0Getters; + +use crate::consensus::basic::data_contract::{ + IncompatibleDataContractSchemaError, InvalidDataContractVersionError, +}; +use crate::consensus::state::data_contract::data_contract_update_permission_error::DataContractUpdatePermissionError; +use crate::consensus::state::data_contract::document_type_update_error::DocumentTypeUpdateError; +use crate::data_contract::document_type::schema::validate_schema_compatibility; +use crate::data_contract::schema::DataContractSchemaMethodsV0; +use crate::data_contract::DataContract; +use crate::validation::SimpleConsensusValidationResult; +use crate::ProtocolError; +use platform_value::Value; +use platform_version::version::PlatformVersion; +use serde_json::json; + +pub trait DataContractUpdateValidationMethodsV0 { + fn validate_update( + &self, + data_contract: &DataContract, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl DataContract { + #[inline(always)] + pub(super) fn validate_update_v0( + &self, + new_data_contract: &DataContract, + platform_version: &PlatformVersion, + ) -> Result { + // Check if the contract is owned by the same identity + if self.owner_id() != new_data_contract.owner_id() { + return Ok(SimpleConsensusValidationResult::new_with_error( + DataContractUpdatePermissionError::new(self.id(), new_data_contract.owner_id()) + .into(), + )); + } + + // Check version is bumped + // Failure (version != previous version + 1): Keep ST and transform it to a nonce bump action. + // How: A user pushed an update that was not the next version. + + let new_version = new_data_contract.version(); + let old_version = self.version(); + if new_version < old_version || new_version - old_version != 1 { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDataContractVersionError::new(old_version + 1, new_version).into(), + )); + } + + // Validate that the config was not updated + // * Includes verifications that: + // - Old contract is not read_only + // - New contract is not read_only + // - Keeps history did not change + // - Can be deleted did not change + // - Documents keep history did not change + // - Documents can be deleted contract default did not change + // - Documents mutable contract default did not change + // - Requires identity encryption bounded key did not change + // - Requires identity decryption bounded key did not change + // * Failure (contract does not exist): Keep ST and transform it to a nonce bump action. + // * How: A user pushed an update to a contract that changed its configuration. + + let config_validation_result = self.config().validate_update( + new_data_contract.config(), + self.id(), + platform_version, + )?; + + if !config_validation_result.is_valid() { + return Ok(SimpleConsensusValidationResult::new_with_errors( + config_validation_result.errors, + )); + } + + // Validate updates for existing document types to make sure that previously created + // documents will be still valid with a new version of the data contract + for (document_type_name, old_document_type) in self.document_types() { + // Make sure that existing document aren't removed + let Some(new_document_type) = + new_data_contract.document_type_optional_for_name(document_type_name) + else { + return Ok(SimpleConsensusValidationResult::new_with_error( + DocumentTypeUpdateError::new( + self.id(), + document_type_name, + "document type can't be removed", + ) + .into(), + )); + }; + + // Validate document type update rules + let validate_update_result = old_document_type + .as_ref() + .validate_update(new_document_type, platform_version)?; + + if !validate_update_result.is_valid() { + return Ok(SimpleConsensusValidationResult::new_with_errors( + validate_update_result.errors, + )); + } + } + + // Schema $defs should be compatible + if let Some(old_defs_map) = self.schema_defs() { + // If new contract doesn't have $defs, it means that it's $defs was removed and compatibility is broken + let Some(new_defs_map) = new_data_contract.schema_defs() else { + return Ok(SimpleConsensusValidationResult::new_with_error( + IncompatibleDataContractSchemaError::new( + self.id(), + "remove".to_string(), + "/$defs".to_string(), + ) + .into(), + )); + }; + + // If $defs is updated we need to make sure that our data contract is still compatible + // with previously created data + if old_defs_map != new_defs_map { + // both new and old $defs already validated as a part of new and old contract + let old_defs_json = Value::from(old_defs_map) + .try_into_validating_json() + .map_err(ProtocolError::ValueError)?; + + let new_defs_json = Value::from(new_defs_map) + .try_into_validating_json() + .map_err(ProtocolError::ValueError)?; + + let old_defs_schema = json!({ + "$defs": old_defs_json + }); + + let new_defs_schema = json!({ + "$defs": new_defs_json + }); + + // We do not allow to remove or modify $ref in document type schemas + // it means that compatible changes in $defs won't break the overall compatibility + // Make sure that updated $defs schema is compatible + let compatibility_validation_result = validate_schema_compatibility( + &old_defs_schema, + &new_defs_schema, + platform_version, + )?; + + if !compatibility_validation_result.is_valid() { + let errors = compatibility_validation_result + .errors + .into_iter() + .map(|operation| { + IncompatibleDataContractSchemaError::new( + self.id(), + operation.name, + operation.path, + ) + .into() + }) + .collect(); + + return Ok(SimpleConsensusValidationResult::new_with_errors(errors)); + } + } + } + + Ok(SimpleConsensusValidationResult::new()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::consensus::basic::basic_error::BasicError; + use crate::consensus::state::state_error::StateError; + use crate::consensus::ConsensusError; + use crate::data_contract::config::v0::DataContractConfigSettersV0; + use crate::prelude::IdentityNonce; + use crate::tests::fixtures::get_data_contract_fixture; + use assert_matches::assert_matches; + use platform_value::platform_value; + use platform_value::Identifier; + + mod validate_update { + use super::*; + use crate::data_contract::accessors::v0::DataContractV0Setters; + use crate::data_contract::document_type::DocumentTypeMutRef; + + #[test] + fn should_return_invalid_result_if_owner_id_is_not_the_same() { + let platform_version = PlatformVersion::latest(); + + let old_data_contract = + get_data_contract_fixture(None, IdentityNonce::default(), 1).data_contract_owned(); + + let mut new_data_contract = old_data_contract.clone(); + + new_data_contract.as_v0_mut().unwrap().owner_id = Identifier::random(); + + let result = old_data_contract + .validate_update(&new_data_contract, platform_version) + .expect("failed validate update"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DataContractUpdatePermissionError(e) + )] if *e.data_contract_id() == old_data_contract.id() && *e.identity_id() == new_data_contract.owner_id() + ); + } + + #[test] + fn should_return_invalid_result_if_contract_version_is_not_greater_for_one() { + let platform_version = PlatformVersion::latest(); + + let old_data_contract = + get_data_contract_fixture(None, IdentityNonce::default(), 1).data_contract_owned(); + + let new_data_contract = old_data_contract.clone(); + + let result = old_data_contract + .validate_update_v0(&new_data_contract, platform_version) + .expect("failed validate update"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::InvalidDataContractVersionError(e) + )] if e.expected_version() == old_data_contract.version() + 1 && e.version() == new_data_contract.version() + ); + } + + #[test] + fn should_return_invalid_result_if_config_was_updated() { + let platform_version = PlatformVersion::latest(); + + let old_data_contract = + get_data_contract_fixture(None, IdentityNonce::default(), 1).data_contract_owned(); + + let mut new_data_contract = old_data_contract.clone(); + + new_data_contract.set_version(old_data_contract.version() + 1); + new_data_contract.config_mut().set_readonly(true); + + let result = old_data_contract + .validate_update_v0(&new_data_contract, platform_version) + .expect("failed validate update"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DataContractConfigUpdateError(e) + )] if e.additional_message() == "contract can not be changed to readonly" + ); + } + + #[test] + fn should_return_invalid_result_when_document_type_is_removed() { + let platform_version = PlatformVersion::latest(); + + let old_data_contract = + get_data_contract_fixture(None, IdentityNonce::default(), 1).data_contract_owned(); + + let mut new_data_contract = old_data_contract.clone(); + + new_data_contract.set_version(old_data_contract.version() + 1); + new_data_contract + .document_types_mut() + .remove("niceDocument"); + + let result = old_data_contract + .validate_update_v0(&new_data_contract, platform_version) + .expect("failed validate update"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can't be removed" + ); + } + + #[test] + fn should_return_invalid_result_when_document_type_has_incompatible_change() { + let platform_version = PlatformVersion::latest(); + + let old_data_contract = + get_data_contract_fixture(None, IdentityNonce::default(), 1).data_contract_owned(); + + let mut new_data_contract = old_data_contract.clone(); + + new_data_contract.set_version(old_data_contract.version() + 1); + + let DocumentTypeMutRef::V0(new_document_type) = new_data_contract + .document_types_mut() + .get_mut("niceDocument") + .unwrap() + .as_mut_ref(); + new_document_type.documents_mutable = false; + + let result = old_data_contract + .validate_update_v0(&new_data_contract, platform_version) + .expect("failed validate update"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError( + StateError::DocumentTypeUpdateError(e) + )] if e.additional_message() == "document type can not change whether its documents are mutable: changing from true to false" + ); + } + + #[test] + fn should_return_invalid_result_when_defs_is_removed() { + let platform_version = PlatformVersion::latest(); + + let mut old_data_contract = + get_data_contract_fixture(None, IdentityNonce::default(), 1).data_contract_owned(); + + // Remove document that uses $defs, so we can safely remove it for testing + old_data_contract + .document_types_mut() + .remove("prettyDocument"); + + let mut new_data_contract = old_data_contract.clone(); + + new_data_contract.set_version(old_data_contract.version() + 1); + new_data_contract + .set_schema_defs(None, false, &mut Vec::new(), platform_version) + .expect("failed to set schema defs"); + + let result = old_data_contract + .validate_update_v0(&new_data_contract, platform_version) + .expect("failed validate update"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::IncompatibleDataContractSchemaError(e) + )] if e.operation() == "remove" && e.field_path() == "/$defs" + ); + } + + #[test] + fn should_return_invalid_result_when_updated_defs_is_incompatible() { + let platform_version = PlatformVersion::latest(); + + let old_data_contract = + get_data_contract_fixture(None, IdentityNonce::default(), 1).data_contract_owned(); + + let mut new_data_contract = old_data_contract.clone(); + + let incompatible_defs_value = platform_value!({ + "lastName": { + "type": "number", + }, + }); + let incompatible_defs = incompatible_defs_value + .into_btree_string_map() + .expect("should convert to map"); + + new_data_contract.set_version(old_data_contract.version() + 1); + new_data_contract + .set_schema_defs( + Some(incompatible_defs), + false, + &mut Vec::new(), + platform_version, + ) + .expect("failed to set schema defs"); + + let result = old_data_contract + .validate_update_v0(&new_data_contract, platform_version) + .expect("failed validate update"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::IncompatibleDataContractSchemaError(e) + )] if e.operation() == "replace" && e.field_path() == "/$defs/lastName/type" + ); + } + + #[test] + fn should_pass_when_all_changes_are_compatible() { + let platform_version = PlatformVersion::latest(); + + let old_data_contract = + get_data_contract_fixture(None, IdentityNonce::default(), 1).data_contract_owned(); + + let mut new_data_contract = old_data_contract.clone(); + + new_data_contract.set_version(old_data_contract.version() + 1); + + let result = old_data_contract + .validate_update_v0(&new_data_contract, platform_version) + .expect("failed validate update"); + + assert!(result.is_valid()); + } + } +} diff --git a/packages/rs-dpp/src/data_contract/methods/validation/mod.rs b/packages/rs-dpp/src/data_contract/methods/validation/mod.rs deleted file mode 100644 index e0291db7abc..00000000000 --- a/packages/rs-dpp/src/data_contract/methods/validation/mod.rs +++ /dev/null @@ -1,53 +0,0 @@ -use crate::prelude::DataContract; -use platform_value::Value; -use platform_version::version::PlatformVersion; - -mod v0; -use crate::document::Document; -use crate::validation::SimpleConsensusValidationResult; -use crate::ProtocolError; -pub use v0::*; - -impl DataContractValidationMethodsV0 for DataContract { - fn validate_document( - &self, - name: &str, - document: &Document, - platform_version: &PlatformVersion, - ) -> Result { - match platform_version - .dpp - .contract_versions - .methods - .validate_document - { - 0 => self.validate_document_v0(name, document, platform_version), - version => Err(ProtocolError::UnknownVersionMismatch { - method: "DataContract::validate_document".to_string(), - known_versions: vec![0], - received: version, - }), - } - } - - fn validate_document_properties( - &self, - name: &str, - properties: Value, - platform_version: &PlatformVersion, - ) -> Result { - match platform_version - .dpp - .contract_versions - .methods - .validate_document - { - 0 => self.validate_document_properties_v0(name, properties, platform_version), - version => Err(ProtocolError::UnknownVersionMismatch { - method: "DataContract::validate_document_properties".to_string(), - known_versions: vec![0], - received: version, - }), - } - } -} diff --git a/packages/rs-dpp/src/data_contract/methods/validation/v0/mod.rs b/packages/rs-dpp/src/data_contract/methods/validation/v0/mod.rs deleted file mode 100644 index f347ddb46c2..00000000000 --- a/packages/rs-dpp/src/data_contract/methods/validation/v0/mod.rs +++ /dev/null @@ -1,107 +0,0 @@ -use crate::data_contract::accessors::v0::DataContractV0Getters; -use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; -use crate::data_contract::document_type::schema::enrich_with_base_schema; -use crate::data_contract::document_type::DocumentTypeRef; - -use crate::consensus::basic::document::{InvalidDocumentTypeError, MissingDocumentTypeError}; -use crate::data_contract::schema::DataContractSchemaMethodsV0; -use crate::data_contract::DataContract; -use crate::document::{property_names, Document, DocumentV0Getters}; -use crate::validation::SimpleConsensusValidationResult; -use crate::ProtocolError; -use platform_value::Value; -use platform_version::version::PlatformVersion; -use std::ops::Deref; - -pub trait DataContractValidationMethodsV0 { - fn validate_document( - &self, - name: &str, - document: &Document, - platform_version: &PlatformVersion, - ) -> Result; - - fn validate_document_properties( - &self, - name: &str, - value: Value, - platform_version: &PlatformVersion, - ) -> Result; -} - -impl DataContract { - pub(super) fn validate_document_properties_v0( - &self, - name: &str, - value: Value, - platform_version: &PlatformVersion, - ) -> Result { - let Some(document_type) = self.document_type_optional_for_name(name) else { - return Ok(SimpleConsensusValidationResult::new_with_error( - InvalidDocumentTypeError::new(name.to_owned(), self.id()).into(), - )); - }; - - let validator = match document_type { - DocumentTypeRef::V0(v0) => v0.json_schema_validator.deref(), - }; - - // Compile json schema validator if it's not yet compiled - if !validator.is_compiled(platform_version)? { - let root_schema = enrich_with_base_schema( - // TODO: I just wondering if we could you references here - // instead of cloning - document_type.schema().clone(), - self.schema_defs().map(|defs| Value::from(defs.clone())), - platform_version, - )?; - - let root_json_schema = root_schema - .try_to_validating_json() - .map_err(ProtocolError::ValueError)?; - - validator.compile(&root_json_schema, platform_version)?; - } - - let json_value = value - .try_into_validating_json() - .map_err(ProtocolError::ValueError)?; - - validator.validate(&json_value, platform_version) - } - - // TODO: Move to document - pub(super) fn validate_document_v0( - &self, - name: &str, - document: &Document, - platform_version: &PlatformVersion, - ) -> Result { - // Make sure that the document type is defined in the contract - let Some(document_type) = self.document_type_optional_for_name(name) else { - return Ok(SimpleConsensusValidationResult::new_with_error( - InvalidDocumentTypeError::new(name.to_string(), self.id()).into(), - )); - }; - - // Make sure that timestamps are present if required - let required_fields = document_type.required_fields(); - - if required_fields.contains(property_names::CREATED_AT) && document.created_at().is_none() { - // TODO: Create a special consensus error for this - return Ok(SimpleConsensusValidationResult::new_with_error( - MissingDocumentTypeError::new().into(), - )); - } - - if required_fields.contains(property_names::UPDATED_AT) && document.updated_at().is_none() { - // TODO: Create a special consensus error for this - return Ok(SimpleConsensusValidationResult::new_with_error( - MissingDocumentTypeError::new().into(), - )); - } - - // Validate user defined properties - self.validate_document_properties_v0(name, document.properties().into(), platform_version) - } -} diff --git a/packages/rs-dpp/src/data_contract/mod.rs b/packages/rs-dpp/src/data_contract/mod.rs index cffbceea576..5fd8f7b56f5 100644 --- a/packages/rs-dpp/src/data_contract/mod.rs +++ b/packages/rs-dpp/src/data_contract/mod.rs @@ -4,11 +4,9 @@ use crate::serialization::{ PlatformLimitDeserializableFromVersionedStructure, PlatformSerializableWithPlatformVersion, }; -pub use data_contract::*; use derive_more::From; use bincode::config::{BigEndian, Configuration}; -pub use generate_data_contract::*; pub mod errors; pub mod extra; @@ -22,7 +20,7 @@ pub mod document_type; mod v0; #[cfg(feature = "factories")] -mod factory; +pub mod factory; #[cfg(feature = "factories")] pub use factory::*; pub mod conversion; @@ -42,8 +40,7 @@ pub use v0::*; use crate::data_contract::serialized_version::{ DataContractInSerializationFormat, CONTRACT_DESERIALIZATION_LIMIT, }; -use crate::data_contract::v0::data_contract::DataContractV0; -use crate::util::hash::hash_to_vec; +use crate::util::hash::hash_double_to_vec; use crate::version::{FeatureVersion, PlatformVersion}; use crate::ProtocolError; @@ -58,6 +55,8 @@ type DefinitionName = String; pub type DocumentName = String; type PropertyPath = String; +pub const INITIAL_DATA_CONTRACT_VERSION: u32 = 1; + /// Understanding Data Contract versioning /// Data contract versioning is both for the code structure and for serialization. /// @@ -123,7 +122,7 @@ impl PlatformSerializableWithPlatformVersion for DataContract { impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for DataContract { fn versioned_deserialize( data: &[u8], - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where @@ -143,7 +142,8 @@ impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for Dat .0; DataContract::try_from_platform_versioned( data_contract_in_serialization_format, - validate, + full_validation, + &mut vec![], platform_version, ) } @@ -152,7 +152,7 @@ impl PlatformDeserializableWithPotentialValidationFromVersionedStructure for Dat impl PlatformDeserializableWithBytesLenFromVersionedStructure for DataContract { fn versioned_deserialize_with_bytes_len( data: &[u8], - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result<(Self, usize), ProtocolError> where @@ -171,7 +171,8 @@ impl PlatformDeserializableWithBytesLenFromVersionedStructure for DataContract { Ok(( DataContract::try_from_platform_versioned( data_contract_in_serialization_format, - validate, + full_validation, + &mut vec![], platform_version, )?, len, @@ -203,6 +204,7 @@ impl PlatformLimitDeserializableFromVersionedStructure for DataContract { DataContract::try_from_platform_versioned( data_contract_in_serialization_format, true, + &mut vec![], platform_version, ) } @@ -240,9 +242,9 @@ impl DataContract { } pub fn hash(&self, platform_version: &PlatformVersion) -> Result, ProtocolError> { - Ok(hash_to_vec(self.serialize_to_bytes_with_platform_version( - platform_version, - )?)) + Ok(hash_double_to_vec( + self.serialize_to_bytes_with_platform_version(platform_version)?, + )) } } @@ -265,7 +267,7 @@ mod tests { #[test] fn test_contract_serialization() { let platform_version = PlatformVersion::latest(); - let data_contract = load_system_data_contract(Dashpay, platform_version.protocol_version) + let data_contract = load_system_data_contract(Dashpay, platform_version) .expect("expected dashpay contract"); let platform_version = PlatformVersion::latest(); let serialized = data_contract @@ -288,8 +290,9 @@ mod tests { #[test] fn test_contract_can_have_specialized_contract_encryption_decryption_keys() { - let data_contract = get_dashpay_contract_with_generalized_encryption_key_fixture(None, 1) - .data_contract_owned(); + let data_contract = + get_dashpay_contract_with_generalized_encryption_key_fixture(None, 0, 1) + .data_contract_owned(); assert_eq!( data_contract .config() @@ -306,7 +309,7 @@ mod tests { #[test] fn test_contract_document_type_can_have_specialized_contract_encryption_decryption_keys() { - let data_contract = get_dashpay_contract_fixture(None, 1).data_contract_owned(); + let data_contract = get_dashpay_contract_fixture(None, 0, 1).data_contract_owned(); assert_eq!( data_contract .document_type_for_name("contactRequest") diff --git a/packages/rs-dpp/src/data_contract/serialized_version/mod.rs b/packages/rs-dpp/src/data_contract/serialized_version/mod.rs index bf25d0accbc..150bc6a28bf 100644 --- a/packages/rs-dpp/src/data_contract/serialized_version/mod.rs +++ b/packages/rs-dpp/src/data_contract/serialized_version/mod.rs @@ -4,12 +4,14 @@ use crate::data_contract::{DataContract, DefinitionName, DocumentName}; use crate::version::PlatformVersion; use std::collections::BTreeMap; +use crate::validation::operations::ProtocolValidationOperation; use crate::ProtocolError; use bincode::{Decode, Encode}; use derive_more::From; use platform_value::{Identifier, Value}; use platform_version::TryFromPlatformVersioned; use platform_versioning::PlatformVersioned; +#[cfg(feature = "data-contract-serde-conversion")] use serde::{Deserialize, Serialize}; pub(in crate::data_contract) mod v0; @@ -53,6 +55,12 @@ impl DataContractInSerializationFormat { DataContractInSerializationFormat::V0(v0) => v0.schema_defs.as_ref(), } } + + pub fn version(&self) -> u32 { + match self { + DataContractInSerializationFormat::V0(v0) => v0.version, + } + } } impl TryFromPlatformVersioned for DataContractInSerializationFormat { @@ -163,7 +171,8 @@ impl TryFromPlatformVersioned for DataContractInSerializationForma impl DataContract { pub fn try_from_platform_versioned( value: DataContractInSerializationFormat, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result { match value { @@ -176,7 +185,8 @@ impl DataContract { 0 => { let data_contract = DataContractV0::try_from_platform_versioned_v0( serialization_format_v0, - validate, + full_validation, + validation_operations, platform_version, )?; Ok(data_contract.into()) diff --git a/packages/rs-dpp/src/data_contract/serialized_version/v0/mod.rs b/packages/rs-dpp/src/data_contract/serialized_version/v0/mod.rs index ba2a5bd4f15..085b1d2a829 100644 --- a/packages/rs-dpp/src/data_contract/serialized_version/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/serialized_version/v0/mod.rs @@ -1,7 +1,7 @@ use crate::data_contract::config::v0::DataContractConfigV0; use crate::data_contract::config::DataContractConfig; use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; -use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; + use crate::data_contract::v0::DataContractV0; use crate::data_contract::{DataContract, DefinitionName, DocumentName}; use crate::identity::state_transition::asset_lock_proof::{Decode, Encode}; diff --git a/packages/rs-dpp/src/data_contract/state_transition/data_contract_create_transition/mod.rs b/packages/rs-dpp/src/data_contract/state_transition/data_contract_create_transition/mod.rs deleted file mode 100644 index 0869dd85e0a..00000000000 --- a/packages/rs-dpp/src/data_contract/state_transition/data_contract_create_transition/mod.rs +++ /dev/null @@ -1,447 +0,0 @@ -use std::collections::BTreeMap; -use std::convert::TryInto; - -use crate::serialization_traits::PlatformSerializable; -use platform_serialization::PlatformSignable; -use platform_serialization::{PlatformDeserialize, PlatformSerialize}; - -use platform_value::btreemap_extensions::BTreeValueMapHelper; -use platform_value::btreemap_extensions::BTreeValueRemoveFromMapHelper; -use platform_value::{BinaryData, Bytes32, IntegerReplacementType, ReplacementType, Value}; -use serde::{Deserialize, Serialize}; -use serde_json::Value as JsonValue; - -use crate::{ - data_contract::DataContract, - identity::KeyID, - prelude::Identifier, - state_transition::{ - StateTransitionConvert, StateTransitionIdentitySigned, StateTransitionLike, - StateTransitionType, - }, - Convertible, ProtocolError, -}; - -use super::property_names::*; - -use crate::serialization_traits::{PlatformDeserializable, Signable}; - -use bincode::{config, Decode, Encode}; - -mod action; -pub mod apply_data_contract_create_transition_factory; -pub mod builder; -mod serialize_for_signing; -pub mod validation; - -pub use action::{ - DataContractCreateTransitionAction, DATA_CONTRACT_CREATE_TRANSITION_ACTION_VERSION, -}; - -pub mod property_names { - pub const PROTOCOL_VERSION: &str = "protocolVersion"; - pub const DATA_CONTRACT: &str = "dataContract"; - pub const DATA_CONTRACT_ID: &str = "dataContract.$id"; - pub const DATA_CONTRACT_OWNER_ID: &str = "dataContract.ownerId"; - pub const DATA_CONTRACT_ENTROPY: &str = "dataContract.entropy"; - pub const ENTROPY: &str = "entropy"; - pub const DATA_CONTRACT_PROTOCOL_VERSION: &str = "dataContract.protocolVersion"; - pub const SIGNATURE_PUBLIC_KEY_ID: &str = "signaturePublicKeyId"; - pub const SIGNATURE: &str = "signature"; -} - -pub const IDENTIFIER_FIELDS: [&str; 2] = [ - property_names::DATA_CONTRACT_ID, - property_names::DATA_CONTRACT_OWNER_ID, -]; -pub const BINARY_FIELDS: [&str; 3] = [ - property_names::ENTROPY, - property_names::DATA_CONTRACT_ENTROPY, - property_names::SIGNATURE, -]; -pub const U32_FIELDS: [&str; 2] = [ - property_names::PROTOCOL_VERSION, - property_names::DATA_CONTRACT_PROTOCOL_VERSION, -]; - -#[derive( - Debug, - Clone, - Serialize, - Deserialize, - Encode, - Decode, - PlatformDeserialize, - PlatformSerialize, - PartialEq, - PlatformSignable, -)] -#[serde(rename_all = "camelCase")] -#[platform_error_type(ProtocolError)] -pub struct DataContractCreateTransition { - pub protocol_version: u32, - #[serde(rename = "type")] - pub transition_type: StateTransitionType, - pub data_contract: DataContract, - pub entropy: Bytes32, - #[platform_signable(exclude_from_sig_hash)] - pub signature_public_key_id: KeyID, - #[platform_signable(exclude_from_sig_hash)] - pub signature: BinaryData, -} - -impl std::default::Default for DataContractCreateTransition { - fn default() -> Self { - DataContractCreateTransition { - protocol_version: Default::default(), - transition_type: StateTransitionType::DataContractCreate, - entropy: Bytes32::default(), - signature_public_key_id: 0, - signature: BinaryData::default(), - data_contract: Default::default(), - } - } -} - -impl DataContractCreateTransition { - pub fn from_raw_object( - mut raw_object: Value, - ) -> Result { - Ok(DataContractCreateTransition { - protocol_version: raw_object.get_integer(PROTOCOL_VERSION)?, - signature: raw_object - .remove_optional_binary_data(SIGNATURE) - .map_err(ProtocolError::ValueError)? - .unwrap_or_default(), - signature_public_key_id: raw_object - .get_optional_integer(SIGNATURE_PUBLIC_KEY_ID) - .map_err(ProtocolError::ValueError)? - .unwrap_or_default(), - entropy: raw_object - .remove_optional_bytes_32(ENTROPY) - .map_err(ProtocolError::ValueError)? - .unwrap_or_default(), - data_contract: DataContract::from_raw_object( - raw_object.remove(DATA_CONTRACT).map_err(|_| { - ProtocolError::DecodingError( - "data contract missing on state transition".to_string(), - ) - })?, - )?, - ..Default::default() - }) - } - - pub fn from_value_map( - mut raw_data_contract_create_transition: BTreeMap, - ) -> Result { - Ok(DataContractCreateTransition { - protocol_version: raw_data_contract_create_transition - .get_integer(PROTOCOL_VERSION) - .map_err(ProtocolError::ValueError)?, - signature: raw_data_contract_create_transition - .remove_optional_binary_data(SIGNATURE) - .map_err(ProtocolError::ValueError)? - .unwrap_or_default(), - signature_public_key_id: raw_data_contract_create_transition - .remove_optional_integer(SIGNATURE_PUBLIC_KEY_ID) - .map_err(ProtocolError::ValueError)? - .unwrap_or_default(), - entropy: raw_data_contract_create_transition - .remove_optional_bytes_32(ENTROPY) - .map_err(ProtocolError::ValueError)? - .unwrap_or_default(), - data_contract: DataContract::from_raw_object( - raw_data_contract_create_transition - .remove(DATA_CONTRACT) - .ok_or(ProtocolError::DecodingError( - "data contract missing on state transition".to_string(), - ))?, - )?, - ..Default::default() - }) - } - - pub fn get_data_contract(&self) -> &DataContract { - &self.data_contract - } - - pub fn get_protocol_version(&self) -> u32 { - self.protocol_version - } - - pub fn set_data_contract(&mut self, data_contract: DataContract) { - self.data_contract = data_contract; - } - - /// Returns ID of the created contract - pub fn get_modified_data_ids(&self) -> Vec { - vec![self.data_contract.id] - } - - pub fn clean_value(value: &mut Value) -> Result<(), platform_value::Error> { - value.replace_at_paths(IDENTIFIER_FIELDS, ReplacementType::Identifier)?; - value.replace_at_paths(BINARY_FIELDS, ReplacementType::BinaryBytes)?; - value.replace_integer_type_at_paths(U32_FIELDS, IntegerReplacementType::U32)?; - Ok(()) - } -} - -impl StateTransitionIdentitySigned for DataContractCreateTransition { - /// Get owner ID - fn get_owner_id(&self) -> &Identifier { - &self.data_contract.owner_id - } - - fn get_signature_public_key_id(&self) -> Option { - Some(self.signature_public_key_id) - } - - fn set_signature_public_key_id(&mut self, key_id: crate::identity::KeyID) { - self.signature_public_key_id = key_id - } -} - -impl StateTransitionLike for DataContractCreateTransition { - /// Returns ID of the created contract - fn get_modified_data_ids(&self) -> Vec { - vec![self.data_contract.id] - } - - fn get_protocol_version(&self) -> u32 { - self.protocol_version - } - /// returns the type of State Transition - fn get_type(&self) -> StateTransitionType { - self.transition_type - } - /// returns the signature as a byte-array - fn get_signature(&self) -> &BinaryData { - &self.signature - } - /// set a new signature - fn set_signature(&mut self, signature: BinaryData) { - self.signature = signature - } - - fn set_signature_bytes(&mut self, signature: Vec) { - self.signature = BinaryData::new(signature) - } -} - -impl StateTransitionConvert for DataContractCreateTransition { - fn signature_property_paths() -> Vec<&'static str> { - vec![SIGNATURE, SIGNATURE_PUBLIC_KEY_ID] - } - - fn identifiers_property_paths() -> Vec<&'static str> { - vec![] - } - - fn binary_property_paths() -> Vec<&'static str> { - vec![SIGNATURE, ENTROPY] - } - - fn to_json(&self, skip_signature: bool) -> Result { - self.to_cleaned_object(skip_signature) - .and_then(|value| value.try_into().map_err(ProtocolError::ValueError)) - } - - fn to_object(&self, skip_signature: bool) -> Result { - let mut object: Value = platform_value::to_value(self)?; - if skip_signature { - Self::signature_property_paths() - .into_iter() - .try_for_each(|path| { - object - .remove_values_matching_path(path) - .map_err(ProtocolError::ValueError) - .map(|_| ()) - })?; - } - object.insert(String::from(DATA_CONTRACT), self.data_contract.to_object()?)?; - Ok(object) - } - - fn to_cleaned_object(&self, skip_signature: bool) -> Result { - let mut object: Value = platform_value::to_value(self)?; - if skip_signature { - Self::signature_property_paths() - .into_iter() - .try_for_each(|path| { - object - .remove_values_matching_path(path) - .map_err(ProtocolError::ValueError) - .map(|_| ()) - })?; - } - object.insert( - String::from(DATA_CONTRACT), - self.data_contract.to_cleaned_object()?, - )?; - Ok(object) - } -} - -#[cfg(test)] -mod test { - use crate::data_contract::CreatedDataContract; - use integer_encoding::VarInt; - - use crate::tests::fixtures::get_data_contract_fixture; - use crate::util::json_value::JsonValueExt; - use crate::version; - - use super::*; - - struct TestData { - state_transition: DataContractCreateTransition, - created_data_contract: CreatedDataContract, - } - - fn get_test_data() -> TestData { - let created_data_contract = get_data_contract_fixture(None); - - let state_transition = DataContractCreateTransition::from_raw_object(Value::from([ - (PROTOCOL_VERSION, version::LATEST_VERSION.into()), - (ENTROPY, created_data_contract.entropy_used.into()), - ( - DATA_CONTRACT, - created_data_contract.data_contract.to_object().unwrap(), - ), - ])) - .expect("state transition should be created without errors"); - - TestData { - created_data_contract, - state_transition, - } - } - - #[test] - fn should_return_protocol_version() { - let data = get_test_data(); - assert_eq!( - version::LATEST_VERSION, - data.state_transition.get_protocol_version() - ) - } - - #[test] - fn should_return_transition_type() { - let data = get_test_data(); - assert_eq!( - StateTransitionType::DataContractCreate, - data.state_transition.get_type() - ); - } - - #[test] - fn should_return_data_contract() { - let data = get_test_data(); - - assert_eq!( - data.state_transition - .get_data_contract() - .to_json_object() - .expect("conversion to object shouldn't fail"), - data.created_data_contract - .data_contract - .to_json_object() - .expect("conversion to object shouldn't fail") - ); - } - - #[test] - fn should_return_state_transition_in_json_format() { - let data = get_test_data(); - let mut json_object = data - .state_transition - .to_json(false) - .expect("conversion to JSON shouldn't fail"); - - assert_eq!( - version::LATEST_VERSION, - json_object - .get_u64(PROTOCOL_VERSION) - .expect("the protocol version should be present") as u32 - ); - - assert_eq!( - 0, - json_object - .get_u64(TRANSITION_TYPE) - .expect("the transition type should be present") as u8 - ); - assert_eq!( - 0, - json_object - .get_u64(SIGNATURE_PUBLIC_KEY_ID) - .expect("default public key id should be defined"), - ); - assert_eq!( - "", - json_object - .remove_into::(SIGNATURE) - .expect("default string value for signature should be present") - ); - - assert_eq!( - >::into(data.created_data_contract.entropy_used), - json_object - .remove_into::(ENTROPY) - .expect("the entropy should be present") - ) - } - - #[test] - fn should_return_serialized_state_transition_to_buffer() { - let data = get_test_data(); - let state_transition_bytes = data - .state_transition - .to_cbor_buffer(false) - .expect("state transition should be converted to buffer"); - let (protocol_version, _) = - u32::decode_var(state_transition_bytes.as_ref()).expect("expected to decode"); - assert_eq!(version::LATEST_VERSION, protocol_version) - } - - #[test] - fn should_return_owner_id() { - let data = get_test_data(); - assert_eq!( - &data.created_data_contract.data_contract.owner_id, - data.state_transition.get_owner_id() - ); - } - - #[test] - fn is_data_contract_state_transition() { - let data = get_test_data(); - assert!(data.state_transition.is_data_contract_state_transition()); - assert!(!data.state_transition.is_document_state_transition()); - assert!(!data.state_transition.is_identity_state_transition()); - } - - mod platform_serializable { - use crate::data_contract::state_transition::data_contract_create_transition::DataContractCreateTransition; - use crate::serialization_traits::{PlatformDeserializable, PlatformSerializable}; - - #[test] - fn should_serialize_config() { - let mut data = super::get_test_data(); - data.state_transition.data_contract.config.keeps_history = true; - let state_transition_bytes = data - .state_transition - .serialize() - .expect("state transition should be serialized"); - - assert!(data.state_transition.data_contract.config.keeps_history); - - let restored = DataContractCreateTransition::deserialize(&state_transition_bytes) - .expect("state transition should be deserialized"); - - assert!(restored.data_contract.config.keeps_history); - } - } -} diff --git a/packages/rs-dpp/src/data_contract/storage_requirements/keys_for_document_type.rs b/packages/rs-dpp/src/data_contract/storage_requirements/keys_for_document_type.rs index 56f0f4017ed..b825466eba2 100644 --- a/packages/rs-dpp/src/data_contract/storage_requirements/keys_for_document_type.rs +++ b/packages/rs-dpp/src/data_contract/storage_requirements/keys_for_document_type.rs @@ -1,3 +1,6 @@ +use crate::consensus::basic::data_contract::UnknownStorageKeyRequirementsError; +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; use crate::ProtocolError; use bincode::{Decode, Encode}; use serde_repr::*; @@ -20,10 +23,12 @@ impl TryFrom for StorageKeyRequirements { 0 => Ok(Self::Unique), 1 => Ok(Self::Multiple), 2 => Ok(Self::MultipleReferenceToLatest), - value => Err(ProtocolError::UnknownStorageKeyRequirements(format!( - "unrecognized storage key requirements: {}", - value - ))), + value => Err(ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::UnknownStorageKeyRequirementsError( + UnknownStorageKeyRequirementsError::new(vec![0, 1, 3], value.into()), + )) + .into(), + )), } } } @@ -35,10 +40,12 @@ impl TryFrom for StorageKeyRequirements { 0 => Ok(Self::Unique), 1 => Ok(Self::Multiple), 2 => Ok(Self::MultipleReferenceToLatest), - value => Err(ProtocolError::UnknownStorageKeyRequirements(format!( - "unrecognized storage key requirements: {}", - value - ))), + value => Err(ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::UnknownStorageKeyRequirementsError( + UnknownStorageKeyRequirementsError::new(vec![0, 1, 3], value), + )) + .into(), + )), } } } diff --git a/packages/rs-dpp/src/data_contract/v0/accessors/mod.rs b/packages/rs-dpp/src/data_contract/v0/accessors/mod.rs index 1d0168c5e5f..a3d617dc62a 100644 --- a/packages/rs-dpp/src/data_contract/v0/accessors/mod.rs +++ b/packages/rs-dpp/src/data_contract/v0/accessors/mod.rs @@ -1,15 +1,14 @@ use crate::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; use crate::data_contract::config::DataContractConfig; -use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; use crate::data_contract::document_type::{DocumentType, DocumentTypeRef}; use crate::data_contract::errors::DataContractError; -use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; + use crate::data_contract::v0::DataContractV0; use crate::data_contract::DocumentName; use crate::metadata::Metadata; -use crate::ProtocolError; + use platform_value::Identifier; -use std::collections::{BTreeMap, BTreeSet}; +use std::collections::BTreeMap; impl DataContractV0Getters for DataContractV0 { fn id(&self) -> Identifier { @@ -28,20 +27,20 @@ impl DataContractV0Getters for DataContractV0 { self.owner_id } - fn document_type_cloned_for_name(&self, name: &str) -> Result { + fn document_type_cloned_for_name(&self, name: &str) -> Result { self.document_type_cloned_optional_for_name(name) .ok_or_else(|| { - ProtocolError::DataContractError(DataContractError::DocumentTypeNotFound( - "can not get document type from contract", - )) + DataContractError::DocumentTypeNotFound( + "can not get document type from contract".to_string(), + ) }) } - fn document_type_for_name(&self, name: &str) -> Result { + fn document_type_for_name(&self, name: &str) -> Result { self.document_type_optional_for_name(name).ok_or_else(|| { - ProtocolError::DataContractError(DataContractError::DocumentTypeNotFound( - "can not get document type from contract", - )) + DataContractError::DocumentTypeNotFound( + "can not get document type from contract".to_string(), + ) }) } @@ -52,9 +51,7 @@ impl DataContractV0Getters for DataContractV0 { } fn document_type_cloned_optional_for_name(&self, name: &str) -> Option { - self.document_types - .get(name) - .map(|document_type| document_type.clone()) + self.document_types.get(name).cloned() } fn has_document_type_for_name(&self, name: &str) -> bool { @@ -65,6 +62,10 @@ impl DataContractV0Getters for DataContractV0 { &self.document_types } + fn document_types_mut(&mut self) -> &mut BTreeMap { + &mut self.document_types + } + fn metadata(&self) -> Option<&Metadata> { self.metadata.as_ref() } diff --git a/packages/rs-dpp/src/data_contract/v0/conversion/cbor.rs b/packages/rs-dpp/src/data_contract/v0/conversion/cbor.rs index 6d8fa5c5d9c..af497027fd3 100644 --- a/packages/rs-dpp/src/data_contract/v0/conversion/cbor.rs +++ b/packages/rs-dpp/src/data_contract/v0/conversion/cbor.rs @@ -14,10 +14,10 @@ impl DataContractCborConversionMethodsV0 for DataContractV0 { fn from_cbor_with_id( cbor_bytes: impl AsRef<[u8]>, contract_id: Option, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { - let mut data_contract = Self::from_cbor(cbor_bytes, validate, platform_version)?; + let mut data_contract = Self::from_cbor(cbor_bytes, full_validation, platform_version)?; if let Some(id) = contract_id { data_contract.id = id; } @@ -26,7 +26,7 @@ impl DataContractCborConversionMethodsV0 for DataContractV0 { fn from_cbor( cbor_bytes: impl AsRef<[u8]>, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { let data_contract_cbor_value: CborValue = ciborium::de::from_reader(cbor_bytes.as_ref()) @@ -37,7 +37,7 @@ impl DataContractCborConversionMethodsV0 for DataContractV0 { let data_contract_value: Value = Value::try_from(data_contract_cbor_value).map_err(ProtocolError::ValueError)?; - Self::from_value(data_contract_value, validate, platform_version) + Self::from_value(data_contract_value, full_validation, platform_version) } fn to_cbor(&self, platform_version: &PlatformVersion) -> Result, ProtocolError> { diff --git a/packages/rs-dpp/src/data_contract/v0/conversion/json.rs b/packages/rs-dpp/src/data_contract/v0/conversion/json.rs index c1b978830d1..90e05b5f1fd 100644 --- a/packages/rs-dpp/src/data_contract/v0/conversion/json.rs +++ b/packages/rs-dpp/src/data_contract/v0/conversion/json.rs @@ -11,10 +11,10 @@ use std::convert::TryInto; impl DataContractJsonConversionMethodsV0 for DataContractV0 { fn from_json( json_value: JsonValue, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { - Self::from_value(json_value.into(), validate, platform_version) + Self::from_value(json_value.into(), full_validation, platform_version) } /// Returns Data Contract as a JSON Value diff --git a/packages/rs-dpp/src/data_contract/v0/conversion/value.rs b/packages/rs-dpp/src/data_contract/v0/conversion/value.rs index 7f103c96d1f..3ed0a987135 100644 --- a/packages/rs-dpp/src/data_contract/v0/conversion/value.rs +++ b/packages/rs-dpp/src/data_contract/v0/conversion/value.rs @@ -15,7 +15,7 @@ pub const DATA_CONTRACT_IDENTIFIER_FIELDS_V0: [&str; 2] = impl DataContractValueConversionMethodsV0 for DataContractV0 { fn from_value( mut value: Value, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { value.replace_at_paths( @@ -30,7 +30,8 @@ impl DataContractValueConversionMethodsV0 for DataContractV0 { DataContractV0::try_from_platform_versioned( data_contract_data.into(), - validate, + full_validation, + &mut vec![], // this is not used in consensus code platform_version, ) } diff --git a/packages/rs-dpp/src/data_contract/v0/data_contract.rs b/packages/rs-dpp/src/data_contract/v0/data_contract.rs index 100cd1eea1a..6116b2839b6 100644 --- a/packages/rs-dpp/src/data_contract/v0/data_contract.rs +++ b/packages/rs-dpp/src/data_contract/v0/data_contract.rs @@ -7,7 +7,7 @@ use crate::data_contract::{DefinitionName, DocumentName}; use crate::data_contract::config::DataContractConfig; use crate::data_contract::document_type::DocumentType; -use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; + use crate::metadata::Metadata; /// `DataContractV0` represents a data contract in a decentralized platform. @@ -31,7 +31,7 @@ pub struct DataContractV0 { pub(crate) owner_id: Identifier, /// A mapping of document names to their corresponding document types. - pub(crate) document_types: BTreeMap, + pub document_types: BTreeMap, // TODO: Move metadata from here /// Optional metadata associated with the contract. diff --git a/packages/rs-dpp/src/data_contract/v0/methods/schema.rs b/packages/rs-dpp/src/data_contract/v0/methods/schema.rs index 724300da73b..d97cb54045c 100644 --- a/packages/rs-dpp/src/data_contract/v0/methods/schema.rs +++ b/packages/rs-dpp/src/data_contract/v0/methods/schema.rs @@ -4,6 +4,7 @@ use crate::data_contract::document_type::DocumentType; use crate::data_contract::schema::DataContractSchemaMethodsV0; use crate::data_contract::v0::DataContractV0; use crate::data_contract::{DefinitionName, DocumentName}; +use crate::validation::operations::ProtocolValidationOperation; use crate::ProtocolError; use platform_value::Value; use platform_version::version::PlatformVersion; @@ -14,7 +15,8 @@ impl DataContractSchemaMethodsV0 for DataContractV0 { &mut self, schemas: BTreeMap, defs: Option>, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError> { self.document_types = DocumentType::create_document_types_from_document_schemas( @@ -23,7 +25,9 @@ impl DataContractSchemaMethodsV0 for DataContractV0 { defs.as_ref(), self.config.documents_keep_history_contract_default(), self.config.documents_mutable_contract_default(), - validate, + self.config.documents_can_be_deleted_contract_default(), + full_validation, + validation_operations, platform_version, )?; @@ -34,7 +38,8 @@ impl DataContractSchemaMethodsV0 for DataContractV0 { &mut self, name: &str, schema: Value, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError> { let document_type = DocumentType::try_from_schema( @@ -44,7 +49,9 @@ impl DataContractSchemaMethodsV0 for DataContractV0 { self.schema_defs.as_ref(), self.config.documents_keep_history_contract_default(), self.config.documents_mutable_contract_default(), - validate, + self.config.documents_mutable_contract_default(), + full_validation, + validation_operations, platform_version, )?; @@ -68,7 +75,8 @@ impl DataContractSchemaMethodsV0 for DataContractV0 { fn set_schema_defs( &mut self, defs: Option>, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError> { let document_schemas = self @@ -77,7 +85,13 @@ impl DataContractSchemaMethodsV0 for DataContractV0 { .map(|(name, document_type)| (name.to_owned(), document_type.schema().to_owned())) .collect(); - self.set_document_schemas(document_schemas, defs.clone(), validate, platform_version)?; + self.set_document_schemas( + document_schemas, + defs.clone(), + full_validation, + validation_operations, + platform_version, + )?; self.schema_defs = defs; @@ -100,18 +114,31 @@ mod test { let config = DataContractConfig::default_for_version(platform_version) .expect("should create a default config"); + let schema = platform_value!({ + "type": "object", + "properties": { + "a": { + "type": "string", + "maxLength": 10, + "position": 0 + } + }, + "additionalProperties": false, + }); + let serialization_format = DataContractInSerializationFormatV0 { id: Identifier::random(), config, version: 0, owner_id: Default::default(), schema_defs: None, - document_schemas: Default::default(), + document_schemas: BTreeMap::from([("document_type_name".to_string(), schema.clone())]), }; let mut data_contract = DataContractV0::try_from_platform_versioned( serialization_format.into(), true, + &mut vec![], platform_version, ) .expect("should create a contract from serialization format"); @@ -125,7 +152,7 @@ mod test { let defs_map = Some(defs.into_btree_string_map().expect("should convert to map")); data_contract - .set_schema_defs(defs_map.clone(), true, platform_version) + .set_schema_defs(defs_map.clone(), true, &mut vec![], platform_version) .expect("should set defs"); assert_eq!(defs_map.as_ref(), data_contract.schema_defs()) @@ -157,12 +184,13 @@ mod test { let mut data_contract = DataContractV0::try_from_platform_versioned( serialization_format.into(), true, + &mut vec![], platform_version, ) .expect("should create a contract from serialization format"); data_contract - .set_schema_defs(None, true, platform_version) + .set_schema_defs(None, true, &mut vec![], platform_version) .expect("should set defs"); assert_eq!(None, data_contract.schema_defs()) diff --git a/packages/rs-dpp/src/data_contract/v0/serialization/bincode.rs b/packages/rs-dpp/src/data_contract/v0/serialization/bincode.rs index da82005c7a0..65d78beaa1a 100644 --- a/packages/rs-dpp/src/data_contract/v0/serialization/bincode.rs +++ b/packages/rs-dpp/src/data_contract/v0/serialization/bincode.rs @@ -18,7 +18,7 @@ mod tests { let identity = Identity::random_identity(5, Some(5), platform_version) .expect("expected a random identity"); let contract = - get_data_contract_fixture(Some(identity.id()), platform_version.protocol_version) + get_data_contract_fixture(Some(identity.id()), 0, platform_version.protocol_version) .data_contract_owned(); let bytes = contract .serialize_to_bytes_with_platform_version(LATEST_PLATFORM_VERSION) diff --git a/packages/rs-dpp/src/data_contract/v0/serialization/mod.rs b/packages/rs-dpp/src/data_contract/v0/serialization/mod.rs index 0606d722212..104ede8844f 100644 --- a/packages/rs-dpp/src/data_contract/v0/serialization/mod.rs +++ b/packages/rs-dpp/src/data_contract/v0/serialization/mod.rs @@ -7,6 +7,7 @@ use crate::data_contract::DataContract; use crate::version::{PlatformVersion, PlatformVersionCurrentVersion}; use crate::ProtocolError; +use crate::validation::operations::ProtocolValidationOperation; use serde::{Deserialize, Deserializer, Serialize, Serializer}; pub mod bincode; @@ -31,15 +32,21 @@ impl<'de> Deserialize<'de> for DataContractV0 { let current_version = PlatformVersion::get_current().map_err(|e| serde::de::Error::custom(e.to_string()))?; // when deserializing from json/platform_value/cbor we always want to validate (as this is not coming from the state) - DataContractV0::try_from_platform_versioned_v0(serialization_format, true, current_version) - .map_err(serde::de::Error::custom) + DataContractV0::try_from_platform_versioned_v0( + serialization_format, + true, + &mut vec![], + current_version, + ) + .map_err(serde::de::Error::custom) } } impl DataContractV0 { pub(in crate::data_contract) fn try_from_platform_versioned( value: DataContractInSerializationFormat, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result { match value { @@ -52,7 +59,8 @@ impl DataContractV0 { 0 => { let data_contract = DataContractV0::try_from_platform_versioned_v0( serialization_format_v0, - validate, + full_validation, + validation_operations, platform_version, )?; @@ -70,7 +78,8 @@ impl DataContractV0 { pub(in crate::data_contract) fn try_from_platform_versioned_v0( data_contract_data: DataContractInSerializationFormatV0, - validate: bool, + full_validation: bool, + validation_operations: &mut Vec, platform_version: &PlatformVersion, ) -> Result { let DataContractInSerializationFormatV0 { @@ -88,7 +97,9 @@ impl DataContractV0 { schema_defs.as_ref(), config.documents_keep_history_contract_default(), config.documents_mutable_contract_default(), - validate, + config.documents_can_be_deleted_contract_default(), + full_validation, + validation_operations, platform_version, )?; diff --git a/packages/rs-dpp/src/document/accessors/mod.rs b/packages/rs-dpp/src/document/accessors/mod.rs index c2cd2492c04..2ba6d883103 100644 --- a/packages/rs-dpp/src/document/accessors/mod.rs +++ b/packages/rs-dpp/src/document/accessors/mod.rs @@ -4,7 +4,7 @@ pub use v0::*; use crate::document::Document; use crate::identity::TimestampMillis; -use crate::prelude::Revision; +use crate::prelude::{BlockHeight, CoreBlockHeight, Revision}; use platform_value::{Identifier, Value}; use std::collections::BTreeMap; @@ -68,6 +68,48 @@ impl DocumentV0Getters for Document { Document::V0(v0) => v0.updated_at, } } + + fn transferred_at(&self) -> Option { + match self { + Document::V0(v0) => v0.transferred_at, + } + } + + fn created_at_block_height(&self) -> Option { + match self { + Document::V0(v0) => v0.created_at_block_height, + } + } + + fn updated_at_block_height(&self) -> Option { + match self { + Document::V0(v0) => v0.updated_at_block_height, + } + } + + fn transferred_at_block_height(&self) -> Option { + match self { + Document::V0(v0) => v0.transferred_at_block_height, + } + } + + fn created_at_core_block_height(&self) -> Option { + match self { + Document::V0(v0) => v0.created_at_core_block_height, + } + } + + fn updated_at_core_block_height(&self) -> Option { + match self { + Document::V0(v0) => v0.updated_at_core_block_height, + } + } + + fn transferred_at_core_block_height(&self) -> Option { + match self { + Document::V0(v0) => v0.transferred_at_core_block_height, + } + } } impl DocumentV0Setters for Document { @@ -95,6 +137,12 @@ impl DocumentV0Setters for Document { } } + fn bump_revision(&mut self) { + match self { + Document::V0(v0) => v0.bump_revision(), + } + } + fn set_created_at(&mut self, created_at: Option) { match self { Document::V0(v0) => v0.created_at = created_at, @@ -106,4 +154,51 @@ impl DocumentV0Setters for Document { Document::V0(v0) => v0.updated_at = updated_at, } } + + fn set_transferred_at(&mut self, transferred_at: Option) { + match self { + Document::V0(v0) => v0.transferred_at = transferred_at, + } + } + + fn set_created_at_block_height(&mut self, created_at_block_height: Option) { + match self { + Document::V0(v0) => v0.created_at_block_height = created_at_block_height, + } + } + + fn set_updated_at_block_height(&mut self, updated_at_block_height: Option) { + match self { + Document::V0(v0) => v0.updated_at_block_height = updated_at_block_height, + } + } + + fn set_transferred_at_block_height(&mut self, transferred_at_block_height: Option) { + match self { + Document::V0(v0) => v0.transferred_at_block_height = transferred_at_block_height, + } + } + + fn set_created_at_core_block_height(&mut self, created_at_core_block_height: Option) { + match self { + Document::V0(v0) => v0.created_at_core_block_height = created_at_core_block_height, + } + } + + fn set_updated_at_core_block_height(&mut self, updated_at_core_block_height: Option) { + match self { + Document::V0(v0) => v0.updated_at_core_block_height = updated_at_core_block_height, + } + } + + fn set_transferred_at_core_block_height( + &mut self, + transferred_at_core_block_height: Option, + ) { + match self { + Document::V0(v0) => { + v0.transferred_at_core_block_height = transferred_at_core_block_height + } + } + } } diff --git a/packages/rs-dpp/src/document/accessors/v0/mod.rs b/packages/rs-dpp/src/document/accessors/v0/mod.rs index 0ae3b3acd36..e8274af2219 100644 --- a/packages/rs-dpp/src/document/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/document/accessors/v0/mod.rs @@ -30,6 +30,9 @@ pub trait DocumentV0Getters { /// Returns the time in milliseconds that the document was last updated. fn updated_at(&self) -> Option; + /// Returns the time in milliseconds that the document was last transferred. + fn transferred_at(&self) -> Option; + /// Retrieves the field specified by the path. /// Returns `None` if the path is empty or if the field is not present. fn get(&self, path: &str) -> Option<&Value> { @@ -38,6 +41,12 @@ pub trait DocumentV0Getters { fn id_ref(&self) -> &Identifier; fn owner_id_ref(&self) -> &Identifier; fn properties_consumed(self) -> BTreeMap; + fn created_at_block_height(&self) -> Option; + fn updated_at_block_height(&self) -> Option; + fn transferred_at_block_height(&self) -> Option; + fn created_at_core_block_height(&self) -> Option; + fn updated_at_core_block_height(&self) -> Option; + fn transferred_at_core_block_height(&self) -> Option; } pub trait DocumentV0Setters: DocumentV0Getters { @@ -123,4 +132,15 @@ pub trait DocumentV0Setters: DocumentV0Getters { self.properties_mut() .insert(property_name.to_string(), Value::Bytes(value)); } + fn set_created_at_block_height(&mut self, created_at_block_height: Option); + fn set_updated_at_block_height(&mut self, updated_at_block_height: Option); + fn set_created_at_core_block_height(&mut self, created_at_core_block_height: Option); + fn set_updated_at_core_block_height(&mut self, updated_at_core_block_height: Option); + fn set_transferred_at_core_block_height( + &mut self, + transferred_at_core_block_height: Option, + ); + fn set_transferred_at_block_height(&mut self, transferred_at_block_height: Option); + fn set_transferred_at(&mut self, transferred_at: Option); + fn bump_revision(&mut self); } diff --git a/packages/rs-dpp/src/document/document_factory/mod.rs b/packages/rs-dpp/src/document/document_factory/mod.rs index 78cce0323e7..b026e805513 100644 --- a/packages/rs-dpp/src/document/document_factory/mod.rs +++ b/packages/rs-dpp/src/document/document_factory/mod.rs @@ -1,6 +1,7 @@ mod v0; use crate::data_contract::DataContract; +use std::collections::BTreeMap; use crate::version::PlatformVersion; use crate::ProtocolError; @@ -11,8 +12,10 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::document::Document; #[cfg(feature = "extended-document")] use crate::document::ExtendedDocument; -use crate::state_transition::documents_batch_transition::document_transition::action_type::DocumentTransitionActionType; -use crate::state_transition::documents_batch_transition::DocumentsBatchTransition; +#[cfg(feature = "state-transitions")] +use crate::state_transition::documents_batch_transition::{ + document_transition::action_type::DocumentTransitionActionType, DocumentsBatchTransition, +}; use crate::util::entropy_generator::EntropyGenerator; pub use v0::DocumentFactoryV0; @@ -81,9 +84,12 @@ impl DocumentFactory { data: Value, ) -> Result { match self { - DocumentFactory::V0(v0) => { - v0.create_document(data_contract, owner_id, document_type_name, data) - } + DocumentFactory::V0(v0) => v0.create_document_without_time_based_properties( + data_contract, + owner_id, + document_type_name, + data, + ), } } @@ -111,12 +117,14 @@ impl DocumentFactory { Vec<(Document, DocumentTypeRef<'a>, Bytes32)>, ), >, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce ) -> Result { match self { - DocumentFactory::V0(v0) => v0.create_state_transition(documents_iter), + DocumentFactory::V0(v0) => v0.create_state_transition(documents_iter, nonce_counter), } } + #[cfg(feature = "extended-document")] pub fn create_extended_from_document_buffer( &self, buffer: &[u8], diff --git a/packages/rs-dpp/src/document/document_factory/v0/mod.rs b/packages/rs-dpp/src/document/document_factory/v0/mod.rs index a017db8b2dd..957d129f3c9 100644 --- a/packages/rs-dpp/src/document/document_factory/v0/mod.rs +++ b/packages/rs-dpp/src/document/document_factory/v0/mod.rs @@ -7,6 +7,7 @@ use crate::data_contract::DataContract; use crate::document::errors::DocumentError; use crate::document::{Document, DocumentV0Getters, DocumentV0Setters, INITIAL_REVISION}; use chrono::Utc; +use std::collections::BTreeMap; use crate::util::entropy_generator::{DefaultEntropyGenerator, EntropyGenerator}; use crate::version::PlatformVersion; @@ -17,17 +18,17 @@ use platform_value::{Bytes32, Identifier, Value}; use crate::data_contract::document_type::methods::DocumentTypeV0Methods; use crate::document::document_methods::DocumentMethodsV0; #[cfg(feature = "extended-document")] -use crate::document::extended_document::v0::ExtendedDocumentV0; -use crate::document::serialization_traits::DocumentPlatformConversionMethodsV0; -#[cfg(feature = "extended-document")] -use crate::document::ExtendedDocument; -use crate::prelude::TimestampMillis; -use crate::state_transition::documents_batch_transition::document_transition::action_type::DocumentTransitionActionType; -use crate::state_transition::documents_batch_transition::document_transition::{ - DocumentCreateTransition, DocumentDeleteTransition, DocumentReplaceTransition, - DocumentTransition, +use crate::document::{ + extended_document::v0::ExtendedDocumentV0, + serialization_traits::DocumentPlatformConversionMethodsV0, ExtendedDocument, }; +use crate::prelude::{BlockHeight, CoreBlockHeight, TimestampMillis}; +#[cfg(feature = "state-transitions")] use crate::state_transition::documents_batch_transition::{ + document_transition::{ + action_type::DocumentTransitionActionType, DocumentCreateTransition, + DocumentDeleteTransition, DocumentReplaceTransition, DocumentTransition, + }, DocumentsBatchTransition, DocumentsBatchTransitionV0, }; use itertools::Itertools; @@ -87,6 +88,37 @@ impl DocumentFactoryV0 { } pub fn create_document( + &self, + data_contract: &DataContract, + owner_id: Identifier, + block_time: BlockHeight, + core_block_height: CoreBlockHeight, + document_type_name: String, + data: Value, + ) -> Result { + let platform_version = PlatformVersion::get(self.protocol_version)?; + if !data_contract.has_document_type_for_name(&document_type_name) { + return Err(DataContractError::InvalidDocumentTypeError( + InvalidDocumentTypeError::new(document_type_name, data_contract.id()), + ) + .into()); + } + + let document_entropy = self.entropy_generator.generate()?; + + let document_type = data_contract.document_type_for_name(document_type_name.as_str())?; + + document_type.create_document_from_data( + data, + owner_id, + block_time, + core_block_height, + document_entropy, + platform_version, + ) + } + + pub fn create_document_without_time_based_properties( &self, data_contract: &DataContract, owner_id: Identifier, @@ -105,7 +137,14 @@ impl DocumentFactoryV0 { let document_type = data_contract.document_type_for_name(document_type_name.as_str())?; - document_type.create_document_from_data(data, owner_id, document_entropy, platform_version) + document_type.create_document_from_data( + data, + owner_id, + 0, + 0, + document_entropy, + platform_version, + ) } #[cfg(feature = "extended-document")] @@ -128,9 +167,12 @@ impl DocumentFactoryV0 { let document_type = data_contract.document_type_for_name(document_type_name.as_str())?; + // Extended documents are client side, so we don't need to fill in their timestamp properties let document = document_type.create_document_from_data( data, owner_id, + 0, + 0, document_entropy, platform_version, )?; @@ -167,6 +209,7 @@ impl DocumentFactoryV0 { Vec<(Document, DocumentTypeRef<'a>, Bytes32)>, ), >, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce ) -> Result { let platform_version = PlatformVersion::get(self.protocol_version)?; let documents: Vec<( @@ -201,13 +244,14 @@ impl DocumentFactoryV0 { .into_iter() .map(|(action, documents)| match action { DocumentTransitionActionType::Create => { - Self::document_create_transitions(documents, platform_version) + Self::document_create_transitions(documents, nonce_counter, platform_version) } DocumentTransitionActionType::Delete => Self::document_delete_transitions( documents .into_iter() .map(|(document, document_type, _)| (document, document_type)) .collect(), + nonce_counter, platform_version, ), DocumentTransitionActionType::Replace => Self::document_replace_transitions( @@ -215,8 +259,12 @@ impl DocumentFactoryV0 { .into_iter() .map(|(document, document_type, _)| (document, document_type)) .collect(), + nonce_counter, platform_version, ), + _ => Err(ProtocolError::InvalidStateTransitionType( + "action type not accounted for".to_string(), + )), }) .collect::, ProtocolError>>()? .into_iter() @@ -230,12 +278,14 @@ impl DocumentFactoryV0 { Ok(DocumentsBatchTransitionV0 { owner_id, transitions, + user_fee_increase: 0, signature_public_key_id: 0, signature: Default::default(), } .into()) } + #[cfg(feature = "extended-document")] pub fn create_extended_from_document_buffer( &self, buffer: &[u8], @@ -328,8 +378,10 @@ impl DocumentFactoryV0 { // // Ok(data_contract) // // } // + #[cfg(feature = "state-transitions")] fn document_create_transitions( documents: Vec<(Document, DocumentTypeRef, Bytes32)>, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce platform_version: &PlatformVersion, ) -> Result, ProtocolError> { documents @@ -350,21 +402,31 @@ impl DocumentFactoryV0 { .into()); } } - Ok(DocumentCreateTransition::from_document( + let nonce = nonce_counter + .entry((document.owner_id(), document_type.data_contract_id())) + .or_default(); + + let transition = DocumentCreateTransition::from_document( document, document_type, entropy.to_buffer(), + *nonce, platform_version, None, None, - )? - .into()) + )?; + + *nonce += 1; + + Ok(transition.into()) }) .collect() } + #[cfg(feature = "state-transitions")] fn document_replace_transitions( documents: Vec<(Document, DocumentTypeRef)>, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce platform_version: &PlatformVersion, ) -> Result, ProtocolError> { documents @@ -386,14 +448,22 @@ impl DocumentFactoryV0 { document.increment_revision()?; document.set_updated_at(Some(Utc::now().timestamp_millis() as TimestampMillis)); - Ok(DocumentReplaceTransition::from_document( + let nonce = nonce_counter + .entry((document.owner_id(), document_type.data_contract_id())) + .or_default(); + + let transition = DocumentReplaceTransition::from_document( document, document_type, + *nonce, platform_version, None, None, - )? - .into()) + )?; + + *nonce += 1; + + Ok(transition.into()) }) .collect() // let mut raw_transitions = vec![]; @@ -437,8 +507,10 @@ impl DocumentFactoryV0 { // Ok(raw_transitions) } + #[cfg(feature = "state-transitions")] fn document_delete_transitions( documents: Vec<(Document, DocumentTypeRef)>, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce platform_version: &PlatformVersion, ) -> Result, ProtocolError> { documents @@ -456,14 +528,22 @@ impl DocumentFactoryV0 { } .into()); }; - Ok(DocumentDeleteTransition::from_document( + + let nonce = nonce_counter + .entry((document.owner_id(), document_type.data_contract_id())) + .or_default(); + let transition = DocumentDeleteTransition::from_document( document, document_type, + *nonce, platform_version, None, None, - )? - .into()) + )?; + + *nonce += 1; + + Ok(transition.into()) }) .collect() } diff --git a/packages/rs-dpp/src/document/document_methods/get_raw_for_contract/v0/mod.rs b/packages/rs-dpp/src/document/document_methods/get_raw_for_contract/v0/mod.rs index 9a78e8128ba..8750f4034d6 100644 --- a/packages/rs-dpp/src/document/document_methods/get_raw_for_contract/v0/mod.rs +++ b/packages/rs-dpp/src/document/document_methods/get_raw_for_contract/v0/mod.rs @@ -18,7 +18,7 @@ pub trait DocumentGetRawForContractV0: DocumentV0Getters + DocumentGetRawForDocu ) -> Result>, ProtocolError> { let document_type = contract.document_types().get(document_type_name).ok_or({ ProtocolError::DataContractError(DataContractError::DocumentTypeNotFound( - "document type should exist for name", + "document type should exist for name".to_string(), )) })?; self.get_raw_for_document_type_v0(key, document_type.as_ref(), owner_id, platform_version) diff --git a/packages/rs-dpp/src/document/document_methods/get_raw_for_document_type/v0/mod.rs b/packages/rs-dpp/src/document/document_methods/get_raw_for_document_type/v0/mod.rs index ca13d60c550..2bcaa11c271 100644 --- a/packages/rs-dpp/src/document/document_methods/get_raw_for_document_type/v0/mod.rs +++ b/packages/rs-dpp/src/document/document_methods/get_raw_for_document_type/v0/mod.rs @@ -18,31 +18,66 @@ pub trait DocumentGetRawForDocumentTypeV0: DocumentV0Getters { // todo: maybe merge with document_type.serialize_value_for_key() because we use different // code paths for query and index creation // returns the owner id if the key path is $ownerId and an owner id is given - if key_path == "$ownerId" && owner_id.is_some() { - Ok(Some(Vec::from(owner_id.unwrap()))) - } else { - match key_path { - // returns self.id or self.owner_id if key path is $id or $ownerId - "$id" => return Ok(Some(self.id().to_vec())), - "$ownerId" => return Ok(Some(self.owner_id().to_vec())), - "$createdAt" => { - return Ok(self - .created_at() - .map(|time| DocumentPropertyType::encode_date_timestamp(time).unwrap())) - } - "$updatedAt" => { - return Ok(self - .updated_at() - .map(|time| DocumentPropertyType::encode_date_timestamp(time).unwrap())) - } - _ => {} - } - self.properties() - .get_optional_at_path(key_path)? - .map(|value| { - document_type.serialize_value_for_key(key_path, value, platform_version) - }) - .transpose() + if key_path == "$ownerId" { + if let Some(owner_id) = owner_id { + return Ok(Some(Vec::from(owner_id))); + } + } + + match key_path { + // returns self.id or self.owner_id if key path is $id or $ownerId + "$id" => return Ok(Some(self.id().to_vec())), + "$ownerId" => return Ok(Some(self.owner_id().to_vec())), + "$createdAt" => { + return Ok(self + .created_at() + .map(DocumentPropertyType::encode_date_timestamp)) + } + "$createdAtBlockHeight" => { + return Ok(self + .created_at_block_height() + .map(DocumentPropertyType::encode_u64)) + } + "$createdAtCoreBlockHeight" => { + return Ok(self + .created_at_core_block_height() + .map(DocumentPropertyType::encode_u32)) + } + "$updatedAt" => { + return Ok(self + .updated_at() + .map(DocumentPropertyType::encode_date_timestamp)) + } + "$updatedAtBlockHeight" => { + return Ok(self + .updated_at_block_height() + .map(DocumentPropertyType::encode_u64)) + } + "$updatedAtCoreBlockHeight" => { + return Ok(self + .updated_at_core_block_height() + .map(DocumentPropertyType::encode_u32)) + } + "$transferredAt" => { + return Ok(self + .transferred_at() + .map(DocumentPropertyType::encode_date_timestamp)) + } + "$transferredAtBlockHeight" => { + return Ok(self + .transferred_at_block_height() + .map(DocumentPropertyType::encode_u64)) + } + "$transferredAtCoreBlockHeight" => { + return Ok(self + .transferred_at_core_block_height() + .map(DocumentPropertyType::encode_u32)) + } + _ => {} } + self.properties() + .get_optional_at_path(key_path)? + .map(|value| document_type.serialize_value_for_key(key_path, value, platform_version)) + .transpose() } } diff --git a/packages/rs-dpp/src/document/document_methods/hash/v0/mod.rs b/packages/rs-dpp/src/document/document_methods/hash/v0/mod.rs index af2a92a3b0b..4961a39f42b 100644 --- a/packages/rs-dpp/src/document/document_methods/hash/v0/mod.rs +++ b/packages/rs-dpp/src/document/document_methods/hash/v0/mod.rs @@ -3,7 +3,7 @@ use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; use crate::data_contract::document_type::DocumentTypeRef; use crate::data_contract::DataContract; use crate::document::serialization_traits::DocumentPlatformConversionMethodsV0; -use crate::util::hash::hash_to_vec; +use crate::util::hash::hash_double_to_vec; use crate::version::PlatformVersion; use crate::ProtocolError; @@ -19,6 +19,6 @@ pub trait DocumentHashV0Method: DocumentPlatformConversionMethodsV0 { let mut buf = contract.id().to_vec(); buf.extend(document_type.name().as_bytes()); // TODO: Why we put it here? buf.extend(self.serialize(document_type, platform_version)?); - Ok(hash_to_vec(buf)) + Ok(hash_double_to_vec(buf)) } } diff --git a/packages/rs-dpp/src/document/document_methods/is_equal_ignoring_timestamps/mod.rs b/packages/rs-dpp/src/document/document_methods/is_equal_ignoring_timestamps/mod.rs new file mode 100644 index 00000000000..85654bb28ad --- /dev/null +++ b/packages/rs-dpp/src/document/document_methods/is_equal_ignoring_timestamps/mod.rs @@ -0,0 +1,2 @@ +mod v0; +pub(in crate::document) use v0::*; diff --git a/packages/rs-dpp/src/document/document_methods/is_equal_ignoring_timestamps/v0/mod.rs b/packages/rs-dpp/src/document/document_methods/is_equal_ignoring_timestamps/v0/mod.rs new file mode 100644 index 00000000000..660c26fb643 --- /dev/null +++ b/packages/rs-dpp/src/document/document_methods/is_equal_ignoring_timestamps/v0/mod.rs @@ -0,0 +1,20 @@ +use crate::document::document_methods::DocumentGetRawForDocumentTypeV0; +use crate::document::DocumentV0Getters; + +pub trait DocumentIsEqualIgnoringTimestampsV0: + DocumentV0Getters + DocumentGetRawForDocumentTypeV0 +{ + /// Checks to see if a document is equal without time based fields. + /// Since these fields are set on the network this function can be useful to make sure that + /// fields that were supplied have not changed, while ignoring those that are set network side. + /// Time based fields that are ignored are + /// created_at/updated_at + /// created_at_block_height/updated_at_block_height + /// created_at_core_block_height/updated_at_core_block_height + fn is_equal_ignoring_time_based_fields_v0(&self, rhs: &Self) -> bool { + self.id() == rhs.id() + && self.owner_id() == rhs.owner_id() + && self.properties() == rhs.properties() + && self.revision() == rhs.revision() + } +} diff --git a/packages/rs-dpp/src/document/document_methods/mod.rs b/packages/rs-dpp/src/document/document_methods/mod.rs index 18edf4b8d7a..887d7f26421 100644 --- a/packages/rs-dpp/src/document/document_methods/mod.rs +++ b/packages/rs-dpp/src/document/document_methods/mod.rs @@ -6,10 +6,12 @@ use crate::ProtocolError; mod get_raw_for_contract; mod get_raw_for_document_type; mod hash; +mod is_equal_ignoring_timestamps; pub(in crate::document) use get_raw_for_contract::*; pub(in crate::document) use get_raw_for_document_type::*; pub(in crate::document) use hash::*; +pub(in crate::document) use is_equal_ignoring_timestamps::*; pub trait DocumentMethodsV0 { /// Return a value given the path to its key and the document type for a contract. @@ -39,4 +41,17 @@ pub trait DocumentMethodsV0 { ) -> Result, ProtocolError>; fn increment_revision(&mut self) -> Result<(), ProtocolError>; + + /// Checks to see if a document is equal without time based fields. + /// Since these fields are set on the network this function can be useful to make sure that + /// fields that were supplied have not changed, while ignoring those that are set network side. + /// Time based fields that are ignored are + /// created_at/updated_at + /// created_at_block_height/updated_at_block_height + /// created_at_core_block_height/updated_at_core_block_height + fn is_equal_ignoring_time_based_fields( + &self, + rhs: &Self, + platform_version: &PlatformVersion, + ) -> Result; } diff --git a/packages/rs-dpp/src/document/extended_document/accessors.rs b/packages/rs-dpp/src/document/extended_document/accessors.rs index c051c7d79d4..a471124d21f 100644 --- a/packages/rs-dpp/src/document/extended_document/accessors.rs +++ b/packages/rs-dpp/src/document/extended_document/accessors.rs @@ -3,7 +3,7 @@ use crate::data_contract::DataContract; use crate::document::{Document, ExtendedDocument}; use crate::identity::TimestampMillis; use crate::metadata::Metadata; -use crate::prelude::Revision; +use crate::prelude::{BlockHeight, CoreBlockHeight, Revision}; use crate::ProtocolError; use platform_value::{Bytes32, Identifier, Value}; use std::collections::BTreeMap; @@ -56,6 +56,7 @@ impl ExtendedDocument { } /// Returns an optional reference to the document's creation timestamp in milliseconds. + /// It will be None if it is not required by the schema. pub fn created_at(&self) -> Option { match self { ExtendedDocument::V0(v0) => v0.created_at(), @@ -63,12 +64,45 @@ impl ExtendedDocument { } /// Returns an optional reference to the document's last update timestamp in milliseconds. + /// It will be None if it is not required by the schema. pub fn updated_at(&self) -> Option { match self { ExtendedDocument::V0(v0) => v0.updated_at(), } } + /// Returns an optional block height at which the document was created. + /// It will be None if it is not required by the schema. + pub fn created_at_block_height(&self) -> Option { + match self { + ExtendedDocument::V0(v0) => v0.created_at_block_height(), + } + } + + /// Returns an optional block height at which the document was last updated. + /// It will be None if it is not required by the schema. + pub fn updated_at_block_height(&self) -> Option { + match self { + ExtendedDocument::V0(v0) => v0.updated_at_block_height(), + } + } + + /// Returns an optional core block height at which the document was created. + /// It will be None if it is not required by the schema. + pub fn created_at_core_block_height(&self) -> Option { + match self { + ExtendedDocument::V0(v0) => v0.created_at_core_block_height(), + } + } + + /// Returns an optional core block height at which the document was last updated. + /// It will be None if it is not required by the schema. + pub fn updated_at_core_block_height(&self) -> Option { + match self { + ExtendedDocument::V0(v0) => v0.updated_at_core_block_height(), + } + } + /// Returns the document type name as a reference to a string. pub fn document_type_name(&self) -> &String { match self { diff --git a/packages/rs-dpp/src/document/extended_document/fields.rs b/packages/rs-dpp/src/document/extended_document/fields.rs index 0466c759b01..09400b60edd 100644 --- a/packages/rs-dpp/src/document/extended_document/fields.rs +++ b/packages/rs-dpp/src/document/extended_document/fields.rs @@ -8,6 +8,13 @@ pub mod property_names { pub const OWNER_ID: &str = "$ownerId"; pub const CREATED_AT: &str = "$createdAt"; pub const UPDATED_AT: &str = "$updatedAt"; + pub const TRANSFERRED_AT: &str = "$transferredAt"; + pub const CREATED_AT_BLOCK_HEIGHT: &str = "$createdAtBlockHeight"; + pub const UPDATED_AT_BLOCK_HEIGHT: &str = "$updatedAtBlockHeight"; + pub const TRANSFERRED_AT_BLOCK_HEIGHT: &str = "$transferredAtBlockHeight"; + pub const CREATED_AT_CORE_BLOCK_HEIGHT: &str = "$createdAtCoreBlockHeight"; + pub const UPDATED_AT_CORE_BLOCK_HEIGHT: &str = "$updatedAtCoreBlockHeight"; + pub const TRANSFERRED_AT_CORE_BLOCK_HEIGHT: &str = "$transferredAtCoreBlockHeight"; } pub const IDENTIFIER_FIELDS: [&str; 3] = [ diff --git a/packages/rs-dpp/src/document/extended_document/mod.rs b/packages/rs-dpp/src/document/extended_document/mod.rs index fe16af61183..c97b4b588b1 100644 --- a/packages/rs-dpp/src/document/extended_document/mod.rs +++ b/packages/rs-dpp/src/document/extended_document/mod.rs @@ -7,6 +7,10 @@ pub(crate) mod v0; pub use fields::{property_names, IDENTIFIER_FIELDS}; +#[cfg(any( + feature = "document-json-conversion", + feature = "document-value-conversion" +))] use crate::data_contract::DataContract; use crate::ProtocolError; @@ -14,11 +18,14 @@ use crate::document::extended_document::v0::ExtendedDocumentV0; #[cfg(feature = "document-json-conversion")] use crate::document::serialization_traits::DocumentJsonMethodsV0; +#[cfg(feature = "validation")] use crate::validation::SimpleConsensusValidationResult; use platform_value::Value; use platform_version::version::PlatformVersion; use platform_versioning::PlatformVersioned; +#[cfg(feature = "document-json-conversion")] use serde_json::Value as JsonValue; +#[cfg(feature = "document-value-conversion")] use std::collections::BTreeMap; #[derive(Debug, Clone, PlatformVersioned)] @@ -68,7 +75,7 @@ impl ExtendedDocument { /// Returns a `ProtocolError` if the document type is not found in the data contract. pub fn needs_revision(&self) -> Result { match self { - ExtendedDocument::V0(v0) => v0.needs_revision(), + ExtendedDocument::V0(v0) => v0.requires_revision(), } } @@ -331,6 +338,8 @@ mod test { use crate::data_contract::document_type::random_document::CreateRandomDocument; use crate::document::serialization_traits::ExtendedDocumentPlatformConversionMethodsV0; use crate::tests::fixtures::get_dashpay_contract_fixture; + use base64::prelude::BASE64_STANDARD; + use base64::Engine; fn init() { let _ = env_logger::builder() @@ -410,8 +419,7 @@ mod test { fn test_document_json_deserialize() -> Result<()> { init(); let platform_version = PlatformVersion::latest(); - let dpns_contract = - load_system_data_contract(SystemDataContract::DPNS, platform_version.protocol_version)?; + let dpns_contract = load_system_data_contract(SystemDataContract::DPNS, platform_version)?; let document_json = get_data_from_file("src/tests/payloads/document_dpns.json")?; let doc = ExtendedDocument::from_json_string(&document_json, dpns_contract, platform_version)?; @@ -481,6 +489,22 @@ mod test { assert_eq!(init_doc.created_at(), doc.created_at()); assert_eq!(init_doc.updated_at(), doc.updated_at()); + assert_eq!( + init_doc.created_at_block_height(), + doc.created_at_block_height() + ); + assert_eq!( + init_doc.updated_at_block_height(), + doc.updated_at_block_height() + ); + assert_eq!( + init_doc.created_at_core_block_height(), + doc.created_at_core_block_height() + ); + assert_eq!( + init_doc.updated_at_core_block_height(), + doc.updated_at_core_block_height() + ); assert_eq!(init_doc.id(), doc.id()); assert_eq!(init_doc.data_contract_id(), doc.data_contract_id()); assert_eq!(init_doc.owner_id(), doc.owner_id()); @@ -489,11 +513,8 @@ mod test { #[test] fn test_to_object() { init(); - let dpns_contract = load_system_data_contract( - SystemDataContract::DPNS, - LATEST_PLATFORM_VERSION.protocol_version, - ) - .unwrap(); + let dpns_contract = + load_system_data_contract(SystemDataContract::DPNS, LATEST_PLATFORM_VERSION).unwrap(); let document_json = get_data_from_file("src/tests/payloads/document_dpns.json").unwrap(); let document = ExtendedDocument::from_json_string( &document_json, @@ -517,10 +538,8 @@ mod test { fn test_json_serialize() -> Result<()> { init(); - let dpns_contract = load_system_data_contract( - SystemDataContract::DPNS, - LATEST_PLATFORM_VERSION.protocol_version, - )?; + let dpns_contract = + load_system_data_contract(SystemDataContract::DPNS, LATEST_PLATFORM_VERSION)?; let document_json = get_data_from_file("src/tests/payloads/document_dpns.json")?; let document = ExtendedDocument::from_json_string( &document_json, @@ -530,7 +549,7 @@ mod test { let string = serde_json::to_string(&document)?; assert_eq!( - "{\"version\":0,\"$type\":\"domain\",\"$dataContractId\":\"566vcJkmebVCAb2Dkj2yVMSgGFcsshupnQqtsz1RFbcy\",\"document\":{\"$version\":\"0\",\"$id\":\"4veLBZPHDkaCPF9LfZ8fX3JZiS5q5iUVGhdBbaa9ga5E\",\"$ownerId\":\"HBNMY5QWuBVKNFLhgBTC1VmpEnscrmqKPMXpnYSHwhfn\",\"$dataContractId\":\"566vcJkmebVCAb2Dkj2yVMSgGFcsshupnQqtsz1RFbcy\",\"$protocolVersion\":0,\"$type\":\"domain\",\"label\":\"user-9999\",\"normalizedLabel\":\"user-9999\",\"normalizedParentDomainName\":\"dash\",\"preorderSalt\":\"BzQi567XVqc8wYiVHS887sJtL6MDbxLHNnp+UpTFSB0=\",\"records\":{\"dashUniqueIdentityId\":\"HBNMY5QWuBVKNFLhgBTC1VmpEnscrmqKPMXpnYSHwhfn\"},\"subdomainRules\":{\"allowSubdomains\":false},\"$revision\":1,\"$createdAt\":null,\"$updatedAt\":null}}", + "{\"version\":0,\"$type\":\"domain\",\"$dataContractId\":\"566vcJkmebVCAb2Dkj2yVMSgGFcsshupnQqtsz1RFbcy\",\"document\":{\"$version\":\"0\",\"$id\":\"4veLBZPHDkaCPF9LfZ8fX3JZiS5q5iUVGhdBbaa9ga5E\",\"$ownerId\":\"HBNMY5QWuBVKNFLhgBTC1VmpEnscrmqKPMXpnYSHwhfn\",\"$dataContractId\":\"566vcJkmebVCAb2Dkj2yVMSgGFcsshupnQqtsz1RFbcy\",\"$protocolVersion\":0,\"$type\":\"domain\",\"label\":\"user-9999\",\"normalizedLabel\":\"user-9999\",\"normalizedParentDomainName\":\"dash\",\"preorderSalt\":\"BzQi567XVqc8wYiVHS887sJtL6MDbxLHNnp+UpTFSB0=\",\"records\":{\"dashUniqueIdentityId\":\"HBNMY5QWuBVKNFLhgBTC1VmpEnscrmqKPMXpnYSHwhfn\"},\"subdomainRules\":{\"allowSubdomains\":false},\"$revision\":1,\"$createdAt\":null,\"$updatedAt\":null,\"$transferredAt\":null,\"$createdAtBlockHeight\":null,\"$updatedAtBlockHeight\":null,\"$transferredAtBlockHeight\":null,\"$createdAtCoreBlockHeight\":null,\"$updatedAtCoreBlockHeight\":null,\"$transferredAtCoreBlockHeight\":null}}", string ); @@ -542,11 +561,8 @@ mod test { init(); let document_json = get_data_from_file("src/tests/payloads/document_dpns.json")?; - let dpns_contract = load_system_data_contract( - SystemDataContract::DPNS, - LATEST_PLATFORM_VERSION.protocol_version, - ) - .unwrap(); + let dpns_contract = + load_system_data_contract(SystemDataContract::DPNS, LATEST_PLATFORM_VERSION).unwrap(); ExtendedDocument::from_json_string(&document_json, dpns_contract, LATEST_PLATFORM_VERSION) .expect("expected extended document"); Ok(()) @@ -597,11 +613,11 @@ mod test { ); assert_eq!( json_document["alphaBinary"], - JsonValue::String(base64::encode(&alpha_value)) + JsonValue::String(BASE64_STANDARD.encode(&alpha_value)) ); assert_eq!( json_document["alphaIdentifier"], - JsonValue::String(base64::encode(&alpha_value)) + JsonValue::String(BASE64_STANDARD.encode(&alpha_value)) ); } @@ -613,7 +629,7 @@ mod test { fn new_example_document() -> ExtendedDocument { let data_contract = - get_dashpay_contract_fixture(None, LATEST_PLATFORM_VERSION.protocol_version) + get_dashpay_contract_fixture(None, 0, LATEST_PLATFORM_VERSION.protocol_version) .data_contract_owned(); let document_type = data_contract .document_type_for_name("profile") diff --git a/packages/rs-dpp/src/document/extended_document/v0/mod.rs b/packages/rs-dpp/src/document/extended_document/v0/mod.rs index 65f14f84249..b1ca400b982 100644 --- a/packages/rs-dpp/src/document/extended_document/v0/mod.rs +++ b/packages/rs-dpp/src/document/extended_document/v0/mod.rs @@ -6,18 +6,25 @@ mod serialize; use crate::data_contract::document_type::DocumentTypeRef; use crate::data_contract::DataContract; +#[cfg(any( + feature = "document-value-conversion", + feature = "document-json-conversion" +))] use crate::document::extended_document::fields::property_names; use crate::document::{Document, DocumentV0Getters, ExtendedDocument}; use crate::identity::TimestampMillis; use crate::metadata::Metadata; -use crate::prelude::Revision; +use crate::prelude::{BlockHeight, CoreBlockHeight, Revision}; -use crate::util::hash::hash_to_vec; +use crate::util::hash::hash_double_to_vec; use crate::ProtocolError; use platform_value::btreemap_extensions::{ - BTreeValueMapInsertionPathHelper, BTreeValueMapPathHelper, BTreeValueMapReplacementPathHelper, - BTreeValueRemoveFromMapHelper, + BTreeValueMapInsertionPathHelper, BTreeValueMapPathHelper, +}; +#[cfg(feature = "document-value-conversion")] +use platform_value::btreemap_extensions::{ + BTreeValueMapReplacementPathHelper, BTreeValueRemoveFromMapHelper, }; use platform_value::{Bytes32, Identifier, ReplacementType, Value}; use serde::{Deserialize, Serialize}; @@ -25,8 +32,9 @@ use std::collections::BTreeMap; use crate::data_contract::accessors::v0::DataContractV0Getters; use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; +use crate::data_contract::document_type::methods::DocumentTypeV0Methods; #[cfg(feature = "validation")] -use crate::data_contract::validation::DataContractValidationMethodsV0; +use crate::data_contract::validate_document::DataContractDocumentValidationMethodsV0; #[cfg(feature = "document-json-conversion")] use crate::document::serialization_traits::DocumentJsonMethodsV0; #[cfg(feature = "document-value-conversion")] @@ -34,6 +42,7 @@ use crate::document::serialization_traits::DocumentPlatformValueMethodsV0; use crate::document::serialization_traits::ExtendedDocumentPlatformConversionMethodsV0; #[cfg(feature = "validation")] use crate::validation::SimpleConsensusValidationResult; +#[cfg(feature = "document-json-conversion")] use platform_value::converter::serde_json::BTreeValueJsonConverter; use platform_version::version::PlatformVersion; #[cfg(feature = "document-json-conversion")] @@ -145,6 +154,7 @@ impl ExtendedDocumentV0 { // We can unwrap because the Document can not be created without a valid Document Type self.data_contract .document_type_for_name(self.document_type_name.as_str()) + .map_err(ProtocolError::DataContractError) } pub fn can_be_modified(&self) -> Result { @@ -152,23 +162,51 @@ impl ExtendedDocumentV0 { .map(|document_type| document_type.documents_mutable()) } - pub fn needs_revision(&self) -> Result { + pub fn requires_revision(&self) -> Result { self.document_type() - .map(|document_type| document_type.documents_mutable()) + .map(|document_type| document_type.requires_revision()) } pub fn revision(&self) -> Option { self.document.revision() } + /// Returns an optional block timestamp at which the document was created. + /// It will be None if it is not required by the schema. pub fn created_at(&self) -> Option { self.document.created_at() } + /// Returns an optional block timestamp at which the document was updated. + /// It will be None if it is not required by the schema. pub fn updated_at(&self) -> Option { self.document.updated_at() } + /// Returns an optional block height at which the document was created. + /// It will be None if it is not required by the schema. + pub fn created_at_block_height(&self) -> Option { + self.document.created_at_block_height() + } + + /// Returns an optional block height at which the document was last updated. + /// It will be None if it is not required by the schema. + pub fn updated_at_block_height(&self) -> Option { + self.document.updated_at_block_height() + } + + /// Returns an optional core block height at which the document was created. + /// It will be None if it is not required by the schema. + pub fn created_at_core_block_height(&self) -> Option { + self.document.created_at_core_block_height() + } + + /// Returns an optional core block height at which the document was last updated. + /// It will be None if it is not required by the schema. + pub fn updated_at_core_block_height(&self) -> Option { + self.document.updated_at_core_block_height() + } + /// Create an extended document with additional information. /// /// # Arguments @@ -415,7 +453,7 @@ impl ExtendedDocumentV0 { } pub fn hash(&self, platform_version: &PlatformVersion) -> Result, ProtocolError> { - Ok(hash_to_vec( + Ok(hash_double_to_vec( ExtendedDocumentPlatformConversionMethodsV0::serialize_to_bytes( self, platform_version, diff --git a/packages/rs-dpp/src/document/extended_document/v0/serialize.rs b/packages/rs-dpp/src/document/extended_document/v0/serialize.rs index 64c5f0a35d1..255d49bd960 100644 --- a/packages/rs-dpp/src/document/extended_document/v0/serialize.rs +++ b/packages/rs-dpp/src/document/extended_document/v0/serialize.rs @@ -21,6 +21,8 @@ use crate::version::PlatformVersion; use integer_encoding::{VarInt, VarIntReader}; +use crate::consensus::basic::decode::DecodingError; +use crate::data_contract::errors::DataContractError; use platform_version::version::FeatureVersion; impl ExtendedDocumentPlatformSerializationMethodsV0 for ExtendedDocumentV0 { @@ -95,9 +97,11 @@ impl ExtendedDocumentPlatformDeserializationMethodsV0 for ExtendedDocumentV0 { let (document_type_name_len, rest) = serialized_document .split_first() - .ok_or(ProtocolError::DecodingError( - "error reading document type name len from serialized extended document" - .to_string(), + .ok_or(DataContractError::DecodingDocumentError( + DecodingError::new( + "error reading document type name len from serialized extended document" + .to_string(), + ), ))?; if serialized_document.len() < *document_type_name_len as usize { return Err(ProtocolError::DecodingError( diff --git a/packages/rs-dpp/src/document/fields.rs b/packages/rs-dpp/src/document/fields.rs index efd49d69a52..452b7f7c3ef 100644 --- a/packages/rs-dpp/src/document/fields.rs +++ b/packages/rs-dpp/src/document/fields.rs @@ -5,8 +5,16 @@ pub mod property_names { pub const DATA_CONTRACT_ID: &str = "$dataContractId"; pub const REVISION: &str = "$revision"; pub const OWNER_ID: &str = "$ownerId"; + pub const PRICE: &str = "$price"; pub const CREATED_AT: &str = "$createdAt"; pub const UPDATED_AT: &str = "$updatedAt"; + pub const TRANSFERRED_AT: &str = "$transferredAt"; + pub const CREATED_AT_BLOCK_HEIGHT: &str = "$createdAtBlockHeight"; + pub const UPDATED_AT_BLOCK_HEIGHT: &str = "$updatedAtBlockHeight"; + pub const TRANSFERRED_AT_BLOCK_HEIGHT: &str = "$transferredAtBlockHeight"; + pub const CREATED_AT_CORE_BLOCK_HEIGHT: &str = "$createdAtCoreBlockHeight"; + pub const UPDATED_AT_CORE_BLOCK_HEIGHT: &str = "$updatedAtCoreBlockHeight"; + pub const TRANSFERRED_AT_CORE_BLOCK_HEIGHT: &str = "$transferredAtCoreBlockHeight"; } pub const IDENTIFIER_FIELDS: [&str; 3] = [ diff --git a/packages/rs-dpp/src/document/generate_document_id.rs b/packages/rs-dpp/src/document/generate_document_id.rs index a1a7009d859..b14fc599a44 100644 --- a/packages/rs-dpp/src/document/generate_document_id.rs +++ b/packages/rs-dpp/src/document/generate_document_id.rs @@ -1,5 +1,5 @@ use crate::document::Document; -use crate::{prelude::Identifier, util::hash::hash_to_vec}; +use crate::{prelude::Identifier, util::hash::hash_double_to_vec}; impl Document { /// Generates the document ID @@ -16,6 +16,6 @@ impl Document { buf.extend_from_slice(document_type_name.as_bytes()); buf.extend_from_slice(entropy); - Identifier::from_bytes(&hash_to_vec(&buf)).unwrap() + Identifier::from_bytes(&hash_double_to_vec(&buf)).unwrap() } } diff --git a/packages/rs-dpp/src/document/mod.rs b/packages/rs-dpp/src/document/mod.rs index 5eda83da448..1fe74ad8ae6 100644 --- a/packages/rs-dpp/src/document/mod.rs +++ b/packages/rs-dpp/src/document/mod.rs @@ -15,6 +15,7 @@ pub mod generate_document_id; pub mod serialization_traits; #[cfg(feature = "factories")] pub mod specialized_document_factory; +pub mod transfer; mod v0; pub use accessors::*; @@ -34,7 +35,7 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::data_contract::DataContract; use crate::document::document_methods::{ DocumentGetRawForContractV0, DocumentGetRawForDocumentTypeV0, DocumentHashV0Method, - DocumentMethodsV0, + DocumentIsEqualIgnoringTimestampsV0, DocumentMethodsV0, }; use crate::document::errors::DocumentError; use crate::version::PlatformVersion; @@ -178,6 +179,30 @@ impl DocumentMethodsV0 for Document { Ok(()) } + + fn is_equal_ignoring_time_based_fields( + &self, + rhs: &Self, + platform_version: &PlatformVersion, + ) -> Result { + match (self, rhs) { + (Document::V0(document_v0), Document::V0(rhs_v0)) => { + match platform_version + .dpp + .document_versions + .document_method_versions + .is_equal_ignoring_timestamps + { + 0 => Ok(document_v0.is_equal_ignoring_time_based_fields_v0(rhs_v0)), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DocumentMethodV0::is_equal_ignoring_time_based_fields".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + } + } } #[cfg(test)] @@ -187,7 +212,7 @@ mod tests { use crate::data_contract::document_type::random_document::CreateRandomDocument; use crate::document::serialization_traits::DocumentPlatformConversionMethodsV0; use crate::tests::json_document::json_document_to_contract; - use platform_value::{Bytes32, Identifier}; + use regex::Regex; #[test] @@ -208,7 +233,7 @@ mod tests { .expect("expected to get a random document"); let document_string = format!("{}", document); - let pattern = r#"v\d+ : id:45ZNwGcxeMpLpYmiVEKKBKXbZfinrhjZLkau1GWizPFX owner_id:2vq574DjKi7ZD8kJ6dMHxT5wu6ZKD2bW5xKAyKAGW7qZ created_at:(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) updated_at:(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) avatarUrl:string y8RD1DbW18RuyblDX7hx\[...\(670\)\] displayName:string y94Itl6mn1yBE publicMessage:string SvAQrzsslj0ESc15GQBQ\[...\(105\)\] .*"#; + let pattern = r"v\d+ : id:45ZNwGcxeMpLpYmiVEKKBKXbZfinrhjZLkau1GWizPFX owner_id:2vq574DjKi7ZD8kJ6dMHxT5wu6ZKD2bW5xKAyKAGW7qZ created_at:(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) updated_at:(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) avatarUrl:string y8RD1DbW18RuyblDX7hx\[...\(670\)\] displayName:string y94Itl6mn1yBE publicMessage:string SvAQrzsslj0ESc15GQBQ\[...\(105\)\] .*"; let re = Regex::new(pattern).unwrap(); assert!( re.is_match(document_string.as_str()), diff --git a/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/deserialize/v0/mod.rs b/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/deserialize/v0/mod.rs index b832c1977cb..ac52261c8e8 100644 --- a/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/deserialize/v0/mod.rs +++ b/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/deserialize/v0/mod.rs @@ -1,4 +1,6 @@ use crate::data_contract::document_type::DocumentTypeRef; +use crate::data_contract::errors::DataContractError; +#[cfg(feature = "extended-document")] use crate::ProtocolError; use platform_version::version::PlatformVersion; @@ -8,7 +10,7 @@ pub(in crate::document) trait DocumentPlatformDeserializationMethodsV0 { serialized_document: &[u8], document_type: DocumentTypeRef, platform_version: &PlatformVersion, - ) -> Result + ) -> Result where Self: Sized; } diff --git a/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/mod.rs b/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/mod.rs index 2fff26077c5..e3a112c47e9 100644 --- a/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/mod.rs +++ b/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/mod.rs @@ -4,6 +4,8 @@ mod v0; use crate::data_contract::document_type::DocumentTypeRef; use crate::document::{Document, DocumentV0}; +#[cfg(feature = "validation")] +use crate::prelude::ConsensusValidationResult; use crate::ProtocolError; use platform_version::version::{FeatureVersion, PlatformVersion}; pub use v0::*; @@ -73,6 +75,34 @@ impl DocumentPlatformConversionMethodsV0 for Document { }), } } + + #[cfg(feature = "validation")] + fn from_bytes_in_consensus( + serialized_document: &[u8], + document_type: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> + where + Self: Sized, + { + match platform_version + .dpp + .document_versions + .document_structure_version + { + 0 => Ok(DocumentV0::from_bytes_in_consensus( + serialized_document, + document_type, + platform_version, + )? + .map(|document_v0| document_v0.into())), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "Document::from_bytes_in_consensus".to_string(), + known_versions: vec![0], + received: version, + }), + } + } } #[cfg(test)] diff --git a/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/serialize/v0/mod.rs b/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/serialize/v0/mod.rs index a3138412374..3e62bf50e11 100644 --- a/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/serialize/v0/mod.rs +++ b/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/serialize/v0/mod.rs @@ -1,5 +1,6 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::ProtocolError; +#[cfg(feature = "extended-document")] use platform_version::version::PlatformVersion; pub(in crate::document) trait DocumentPlatformSerializationMethodsV0 { diff --git a/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/v0/mod.rs b/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/v0/mod.rs index fcc676d680e..ce942172bc1 100644 --- a/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/v0/mod.rs +++ b/packages/rs-dpp/src/document/serialization_traits/platform_serialization_conversion/v0/mod.rs @@ -1,9 +1,11 @@ use crate::data_contract::document_type::DocumentTypeRef; +#[cfg(feature = "validation")] +use crate::validation::ConsensusValidationResult; use crate::version::PlatformVersion; use crate::ProtocolError; use platform_version::version::FeatureVersion; -pub trait DocumentPlatformConversionMethodsV0 { +pub trait DocumentPlatformConversionMethodsV0: Clone { /// Serializes the document. /// /// The serialization of a document follows the pattern: @@ -42,6 +44,18 @@ pub trait DocumentPlatformConversionMethodsV0 { ) -> Result where Self: Sized; + + #[cfg(feature = "validation")] + /// Reads a serialized document and creates a Document from it. + /// This will return a ConsensusValidationResult instead when the error is happening + /// in consensus (deserialization of a message from the network) + fn from_bytes_in_consensus( + serialized_document: &[u8], + document_type: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> + where + Self: Sized; } pub trait ExtendedDocumentPlatformConversionMethodsV0 { diff --git a/packages/rs-dpp/src/document/specialized_document_factory/mod.rs b/packages/rs-dpp/src/document/specialized_document_factory/mod.rs index f4f25835010..2e8cd371cda 100644 --- a/packages/rs-dpp/src/document/specialized_document_factory/mod.rs +++ b/packages/rs-dpp/src/document/specialized_document_factory/mod.rs @@ -1,6 +1,7 @@ mod v0; use crate::data_contract::DataContract; +use std::collections::BTreeMap; use crate::version::PlatformVersion; use crate::ProtocolError; @@ -11,8 +12,10 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::document::Document; #[cfg(feature = "extended-document")] use crate::document::ExtendedDocument; -use crate::state_transition::documents_batch_transition::document_transition::action_type::DocumentTransitionActionType; -use crate::state_transition::documents_batch_transition::DocumentsBatchTransition; +#[cfg(feature = "state-transitions")] +use crate::state_transition::documents_batch_transition::{ + document_transition::action_type::DocumentTransitionActionType, DocumentsBatchTransition, +}; use crate::util::entropy_generator::EntropyGenerator; pub use v0::SpecializedDocumentFactoryV0; @@ -89,7 +92,7 @@ impl SpecializedDocumentFactory { ) -> Result { match self { SpecializedDocumentFactory::V0(v0) => { - v0.create_document(owner_id, document_type_name, data) + v0.create_document_without_time_based_properties(owner_id, document_type_name, data) } } } @@ -117,12 +120,16 @@ impl SpecializedDocumentFactory { Vec<(Document, DocumentTypeRef<'a>, Bytes32)>, ), >, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce ) -> Result { match self { - SpecializedDocumentFactory::V0(v0) => v0.create_state_transition(documents_iter), + SpecializedDocumentFactory::V0(v0) => { + v0.create_state_transition(documents_iter, nonce_counter) + } } } + #[cfg(feature = "extended-document")] pub fn create_extended_from_document_buffer( &self, buffer: &[u8], diff --git a/packages/rs-dpp/src/document/specialized_document_factory/v0/mod.rs b/packages/rs-dpp/src/document/specialized_document_factory/v0/mod.rs index b469dc4fc04..e7b4c3c2216 100644 --- a/packages/rs-dpp/src/document/specialized_document_factory/v0/mod.rs +++ b/packages/rs-dpp/src/document/specialized_document_factory/v0/mod.rs @@ -7,6 +7,7 @@ use crate::data_contract::DataContract; use crate::document::errors::DocumentError; use crate::document::{Document, DocumentV0Getters, DocumentV0Setters, INITIAL_REVISION}; use chrono::Utc; +use std::collections::BTreeMap; use crate::util::entropy_generator::{DefaultEntropyGenerator, EntropyGenerator}; use crate::version::PlatformVersion; @@ -16,17 +17,17 @@ use platform_value::{Bytes32, Identifier, Value}; use crate::data_contract::document_type::methods::DocumentTypeV0Methods; #[cfg(feature = "extended-document")] -use crate::document::extended_document::v0::ExtendedDocumentV0; -use crate::document::serialization_traits::DocumentPlatformConversionMethodsV0; -#[cfg(feature = "extended-document")] -use crate::document::ExtendedDocument; -use crate::prelude::TimestampMillis; -use crate::state_transition::documents_batch_transition::document_transition::action_type::DocumentTransitionActionType; -use crate::state_transition::documents_batch_transition::document_transition::{ - DocumentCreateTransition, DocumentDeleteTransition, DocumentReplaceTransition, - DocumentTransition, +use crate::document::{ + extended_document::v0::ExtendedDocumentV0, + serialization_traits::DocumentPlatformConversionMethodsV0, ExtendedDocument, }; +use crate::prelude::{BlockHeight, CoreBlockHeight, TimestampMillis}; +#[cfg(feature = "state-transitions")] use crate::state_transition::documents_batch_transition::{ + document_transition::{ + action_type::DocumentTransitionActionType, DocumentCreateTransition, + DocumentDeleteTransition, DocumentReplaceTransition, DocumentTransition, + }, DocumentsBatchTransition, DocumentsBatchTransitionV0, }; use itertools::Itertools; @@ -88,7 +89,38 @@ impl SpecializedDocumentFactoryV0 { entropy_generator, } } + pub fn create_document( + &self, + data_contract: &DataContract, + owner_id: Identifier, + block_time: BlockHeight, + core_block_height: CoreBlockHeight, + document_type_name: String, + data: Value, + ) -> Result { + let platform_version = PlatformVersion::get(self.protocol_version)?; + if !data_contract.has_document_type_for_name(&document_type_name) { + return Err(DataContractError::InvalidDocumentTypeError( + InvalidDocumentTypeError::new(document_type_name, data_contract.id()), + ) + .into()); + } + + let document_entropy = self.entropy_generator.generate()?; + + let document_type = data_contract.document_type_for_name(document_type_name.as_str())?; + + document_type.create_document_from_data( + data, + owner_id, + block_time, + core_block_height, + document_entropy, + platform_version, + ) + } + pub fn create_document_without_time_based_properties( &self, owner_id: Identifier, document_type_name: String, @@ -111,7 +143,14 @@ impl SpecializedDocumentFactoryV0 { .data_contract .document_type_for_name(document_type_name.as_str())?; - document_type.create_document_from_data(data, owner_id, document_entropy, platform_version) + document_type.create_document_from_data( + data, + owner_id, + 0, + 0, + document_entropy, + platform_version, + ) } #[cfg(feature = "extended-document")] pub fn create_extended_document( @@ -140,6 +179,8 @@ impl SpecializedDocumentFactoryV0 { let document = document_type.create_document_from_data( data, owner_id, + 0, + 0, document_entropy, platform_version, )?; @@ -176,6 +217,7 @@ impl SpecializedDocumentFactoryV0 { Vec<(Document, DocumentTypeRef<'a>, Bytes32)>, ), >, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce ) -> Result { let platform_version = PlatformVersion::get(self.protocol_version)?; let documents: Vec<( @@ -210,13 +252,14 @@ impl SpecializedDocumentFactoryV0 { .into_iter() .map(|(action, documents)| match action { DocumentTransitionActionType::Create => { - Self::document_create_transitions(documents, platform_version) + Self::document_create_transitions(documents, nonce_counter, platform_version) } DocumentTransitionActionType::Delete => Self::document_delete_transitions( documents .into_iter() .map(|(document, document_type, _)| (document, document_type)) .collect(), + nonce_counter, platform_version, ), DocumentTransitionActionType::Replace => Self::document_replace_transitions( @@ -224,8 +267,12 @@ impl SpecializedDocumentFactoryV0 { .into_iter() .map(|(document, document_type, _)| (document, document_type)) .collect(), + nonce_counter, platform_version, ), + _ => Err(ProtocolError::InvalidStateTransitionType( + "action type not accounted for".to_string(), + )), }) .collect::, ProtocolError>>()? .into_iter() @@ -239,12 +286,14 @@ impl SpecializedDocumentFactoryV0 { Ok(DocumentsBatchTransitionV0 { owner_id, transitions, + user_fee_increase: 0, signature_public_key_id: 0, signature: Default::default(), } .into()) } + #[cfg(feature = "extended-document")] pub fn create_extended_from_document_buffer( &self, buffer: &[u8], @@ -338,8 +387,10 @@ impl SpecializedDocumentFactoryV0 { // // Ok(data_contract) // // } // + #[cfg(feature = "state-transitions")] fn document_create_transitions( documents: Vec<(Document, DocumentTypeRef, Bytes32)>, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce platform_version: &PlatformVersion, ) -> Result, ProtocolError> { documents @@ -360,21 +411,31 @@ impl SpecializedDocumentFactoryV0 { .into()); } } - Ok(DocumentCreateTransition::from_document( + let nonce = nonce_counter + .entry((document.owner_id(), document_type.data_contract_id())) + .or_default(); + + let transition = DocumentCreateTransition::from_document( document, document_type, entropy.to_buffer(), + *nonce, platform_version, None, None, - )? - .into()) + )?; + + *nonce += 1; + + Ok(transition.into()) }) .collect() } + #[cfg(feature = "state-transitions")] fn document_replace_transitions( documents: Vec<(Document, DocumentTypeRef)>, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce platform_version: &PlatformVersion, ) -> Result, ProtocolError> { documents @@ -396,14 +457,22 @@ impl SpecializedDocumentFactoryV0 { document.set_revision(document.revision().map(|revision| revision + 1)); document.set_updated_at(Some(Utc::now().timestamp_millis() as TimestampMillis)); - Ok(DocumentReplaceTransition::from_document( + let nonce = nonce_counter + .entry((document.owner_id(), document_type.data_contract_id())) + .or_default(); + + let transition = DocumentReplaceTransition::from_document( document, document_type, + *nonce, platform_version, None, None, - )? - .into()) + )?; + + *nonce += 1; + + Ok(transition.into()) }) .collect() // let mut raw_transitions = vec![]; @@ -447,8 +516,10 @@ impl SpecializedDocumentFactoryV0 { // Ok(raw_transitions) } + #[cfg(feature = "state-transitions")] fn document_delete_transitions( documents: Vec<(Document, DocumentTypeRef)>, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce platform_version: &PlatformVersion, ) -> Result, ProtocolError> { documents @@ -466,14 +537,21 @@ impl SpecializedDocumentFactoryV0 { } .into()); }; - Ok(DocumentDeleteTransition::from_document( + let nonce = nonce_counter + .entry((document.owner_id(), document_type.data_contract_id())) + .or_default(); + let transition = DocumentDeleteTransition::from_document( document, document_type, + *nonce, platform_version, None, None, - )? - .into()) + )?; + + *nonce += 1; + + Ok(transition.into()) }) .collect() } diff --git a/packages/rs-dpp/src/document/transfer.rs b/packages/rs-dpp/src/document/transfer.rs new file mode 100644 index 00000000000..cf7bfd48b25 --- /dev/null +++ b/packages/rs-dpp/src/document/transfer.rs @@ -0,0 +1,42 @@ +use crate::consensus::basic::data_contract::UnknownTransferableTypeError; +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; +use derive_more::Display; + +/// We made this enum because in the future we might have a case where documents are sometimes +/// transferable + +#[derive(Clone, Copy, Debug, PartialEq, Default, Display)] +#[repr(u8)] +pub enum Transferable { + #[default] + Never = 0, + Always = 1, +} + +impl Transferable { + pub fn is_transferable(&self) -> bool { + match self { + Transferable::Never => false, + Transferable::Always => true, + } + } +} + +impl TryFrom for Transferable { + type Error = ProtocolError; + + fn try_from(value: u8) -> Result { + match value { + 0 => Ok(Self::Never), + 1 => Ok(Self::Always), + value => Err(ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::UnknownTransferableTypeError( + UnknownTransferableTypeError::new(vec![0, 1], value), + )) + .into(), + )), + } + } +} diff --git a/packages/rs-dpp/src/document/v0/accessors.rs b/packages/rs-dpp/src/document/v0/accessors.rs index 857d65613a4..63d056b2d12 100644 --- a/packages/rs-dpp/src/document/v0/accessors.rs +++ b/packages/rs-dpp/src/document/v0/accessors.rs @@ -5,69 +5,270 @@ use platform_value::{Identifier, Value}; use std::collections::BTreeMap; impl DocumentV0Getters for DocumentV0 { + /// Returns the document's unique identifier. + /// + /// # Returns + /// An `Identifier` representing the unique ID of the document. fn id(&self) -> Identifier { self.id } + /// Returns the identifier of the document's owner. + /// + /// # Returns + /// An `Identifier` representing the owner's ID. fn owner_id(&self) -> Identifier { self.owner_id } + /// Provides a reference to the document's properties. + /// + /// # Returns + /// A reference to a `BTreeMap` containing the document's properties. fn properties(&self) -> &BTreeMap { &self.properties } + /// Provides a mutable reference to the document's properties. + /// + /// # Returns + /// A mutable reference to a `BTreeMap` containing the document's properties. fn properties_mut(&mut self) -> &mut BTreeMap { &mut self.properties } + /// Returns the document's revision, if it is part + /// of the document. The document will have this field if it's schema has this document type + /// as mutable. + /// + /// # Returns + /// An `Option` which is `Some(Revision)` if the document has a revision, or `None` if not. fn revision(&self) -> Option { self.revision } + /// Returns the timestamp of when the document was created, if it is part + /// of the document. The document will have this field if it's schema has it set as required. + /// + /// # Returns + /// An `Option` representing the creation time in milliseconds, or `None` if not available. fn created_at(&self) -> Option { self.created_at } + /// Returns the timestamp of the last update to the document, if it is part + /// of the document. The document will have this field if it's schema has it set as required. + /// + /// # Returns + /// An `Option` representing the update time in milliseconds, or `None` if not available. fn updated_at(&self) -> Option { self.updated_at } + /// Returns the timestamp of the last time the document was transferred, if it is part + /// of the document. The document will have this field if it's schema has it set as required. + /// + /// # Returns + /// An `Option` representing the transferred at time in milliseconds, or `None` if not available. + fn transferred_at(&self) -> Option { + self.transferred_at + } + + /// Provides a reference to the document's unique identifier. + /// + /// # Returns + /// A reference to an `Identifier` representing the unique ID of the document. fn id_ref(&self) -> &Identifier { &self.id } + /// Provides a reference to the document's owner identifier. + /// + /// # Returns + /// A reference to an `Identifier` representing the owner's ID. fn owner_id_ref(&self) -> &Identifier { &self.owner_id } + /// Consumes the document and returns its properties. + /// + /// # Returns + /// A `BTreeMap` containing the document's properties. fn properties_consumed(self) -> BTreeMap { self.properties } + + /// Returns the block height at which the document was created, if it is part + /// of the document. The document will have this field if it's schema has it set as required. + /// + /// # Returns + /// An `Option` representing the creation block height, or `None` if not available. + fn created_at_block_height(&self) -> Option { + self.created_at_block_height + } + + /// Returns the block height at which the document was last updated, if it is part + /// of the document. The document will have this field if it's schema has it set as required. + /// + /// # Returns + /// An `Option` representing the update block height, or `None` if not available. + fn updated_at_block_height(&self) -> Option { + self.updated_at_block_height + } + + /// Returns the block height of the last time the document was transferred, if it is part + /// of the document. The document will have this field if it's schema has it set as required. + /// + /// # Returns + /// An `Option` representing the transfer block height, or `None` if not available. + fn transferred_at_block_height(&self) -> Option { + self.transferred_at_block_height + } + + /// Returns the core network block height at which the document was created, if it is part + /// of the document. The document will have this field if it's schema has it set as required. + /// + /// # Returns + /// An `Option` representing the creation core block height, or `None` if not available. + fn created_at_core_block_height(&self) -> Option { + self.created_at_core_block_height + } + + /// Returns the core network block height at which the document was last updated, if it is part + /// of the document. The document will have this field if it's schema has it set as required. + /// + /// # Returns + /// An `Option` representing the update core block height, or `None` if not available. + fn updated_at_core_block_height(&self) -> Option { + self.updated_at_core_block_height + } + + /// Returns the core network block height of the last time the document was transferred, if it is part + /// of the document. The document will have this field if it's schema has it set as required. + /// + /// # Returns + /// An `Option` representing the transfer core block height, or `None` if not available. + fn transferred_at_core_block_height(&self) -> Option { + self.transferred_at_core_block_height + } } impl DocumentV0Setters for DocumentV0 { + /// Sets the document's unique identifier. + /// + /// # Parameters + /// - `id`: An `Identifier` to set as the document's unique ID. fn set_id(&mut self, id: Identifier) { self.id = id; } + /// Sets the identifier of the document's owner. + /// + /// # Parameters + /// - `owner_id`: An `Identifier` to set as the document's owner ID. fn set_owner_id(&mut self, owner_id: Identifier) { self.owner_id = owner_id; } + /// Sets the document's properties. + /// + /// # Parameters + /// - `properties`: A `BTreeMap` containing the properties to set for the document. fn set_properties(&mut self, properties: BTreeMap) { self.properties = properties; } + /// Sets the document's revision. This is applicable if the document's schema indicates + /// the document type as mutable. + /// + /// # Parameters + /// - `revision`: An `Option` to set as the document's revision. `None` indicates + /// the document does not have a revision. fn set_revision(&mut self, revision: Option) { self.revision = revision; } + /// Bumps the document's revision if it has one. This is applicable if the document's schema indicates + /// the document type as mutable. + /// + fn bump_revision(&mut self) { + if let Some(revision) = self.revision { + self.revision = Some(revision.saturating_add(1)) + } + } + + /// Sets the timestamp of when the document was created. This is applicable if the document's + /// schema requires a creation timestamp. + /// + /// # Parameters + /// - `created_at`: An `Option` to set as the document's creation timestamp. + /// `None` indicates the timestamp is not available. fn set_created_at(&mut self, created_at: Option) { self.created_at = created_at; } + /// Sets the timestamp of the last update to the document. This is applicable if the document's + /// schema requires an update timestamp. + /// + /// # Parameters + /// - `updated_at`: An `Option` to set as the document's last update timestamp. + /// `None` indicates the timestamp is not available. fn set_updated_at(&mut self, updated_at: Option) { self.updated_at = updated_at; } + + fn set_transferred_at(&mut self, transferred_at: Option) { + self.transferred_at = transferred_at; + } + + /// Sets the block height at which the document was created. This is applicable if the document's + /// schema requires this information. + /// + /// # Parameters + /// - `created_at_block_height`: An `Option` to set as the document's creation block height. + /// `None` indicates the block height is not available. + fn set_created_at_block_height(&mut self, created_at_block_height: Option) { + self.created_at_block_height = created_at_block_height; + } + + /// Sets the block height at which the document was last updated. This is applicable if the document's + /// schema requires this information. + /// + /// # Parameters + /// - `updated_at_block_height`: An `Option` to set as the document's last update block height. + /// `None` indicates the block height is not available. + fn set_updated_at_block_height(&mut self, updated_at_block_height: Option) { + self.updated_at_block_height = updated_at_block_height; + } + + fn set_transferred_at_block_height(&mut self, transferred_at_block_height: Option) { + self.transferred_at_block_height = transferred_at_block_height; + } + + /// Sets the core network block height at which the document was created. This is applicable if the + /// document's schema requires this information. + /// + /// # Parameters + /// - `created_at_core_block_height`: An `Option` to set as the document's creation core block height. + /// `None` indicates the core block height is not available. + fn set_created_at_core_block_height(&mut self, created_at_core_block_height: Option) { + self.created_at_core_block_height = created_at_core_block_height; + } + + /// Sets the core network block height at which the document was last updated. This is applicable if the + /// document's schema requires this information. + /// + /// # Parameters + /// - `updated_at_core_block_height`: An `Option` to set as the document's last update core block height. + /// `None` indicates the core block height is not available. + fn set_updated_at_core_block_height(&mut self, updated_at_core_block_height: Option) { + self.updated_at_core_block_height = updated_at_core_block_height; + } + + fn set_transferred_at_core_block_height( + &mut self, + transferred_at_core_block_height: Option, + ) { + self.transferred_at_core_block_height = transferred_at_core_block_height; + } } diff --git a/packages/rs-dpp/src/document/v0/cbor_conversion.rs b/packages/rs-dpp/src/document/v0/cbor_conversion.rs index bcd4f40919a..8fe0732ea2c 100644 --- a/packages/rs-dpp/src/document/v0/cbor_conversion.rs +++ b/packages/rs-dpp/src/document/v0/cbor_conversion.rs @@ -1,9 +1,7 @@ -use crate::data_contract::errors::StructureError; - use crate::document::property_names; use crate::identity::TimestampMillis; -use crate::prelude::Revision; +use crate::prelude::{BlockHeight, CoreBlockHeight, Revision}; use crate::ProtocolError; @@ -43,6 +41,22 @@ pub struct DocumentForCbor { pub created_at: Option, #[serde(rename = "$updatedAt")] pub updated_at: Option, + #[serde(rename = "$transferredAt")] + pub transferred_at: Option, + + #[serde(rename = "$createdAtBlockHeight")] + pub created_at_block_height: Option, + #[serde(rename = "$updatedAtBlockHeight")] + pub updated_at_block_height: Option, + #[serde(rename = "$transferredAtBlockHeight")] + pub transferred_at_block_height: Option, + + #[serde(rename = "$createdAtCoreBlockHeight")] + pub created_at_core_block_height: Option, + #[serde(rename = "$updatedAtCoreBlockHeight")] + pub updated_at_core_block_height: Option, + #[serde(rename = "$transferredAtCoreBlockHeight")] + pub transferred_at_core_block_height: Option, } #[cfg(feature = "cbor")] @@ -57,6 +71,13 @@ impl TryFrom for DocumentForCbor { revision, created_at, updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, } = value; Ok(DocumentForCbor { id: id.to_buffer(), @@ -66,6 +87,13 @@ impl TryFrom for DocumentForCbor { revision, created_at, updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, }) } } @@ -96,6 +124,20 @@ impl DocumentV0 { let created_at = document_map.remove_optional_integer(property_names::CREATED_AT)?; let updated_at = document_map.remove_optional_integer(property_names::UPDATED_AT)?; + let transferred_at = + document_map.remove_optional_integer(property_names::TRANSFERRED_AT)?; + let created_at_block_height = + document_map.remove_optional_integer(property_names::CREATED_AT_BLOCK_HEIGHT)?; + let updated_at_block_height = + document_map.remove_optional_integer(property_names::UPDATED_AT_BLOCK_HEIGHT)?; + let transferred_at_block_height = + document_map.remove_optional_integer(property_names::TRANSFERRED_AT_BLOCK_HEIGHT)?; + let created_at_core_block_height = + document_map.remove_optional_integer(property_names::CREATED_AT_CORE_BLOCK_HEIGHT)?; + let updated_at_core_block_height = + document_map.remove_optional_integer(property_names::UPDATED_AT_CORE_BLOCK_HEIGHT)?; + let transferred_at_core_block_height = document_map + .remove_optional_integer(property_names::TRANSFERRED_AT_CORE_BLOCK_HEIGHT)?; // dev-note: properties is everything other than the id and owner id Ok(DocumentV0 { @@ -105,6 +147,13 @@ impl DocumentV0 { revision, created_at, updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, }) } } @@ -122,9 +171,9 @@ impl DocumentCborMethodsV0 for DocumentV0 { // we would need dedicated deserialization functions based on the document type let document_cbor_map: BTreeMap = ciborium::de::from_reader(document_cbor).map_err(|_| { - ProtocolError::StructureError(StructureError::InvalidCBOR( - "unable to decode document for document call", - )) + ProtocolError::InvalidCBOR( + "unable to decode document for document call".to_string(), + ) })?; let document_map: BTreeMap = Value::convert_from_cbor_map(document_cbor_map).map_err(ProtocolError::ValueError)?; diff --git a/packages/rs-dpp/src/document/v0/json_conversion.rs b/packages/rs-dpp/src/document/v0/json_conversion.rs index ea4fc8d046a..87c1718a867 100644 --- a/packages/rs-dpp/src/document/v0/json_conversion.rs +++ b/packages/rs-dpp/src/document/v0/json_conversion.rs @@ -33,6 +33,33 @@ impl<'a> DocumentJsonMethodsV0<'a> for DocumentV0 { JsonValue::Number(updated_at.into()), ); } + if let Some(created_at_block_height) = self.created_at_block_height { + value_mut.insert( + property_names::CREATED_AT_BLOCK_HEIGHT.to_string(), + JsonValue::Number(created_at_block_height.into()), + ); + } + + if let Some(updated_at_block_height) = self.updated_at_block_height { + value_mut.insert( + property_names::UPDATED_AT_BLOCK_HEIGHT.to_string(), + JsonValue::Number(updated_at_block_height.into()), + ); + } + + if let Some(created_at_core_block_height) = self.created_at_core_block_height { + value_mut.insert( + property_names::CREATED_AT_CORE_BLOCK_HEIGHT.to_string(), + JsonValue::Number(created_at_core_block_height.into()), + ); + } + + if let Some(updated_at_core_block_height) = self.updated_at_core_block_height { + value_mut.insert( + property_names::UPDATED_AT_CORE_BLOCK_HEIGHT.to_string(), + JsonValue::Number(updated_at_core_block_height.into()), + ); + } if let Some(revision) = self.revision { value_mut.insert( property_names::REVISION.to_string(), @@ -84,6 +111,18 @@ impl<'a> DocumentJsonMethodsV0<'a> for DocumentV0 { if let Ok(value) = document_value.remove(property_names::UPDATED_AT) { document.updated_at = serde_json::from_value(value)? } + if let Ok(value) = document_value.remove(property_names::CREATED_AT_BLOCK_HEIGHT) { + document.created_at_block_height = serde_json::from_value(value)?; + } + if let Ok(value) = document_value.remove(property_names::UPDATED_AT_BLOCK_HEIGHT) { + document.updated_at_block_height = serde_json::from_value(value)?; + } + if let Ok(value) = document_value.remove(property_names::CREATED_AT_CORE_BLOCK_HEIGHT) { + document.created_at_core_block_height = serde_json::from_value(value)?; + } + if let Ok(value) = document_value.remove(property_names::UPDATED_AT_CORE_BLOCK_HEIGHT) { + document.updated_at_core_block_height = serde_json::from_value(value)?; + } let platform_value: Value = document_value.into(); diff --git a/packages/rs-dpp/src/document/v0/mod.rs b/packages/rs-dpp/src/document/v0/mod.rs index aae6e1a25c5..c68c01a42ac 100644 --- a/packages/rs-dpp/src/document/v0/mod.rs +++ b/packages/rs-dpp/src/document/v0/mod.rs @@ -12,20 +12,22 @@ pub(super) mod json_conversion; mod platform_value_conversion; pub mod serialize; -use chrono::{DateTime, NaiveDateTime, Utc}; +use chrono::DateTime; use std::collections::BTreeMap; use std::fmt; use platform_value::Value; +#[cfg(feature = "document-serde-conversion")] use serde::{Deserialize, Serialize}; use crate::document::document_methods::{ DocumentGetRawForContractV0, DocumentGetRawForDocumentTypeV0, DocumentHashV0Method, + DocumentIsEqualIgnoringTimestampsV0, }; use crate::identity::TimestampMillis; -use crate::prelude::Identifier; use crate::prelude::Revision; +use crate::prelude::{BlockHeight, CoreBlockHeight, Identifier}; /// Documents contain the data that goes into data contracts. #[derive(Clone, Debug, PartialEq, Default)] @@ -40,30 +42,76 @@ pub struct DocumentV0 { /// The document's properties (data). #[cfg_attr(feature = "document-serde-conversion", serde(flatten))] pub properties: BTreeMap, - /// The document revision. + /// The document revision, if the document is mutable. #[cfg_attr( feature = "document-serde-conversion", serde(rename = "$revision", default) )] pub revision: Option, - /// The time in milliseconds that the document was created + /// The time in milliseconds that the document was created, if it is set as required by the document type schema. #[cfg_attr( feature = "document-serde-conversion", serde(rename = "$createdAt", default) )] pub created_at: Option, - /// The time in milliseconds that the document was last updated + /// The time in milliseconds that the document was last updated, if it is set as required by the document type schema. #[cfg_attr( feature = "document-serde-conversion", serde(rename = "$updatedAt", default) )] pub updated_at: Option, + /// The time in milliseconds that the document was last transferred, if it is set as required by the document type schema. + #[cfg_attr( + feature = "document-serde-conversion", + serde(rename = "$transferredAt", default) + )] + pub transferred_at: Option, + /// The block that the document was created, if it is set as required by the document type schema. + #[cfg_attr( + feature = "document-serde-conversion", + serde(rename = "$createdAtBlockHeight", default) + )] + pub created_at_block_height: Option, + /// The block that the document was last updated, if it is set as required by the document type schema. + #[cfg_attr( + feature = "document-serde-conversion", + serde(rename = "$updatedAtBlockHeight", default) + )] + pub updated_at_block_height: Option, + /// The block that the document was last transferred to a new identity, if it is set as required by the document type schema. + #[cfg_attr( + feature = "document-serde-conversion", + serde(rename = "$transferredAtBlockHeight", default) + )] + pub transferred_at_block_height: Option, + /// The core block that the document was created, if it is set as required by the document type schema. + #[cfg_attr( + feature = "document-serde-conversion", + serde(rename = "$createdAtCoreBlockHeight", default) + )] + pub created_at_core_block_height: Option, + /// The core block that the document was last updated, if it is set as required by the document type schema. + #[cfg_attr( + feature = "document-serde-conversion", + serde(rename = "$updatedAtCoreBlockHeight", default) + )] + pub updated_at_core_block_height: Option, + /// The core block that the document was last transferred to a new identity, if it is set as required by the document type schema. + #[cfg_attr( + feature = "document-serde-conversion", + serde(rename = "$transferredAtCoreBlockHeight", default) + )] + pub transferred_at_core_block_height: Option, } impl DocumentGetRawForContractV0 for DocumentV0 { //automatically done } +impl DocumentIsEqualIgnoringTimestampsV0 for DocumentV0 { + //automatically done +} + impl DocumentGetRawForDocumentTypeV0 for DocumentV0 { //automatically done } @@ -77,16 +125,35 @@ impl fmt::Display for DocumentV0 { write!(f, "id:{} ", self.id)?; write!(f, "owner_id:{} ", self.owner_id)?; if let Some(created_at) = self.created_at { - let naive = NaiveDateTime::from_timestamp_millis(created_at as i64).unwrap_or_default(); - let datetime: DateTime = DateTime::from_utc(naive, Utc); + let datetime = DateTime::from_timestamp_millis(created_at as i64).unwrap_or_default(); write!(f, "created_at:{} ", datetime.format("%Y-%m-%d %H:%M:%S"))?; } if let Some(updated_at) = self.updated_at { - let naive = NaiveDateTime::from_timestamp_millis(updated_at as i64).unwrap_or_default(); - let datetime: DateTime = DateTime::from_utc(naive, Utc); + let datetime = DateTime::from_timestamp_millis(updated_at as i64).unwrap_or_default(); write!(f, "updated_at:{} ", datetime.format("%Y-%m-%d %H:%M:%S"))?; } + if let Some(created_at_block_height) = self.created_at_block_height { + write!(f, "created_at_block_height:{} ", created_at_block_height)?; + } + if let Some(updated_at_block_height) = self.updated_at_block_height { + write!(f, "updated_at_block_height:{} ", updated_at_block_height)?; + } + if let Some(created_at_core_block_height) = self.created_at_core_block_height { + write!( + f, + "created_at_core_block_height:{} ", + created_at_core_block_height + )?; + } + if let Some(updated_at_core_block_height) = self.updated_at_core_block_height { + write!( + f, + "updated_at_core_block_height:{} ", + updated_at_core_block_height + )?; + } + if self.properties.is_empty() { write!(f, "no properties")?; } else { diff --git a/packages/rs-dpp/src/document/v0/serialize.rs b/packages/rs-dpp/src/document/v0/serialize.rs index 25c833a2c5d..a26879d9ff9 100644 --- a/packages/rs-dpp/src/document/v0/serialize.rs +++ b/packages/rs-dpp/src/document/v0/serialize.rs @@ -1,7 +1,14 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::data_contract::errors::DataContractError; -use crate::document::property_names::{CREATED_AT, UPDATED_AT}; +use crate::document::property_names::{ + CREATED_AT, CREATED_AT_BLOCK_HEIGHT, CREATED_AT_CORE_BLOCK_HEIGHT, PRICE, TRANSFERRED_AT, + TRANSFERRED_AT_BLOCK_HEIGHT, TRANSFERRED_AT_CORE_BLOCK_HEIGHT, UPDATED_AT, + UPDATED_AT_BLOCK_HEIGHT, UPDATED_AT_CORE_BLOCK_HEIGHT, +}; + +#[cfg(feature = "validation")] +use crate::prelude::ConsensusValidationResult; use crate::prelude::Revision; @@ -22,6 +29,11 @@ use platform_version::version::FeatureVersion; use std::collections::BTreeMap; +use crate::consensus::basic::decode::DecodingError; +#[cfg(feature = "validation")] +use crate::consensus::basic::BasicError; +#[cfg(feature = "validation")] +use crate::consensus::ConsensusError; use std::io::{BufReader, Read}; impl DocumentPlatformSerializationMethodsV0 for DocumentV0 { @@ -45,43 +57,152 @@ impl DocumentPlatformSerializationMethodsV0 for DocumentV0 { buffer.extend((1 as Revision).encode_var_vec()) } + let mut bitwise_exists_flag: u16 = 0; + + let mut time_fields_data_buffer = vec![]; + // $createdAt if let Some(created_at) = &self.created_at { - if !document_type.required_fields().contains(CREATED_AT) { - buffer.push(1); - } + bitwise_exists_flag |= 1; // dbg!("we pushed created at {}", hex::encode(created_at.to_be_bytes())); - buffer.extend(created_at.to_be_bytes()); + time_fields_data_buffer.extend(created_at.to_be_bytes()); } else if document_type.required_fields().contains(CREATED_AT) { return Err(ProtocolError::DataContractError( DataContractError::MissingRequiredKey( "created at field is not present".to_string(), ), )); - } else { - // dbg!("we pushed created at with 0"); - // We don't have the created_at that wasn't required - buffer.push(0); } // $updatedAt if let Some(updated_at) = &self.updated_at { - if !document_type.required_fields().contains(UPDATED_AT) { - // dbg!("we added 1", field_name); - buffer.push(1); - } + bitwise_exists_flag |= 2; // dbg!("we pushed updated at {}", hex::encode(updated_at.to_be_bytes())); - buffer.extend(updated_at.to_be_bytes()); + time_fields_data_buffer.extend(updated_at.to_be_bytes()); } else if document_type.required_fields().contains(UPDATED_AT) { return Err(ProtocolError::DataContractError( DataContractError::MissingRequiredKey( "updated at field is not present".to_string(), ), )); - } else { - // dbg!("we pushed updated at with 0"); - // We don't have the updated_at that wasn't required - buffer.push(0); + } + + // $transferredAt + if let Some(transferred_at) = &self.transferred_at { + bitwise_exists_flag |= 4; + // dbg!("we pushed transferred at {}", hex::encode(transferred_at.to_be_bytes())); + time_fields_data_buffer.extend(transferred_at.to_be_bytes()); + } else if document_type.required_fields().contains(TRANSFERRED_AT) { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "transferred at field is not present".to_string(), + ), + )); + } + + // $createdAtBlockHeight + if let Some(created_at_block_height) = &self.created_at_block_height { + bitwise_exists_flag |= 8; + time_fields_data_buffer.extend(created_at_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(CREATED_AT_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "created_at_block_height field is not present".to_string(), + ), + )); + } + + // $updatedAtBlockHeight + if let Some(updated_at_block_height) = &self.updated_at_block_height { + bitwise_exists_flag |= 16; + time_fields_data_buffer.extend(updated_at_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(UPDATED_AT_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "updated_at_block_height field is not present".to_string(), + ), + )); + } + + // $transferredAtBlockHeight + if let Some(transferred_at_block_height) = &self.transferred_at_block_height { + bitwise_exists_flag |= 32; + time_fields_data_buffer.extend(transferred_at_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(TRANSFERRED_AT_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "transferred_at_block_height field is not present".to_string(), + ), + )); + } + + // $createdAtCoreBlockHeight + if let Some(created_at_core_block_height) = &self.created_at_core_block_height { + bitwise_exists_flag |= 64; + time_fields_data_buffer.extend(created_at_core_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(CREATED_AT_CORE_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "created_at_core_block_height field is not present".to_string(), + ), + )); + } + + // $updatedAtCoreBlockHeight + if let Some(updated_at_core_block_height) = &self.updated_at_core_block_height { + bitwise_exists_flag |= 128; + time_fields_data_buffer.extend(updated_at_core_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(UPDATED_AT_CORE_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "updated_at_core_block_height field is not present".to_string(), + ), + )); + } + + // $transferredAtCoreBlockHeight + if let Some(transferred_at_core_block_height) = &self.transferred_at_core_block_height { + bitwise_exists_flag |= 256; + time_fields_data_buffer.extend(transferred_at_core_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(TRANSFERRED_AT_CORE_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "transferred_at_core_block_height field is not present".to_string(), + ), + )); + } + + buffer.extend(bitwise_exists_flag.to_be_bytes().as_slice()); + buffer.append(&mut time_fields_data_buffer); + + // Now we serialize the price which might not be necessary unless called for by the document type + + if document_type.trade_mode().seller_sets_price() { + if let Some(price) = self.properties.get(PRICE) { + buffer.push(1); + let price_as_u64: u64 = price.to_integer().map_err(ProtocolError::ValueError)?; + buffer.append(&mut price_as_u64.to_be_bytes().to_vec()); + } else { + buffer.push(0); + } } // User defined properties @@ -152,44 +273,152 @@ impl DocumentPlatformSerializationMethodsV0 for DocumentV0 { if let Some(revision) = self.revision { buffer.extend(revision.to_be_bytes()) } + let mut bitwise_exists_flag: u16 = 0; + + let mut time_fields_data_buffer = vec![]; // $createdAt - if let Some(created_at) = self.created_at { - if !document_type.required_fields().contains(CREATED_AT) { - buffer.push(1); - } + if let Some(created_at) = &self.created_at { + bitwise_exists_flag |= 1; // dbg!("we pushed created at {}", hex::encode(created_at.to_be_bytes())); - buffer.extend(created_at.to_be_bytes()); + time_fields_data_buffer.extend(created_at.to_be_bytes()); } else if document_type.required_fields().contains(CREATED_AT) { return Err(ProtocolError::DataContractError( DataContractError::MissingRequiredKey( "created at field is not present".to_string(), ), )); - } else { - // dbg!("we pushed created at with 0"); - // We don't have the created_at that wasn't required - buffer.push(0); } // $updatedAt - if let Some(updated_at) = self.updated_at { - if !document_type.required_fields().contains(UPDATED_AT) { - // dbg!("we added 1", field_name); - buffer.push(1); - } + if let Some(updated_at) = &self.updated_at { + bitwise_exists_flag |= 2; // dbg!("we pushed updated at {}", hex::encode(updated_at.to_be_bytes())); - buffer.extend(updated_at.to_be_bytes()); + time_fields_data_buffer.extend(updated_at.to_be_bytes()); } else if document_type.required_fields().contains(UPDATED_AT) { return Err(ProtocolError::DataContractError( DataContractError::MissingRequiredKey( "updated at field is not present".to_string(), ), )); - } else { - // dbg!("we pushed updated at with 0"); - // We don't have the updated_at that wasn't required - buffer.push(0); + } + + // $transferredAt + if let Some(transferred_at) = &self.transferred_at { + bitwise_exists_flag |= 4; + // dbg!("we pushed transferred at {}", hex::encode(transferred_at.to_be_bytes())); + time_fields_data_buffer.extend(transferred_at.to_be_bytes()); + } else if document_type.required_fields().contains(TRANSFERRED_AT) { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "transferred at field is not present".to_string(), + ), + )); + } + + // $createdAtBlockHeight + if let Some(created_at_block_height) = &self.created_at_block_height { + bitwise_exists_flag |= 8; + time_fields_data_buffer.extend(created_at_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(CREATED_AT_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "created_at_block_height field is not present".to_string(), + ), + )); + } + + // $updatedAtBlockHeight + if let Some(updated_at_block_height) = &self.updated_at_block_height { + bitwise_exists_flag |= 16; + time_fields_data_buffer.extend(updated_at_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(UPDATED_AT_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "updated_at_block_height field is not present".to_string(), + ), + )); + } + + // $transferredAtBlockHeight + if let Some(transferred_at_block_height) = &self.transferred_at_block_height { + bitwise_exists_flag |= 32; + time_fields_data_buffer.extend(transferred_at_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(TRANSFERRED_AT_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "transferred_at_block_height field is not present".to_string(), + ), + )); + } + + // $createdAtCoreBlockHeight + if let Some(created_at_core_block_height) = &self.created_at_core_block_height { + bitwise_exists_flag |= 64; + time_fields_data_buffer.extend(created_at_core_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(CREATED_AT_CORE_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "created_at_core_block_height field is not present".to_string(), + ), + )); + } + + // $updatedAtCoreBlockHeight + if let Some(updated_at_core_block_height) = &self.updated_at_core_block_height { + bitwise_exists_flag |= 128; + time_fields_data_buffer.extend(updated_at_core_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(UPDATED_AT_CORE_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "updated_at_core_block_height field is not present".to_string(), + ), + )); + } + + // $transferredAtCoreBlockHeight + if let Some(transferred_at_core_block_height) = &self.transferred_at_core_block_height { + bitwise_exists_flag |= 256; + time_fields_data_buffer.extend(transferred_at_core_block_height.to_be_bytes()); + } else if document_type + .required_fields() + .contains(TRANSFERRED_AT_CORE_BLOCK_HEIGHT) + { + return Err(ProtocolError::DataContractError( + DataContractError::MissingRequiredKey( + "transferred_at_core_block_height field is not present".to_string(), + ), + )); + } + + buffer.extend(bitwise_exists_flag.to_be_bytes().as_slice()); + buffer.append(&mut time_fields_data_buffer); + + // Now we serialize the price which might not be necessary unless called for by the document type + + if document_type.trade_mode().seller_sets_price() { + if let Some(price) = self.properties.get(PRICE) { + buffer.push(1); + let price_as_u64: u64 = price.to_integer().map_err(ProtocolError::ValueError)?; + buffer.append(&mut price_as_u64.to_be_bytes().to_vec()); + } else { + buffer.push(0); + } } // User defined properties @@ -247,59 +476,177 @@ impl DocumentPlatformDeserializationMethodsV0 for DocumentV0 { serialized_document: &[u8], document_type: DocumentTypeRef, _platform_version: &PlatformVersion, - ) -> Result { + ) -> Result { let mut buf = BufReader::new(serialized_document); if serialized_document.len() < 64 { - return Err(ProtocolError::DecodingError( - "serialized document is too small, must have id and owner id".to_string(), + return Err(DataContractError::DecodingDocumentError( + DecodingError::new( + "serialized document is too small, must have id and owner id".to_string(), + ), )); } // $id let mut id = [0; 32]; buf.read_exact(&mut id).map_err(|_| { - ProtocolError::DecodingError( + DataContractError::DecodingDocumentError(DecodingError::new( "error reading from serialized document for id".to_string(), - ) + )) })?; // $ownerId let mut owner_id = [0; 32]; buf.read_exact(&mut owner_id).map_err(|_| { - ProtocolError::DecodingError( + DataContractError::DecodingDocumentError(DecodingError::new( "error reading from serialized document for owner id".to_string(), - ) + )) })?; // $revision // if the document type is mutable then we should deserialize the revision let revision: Option = if document_type.requires_revision() { let revision = buf.read_varint().map_err(|_| { - ProtocolError::DecodingError( + DataContractError::DecodingDocumentError(DecodingError::new( "error reading revision from serialized document for revision".to_string(), - ) + )) })?; Some(revision) } else { None }; - // $createdAt - let created_at = read_timestamp(&mut buf, document_type, CREATED_AT)?; - let updated_at = read_timestamp(&mut buf, document_type, UPDATED_AT)?; + let timestamp_flags = buf.read_u16::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading timestamp flags from serialized document".to_string(), + ) + })?; + + let created_at = if timestamp_flags & 1 > 0 { + Some(buf.read_u64::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading created_at timestamp from serialized document".to_string(), + ) + })?) + } else { + None + }; + + let updated_at = if timestamp_flags & 2 > 0 { + Some(buf.read_u64::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading updated_at timestamp from serialized document".to_string(), + ) + })?) + } else { + None + }; + + let transferred_at = if timestamp_flags & 4 > 0 { + Some(buf.read_u64::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading transferred_at timestamp from serialized document".to_string(), + ) + })?) + } else { + None + }; + + let created_at_block_height = if timestamp_flags & 8 > 0 { + Some(buf.read_u64::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading created_at_block_height from serialized document".to_string(), + ) + })?) + } else { + None + }; + + let updated_at_block_height = if timestamp_flags & 16 > 0 { + Some(buf.read_u64::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading updated_at_block_height from serialized document".to_string(), + ) + })?) + } else { + None + }; + + let transferred_at_block_height = if timestamp_flags & 32 > 0 { + Some(buf.read_u64::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading transferred_at_block_height from serialized document" + .to_string(), + ) + })?) + } else { + None + }; + + let created_at_core_block_height = if timestamp_flags & 64 > 0 { + Some(buf.read_u32::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading created_at_core_block_height from serialized document" + .to_string(), + ) + })?) + } else { + None + }; + + let updated_at_core_block_height = if timestamp_flags & 128 > 0 { + Some(buf.read_u32::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading updated_at_core_block_height from serialized document" + .to_string(), + ) + })?) + } else { + None + }; + + let transferred_at_core_block_height = if timestamp_flags & 256 > 0 { + Some(buf.read_u32::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading updated_at_core_block_height from serialized document" + .to_string(), + ) + })?) + } else { + None + }; + + // Now we deserialize the price which might not be necessary unless called for by the document type + + let price = if document_type.trade_mode().seller_sets_price() { + let has_price = buf.read_u8().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading has price bool from serialized document".to_string(), + ) + })?; + if has_price > 0 { + let price = buf.read_u64::().map_err(|_| { + DataContractError::CorruptedSerialization( + "error reading price u64 from serialized document".to_string(), + ) + })?; + Some(price) + } else { + None + } + } else { + None + }; let mut finished_buffer = false; - let properties = document_type + let mut properties = document_type .properties() .iter() .filter_map(|(key, property)| { if finished_buffer { return if property.required { - Some(Err(ProtocolError::DataContractError( - DataContractError::CorruptedSerialization( - "required field after finished buffer", - ), + Some(Err(DataContractError::CorruptedSerialization( + "required field after finished buffer".to_string(), ))) } else { None @@ -317,7 +664,11 @@ impl DocumentPlatformDeserializationMethodsV0 for DocumentV0 { Err(e) => Some(Err(e)), } }) - .collect::, ProtocolError>>()?; + .collect::, DataContractError>>()?; + + if let Some(price) = price { + properties.insert(PRICE.to_string(), price.into()); + } Ok(DocumentV0 { id: Identifier::new(id), @@ -326,36 +677,17 @@ impl DocumentPlatformDeserializationMethodsV0 for DocumentV0 { revision, created_at, updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, }) } } -fn read_timestamp( - buf: &mut BufReader<&[u8]>, - document_type: DocumentTypeRef, - property_name: &str, -) -> Result, ProtocolError> { - if !document_type.required_fields().contains(property_name) { - let marker = buf.read_u8().map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading created at optional byte from serialized document", - )) - })?; - - if marker == 0 { - return Ok(None); - } - } - - let timestamp = buf.read_u64::().map_err(|_| { - ProtocolError::DataContractError(DataContractError::CorruptedSerialization( - "error reading created at from serialized document", - )) - })?; - - Ok(Some(timestamp)) -} - impl DocumentPlatformConversionMethodsV0 for DocumentV0 { /// Serializes the document. /// @@ -427,12 +759,46 @@ impl DocumentPlatformConversionMethodsV0 for DocumentV0 { platform_version: &PlatformVersion, ) -> Result { let serialized_version = serialized_document.read_varint().map_err(|_| { - ProtocolError::DecodingError( + DataContractError::DecodingDocumentError(DecodingError::new( "error reading revision from serialized document for revision".to_string(), - ) + )) })?; match serialized_version { - 0 => DocumentV0::from_bytes_v0(serialized_document, document_type, platform_version), + 0 => DocumentV0::from_bytes_v0(serialized_document, document_type, platform_version) + .map_err(ProtocolError::DataContractError), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "Document::from_bytes (deserialization)".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + + /// Reads a serialized document and creates a DocumentV0 from it. + #[cfg(feature = "validation")] + fn from_bytes_in_consensus( + mut serialized_document: &[u8], + document_type: DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + let serialized_version = serialized_document.read_varint().map_err(|_| { + DataContractError::DecodingDocumentError(DecodingError::new( + "error reading revision from serialized document for revision".to_string(), + )) + })?; + match serialized_version { + 0 => { + match DocumentV0::from_bytes_v0( + serialized_document, + document_type, + platform_version, + ) { + Ok(document) => Ok(ConsensusValidationResult::new_with_data(document)), + Err(err) => Ok(ConsensusValidationResult::new_with_error( + ConsensusError::BasicError(BasicError::ContractError(err)), + )), + } + } version => Err(ProtocolError::UnknownVersionMismatch { method: "Document::from_bytes (deserialization)".to_string(), known_versions: vec![0], diff --git a/packages/rs-dpp/src/errors/consensus/basic/basic_error.rs b/packages/rs-dpp/src/errors/consensus/basic/basic_error.rs index f6c463b555f..5a565acc0c2 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/basic_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/basic_error.rs @@ -4,33 +4,40 @@ use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; use thiserror::Error; use crate::consensus::basic::data_contract::data_contract_max_depth_exceed_error::DataContractMaxDepthExceedError; +#[cfg(feature = "json-schema-validation")] +use crate::consensus::basic::data_contract::InvalidJsonSchemaRefError; use crate::consensus::basic::data_contract::{ DataContractHaveNewUniqueIndexError, DataContractImmutablePropertiesUpdateError, DataContractInvalidIndexDefinitionUpdateError, DataContractUniqueIndicesChangedError, DuplicateIndexError, DuplicateIndexNameError, IncompatibleDataContractSchemaError, - IncompatibleRe2PatternError, InvalidCompoundIndexError, InvalidDataContractIdError, - InvalidDataContractVersionError, InvalidIndexPropertyTypeError, - InvalidIndexedPropertyConstraintError, InvalidJsonSchemaRefError, - SystemPropertyIndexAlreadyPresentError, UndefinedIndexPropertyError, - UniqueIndicesLimitReachedError, + IncompatibleDocumentTypeSchemaError, IncompatibleRe2PatternError, InvalidCompoundIndexError, + InvalidDataContractIdError, InvalidDataContractVersionError, InvalidDocumentTypeNameError, + InvalidDocumentTypeRequiredSecurityLevelError, InvalidIndexPropertyTypeError, + InvalidIndexedPropertyConstraintError, SystemPropertyIndexAlreadyPresentError, + UndefinedIndexPropertyError, UniqueIndicesLimitReachedError, + UnknownDocumentCreationRestrictionModeError, UnknownSecurityLevelError, + UnknownStorageKeyRequirementsError, UnknownTradeModeError, UnknownTransferableTypeError, }; use crate::consensus::basic::decode::{ ProtocolVersionParsingError, SerializedObjectParsingError, VersionError, }; use crate::consensus::basic::document::{ - DataContractNotPresentError, DocumentTransitionsAreAbsentError, - DuplicateDocumentTransitionsWithIdsError, DuplicateDocumentTransitionsWithIndicesError, - InconsistentCompoundIndexDataError, InvalidDocumentTransitionActionError, - InvalidDocumentTransitionIdError, InvalidDocumentTypeError, - MaxDocumentsTransitionsExceededError, MissingDataContractIdBasicError, - MissingDocumentTransitionActionError, MissingDocumentTransitionTypeError, - MissingDocumentTypeError, MissingPositionsInDocumentTypePropertiesError, + DataContractNotPresentError, DocumentCreationNotAllowedError, + DocumentTransitionsAreAbsentError, DuplicateDocumentTransitionsWithIdsError, + DuplicateDocumentTransitionsWithIndicesError, InconsistentCompoundIndexDataError, + InvalidDocumentTransitionActionError, InvalidDocumentTransitionIdError, + InvalidDocumentTypeError, MaxDocumentsTransitionsExceededError, + MissingDataContractIdBasicError, MissingDocumentTransitionActionError, + MissingDocumentTransitionTypeError, MissingDocumentTypeError, + MissingPositionsInDocumentTypePropertiesError, NonceOutOfBoundsError, }; use crate::consensus::basic::identity::{ - DataContractBoundsNotPresentError, DuplicatedIdentityPublicKeyBasicError, - DuplicatedIdentityPublicKeyIdBasicError, IdentityAssetLockProofLockedTransactionMismatchError, - IdentityAssetLockTransactionIsNotFoundError, - IdentityAssetLockTransactionOutPointAlreadyExistsError, + DataContractBoundsNotPresentError, DisablingKeyIdAlsoBeingAddedInSameTransitionError, + DuplicatedIdentityPublicKeyBasicError, DuplicatedIdentityPublicKeyIdBasicError, + IdentityAssetLockProofLockedTransactionMismatchError, + IdentityAssetLockStateTransitionReplayError, IdentityAssetLockTransactionIsNotFoundError, + IdentityAssetLockTransactionOutPointAlreadyConsumedError, + IdentityAssetLockTransactionOutPointNotEnoughBalanceError, IdentityAssetLockTransactionOutputNotFoundError, IdentityCreditTransferToSelfError, InvalidAssetLockProofCoreChainHeightError, InvalidAssetLockProofTransactionHeightError, InvalidAssetLockTransactionOutputReturnSizeError, @@ -43,6 +50,7 @@ use crate::consensus::basic::identity::{ InvalidIdentityUpdateTransitionDisableKeysError, InvalidIdentityUpdateTransitionEmptyError, InvalidInstantAssetLockProofError, InvalidInstantAssetLockProofSignatureError, MissingMasterPublicKeyError, NotImplementedIdentityCreditWithdrawalTransitionPoolingError, + TooManyMasterPublicKeyError, }; use crate::consensus::basic::invalid_identifier_error::InvalidIdentifierError; use crate::consensus::basic::state_transition::{ @@ -52,10 +60,14 @@ use crate::consensus::basic::state_transition::{ use crate::consensus::basic::{IncompatibleProtocolVersionError, UnsupportedProtocolVersionError}; use crate::consensus::ConsensusError; -use crate::consensus::basic::json_schema_compilation_error::JsonSchemaCompilationError; -use crate::consensus::basic::json_schema_error::JsonSchemaError; use crate::consensus::basic::unsupported_version_error::UnsupportedVersionError; use crate::consensus::basic::value_error::ValueError; +#[cfg(feature = "json-schema-validation")] +use crate::consensus::basic::{ + json_schema_compilation_error::JsonSchemaCompilationError, json_schema_error::JsonSchemaError, +}; +use crate::consensus::state::identity::master_public_key_update_error::MasterPublicKeyUpdateError; +use crate::data_contract::errors::DataContractError; #[derive(Error, Debug, PlatformSerialize, PlatformDeserialize, Encode, Decode, Clone)] pub enum BasicError { @@ -71,6 +83,24 @@ pub enum BasicError { #[error(transparent)] VersionError(VersionError), + #[error(transparent)] + ContractError(DataContractError), + + #[error(transparent)] + UnknownSecurityLevelError(UnknownSecurityLevelError), + + #[error(transparent)] + UnknownStorageKeyRequirementsError(UnknownStorageKeyRequirementsError), + + #[error(transparent)] + UnknownTransferableTypeError(UnknownTransferableTypeError), + + #[error(transparent)] + UnknownTradeModeError(UnknownTradeModeError), + + #[error(transparent)] + UnknownDocumentCreationRestrictionModeError(UnknownDocumentCreationRestrictionModeError), + #[error(transparent)] SerializedObjectParsingError(SerializedObjectParsingError), @@ -83,10 +113,12 @@ pub enum BasicError { #[error(transparent)] IncompatibleProtocolVersionError(IncompatibleProtocolVersionError), + #[cfg(feature = "json-schema-validation")] // Structure error #[error(transparent)] JsonSchemaCompilationError(JsonSchemaCompilationError), + #[cfg(feature = "json-schema-validation")] #[error(transparent)] JsonSchemaError(JsonSchemaError), @@ -118,6 +150,7 @@ pub enum BasicError { #[error(transparent)] InvalidIndexPropertyTypeError(InvalidIndexPropertyTypeError), + #[cfg(feature = "json-schema-validation")] #[error(transparent)] InvalidJsonSchemaRefError(InvalidJsonSchemaRefError), @@ -155,6 +188,9 @@ pub enum BasicError { #[error(transparent)] DataContractNotPresentError(DataContractNotPresentError), + #[error(transparent)] + DocumentCreationNotAllowedError(DocumentCreationNotAllowedError), + #[error(transparent)] DataContractBoundsNotPresentError(DataContractBoundsNotPresentError), @@ -164,6 +200,9 @@ pub enum BasicError { #[error(transparent)] DuplicateDocumentTransitionsWithIndicesError(DuplicateDocumentTransitionsWithIndicesError), + #[error(transparent)] + NonceOutOfBoundsError(NonceOutOfBoundsError), + #[error(transparent)] InconsistentCompoundIndexDataError(InconsistentCompoundIndexDataError), @@ -201,6 +240,11 @@ pub enum BasicError { #[error(transparent)] DuplicatedIdentityPublicKeyIdBasicError(DuplicatedIdentityPublicKeyIdBasicError), + #[error(transparent)] + DisablingKeyIdAlsoBeingAddedInSameTransitionError( + DisablingKeyIdAlsoBeingAddedInSameTransitionError, + ), + #[error(transparent)] IdentityAssetLockProofLockedTransactionMismatchError( IdentityAssetLockProofLockedTransactionMismatchError, @@ -210,10 +254,18 @@ pub enum BasicError { IdentityAssetLockTransactionIsNotFoundError(IdentityAssetLockTransactionIsNotFoundError), #[error(transparent)] - IdentityAssetLockTransactionOutPointAlreadyExistsError( - IdentityAssetLockTransactionOutPointAlreadyExistsError, + IdentityAssetLockTransactionOutPointAlreadyConsumedError( + IdentityAssetLockTransactionOutPointAlreadyConsumedError, + ), + + #[error(transparent)] + IdentityAssetLockTransactionOutPointNotEnoughBalanceError( + IdentityAssetLockTransactionOutPointNotEnoughBalanceError, ), + #[error(transparent)] + IdentityAssetLockStateTransitionReplayError(IdentityAssetLockStateTransitionReplayError), + #[error(transparent)] IdentityAssetLockTransactionOutputNotFoundError( IdentityAssetLockTransactionOutputNotFoundError, @@ -253,6 +305,15 @@ pub enum BasicError { #[error(transparent)] MissingMasterPublicKeyError(MissingMasterPublicKeyError), + #[error(transparent)] + TooManyMasterPublicKeyError(TooManyMasterPublicKeyError), + + #[error(transparent)] + MasterPublicKeyUpdateError(MasterPublicKeyUpdateError), + + #[error(transparent)] + InvalidDocumentTypeRequiredSecurityLevelError(InvalidDocumentTypeRequiredSecurityLevelError), + #[error(transparent)] InvalidIdentityPublicKeySecurityLevelError(InvalidIdentityPublicKeySecurityLevelError), @@ -305,6 +366,12 @@ pub enum BasicError { #[error(transparent)] IdentityCreditTransferToSelfError(IdentityCreditTransferToSelfError), + + #[error(transparent)] + InvalidDocumentTypeNameError(InvalidDocumentTypeNameError), + + #[error(transparent)] + IncompatibleDocumentTypeSchemaError(IncompatibleDocumentTypeSchemaError), } impl From for ConsensusError { diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_invalid_index_definition_update_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_invalid_index_definition_update_error.rs index 5c0b8020a58..52f4633e2ad 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_invalid_index_definition_update_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_invalid_index_definition_update_error.rs @@ -8,7 +8,7 @@ use thiserror::Error; #[derive( Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, )] -#[error("Document with type {document_type} has badly constructed index '{index_path}'. Existing properties in the indices should be defined in the beginning of it.")] +#[error("Document with type {document_type} could not add or remove '{index_path}' during data contract update as we do not allow modifications of data contract index paths")] #[platform_serialize(unversioned)] pub struct DataContractInvalidIndexDefinitionUpdateError { /* diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_max_depth_exceed_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_max_depth_exceed_error.rs index f30ca920e64..dd539edc469 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_max_depth_exceed_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/data_contract_max_depth_exceed_error.rs @@ -16,24 +16,16 @@ pub struct DataContractMaxDepthExceedError { DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION */ - schema_depth: usize, max_depth: usize, } impl DataContractMaxDepthExceedError { - pub fn new(schema_depth: usize, max_depth: usize) -> Self { - Self { - schema_depth, - max_depth, - } + pub fn new(max_depth: usize) -> Self { + Self { max_depth } } - pub fn max_depth(&self) -> usize { self.max_depth } - pub fn schema_depth(&self) -> usize { - self.schema_depth - } } impl From for ConsensusError { diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/document_types_are_missing_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/document_types_are_missing_error.rs new file mode 100644 index 00000000000..63de5d6fdda --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/document_types_are_missing_error.rs @@ -0,0 +1,43 @@ +use crate::consensus::basic::BasicError; +use crate::errors::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +use crate::consensus::ConsensusError; +use crate::prelude::Identifier; + +use crate::data_contract::errors::DataContractError; +use bincode::{Decode, Encode}; + +#[derive( + Error, Debug, Clone, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Data Contract {data_contract_id} must have at least one document type defined.")] +#[platform_serialize(unversioned)] +pub struct DocumentTypesAreMissingError { + data_contract_id: Identifier, +} + +impl DocumentTypesAreMissingError { + pub fn new(data_contract_id: Identifier) -> Self { + Self { data_contract_id } + } + + pub fn data_contract_id(&self) -> Identifier { + self.data_contract_id + } +} + +impl From for ConsensusError { + fn from(err: DocumentTypesAreMissingError) -> Self { + Self::BasicError(BasicError::ContractError( + DataContractError::DocumentTypesAreMissingError(err), + )) + } +} + +impl From for DataContractError { + fn from(err: DocumentTypesAreMissingError) -> Self { + DataContractError::DocumentTypesAreMissingError(err) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/incompatible_data_contract_schema_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/incompatible_data_contract_schema_error.rs index 10666a545a9..9a75c009495 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/data_contract/incompatible_data_contract_schema_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/incompatible_data_contract_schema_error.rs @@ -7,36 +7,25 @@ use crate::consensus::ConsensusError; use crate::prelude::Identifier; use bincode::{Decode, Encode}; -use platform_value::Value; #[derive( Error, Debug, Clone, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, )] -#[error("Data Contract updated schema is not backward compatible with one defined in Data Contract wid id {data_contract_id}. Field: '{field_path}', Operation: '{operation}'" +#[error("Data Contract updated schema is not backward compatible with one defined in Data Contract with id {data_contract_id}. Field: '{field_path}', Operation: '{operation}'" )] #[platform_serialize(unversioned)] pub struct IncompatibleDataContractSchemaError { data_contract_id: Identifier, operation: String, field_path: String, - old_schema: Value, - new_schema: Value, } impl IncompatibleDataContractSchemaError { - pub fn new( - data_contract_id: Identifier, - operation: String, - field_path: String, - old_schema: Value, - new_schema: Value, - ) -> Self { + pub fn new(data_contract_id: Identifier, operation: String, field_path: String) -> Self { Self { data_contract_id, operation, field_path, - old_schema, - new_schema, } } @@ -49,12 +38,6 @@ impl IncompatibleDataContractSchemaError { pub fn field_path(&self) -> String { self.field_path.clone() } - pub fn old_schema(&self) -> Value { - self.old_schema.clone() - } - pub fn new_schema(&self) -> Value { - self.new_schema.clone() - } } impl From for ConsensusError { diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/incompatible_document_type_schema_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/incompatible_document_type_schema_error.rs new file mode 100644 index 00000000000..2dd41eb12e4 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/incompatible_document_type_schema_error.rs @@ -0,0 +1,50 @@ +use crate::consensus::basic::BasicError; +use crate::errors::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +use crate::consensus::ConsensusError; + +use bincode::{Decode, Encode}; + +#[derive( + Error, Debug, Clone, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Updated document type '{document_type_name}' schema is not backward compatible with previous version. Incompatible change '{operation}' of property '{property_path}'" +)] +#[platform_serialize(unversioned)] +pub struct IncompatibleDocumentTypeSchemaError { + document_type_name: String, + operation: String, + property_path: String, +} + +impl IncompatibleDocumentTypeSchemaError { + pub fn new( + document_type_name: impl Into, + operation: impl Into, + property_path: impl Into, + ) -> Self { + Self { + document_type_name: document_type_name.into(), + operation: operation.into(), + property_path: property_path.into(), + } + } + + pub fn document_type_name(&self) -> &str { + &self.document_type_name + } + pub fn operation(&self) -> &str { + &self.operation + } + pub fn property_path(&self) -> &str { + &self.property_path + } +} + +impl From for ConsensusError { + fn from(err: IncompatibleDocumentTypeSchemaError) -> Self { + Self::BasicError(BasicError::IncompatibleDocumentTypeSchemaError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_data_contract_version_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_data_contract_version_error.rs index f978d38d20f..02fde1a679c 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_data_contract_version_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_data_contract_version_error.rs @@ -8,7 +8,7 @@ use thiserror::Error; #[derive( Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, )] -#[error("Data Contract version must be {expected_version}, go {version}")] +#[error("Data Contract version must be {expected_version}, got {version}")] #[platform_serialize(unversioned)] pub struct InvalidDataContractVersionError { /* diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_document_type_name_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_document_type_name_error.rs new file mode 100644 index 00000000000..8b9a8bf1c76 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_document_type_name_error.rs @@ -0,0 +1,36 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("document type name '{name}' is not supported. It must be from 1 to 64 alphanumeric chars, and '_' or '-'.")] +#[platform_serialize(unversioned)] +pub struct InvalidDocumentTypeNameError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + name: String, +} + +impl InvalidDocumentTypeNameError { + pub fn new(name: String) -> Self { + Self { name } + } + + pub fn name(&self) -> &str { + &self.name + } +} + +impl From for ConsensusError { + fn from(err: InvalidDocumentTypeNameError) -> Self { + Self::BasicError(BasicError::InvalidDocumentTypeNameError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_document_type_required_security_level.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_document_type_required_security_level.rs new file mode 100644 index 00000000000..dae65b27284 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_document_type_required_security_level.rs @@ -0,0 +1,60 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +use crate::identity::SecurityLevel; + +use bincode::{Decode, Encode}; +use platform_value::Identifier; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Invalid document type security level error security level: got {security_level:?} for {contract_id}::{document_type_name}")] +#[platform_serialize(unversioned)] +pub struct InvalidDocumentTypeRequiredSecurityLevelError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + security_level: SecurityLevel, + contract_id: Identifier, + document_type_name: String, +} + +impl InvalidDocumentTypeRequiredSecurityLevelError { + pub fn new( + security_level: SecurityLevel, + contract_id: Identifier, + document_type_name: String, + ) -> Self { + Self { + security_level, + contract_id, + document_type_name, + } + } + + pub fn security_level(&self) -> SecurityLevel { + self.security_level + } + + pub fn contract_id(&self) -> Identifier { + self.contract_id + } + + pub fn document_type_name(&self) -> &String { + &self.document_type_name + } +} + +impl From for ConsensusError { + fn from(err: InvalidDocumentTypeRequiredSecurityLevelError) -> Self { + Self::BasicError(BasicError::InvalidDocumentTypeRequiredSecurityLevelError( + err, + )) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/mod.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/mod.rs index 8c76d586b50..51526dceedd 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/data_contract/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/mod.rs @@ -3,24 +3,35 @@ mod data_contract_immutable_properties_update_error; mod data_contract_invalid_index_definition_update_error; pub mod data_contract_max_depth_exceed_error; mod data_contract_unique_indices_changed_error; +mod document_types_are_missing_error; mod duplicate_index_error; mod duplicate_index_name_error; mod incompatible_data_contract_schema_error; +mod incompatible_document_type_schema_error; mod incompatible_re2_pattern_error; mod invalid_compound_index_error; mod invalid_data_contract_id_error; mod invalid_data_contract_version_error; +mod invalid_document_type_name_error; +mod invalid_document_type_required_security_level; mod invalid_index_property_type_error; mod invalid_indexed_property_constraint_error; +#[cfg(feature = "json-schema-validation")] mod invalid_json_schema_ref_error; mod system_property_index_already_present_error; mod undefined_index_property_error; mod unique_indices_limit_reached_error; +mod unknown_document_creation_restriction_mode_error; +mod unknown_security_level_error; +mod unknown_storage_key_requirements_error; +mod unknown_trade_mode_error; +mod unknown_transferable_type_error; pub use data_contract_have_new_unique_index_error::*; pub use data_contract_immutable_properties_update_error::*; pub use data_contract_invalid_index_definition_update_error::*; pub use data_contract_unique_indices_changed_error::*; +pub use document_types_are_missing_error::*; pub use duplicate_index_error::*; pub use duplicate_index_name_error::*; pub use incompatible_data_contract_schema_error::*; @@ -28,10 +39,20 @@ pub use incompatible_re2_pattern_error::*; pub use invalid_compound_index_error::*; pub use invalid_data_contract_id_error::*; pub use invalid_data_contract_version_error::*; +pub use invalid_document_type_required_security_level::*; pub use invalid_index_property_type_error::*; pub use invalid_indexed_property_constraint_error::*; +#[cfg(feature = "json-schema-validation")] pub use invalid_json_schema_ref_error::*; -pub use invalid_json_schema_ref_error::*; + pub use system_property_index_already_present_error::*; pub use undefined_index_property_error::*; pub use unique_indices_limit_reached_error::*; + +pub use incompatible_document_type_schema_error::*; +pub use invalid_document_type_name_error::*; +pub use unknown_document_creation_restriction_mode_error::*; +pub use unknown_security_level_error::*; +pub use unknown_storage_key_requirements_error::*; +pub use unknown_trade_mode_error::*; +pub use unknown_transferable_type_error::*; diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_document_creation_restriction_mode_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_document_creation_restriction_mode_error.rs new file mode 100644 index 00000000000..2d55df7e397 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_document_creation_restriction_mode_error.rs @@ -0,0 +1,47 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "Unrecognized document creation restriction mode: allowed {:?}, got {}", + allowed_values, + received +)] +#[platform_serialize(unversioned)] +pub struct UnknownDocumentCreationRestrictionModeError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + allowed_values: Vec, + received: u8, +} + +impl UnknownDocumentCreationRestrictionModeError { + pub fn new(allowed_values: Vec, received: u8) -> Self { + Self { + allowed_values, + received, + } + } + + pub fn allowed_values(&self) -> Vec { + self.allowed_values.clone() + } + pub fn received(&self) -> u8 { + self.received + } +} + +impl From for ConsensusError { + fn from(err: UnknownDocumentCreationRestrictionModeError) -> Self { + Self::BasicError(BasicError::UnknownDocumentCreationRestrictionModeError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_security_level_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_security_level_error.rs new file mode 100644 index 00000000000..325c5641106 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_security_level_error.rs @@ -0,0 +1,47 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "Unrecognized security level: allowed {:?}, got {}", + allowed_values, + received +)] +#[platform_serialize(unversioned)] +pub struct UnknownSecurityLevelError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + allowed_values: Vec, + received: u8, +} + +impl UnknownSecurityLevelError { + pub fn new(allowed_values: Vec, received: u8) -> Self { + Self { + allowed_values, + received, + } + } + + pub fn allowed_values(&self) -> Vec { + self.allowed_values.clone() + } + pub fn received(&self) -> u8 { + self.received + } +} + +impl From for ConsensusError { + fn from(err: UnknownSecurityLevelError) -> Self { + Self::BasicError(BasicError::UnknownSecurityLevelError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_storage_key_requirements_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_storage_key_requirements_error.rs new file mode 100644 index 00000000000..82d00e70371 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_storage_key_requirements_error.rs @@ -0,0 +1,47 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "Unrecognized storage key requirements: allowed {:?}, got {}", + allowed_values, + received +)] +#[platform_serialize(unversioned)] +pub struct UnknownStorageKeyRequirementsError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + allowed_values: Vec, + received: i128, +} + +impl UnknownStorageKeyRequirementsError { + pub fn new(allowed_values: Vec, received: i128) -> Self { + Self { + allowed_values, + received, + } + } + + pub fn allowed_values(&self) -> Vec { + self.allowed_values.clone() + } + pub fn received(&self) -> i128 { + self.received + } +} + +impl From for ConsensusError { + fn from(err: UnknownStorageKeyRequirementsError) -> Self { + Self::BasicError(BasicError::UnknownStorageKeyRequirementsError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_trade_mode_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_trade_mode_error.rs new file mode 100644 index 00000000000..bbf57f33351 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_trade_mode_error.rs @@ -0,0 +1,47 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "Unrecognized trade mode: allowed {:?}, got {}", + allowed_values, + received +)] +#[platform_serialize(unversioned)] +pub struct UnknownTradeModeError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + allowed_values: Vec, + received: u8, +} + +impl UnknownTradeModeError { + pub fn new(allowed_values: Vec, received: u8) -> Self { + Self { + allowed_values, + received, + } + } + + pub fn allowed_values(&self) -> Vec { + self.allowed_values.clone() + } + pub fn received(&self) -> u8 { + self.received + } +} + +impl From for ConsensusError { + fn from(err: UnknownTradeModeError) -> Self { + Self::BasicError(BasicError::UnknownTradeModeError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_transferable_type_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_transferable_type_error.rs new file mode 100644 index 00000000000..0ed1a89d4cf --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/unknown_transferable_type_error.rs @@ -0,0 +1,47 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "Unrecognized transferable type: allowed {:?}, got {}", + allowed_values, + received +)] +#[platform_serialize(unversioned)] +pub struct UnknownTransferableTypeError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + allowed_values: Vec, + received: u8, +} + +impl UnknownTransferableTypeError { + pub fn new(allowed_values: Vec, received: u8) -> Self { + Self { + allowed_values, + received, + } + } + + pub fn allowed_values(&self) -> Vec { + self.allowed_values.clone() + } + pub fn received(&self) -> u8 { + self.received + } +} + +impl From for ConsensusError { + fn from(err: UnknownTransferableTypeError) -> Self { + Self::BasicError(BasicError::UnknownTransferableTypeError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/decode/decoding_error.rs b/packages/rs-dpp/src/errors/consensus/basic/decode/decoding_error.rs new file mode 100644 index 00000000000..2fe833be139 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/decode/decoding_error.rs @@ -0,0 +1,44 @@ +use crate::consensus::basic::BasicError; +use crate::errors::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +use crate::consensus::ConsensusError; +use crate::data_contract::errors::DataContractError; +use bincode::{Decode, Encode}; + +#[derive(Error, Debug, Clone, Encode, Decode, PlatformSerialize, PlatformDeserialize)] +#[error("Decoding error: {error}")] +#[platform_serialize(unversioned)] +pub struct DecodingError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + error: String, +} + +impl DecodingError { + pub fn new(error: String) -> Self { + Self { error } + } + + pub fn error(&self) -> &str { + &self.error + } +} + +impl From for ConsensusError { + fn from(err: DecodingError) -> Self { + Self::BasicError(BasicError::ContractError( + DataContractError::DecodingContractError(err), + )) + } +} + +impl From for DataContractError { + fn from(err: DecodingError) -> Self { + Self::DecodingContractError(err) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/decode/mod.rs b/packages/rs-dpp/src/errors/consensus/basic/decode/mod.rs index 115329f17ce..68796ee211e 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/decode/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/decode/mod.rs @@ -1,7 +1,9 @@ +mod decoding_error; mod protocol_version_parsing_error; mod serialized_object_parsing_error; mod version_error; +pub use decoding_error::*; pub use protocol_version_parsing_error::*; pub use serialized_object_parsing_error::*; pub use version_error::*; diff --git a/packages/rs-dpp/src/errors/consensus/basic/document/document_creation_not_allowed_error.rs b/packages/rs-dpp/src/errors/consensus/basic/document/document_creation_not_allowed_error.rs new file mode 100644 index 00000000000..5ad1732dddc --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/document/document_creation_not_allowed_error.rs @@ -0,0 +1,58 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::data_contract::document_type::restricted_creation::CreationRestrictionMode; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Document Creation on {data_contract_id}:{document_type_name} is not allowed because of the document type's creation restriction mode {creation_restriction_mode}")] +#[platform_serialize(unversioned)] +pub struct DocumentCreationNotAllowedError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + data_contract_id: Identifier, + + document_type_name: String, + + creation_restriction_mode: CreationRestrictionMode, +} + +impl DocumentCreationNotAllowedError { + pub fn new( + data_contract_id: Identifier, + document_type_name: String, + creation_restriction_mode: CreationRestrictionMode, + ) -> Self { + Self { + data_contract_id, + document_type_name, + creation_restriction_mode, + } + } + + pub fn data_contract_id(&self) -> Identifier { + self.data_contract_id + } + + pub fn document_type_name(&self) -> &str { + self.document_type_name.as_str() + } + + pub fn creation_restriction_mode(&self) -> CreationRestrictionMode { + self.creation_restriction_mode + } +} + +impl From for ConsensusError { + fn from(err: DocumentCreationNotAllowedError) -> Self { + Self::BasicError(BasicError::DocumentCreationNotAllowedError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/document/document_transitions_are_absent_error.rs b/packages/rs-dpp/src/errors/consensus/basic/document/document_transitions_are_absent_error.rs index 932c01d4c48..854a530cb31 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/document/document_transitions_are_absent_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/document/document_transitions_are_absent_error.rs @@ -13,6 +13,12 @@ use thiserror::Error; #[platform_serialize(unversioned)] pub struct DocumentTransitionsAreAbsentError {} +impl Default for DocumentTransitionsAreAbsentError { + fn default() -> Self { + Self::new() + } +} + impl DocumentTransitionsAreAbsentError { pub fn new() -> Self { Self {} diff --git a/packages/rs-dpp/src/errors/consensus/basic/document/identity_contract_nonce_out_of_bounds_error.rs b/packages/rs-dpp/src/errors/consensus/basic/document/identity_contract_nonce_out_of_bounds_error.rs new file mode 100644 index 00000000000..54eee70ff2c --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/document/identity_contract_nonce_out_of_bounds_error.rs @@ -0,0 +1,37 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use crate::prelude::IdentityNonce; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Nonce is out of bounds: {}", nonce)] +#[platform_serialize(unversioned)] +pub struct NonceOutOfBoundsError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + nonce: IdentityNonce, +} + +impl NonceOutOfBoundsError { + pub fn new(nonce: IdentityNonce) -> Self { + Self { nonce } + } + + pub fn identity_contract_nonce(&self) -> IdentityNonce { + self.nonce + } +} + +impl From for ConsensusError { + fn from(err: NonceOutOfBoundsError) -> Self { + Self::BasicError(BasicError::NonceOutOfBoundsError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/document/max_documents_transitions_exceeded_error.rs b/packages/rs-dpp/src/errors/consensus/basic/document/max_documents_transitions_exceeded_error.rs index 8ebd8681547..549ae5d3fc6 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/document/max_documents_transitions_exceeded_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/document/max_documents_transitions_exceeded_error.rs @@ -17,15 +17,15 @@ pub struct MaxDocumentsTransitionsExceededError { DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION */ - max_transitions: u32, + max_transitions: u16, } impl MaxDocumentsTransitionsExceededError { - pub fn new(max_transitions: u32) -> Self { + pub fn new(max_transitions: u16) -> Self { Self { max_transitions } } - pub fn max_transitions(&self) -> u32 { + pub fn max_transitions(&self) -> u16 { self.max_transitions } } diff --git a/packages/rs-dpp/src/errors/consensus/basic/document/mod.rs b/packages/rs-dpp/src/errors/consensus/basic/document/mod.rs index 97346e5b0ac..9c011e12b59 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/document/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/document/mod.rs @@ -1,7 +1,9 @@ mod data_contract_not_present_error; +mod document_creation_not_allowed_error; mod document_transitions_are_absent_error; mod duplicate_document_transitions_with_ids_error; mod duplicate_document_transitions_with_indices_error; +mod identity_contract_nonce_out_of_bounds_error; mod inconsistent_compound_index_data_error; mod invalid_document_transition_action_error; mod invalid_document_transition_id_error; @@ -14,9 +16,11 @@ mod missing_document_type_error; mod missing_positions_in_document_type_properties_error; pub use data_contract_not_present_error::*; +pub use document_creation_not_allowed_error::*; pub use document_transitions_are_absent_error::*; pub use duplicate_document_transitions_with_ids_error::*; pub use duplicate_document_transitions_with_indices_error::*; +pub use identity_contract_nonce_out_of_bounds_error::*; pub use inconsistent_compound_index_data_error::*; pub use invalid_document_transition_action_error::*; pub use invalid_document_transition_id_error::*; diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/disabling_key_id_also_being_added_in_same_transition_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/disabling_key_id_also_being_added_in_same_transition_error.rs new file mode 100644 index 00000000000..4d37c1e4e70 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/disabling_key_id_also_being_added_in_same_transition_error.rs @@ -0,0 +1,36 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use crate::identity::KeyID; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Disabling a key with id {key_id:?} that is being added in same state transition")] +#[platform_serialize(unversioned)] +pub struct DisablingKeyIdAlsoBeingAddedInSameTransitionError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + key_id: KeyID, +} + +impl DisablingKeyIdAlsoBeingAddedInSameTransitionError { + pub fn new(key_id: KeyID) -> Self { + Self { key_id } + } + + pub fn key_id(&self) -> KeyID { + self.key_id + } +} +impl From for ConsensusError { + fn from(err: DisablingKeyIdAlsoBeingAddedInSameTransitionError) -> Self { + Self::BasicError(BasicError::DisablingKeyIdAlsoBeingAddedInSameTransitionError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_state_transition_replay_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_state_transition_replay_error.rs new file mode 100644 index 00000000000..8c1e8ab9401 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_state_transition_replay_error.rs @@ -0,0 +1,56 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use dashcore::Txid; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Bytes32; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Asset lock transaction {transaction_id} is trying to be replayed and will be discarded")] +#[platform_serialize(unversioned)] +pub struct IdentityAssetLockStateTransitionReplayError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + #[platform_serialize(with_serde)] + #[bincode(with_serde)] + transaction_id: Txid, + + output_index: usize, + + state_transition_id: Bytes32, +} + +impl IdentityAssetLockStateTransitionReplayError { + pub fn new(transaction_id: Txid, output_index: usize, state_transition_id: Bytes32) -> Self { + Self { + transaction_id, + output_index, + state_transition_id, + } + } + + pub fn transaction_id(&self) -> Txid { + self.transaction_id + } + + pub fn state_transition_id(&self) -> Bytes32 { + self.state_transition_id + } + + pub fn output_index(&self) -> usize { + self.output_index + } +} + +impl From for ConsensusError { + fn from(err: IdentityAssetLockStateTransitionReplayError) -> Self { + Self::BasicError(BasicError::IdentityAssetLockStateTransitionReplayError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_consumed_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_consumed_error.rs new file mode 100644 index 00000000000..250d2fc72cc --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_consumed_error.rs @@ -0,0 +1,47 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use dashcore::Txid; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Asset lock transaction {transaction_id} output {output_index} already completely used")] +#[platform_serialize(unversioned)] +pub struct IdentityAssetLockTransactionOutPointAlreadyConsumedError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + #[platform_serialize(with_serde)] + #[bincode(with_serde)] + transaction_id: Txid, + output_index: usize, +} + +impl IdentityAssetLockTransactionOutPointAlreadyConsumedError { + pub fn new(transaction_id: Txid, output_index: usize) -> Self { + Self { + transaction_id, + output_index, + } + } + + pub fn output_index(&self) -> usize { + self.output_index + } + + pub fn transaction_id(&self) -> Txid { + self.transaction_id + } +} + +impl From for ConsensusError { + fn from(err: IdentityAssetLockTransactionOutPointAlreadyConsumedError) -> Self { + Self::BasicError(BasicError::IdentityAssetLockTransactionOutPointAlreadyConsumedError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_exists_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_exists_error.rs deleted file mode 100644 index 31b149e0e1d..00000000000 --- a/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_exists_error.rs +++ /dev/null @@ -1,47 +0,0 @@ -use crate::consensus::basic::BasicError; -use crate::consensus::ConsensusError; -use crate::errors::ProtocolError; -use bincode::{Decode, Encode}; -use dashcore::Txid; -use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; -use thiserror::Error; - -#[derive( - Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, -)] -#[error("Asset lock transaction {transaction_id} output {output_index} already used")] -#[platform_serialize(unversioned)] -pub struct IdentityAssetLockTransactionOutPointAlreadyExistsError { - /* - - DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION - - */ - #[platform_serialize(with_serde)] - #[bincode(with_serde)] - transaction_id: Txid, - output_index: usize, -} - -impl IdentityAssetLockTransactionOutPointAlreadyExistsError { - pub fn new(transaction_id: Txid, output_index: usize) -> Self { - Self { - transaction_id, - output_index, - } - } - - pub fn output_index(&self) -> usize { - self.output_index - } - - pub fn transaction_id(&self) -> Txid { - self.transaction_id - } -} - -impl From for ConsensusError { - fn from(err: IdentityAssetLockTransactionOutPointAlreadyExistsError) -> Self { - Self::BasicError(BasicError::IdentityAssetLockTransactionOutPointAlreadyExistsError(err)) - } -} diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_not_enough_balance_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_not_enough_balance_error.rs new file mode 100644 index 00000000000..98db7c70539 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_not_enough_balance_error.rs @@ -0,0 +1,72 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use crate::fee::Credits; +use bincode::{Decode, Encode}; +use dashcore::Txid; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Asset lock transaction {transaction_id} output {output_index} only has {credits_left} credits left out of {initial_asset_lock_credits} initial credits on the asset lock but needs {credits_required} credits to start processing")] +#[platform_serialize(unversioned)] +pub struct IdentityAssetLockTransactionOutPointNotEnoughBalanceError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + #[platform_serialize(with_serde)] + #[bincode(with_serde)] + transaction_id: Txid, + output_index: usize, + initial_asset_lock_credits: Credits, + credits_left: Credits, + credits_required: Credits, +} + +impl IdentityAssetLockTransactionOutPointNotEnoughBalanceError { + pub fn new( + transaction_id: Txid, + output_index: usize, + initial_asset_lock_credits: Credits, + credits_left: Credits, + credits_required: Credits, + ) -> Self { + Self { + transaction_id, + output_index, + initial_asset_lock_credits, + credits_left, + credits_required, + } + } + + pub fn output_index(&self) -> usize { + self.output_index + } + + pub fn transaction_id(&self) -> Txid { + self.transaction_id + } + + pub fn initial_asset_lock_credits(&self) -> Credits { + self.initial_asset_lock_credits + } + + pub fn credits_left(&self) -> Credits { + self.credits_left + } + + pub fn credits_required(&self) -> Credits { + self.credits_required + } +} + +impl From for ConsensusError { + fn from(err: IdentityAssetLockTransactionOutPointNotEnoughBalanceError) -> Self { + Self::BasicError(BasicError::IdentityAssetLockTransactionOutPointNotEnoughBalanceError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_core_fee_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_core_fee_error.rs index 357b3389fd5..2c3be767a38 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_core_fee_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_core_fee_error.rs @@ -10,7 +10,7 @@ use bincode::{Decode, Encode}; #[derive( Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, )] -#[error("Core fee per byte {core_fee_per_byte:?} must be part of fibonacci sequence")] +#[error("Core fee per byte {core_fee_per_byte:?} must be part of fibonacci sequence and not less than {min_core_fee_per_byte:?}")] #[platform_serialize(unversioned)] pub struct InvalidIdentityCreditWithdrawalTransitionCoreFeeError { /* @@ -19,16 +19,23 @@ pub struct InvalidIdentityCreditWithdrawalTransitionCoreFeeError { */ core_fee_per_byte: u32, + min_core_fee_per_byte: u32, } impl InvalidIdentityCreditWithdrawalTransitionCoreFeeError { - pub fn new(core_fee_per_byte: u32) -> Self { - Self { core_fee_per_byte } + pub fn new(core_fee_per_byte: u32, min_core_fee_per_byte: u32) -> Self { + Self { + core_fee_per_byte, + min_core_fee_per_byte, + } } pub fn core_fee_per_byte(&self) -> u32 { self.core_fee_per_byte } + pub fn min_core_fee_per_byte(&self) -> u32 { + self.min_core_fee_per_byte + } } impl From for ConsensusError { diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_update_transition_disable_keys_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_update_transition_disable_keys_error.rs index dc6fa9e9c82..81bff1d14a2 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_update_transition_disable_keys_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_update_transition_disable_keys_error.rs @@ -14,6 +14,12 @@ use bincode::{Decode, Encode}; #[platform_serialize(unversioned)] pub struct InvalidIdentityUpdateTransitionDisableKeysError; +impl Default for InvalidIdentityUpdateTransitionDisableKeysError { + fn default() -> Self { + Self::new() + } +} + impl InvalidIdentityUpdateTransitionDisableKeysError { pub fn new() -> Self { Self {} diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_update_transition_empty_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_update_transition_empty_error.rs index a553800f600..03048789878 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_update_transition_empty_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_identity_update_transition_empty_error.rs @@ -14,6 +14,12 @@ use bincode::{Decode, Encode}; #[platform_serialize(unversioned)] pub struct InvalidIdentityUpdateTransitionEmptyError; +impl Default for InvalidIdentityUpdateTransitionEmptyError { + fn default() -> Self { + Self::new() + } +} + impl InvalidIdentityUpdateTransitionEmptyError { pub fn new() -> Self { Self {} diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/mod.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/mod.rs index fc70b59971f..aafc111b859 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/identity/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/mod.rs @@ -1,9 +1,12 @@ pub use data_contract_bounds_not_present_error::*; +pub use disabling_key_id_also_being_added_in_same_transition_error::*; pub use duplicated_identity_public_key_basic_error::*; pub use duplicated_identity_public_key_id_basic_error::*; pub use identity_asset_lock_proof_locked_transaction_mismatch_error::*; +pub use identity_asset_lock_state_transition_replay_error::*; pub use identity_asset_lock_transaction_is_not_found_error::*; -pub use identity_asset_lock_transaction_out_point_already_exists_error::*; +pub use identity_asset_lock_transaction_out_point_already_consumed_error::*; +pub use identity_asset_lock_transaction_out_point_not_enough_balance_error::*; pub use identity_asset_lock_transaction_output_not_found_error::*; pub use identity_credit_transfer_to_self_error::*; pub use invalid_asset_lock_proof_core_chain_height_error::*; @@ -25,13 +28,18 @@ pub use invalid_instant_asset_lock_proof_error::*; pub use invalid_instant_asset_lock_proof_signature_error::*; pub use missing_master_public_key_error::*; pub use not_implemented_identity_credit_withdrawal_transition_pooling_error::*; +pub use too_many_master_public_key_error::*; mod data_contract_bounds_not_present_error; +mod disabling_key_id_also_being_added_in_same_transition_error; mod duplicated_identity_public_key_basic_error; mod duplicated_identity_public_key_id_basic_error; mod identity_asset_lock_proof_locked_transaction_mismatch_error; mod identity_asset_lock_transaction_is_not_found_error; -mod identity_asset_lock_transaction_out_point_already_exists_error; +mod identity_asset_lock_transaction_out_point_already_consumed_error; + +mod identity_asset_lock_state_transition_replay_error; +mod identity_asset_lock_transaction_out_point_not_enough_balance_error; mod identity_asset_lock_transaction_output_not_found_error; mod identity_credit_transfer_to_self_error; mod invalid_asset_lock_proof_core_chain_height_error; @@ -53,3 +61,4 @@ mod invalid_instant_asset_lock_proof_error; mod invalid_instant_asset_lock_proof_signature_error; mod missing_master_public_key_error; mod not_implemented_identity_credit_withdrawal_transition_pooling_error; +mod too_many_master_public_key_error; diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/too_many_master_public_key_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/too_many_master_public_key_error.rs new file mode 100644 index 00000000000..0b8bda2d2c0 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/too_many_master_public_key_error.rs @@ -0,0 +1,42 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +use bincode::{Decode, Encode}; + +#[derive( + Error, + Debug, + Clone, + PartialEq, + Eq, + Default, + Encode, + Decode, + PlatformSerialize, + PlatformDeserialize, +)] +#[error( + "Identity is trying to be created with more than one master key. Please only use one master key." +)] +#[platform_serialize(unversioned)] +pub struct TooManyMasterPublicKeyError; + +/* + +DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + +*/ + +impl TooManyMasterPublicKeyError { + pub fn new() -> Self { + Self + } +} +impl From for ConsensusError { + fn from(err: TooManyMasterPublicKeyError) -> Self { + Self::BasicError(BasicError::TooManyMasterPublicKeyError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/json_schema_error/json_schema_error_data.rs b/packages/rs-dpp/src/errors/consensus/basic/json_schema_error/json_schema_error_data.rs index bceddf8afdd..85a8c5bd93a 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/json_schema_error/json_schema_error_data.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/json_schema_error/json_schema_error_data.rs @@ -142,7 +142,7 @@ impl<'a> From<&ValidationError<'a>> for JsonSchemaErrorData { keyword, params, property_name, - error_message, + error_message: _, } = JsonSchemaErrorData::from(error.deref()); builder diff --git a/packages/rs-dpp/src/errors/consensus/basic/mod.rs b/packages/rs-dpp/src/errors/consensus/basic/mod.rs index 1c417e2ee85..d38bbe09387 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/mod.rs @@ -12,7 +12,9 @@ pub mod unsupported_protocol_version_error; pub mod basic_error; pub mod invalid_identifier_error; +#[cfg(feature = "json-schema-validation")] pub mod json_schema_compilation_error; +#[cfg(feature = "json-schema-validation")] pub mod json_schema_error; pub mod state_transition; pub mod unsupported_version_error; diff --git a/packages/rs-dpp/src/errors/consensus/basic/state_transition/state_transition_max_size_exceeded_error.rs b/packages/rs-dpp/src/errors/consensus/basic/state_transition/state_transition_max_size_exceeded_error.rs index 8de34c07cd8..8d33a1999d1 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/state_transition/state_transition_max_size_exceeded_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/state_transition/state_transition_max_size_exceeded_error.rs @@ -8,7 +8,7 @@ use thiserror::Error; #[derive( Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, )] -#[error("State transition size {actual_size_kbytes} KB is more than maximum {max_size_kbytes} KB")] +#[error("State transition size {actual_size_bytes} is more than maximum {max_size_bytes}")] #[platform_serialize(unversioned)] pub struct StateTransitionMaxSizeExceededError { /* @@ -16,23 +16,23 @@ pub struct StateTransitionMaxSizeExceededError { DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION */ - actual_size_kbytes: usize, - max_size_kbytes: usize, + actual_size_bytes: u64, + max_size_bytes: u64, } impl StateTransitionMaxSizeExceededError { - pub fn new(actual_size_kbytes: usize, max_size_kbytes: usize) -> Self { + pub fn new(actual_size_bytes: u64, max_size_bytes: u64) -> Self { Self { - actual_size_kbytes, - max_size_kbytes, + actual_size_bytes, + max_size_bytes, } } - pub fn actual_size_kbytes(&self) -> usize { - self.actual_size_kbytes + pub fn actual_size_bytes(&self) -> u64 { + self.actual_size_bytes } - pub fn max_size_kbytes(&self) -> usize { - self.max_size_kbytes + pub fn max_size_bytes(&self) -> u64 { + self.max_size_bytes } } diff --git a/packages/rs-dpp/src/errors/consensus/basic/unsupported_protocol_version_error.rs b/packages/rs-dpp/src/errors/consensus/basic/unsupported_protocol_version_error.rs index a7e258e6c96..9021c8df0e3 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/unsupported_protocol_version_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/unsupported_protocol_version_error.rs @@ -3,8 +3,7 @@ use crate::consensus::ConsensusError; use crate::errors::ProtocolError; use bincode::{Decode, Encode}; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; -use platform_value::Value; -use std::convert::TryFrom; + use thiserror::Error; #[derive( diff --git a/packages/rs-dpp/src/errors/consensus/basic/unsupported_version_error.rs b/packages/rs-dpp/src/errors/consensus/basic/unsupported_version_error.rs index fe6f447eb3e..cba93d0a35c 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/unsupported_version_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/unsupported_version_error.rs @@ -3,8 +3,7 @@ use crate::consensus::ConsensusError; use crate::errors::ProtocolError; use bincode::{Decode, Encode}; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; -use platform_value::Value; -use std::convert::TryFrom; + use thiserror::Error; #[derive( diff --git a/packages/rs-dpp/src/errors/consensus/basic/value_error.rs b/packages/rs-dpp/src/errors/consensus/basic/value_error.rs index ce787a06d7c..83f1b85cdb5 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/value_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/value_error.rs @@ -1,6 +1,6 @@ use crate::consensus::basic::BasicError; use crate::consensus::ConsensusError; -use crate::errors::ProtocolError; +use crate::ProtocolError; use bincode::{Decode, Encode}; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; use platform_value::Error as PlatformValueError; @@ -27,6 +27,10 @@ impl ValueError { } } + pub fn new_from_string(value_error: String) -> Self { + Self { value_error } + } + pub fn value_error(&self) -> &str { &self.value_error } @@ -36,3 +40,9 @@ impl From for ConsensusError { Self::BasicError(BasicError::ValueError(err)) } } + +impl From for ValueError { + fn from(err: PlatformValueError) -> Self { + ValueError::new(err) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/codes.rs b/packages/rs-dpp/src/errors/consensus/codes.rs index ea032c311bc..0a8201bfb65 100644 --- a/packages/rs-dpp/src/errors/consensus/codes.rs +++ b/packages/rs-dpp/src/errors/consensus/codes.rs @@ -1,6 +1,7 @@ use crate::consensus::signature::SignatureError; #[cfg(feature = "state-transition-validation")] use crate::consensus::state::data_trigger::DataTriggerError; +use crate::data_contract::errors::DataContractError; use crate::errors::consensus::{ basic::BasicError, fee::fee_error::FeeError, state::state_error::StateError, ConsensusError, @@ -25,95 +26,132 @@ impl ErrorWithCode for ConsensusError { } } } - impl ErrorWithCode for BasicError { fn code(&self) -> u32 { match self { - // Versioning - Self::UnsupportedVersionError(_) => 1100, - // Decoding - Self::ProtocolVersionParsingError { .. } => 1000, - Self::SerializedObjectParsingError { .. } => 1001, - Self::UnsupportedProtocolVersionError(_) => 1002, - Self::IncompatibleProtocolVersionError(_) => 1003, - Self::VersionError(_) => 1004, - - // Structure error - Self::JsonSchemaCompilationError(..) => 1004, - Self::JsonSchemaError(_) => 1005, - Self::InvalidIdentifierError { .. } => 1006, - Self::ValueError(_) => 1060, - - // DataContract - Self::DataContractMaxDepthExceedError { .. } => 1007, - Self::DuplicateIndexError { .. } => 1008, - Self::IncompatibleRe2PatternError { .. } => 1009, - Self::InvalidCompoundIndexError { .. } => 1010, - Self::InvalidDataContractIdError { .. } => 1011, - Self::InvalidIndexedPropertyConstraintError { .. } => 1012, - Self::InvalidIndexPropertyTypeError { .. } => 1013, - Self::InvalidJsonSchemaRefError { .. } => 1014, - Self::SystemPropertyIndexAlreadyPresentError { .. } => 1015, - Self::UndefinedIndexPropertyError { .. } => 1016, - Self::UniqueIndicesLimitReachedError { .. } => 1017, - Self::DuplicateIndexNameError { .. } => 1048, - Self::InvalidDataContractVersionError { .. } => 1050, - Self::IncompatibleDataContractSchemaError { .. } => 1051, - Self::DataContractImmutablePropertiesUpdateError { .. } => 1052, - Self::DataContractUniqueIndicesChangedError { .. } => 1053, - Self::DataContractInvalidIndexDefinitionUpdateError { .. } => 1054, - Self::DataContractHaveNewUniqueIndexError { .. } => 1055, - - // Document - Self::DataContractNotPresentError { .. } => 1018, - Self::DuplicateDocumentTransitionsWithIdsError { .. } => 1019, - Self::DuplicateDocumentTransitionsWithIndicesError { .. } => 1020, - Self::InconsistentCompoundIndexDataError { .. } => 1021, - Self::InvalidDocumentTransitionActionError { .. } => 1022, - Self::InvalidDocumentTransitionIdError { .. } => 1023, - Self::InvalidDocumentTypeError { .. } => 1024, - Self::MissingDataContractIdBasicError { .. } => 1025, - Self::MissingDocumentTransitionActionError { .. } => 1026, - Self::MissingDocumentTransitionTypeError { .. } => 1027, - Self::MissingDocumentTypeError { .. } => 1028, - Self::MissingPositionsInDocumentTypePropertiesError { .. } => 1067, - Self::MaxDocumentsTransitionsExceededError { .. } => 1065, - Self::DocumentTransitionsAreAbsentError { .. } => 1068, - - // Identity - Self::DuplicatedIdentityPublicKeyBasicError(_) => 1029, - Self::DuplicatedIdentityPublicKeyIdBasicError(_) => 1030, - Self::IdentityAssetLockProofLockedTransactionMismatchError(_) => 1031, - Self::IdentityAssetLockTransactionIsNotFoundError(_) => 1032, - Self::IdentityAssetLockTransactionOutPointAlreadyExistsError(_) => 1033, - Self::IdentityAssetLockTransactionOutputNotFoundError(_) => 1034, - Self::InvalidAssetLockProofCoreChainHeightError(_) => 1035, - Self::InvalidAssetLockProofTransactionHeightError(_) => 1036, - Self::InvalidAssetLockTransactionOutputReturnSizeError(_) => 1037, - Self::InvalidIdentityAssetLockTransactionError(_) => 1038, - Self::InvalidIdentityAssetLockTransactionOutputError(_) => 1039, - Self::InvalidIdentityPublicKeyDataError(_) => 1040, - Self::InvalidInstantAssetLockProofError(_) => 1041, - Self::InvalidInstantAssetLockProofSignatureError(_) => 1042, - Self::InvalidIdentityAssetLockProofChainLockValidationError(_) => 1043, - Self::DataContractBoundsNotPresentError(_) => 1066, - - Self::MissingMasterPublicKeyError(_) => 1046, - Self::InvalidIdentityPublicKeySecurityLevelError(_) => 1047, - Self::InvalidIdentityKeySignatureError { .. } => 1056, - Self::InvalidIdentityCreditWithdrawalTransitionOutputScriptError(_) => 1057, - Self::InvalidIdentityCreditWithdrawalTransitionCoreFeeError(_) => 1058, - Self::NotImplementedIdentityCreditWithdrawalTransitionPoolingError(_) => 1059, - Self::InvalidIdentityCreditTransferAmountError(_) => 1061, - Self::InvalidIdentityCreditWithdrawalTransitionAmountError(_) => 1062, - Self::InvalidIdentityUpdateTransitionEmptyError(_) => 1063, - Self::InvalidIdentityUpdateTransitionDisableKeysError(_) => 1064, - Self::IdentityCreditTransferToSelfError(_) => 1070, - - // State Transition - Self::InvalidStateTransitionTypeError { .. } => 1043, - Self::MissingStateTransitionTypeError { .. } => 1044, - Self::StateTransitionMaxSizeExceededError { .. } => 1045, + // Versioning Errors: 10000-10099 + Self::UnsupportedVersionError(_) => 10000, + Self::ProtocolVersionParsingError { .. } => 10001, + Self::SerializedObjectParsingError { .. } => 10002, + Self::UnsupportedProtocolVersionError(_) => 10003, + Self::IncompatibleProtocolVersionError(_) => 10004, + Self::VersionError(_) => 10005, + + // Structure Errors: 10100-10199 + #[cfg(feature = "json-schema-validation")] + Self::JsonSchemaCompilationError(..) => 10100, + #[cfg(feature = "json-schema-validation")] + Self::JsonSchemaError(_) => 10101, + Self::InvalidIdentifierError { .. } => 10102, + Self::ValueError(_) => 10103, + + // DataContract Errors: 10200-10399 + Self::DataContractMaxDepthExceedError { .. } => 10200, + Self::DuplicateIndexError { .. } => 10201, + Self::IncompatibleRe2PatternError { .. } => 10202, + Self::InvalidCompoundIndexError { .. } => 10203, + Self::InvalidDataContractIdError { .. } => 10204, + Self::InvalidIndexedPropertyConstraintError { .. } => 10205, + Self::InvalidIndexPropertyTypeError { .. } => 10206, + #[cfg(feature = "json-schema-validation")] + Self::InvalidJsonSchemaRefError { .. } => 10207, + Self::SystemPropertyIndexAlreadyPresentError { .. } => 10208, + Self::UndefinedIndexPropertyError { .. } => 10209, + Self::UniqueIndicesLimitReachedError { .. } => 10210, + Self::DuplicateIndexNameError { .. } => 10211, + Self::InvalidDataContractVersionError { .. } => 10212, + Self::IncompatibleDataContractSchemaError { .. } => 10213, + Self::ContractError(DataContractError::DocumentTypesAreMissingError { .. }) => 10214, + Self::DataContractImmutablePropertiesUpdateError { .. } => 10215, + Self::DataContractUniqueIndicesChangedError { .. } => 10216, + Self::DataContractInvalidIndexDefinitionUpdateError { .. } => 10217, + Self::DataContractHaveNewUniqueIndexError { .. } => 10218, + Self::InvalidDocumentTypeRequiredSecurityLevelError { .. } => 10219, + Self::UnknownSecurityLevelError { .. } => 10220, + Self::UnknownStorageKeyRequirementsError { .. } => 10221, + Self::ContractError(DataContractError::DecodingContractError { .. }) => 10222, + Self::ContractError(DataContractError::DecodingDocumentError { .. }) => 10223, + Self::ContractError(DataContractError::InvalidDocumentTypeError { .. }) => 10224, + Self::ContractError(DataContractError::MissingRequiredKey(_)) => 10225, + Self::ContractError(DataContractError::FieldRequirementUnmet(_)) => 10226, + Self::ContractError(DataContractError::KeyWrongType(_)) => 10227, + Self::ContractError(DataContractError::ValueWrongType(_)) => 10228, + Self::ContractError(DataContractError::ValueDecodingError(_)) => 10229, + Self::ContractError(DataContractError::EncodingDataStructureNotSupported(_)) => 10230, + Self::ContractError(DataContractError::InvalidContractStructure(_)) => 10231, + Self::ContractError(DataContractError::DocumentTypeNotFound(_)) => 10232, + Self::ContractError(DataContractError::DocumentTypeFieldNotFound(_)) => 10233, + Self::ContractError(DataContractError::ReferenceDefinitionNotFound(_)) => 10234, + Self::ContractError(DataContractError::DocumentOwnerIdMissing(_)) => 10235, + Self::ContractError(DataContractError::DocumentIdMissing(_)) => 10236, + Self::ContractError(DataContractError::Unsupported(_)) => 10237, + Self::ContractError(DataContractError::CorruptedSerialization(_)) => 10238, + Self::ContractError(DataContractError::JsonSchema(_)) => 10239, + Self::ContractError(DataContractError::InvalidURI(_)) => 10240, + Self::ContractError(DataContractError::KeyWrongBounds(_)) => 10241, + Self::ContractError(DataContractError::KeyValueMustExist(_)) => 10242, + Self::UnknownTransferableTypeError { .. } => 10243, + Self::UnknownTradeModeError { .. } => 10244, + Self::UnknownDocumentCreationRestrictionModeError { .. } => 10245, + Self::IncompatibleDocumentTypeSchemaError { .. } => 10246, + + // Document Errors: 10400-10499 + Self::DataContractNotPresentError { .. } => 10400, + Self::DuplicateDocumentTransitionsWithIdsError { .. } => 10401, + Self::DuplicateDocumentTransitionsWithIndicesError { .. } => 10402, + Self::InconsistentCompoundIndexDataError { .. } => 10403, + Self::InvalidDocumentTransitionActionError { .. } => 10404, + Self::InvalidDocumentTransitionIdError { .. } => 10405, + Self::InvalidDocumentTypeError { .. } => 10406, + Self::MissingDataContractIdBasicError { .. } => 10407, + Self::MissingDocumentTransitionActionError { .. } => 10408, + Self::MissingDocumentTransitionTypeError { .. } => 10409, + Self::MissingDocumentTypeError { .. } => 10410, + Self::MissingPositionsInDocumentTypePropertiesError { .. } => 10411, + Self::MaxDocumentsTransitionsExceededError { .. } => 10412, + Self::DocumentTransitionsAreAbsentError { .. } => 10413, + Self::NonceOutOfBoundsError(_) => 10414, + Self::InvalidDocumentTypeNameError(_) => 10415, + Self::DocumentCreationNotAllowedError(_) => 10416, + + // Identity Errors: 10500-10599 + Self::DuplicatedIdentityPublicKeyBasicError(_) => 10500, + Self::DuplicatedIdentityPublicKeyIdBasicError(_) => 10501, + Self::IdentityAssetLockProofLockedTransactionMismatchError(_) => 10502, + Self::IdentityAssetLockTransactionIsNotFoundError(_) => 10503, + Self::IdentityAssetLockTransactionOutPointAlreadyConsumedError(_) => 10504, + Self::IdentityAssetLockTransactionOutputNotFoundError(_) => 10505, + Self::InvalidAssetLockProofCoreChainHeightError(_) => 10506, + Self::InvalidAssetLockProofTransactionHeightError(_) => 10507, + Self::InvalidAssetLockTransactionOutputReturnSizeError(_) => 10508, + Self::InvalidIdentityAssetLockTransactionError(_) => 10509, + Self::InvalidIdentityAssetLockTransactionOutputError(_) => 10510, + Self::InvalidIdentityPublicKeyDataError(_) => 10511, + Self::InvalidInstantAssetLockProofError(_) => 10512, + Self::InvalidInstantAssetLockProofSignatureError(_) => 10513, + Self::InvalidIdentityAssetLockProofChainLockValidationError(_) => 10514, + Self::DataContractBoundsNotPresentError(_) => 10515, + Self::DisablingKeyIdAlsoBeingAddedInSameTransitionError(_) => 10516, + Self::MissingMasterPublicKeyError(_) => 10517, + Self::TooManyMasterPublicKeyError(_) => 10518, + Self::InvalidIdentityPublicKeySecurityLevelError(_) => 10519, + Self::InvalidIdentityKeySignatureError { .. } => 10520, + Self::InvalidIdentityCreditWithdrawalTransitionOutputScriptError(_) => 10521, + Self::InvalidIdentityCreditWithdrawalTransitionCoreFeeError(_) => 10522, + Self::NotImplementedIdentityCreditWithdrawalTransitionPoolingError(_) => 10523, + Self::InvalidIdentityCreditTransferAmountError(_) => 10524, + Self::InvalidIdentityCreditWithdrawalTransitionAmountError(_) => 10525, + Self::InvalidIdentityUpdateTransitionEmptyError(_) => 10526, + Self::InvalidIdentityUpdateTransitionDisableKeysError(_) => 10527, + Self::IdentityCreditTransferToSelfError(_) => 10528, + Self::MasterPublicKeyUpdateError(_) => 10529, + Self::IdentityAssetLockTransactionOutPointNotEnoughBalanceError(_) => 10530, + Self::IdentityAssetLockStateTransitionReplayError(_) => 10531, + + // State Transition Errors: 10600-10699 + Self::InvalidStateTransitionTypeError { .. } => 10600, + Self::MissingStateTransitionTypeError { .. } => 10601, + Self::StateTransitionMaxSizeExceededError { .. } => 10602, } } } @@ -121,17 +159,18 @@ impl ErrorWithCode for BasicError { impl ErrorWithCode for SignatureError { fn code(&self) -> u32 { match self { - Self::IdentityNotFoundError { .. } => 2000, - Self::InvalidIdentityPublicKeyTypeError { .. } => 2001, - Self::InvalidStateTransitionSignatureError { .. } => 2002, - Self::MissingPublicKeyError { .. } => 2003, - Self::InvalidSignaturePublicKeySecurityLevelError { .. } => 2004, - Self::WrongPublicKeyPurposeError { .. } => 2005, - Self::PublicKeyIsDisabledError { .. } => 2006, - Self::PublicKeySecurityLevelNotMetError { .. } => 2007, - Self::SignatureShouldNotBePresentError(_) => 2008, - Self::BasicECDSAError(_) => 2009, - Self::BasicBLSError(_) => 2010, + Self::IdentityNotFoundError { .. } => 20000, + Self::InvalidIdentityPublicKeyTypeError { .. } => 20001, + Self::InvalidStateTransitionSignatureError { .. } => 20002, + Self::MissingPublicKeyError { .. } => 20003, + Self::InvalidSignaturePublicKeySecurityLevelError { .. } => 20004, + Self::WrongPublicKeyPurposeError { .. } => 20005, + Self::PublicKeyIsDisabledError { .. } => 20006, + Self::PublicKeySecurityLevelNotMetError { .. } => 20007, + Self::SignatureShouldNotBePresentError(_) => 20008, + Self::BasicECDSAError(_) => 20009, + Self::BasicBLSError(_) => 20010, + Self::InvalidSignaturePublicKeyPurposeError(_) => 20011, } } } @@ -139,7 +178,7 @@ impl ErrorWithCode for SignatureError { impl ErrorWithCode for FeeError { fn code(&self) -> u32 { match self { - Self::BalanceIsNotEnoughError { .. } => 3000, + Self::BalanceIsNotEnoughError { .. } => 30000, } } } @@ -147,36 +186,42 @@ impl ErrorWithCode for FeeError { impl ErrorWithCode for StateError { fn code(&self) -> u32 { match self { - // Data contract - Self::DataContractAlreadyPresentError { .. } => 4000, - Self::DataContractIsReadonlyError { .. } => 4026, - #[cfg(feature = "validation")] + // Data contract Errors: 40000-40099 + Self::DataContractAlreadyPresentError { .. } => 40000, + Self::DataContractIsReadonlyError { .. } => 40001, + Self::DataContractConfigUpdateError { .. } => 40002, + + // Document Errors: 40100-40199 + Self::DocumentAlreadyPresentError { .. } => 40100, + Self::DocumentNotFoundError { .. } => 40101, + Self::DocumentOwnerIdMismatchError { .. } => 40102, + Self::DocumentTimestampsMismatchError { .. } => 40103, + Self::DocumentTimestampWindowViolationError { .. } => 40104, + Self::DuplicateUniqueIndexError { .. } => 40105, + Self::InvalidDocumentRevisionError { .. } => 40106, + Self::DocumentTimestampsAreEqualError(_) => 40107, + Self::DocumentNotForSaleError(_) => 40108, + Self::DocumentIncorrectPurchasePriceError(_) => 40109, + + // Identity Errors: 40200-40299 + Self::IdentityAlreadyExistsError(_) => 40200, + Self::IdentityPublicKeyIsReadOnlyError { .. } => 40201, + Self::InvalidIdentityPublicKeyIdError { .. } => 40202, + Self::InvalidIdentityRevisionError { .. } => 40203, + Self::InvalidIdentityNonceError(_) => 40204, + Self::MaxIdentityPublicKeyLimitReachedError { .. } => 40205, + Self::DuplicatedIdentityPublicKeyStateError { .. } => 40206, + Self::DuplicatedIdentityPublicKeyIdStateError { .. } => 40207, + Self::IdentityPublicKeyIsDisabledError { .. } => 40208, + Self::MissingIdentityPublicKeyIdsError { .. } => 40209, + Self::IdentityInsufficientBalanceError(_) => 40210, + Self::IdentityPublicKeyAlreadyExistsForUniqueContractBoundsError(_) => 40211, + Self::DocumentTypeUpdateError(_) => 40212, + Self::DataContractUpdatePermissionError(_) => 40213, + + // Data trigger errors: 40500-40799 + #[cfg(feature = "state-transition-validation")] Self::DataTriggerError(ref e) => e.code(), - Self::DataContractConfigUpdateError { .. } => 4027, - - // Document - Self::DocumentAlreadyPresentError { .. } => 4004, - Self::DocumentNotFoundError { .. } => 4005, - Self::DocumentOwnerIdMismatchError { .. } => 4006, - Self::DocumentTimestampsMismatchError { .. } => 4007, - Self::DocumentTimestampWindowViolationError { .. } => 4008, - Self::DuplicateUniqueIndexError { .. } => 4009, - Self::InvalidDocumentRevisionError { .. } => 4010, - Self::DocumentTimestampsAreEqualError(_) => 4025, - - // Identity - Self::IdentityAlreadyExistsError(_) => 4011, - Self::IdentityPublicKeyDisabledAtWindowViolationError { .. } => 4012, - Self::IdentityPublicKeyIsReadOnlyError { .. } => 4017, - Self::InvalidIdentityPublicKeyIdError { .. } => 4018, - Self::InvalidIdentityRevisionError { .. } => 4019, - Self::MaxIdentityPublicKeyLimitReachedError { .. } => 4020, - Self::DuplicatedIdentityPublicKeyStateError { .. } => 4021, - Self::DuplicatedIdentityPublicKeyIdStateError { .. } => 4022, - Self::IdentityPublicKeyIsDisabledError { .. } => 4023, - Self::MissingIdentityPublicKeyIdsError { .. } => 4024, - Self::IdentityInsufficientBalanceError(_) => 4026, - Self::IdentityPublicKeyAlreadyExistsForUniqueContractBoundsError(_) => 4027, } } } @@ -185,9 +230,9 @@ impl ErrorWithCode for StateError { impl ErrorWithCode for DataTriggerError { fn code(&self) -> u32 { match self { - Self::DataTriggerConditionError { .. } => 4001, - Self::DataTriggerExecutionError { .. } => 4002, - Self::DataTriggerInvalidResultError { .. } => 4003, + Self::DataTriggerConditionError { .. } => 40500, + Self::DataTriggerExecutionError { .. } => 40501, + Self::DataTriggerInvalidResultError { .. } => 40502, } } } diff --git a/packages/rs-dpp/src/errors/consensus/consensus_error.rs b/packages/rs-dpp/src/errors/consensus/consensus_error.rs index 6966825408e..7be628f29ca 100644 --- a/packages/rs-dpp/src/errors/consensus/consensus_error.rs +++ b/packages/rs-dpp/src/errors/consensus/consensus_error.rs @@ -2,7 +2,6 @@ use crate::errors::ProtocolError; use bincode; use bincode::{Decode, Encode}; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; -use thiserror::Error; use crate::consensus::state::state_error::StateError; @@ -16,7 +15,9 @@ use crate::errors::consensus::basic::BasicError; // TODO It must be versioned as all other serializable types -#[derive(Error, Debug, Encode, Decode, PlatformSerialize, PlatformDeserialize, Clone)] +#[derive( + thiserror::Error, Debug, Encode, Decode, PlatformSerialize, PlatformDeserialize, Clone, +)] #[platform_serialize(limit = 2000)] #[error(transparent)] pub enum ConsensusError { diff --git a/packages/rs-dpp/src/errors/consensus/signature/invalid_signature_public_key_purpose_error.rs b/packages/rs-dpp/src/errors/consensus/signature/invalid_signature_public_key_purpose_error.rs new file mode 100644 index 00000000000..55a05964394 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/signature/invalid_signature_public_key_purpose_error.rs @@ -0,0 +1,47 @@ +use thiserror::Error; + +use crate::consensus::signature::signature_error::SignatureError; +use crate::consensus::ConsensusError; +use crate::identity::Purpose; + +use crate::errors::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; + +use bincode::{Decode, Encode}; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Invalid public key purpose {public_key_purpose}. The state transition requires {allowed_key_purpose}")] +#[platform_serialize(unversioned)] +pub struct InvalidSignaturePublicKeyPurposeError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + public_key_purpose: Purpose, + allowed_key_purpose: Purpose, +} + +impl InvalidSignaturePublicKeyPurposeError { + pub fn new(public_key_purpose: Purpose, allowed_key_purpose: Purpose) -> Self { + Self { + public_key_purpose, + allowed_key_purpose, + } + } + + pub fn public_key_purpose(&self) -> Purpose { + self.public_key_purpose + } + pub fn allowed_key_purpose(&self) -> Purpose { + self.allowed_key_purpose + } +} + +impl From for ConsensusError { + fn from(err: InvalidSignaturePublicKeyPurposeError) -> Self { + Self::SignatureError(SignatureError::InvalidSignaturePublicKeyPurposeError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/signature/mod.rs b/packages/rs-dpp/src/errors/consensus/signature/mod.rs index 37be8d8a872..46c0b6282af 100644 --- a/packages/rs-dpp/src/errors/consensus/signature/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/signature/mod.rs @@ -2,6 +2,7 @@ mod basic_bls_error; mod basic_ecdsa_error; mod identity_not_found_error; mod invalid_identity_public_key_type_error; +mod invalid_signature_public_key_purpose_error; mod invalid_signature_public_key_security_level_error; mod invalid_state_transition_signature_error; mod missing_public_key_error; @@ -15,6 +16,7 @@ pub use crate::consensus::signature::basic_bls_error::BasicBLSError; pub use crate::consensus::signature::basic_ecdsa_error::BasicECDSAError; pub use crate::consensus::signature::identity_not_found_error::IdentityNotFoundError; pub use crate::consensus::signature::invalid_identity_public_key_type_error::InvalidIdentityPublicKeyTypeError; +pub use crate::consensus::signature::invalid_signature_public_key_purpose_error::InvalidSignaturePublicKeyPurposeError; pub use crate::consensus::signature::invalid_signature_public_key_security_level_error::InvalidSignaturePublicKeySecurityLevelError; pub use crate::consensus::signature::invalid_state_transition_signature_error::InvalidStateTransitionSignatureError; pub use crate::consensus::signature::missing_public_key_error::MissingPublicKeyError; diff --git a/packages/rs-dpp/src/errors/consensus/signature/signature_error.rs b/packages/rs-dpp/src/errors/consensus/signature/signature_error.rs index af4047782d3..74b2c6a7241 100644 --- a/packages/rs-dpp/src/errors/consensus/signature/signature_error.rs +++ b/packages/rs-dpp/src/errors/consensus/signature/signature_error.rs @@ -8,6 +8,7 @@ use crate::consensus::ConsensusError; use bincode::{Decode, Encode}; use thiserror::Error; +use crate::consensus::signature::invalid_signature_public_key_purpose_error::InvalidSignaturePublicKeyPurposeError; use crate::errors::ProtocolError; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; @@ -30,6 +31,9 @@ pub enum SignatureError { #[error(transparent)] MissingPublicKeyError(MissingPublicKeyError), + #[error(transparent)] + InvalidSignaturePublicKeyPurposeError(InvalidSignaturePublicKeyPurposeError), + #[error(transparent)] InvalidSignaturePublicKeySecurityLevelError(InvalidSignaturePublicKeySecurityLevelError), diff --git a/packages/rs-dpp/src/errors/consensus/signature/wrong_public_key_purpose_error.rs b/packages/rs-dpp/src/errors/consensus/signature/wrong_public_key_purpose_error.rs index 6b4c4ddb28c..501cf0d64b4 100644 --- a/packages/rs-dpp/src/errors/consensus/signature/wrong_public_key_purpose_error.rs +++ b/packages/rs-dpp/src/errors/consensus/signature/wrong_public_key_purpose_error.rs @@ -46,7 +46,10 @@ impl From for ConsensusError { } } -#[cfg(all(feature = "state-transitions", feature = "validation"))] +#[cfg(any( + all(feature = "state-transitions", feature = "validation"), + feature = "state-transition-validation" +))] // This is a separate error of the same name, but from ProtocolError impl From for ConsensusError { fn from(value: crate::state_transition::errors::WrongPublicKeyPurposeError) -> Self { diff --git a/packages/rs-dpp/src/errors/consensus/state/data_contract/data_contract_update_permission_error.rs b/packages/rs-dpp/src/errors/consensus/state/data_contract/data_contract_update_permission_error.rs new file mode 100644 index 00000000000..73cafe6de32 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/data_contract/data_contract_update_permission_error.rs @@ -0,0 +1,46 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "Identity {identity_id} doesn't have permissions to update Data Contract {data_contract_id}" +)] +#[platform_serialize(unversioned)] +pub struct DataContractUpdatePermissionError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + data_contract_id: Identifier, + identity_id: Identifier, +} + +impl DataContractUpdatePermissionError { + pub fn new(data_contract_id: Identifier, identity_id: Identifier) -> Self { + Self { + data_contract_id, + identity_id, + } + } + + pub fn data_contract_id(&self) -> &Identifier { + &self.data_contract_id + } + pub fn identity_id(&self) -> &Identifier { + &self.identity_id + } +} + +impl From for ConsensusError { + fn from(err: DataContractUpdatePermissionError) -> Self { + Self::StateError(StateError::DataContractUpdatePermissionError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/data_contract/document_type_update_error.rs b/packages/rs-dpp/src/errors/consensus/state/data_contract/document_type_update_error.rs new file mode 100644 index 00000000000..a18c21f0c71 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/data_contract/document_type_update_error.rs @@ -0,0 +1,56 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error( + "Can't update Document Type {data_contract_id}::{document_type_name}: {additional_message}" +)] +#[platform_serialize(unversioned)] +pub struct DocumentTypeUpdateError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + data_contract_id: Identifier, + document_type_name: String, + additional_message: String, +} + +impl DocumentTypeUpdateError { + pub fn new( + data_contract_id: Identifier, + document_type_name: impl Into, + additional_message: impl Into, + ) -> Self { + Self { + data_contract_id, + document_type_name: document_type_name.into(), + additional_message: additional_message.into(), + } + } + + pub fn data_contract_id(&self) -> &Identifier { + &self.data_contract_id + } + + pub fn document_type_name(&self) -> &String { + &self.document_type_name + } + pub fn additional_message(&self) -> &str { + &self.additional_message + } +} + +impl From for ConsensusError { + fn from(err: DocumentTypeUpdateError) -> Self { + Self::StateError(StateError::DocumentTypeUpdateError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/data_contract/mod.rs b/packages/rs-dpp/src/errors/consensus/state/data_contract/mod.rs index fe67475ed89..563596603d6 100644 --- a/packages/rs-dpp/src/errors/consensus/state/data_contract/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/state/data_contract/mod.rs @@ -1,3 +1,5 @@ pub mod data_contract_already_present_error; pub mod data_contract_config_update_error; pub mod data_contract_is_readonly_error; +pub mod data_contract_update_permission_error; +pub mod document_type_update_error; diff --git a/packages/rs-dpp/src/errors/consensus/state/document/document_incorrect_purchase_price_error.rs b/packages/rs-dpp/src/errors/consensus/state/document/document_incorrect_purchase_price_error.rs new file mode 100644 index 00000000000..5e726c5cbef --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/document/document_incorrect_purchase_price_error.rs @@ -0,0 +1,58 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use crate::fee::Credits; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("{document_id} document can not be purchased for {trying_to_purchase_at_price}, it's sale price is {actual_price} (in credits)")] +#[platform_serialize(unversioned)] +pub struct DocumentIncorrectPurchasePriceError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + document_id: Identifier, + + trying_to_purchase_at_price: Credits, + + actual_price: Credits, +} + +impl DocumentIncorrectPurchasePriceError { + pub fn new( + document_id: Identifier, + trying_to_purchase_at_price: Credits, + actual_price: Credits, + ) -> Self { + Self { + document_id, + trying_to_purchase_at_price, + actual_price, + } + } + + pub fn document_id(&self) -> &Identifier { + &self.document_id + } + + pub fn trying_to_purchase_at_price(&self) -> Credits { + self.trying_to_purchase_at_price + } + + pub fn actual_price(&self) -> Credits { + self.actual_price + } +} + +impl From for ConsensusError { + fn from(err: DocumentIncorrectPurchasePriceError) -> Self { + Self::StateError(StateError::DocumentIncorrectPurchasePriceError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/document/document_not_for_sale_error.rs b/packages/rs-dpp/src/errors/consensus/state/document/document_not_for_sale_error.rs new file mode 100644 index 00000000000..1304477355f --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/document/document_not_for_sale_error.rs @@ -0,0 +1,37 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use platform_value::Identifier; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("{document_id} document not for sale")] +#[platform_serialize(unversioned)] +pub struct DocumentNotForSaleError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + document_id: Identifier, +} + +impl DocumentNotForSaleError { + pub fn new(document_id: Identifier) -> Self { + Self { document_id } + } + + pub fn document_id(&self) -> &Identifier { + &self.document_id + } +} + +impl From for ConsensusError { + fn from(err: DocumentNotForSaleError) -> Self { + Self::StateError(StateError::DocumentNotForSaleError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/document/mod.rs b/packages/rs-dpp/src/errors/consensus/state/document/mod.rs index 2469345323f..36621070ab8 100644 --- a/packages/rs-dpp/src/errors/consensus/state/document/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/state/document/mod.rs @@ -1,4 +1,6 @@ pub mod document_already_present_error; +pub mod document_incorrect_purchase_price_error; +pub mod document_not_for_sale_error; pub mod document_not_found_error; pub mod document_owner_id_mismatch_error; pub mod document_timestamp_window_violation_error; diff --git a/packages/rs-dpp/src/errors/consensus/state/identity/identity_public_key_disabled_at_window_violation_error.rs b/packages/rs-dpp/src/errors/consensus/state/identity/identity_public_key_disabled_at_window_violation_error.rs deleted file mode 100644 index 772a5a123f2..00000000000 --- a/packages/rs-dpp/src/errors/consensus/state/identity/identity_public_key_disabled_at_window_violation_error.rs +++ /dev/null @@ -1,50 +0,0 @@ -use crate::consensus::state::state_error::StateError; -use crate::consensus::ConsensusError; -use crate::errors::ProtocolError; -use bincode::{Decode, Encode}; -use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; -use thiserror::Error; - -#[derive( - Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, -)] -#[error("Identity public keys disabled time ({disabled_at}) is out of block time window from {time_window_start} and {time_window_end}")] -#[platform_serialize(unversioned)] -pub struct IdentityPublicKeyDisabledAtWindowViolationError { - /* - - DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION - - */ - disabled_at: u64, - time_window_start: u64, - time_window_end: u64, -} - -impl IdentityPublicKeyDisabledAtWindowViolationError { - pub fn new(disabled_at: u64, time_window_start: u64, time_window_end: u64) -> Self { - Self { - disabled_at, - time_window_start, - time_window_end, - } - } - - pub fn disabled_at(&self) -> u64 { - self.disabled_at - } - - pub fn time_window_start(&self) -> u64 { - self.time_window_start - } - pub fn time_window_end(&self) -> u64 { - self.time_window_end - } -} -impl From for ConsensusError { - fn from(err: IdentityPublicKeyDisabledAtWindowViolationError) -> Self { - Self::StateError(StateError::IdentityPublicKeyDisabledAtWindowViolationError( - err, - )) - } -} diff --git a/packages/rs-dpp/src/errors/consensus/state/identity/invalid_identity_contract_nonce_error.rs b/packages/rs-dpp/src/errors/consensus/state/identity/invalid_identity_contract_nonce_error.rs new file mode 100644 index 00000000000..39bbbfaaaf5 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/identity/invalid_identity_contract_nonce_error.rs @@ -0,0 +1,76 @@ +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; // needed for PlatformDeserialize and PlatformSerialize +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use std::fmt::{Display, Formatter}; +use thiserror::Error; + +use crate::prelude::{Identifier, IdentityNonce}; + +use crate::identity::identity_nonce::MergeIdentityNonceResult; +use bincode::{Decode, Encode}; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[platform_serialize(unversioned)] +pub struct InvalidIdentityNonceError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + pub identity_id: Identifier, + pub current_identity_nonce: Option, + pub setting_identity_nonce: IdentityNonce, + pub error: MergeIdentityNonceResult, +} +impl Display for InvalidIdentityNonceError { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + // Pre-calculate the `current_identity_contract_nonce` value + let current_nonce = self + .current_identity_nonce + .as_ref() + .unwrap_or(&Default::default()) // Assuming `IdentityContractNonce` implements `Default` + .to_string(); // Assuming `IdentityContractNonce` implements `ToString` or has a similar method for representation + + // Format the error message with pre-calculated `current_nonce` + write!(f, "Identity {} is trying to set an invalid identity nonce. The current identity nonce is {}, we are setting {}, error is {}", self.identity_id, current_nonce, self.setting_identity_nonce, self.error) + } +} + +impl InvalidIdentityNonceError { + pub fn new( + identity_id: Identifier, + current_identity_contract_nonce: Option, + setting_identity_contract_nonce: IdentityNonce, + error: MergeIdentityNonceResult, + ) -> Self { + Self { + identity_id, + current_identity_nonce: current_identity_contract_nonce, + setting_identity_nonce: setting_identity_contract_nonce, + error, + } + } + + pub fn identity_id(&self) -> &Identifier { + &self.identity_id + } + pub fn current_identity_contract_nonce(&self) -> Option<&IdentityNonce> { + self.current_identity_nonce.as_ref() + } + + pub fn setting_identity_contract_nonce(&self) -> &IdentityNonce { + &self.setting_identity_nonce + } + + pub fn error(&self) -> &MergeIdentityNonceResult { + &self.error + } +} +impl From for ConsensusError { + fn from(err: InvalidIdentityNonceError) -> Self { + Self::StateError(StateError::InvalidIdentityNonceError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/identity/master_public_key_update_error.rs b/packages/rs-dpp/src/errors/consensus/state/identity/master_public_key_update_error.rs new file mode 100644 index 00000000000..bde78547a79 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/state/identity/master_public_key_update_error.rs @@ -0,0 +1,66 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +use bincode::{Decode, Encode}; + +#[derive( + Error, + Debug, + Clone, + PartialEq, + Eq, + Default, + Encode, + Decode, + PlatformSerialize, + PlatformDeserialize, +)] +#[error("Failed to update the master public key: {description}. Ensure the operation is valid and permissible under current system rules.")] +#[platform_serialize(unversioned)] +pub struct MasterPublicKeyUpdateError { + adding: usize, + removing: usize, + description: String, +} + +/* + +DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + +*/ + +impl MasterPublicKeyUpdateError { + pub fn new(adding: usize, removing: usize) -> Self { + let description = match (adding, removing) { + (1, _) => "Attempt to add a new master key is not allowed unless one is being disabled" + .to_string(), + (0, _) => "Removing a master key without adding one is not allowed".to_string(), + (_, 1) | (_, 0) => "Attempt to add more than one master key is not allowed".to_string(), + (adding, removing) => format!( + "Attempting to add {adding} master keys while removing {removing} master keys" + ), + }; + + Self { + adding, + removing, + description, + } + } + + pub fn adding(&self) -> usize { + self.adding + } + + pub fn removing(&self) -> usize { + self.removing + } +} +impl From for ConsensusError { + fn from(err: MasterPublicKeyUpdateError) -> Self { + Self::BasicError(BasicError::MasterPublicKeyUpdateError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/state/identity/mod.rs b/packages/rs-dpp/src/errors/consensus/state/identity/mod.rs index 01ec04bb52a..53a60d0ed4c 100644 --- a/packages/rs-dpp/src/errors/consensus/state/identity/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/state/identity/mod.rs @@ -6,10 +6,11 @@ pub mod duplicated_identity_public_key_state_error; mod identity_already_exists_error; mod identity_insufficient_balance_error; pub mod identity_public_key_already_exists_for_unique_contract_bounds_error; -pub mod identity_public_key_disabled_at_window_violation_error; pub mod identity_public_key_is_disabled_error; pub mod identity_public_key_is_read_only_error; +pub mod invalid_identity_contract_nonce_error; pub mod invalid_identity_public_key_id_error; pub mod invalid_identity_revision_error; +pub mod master_public_key_update_error; pub mod max_identity_public_key_limit_reached_error; pub mod missing_identity_public_key_ids_error; diff --git a/packages/rs-dpp/src/errors/consensus/state/state_error.rs b/packages/rs-dpp/src/errors/consensus/state/state_error.rs index 4098b85042d..2880b4e533f 100644 --- a/packages/rs-dpp/src/errors/consensus/state/state_error.rs +++ b/packages/rs-dpp/src/errors/consensus/state/state_error.rs @@ -17,7 +17,6 @@ use crate::consensus::state::document::duplicate_unique_index_error::DuplicateUn use crate::consensus::state::document::invalid_document_revision_error::InvalidDocumentRevisionError; use crate::consensus::state::identity::duplicated_identity_public_key_id_state_error::DuplicatedIdentityPublicKeyIdStateError; use crate::consensus::state::identity::duplicated_identity_public_key_state_error::DuplicatedIdentityPublicKeyStateError; -use crate::consensus::state::identity::identity_public_key_disabled_at_window_violation_error::IdentityPublicKeyDisabledAtWindowViolationError; use crate::consensus::state::identity::identity_public_key_is_disabled_error::IdentityPublicKeyIsDisabledError; use crate::consensus::state::identity::identity_public_key_is_read_only_error::IdentityPublicKeyIsReadOnlyError; use crate::consensus::state::identity::invalid_identity_public_key_id_error::InvalidIdentityPublicKeyIdError; @@ -28,7 +27,12 @@ use crate::consensus::state::identity::{ IdentityAlreadyExistsError, IdentityInsufficientBalanceError, }; use crate::consensus::ConsensusError; +use crate::consensus::state::data_contract::data_contract_update_permission_error::DataContractUpdatePermissionError; +use crate::consensus::state::data_contract::document_type_update_error::DocumentTypeUpdateError; +use crate::consensus::state::document::document_incorrect_purchase_price_error::DocumentIncorrectPurchasePriceError; +use crate::consensus::state::document::document_not_for_sale_error::DocumentNotForSaleError; use crate::consensus::state::identity::identity_public_key_already_exists_for_unique_contract_bounds_error::IdentityPublicKeyAlreadyExistsForUniqueContractBoundsError; +use crate::consensus::state::identity::invalid_identity_contract_nonce_error::InvalidIdentityNonceError; use super::document::document_timestamps_are_equal_error::DocumentTimestampsAreEqualError; @@ -54,6 +58,12 @@ pub enum StateError { #[error(transparent)] DocumentNotFoundError(DocumentNotFoundError), + #[error(transparent)] + DocumentNotForSaleError(DocumentNotForSaleError), + + #[error(transparent)] + DocumentIncorrectPurchasePriceError(DocumentIncorrectPurchasePriceError), + #[error(transparent)] DocumentOwnerIdMismatchError(DocumentOwnerIdMismatchError), @@ -77,11 +87,6 @@ pub enum StateError { IdentityPublicKeyAlreadyExistsForUniqueContractBoundsError, ), - #[error(transparent)] - IdentityPublicKeyDisabledAtWindowViolationError( - IdentityPublicKeyDisabledAtWindowViolationError, - ), - #[error(transparent)] IdentityPublicKeyIsReadOnlyError(IdentityPublicKeyIsReadOnlyError), @@ -94,6 +99,9 @@ pub enum StateError { #[error(transparent)] InvalidIdentityRevisionError(InvalidIdentityRevisionError), + #[error(transparent)] + InvalidIdentityNonceError(InvalidIdentityNonceError), + #[error(transparent)] MaxIdentityPublicKeyLimitReachedError(MaxIdentityPublicKeyLimitReachedError), @@ -117,6 +125,12 @@ pub enum StateError { #[error(transparent)] DataContractConfigUpdateError(DataContractConfigUpdateError), + + #[error(transparent)] + DocumentTypeUpdateError(DocumentTypeUpdateError), + + #[error(transparent)] + DataContractUpdatePermissionError(DataContractUpdatePermissionError), } impl From for ConsensusError { diff --git a/packages/rs-dpp/src/errors/dpp_init_error.rs b/packages/rs-dpp/src/errors/dpp_init_error.rs index 9fa82c3f6ff..baf41047c23 100644 --- a/packages/rs-dpp/src/errors/dpp_init_error.rs +++ b/packages/rs-dpp/src/errors/dpp_init_error.rs @@ -1,15 +1,10 @@ -use std::borrow::Cow; - use crate::version::FeatureVersion; -use jsonschema::ValidationError; use thiserror::Error; #[derive(Error, Debug)] pub enum DashPlatformProtocolInitError { #[error(transparent)] SchemaDeserializationError(serde_json::Error), - #[error(transparent)] - ValidationError(ValidationError<'static>), #[error("Loaded Schema is invalid: {0}")] InvalidSchemaError(&'static str), #[error("platform init unknown version on {method}, received: {received}")] @@ -23,23 +18,8 @@ pub enum DashPlatformProtocolInitError { }, } -fn into_owned(err: ValidationError) -> ValidationError<'static> { - ValidationError { - instance_path: err.instance_path.clone(), - instance: Cow::Owned(err.instance.into_owned()), - kind: err.kind, - schema_path: err.schema_path, - } -} - impl From for DashPlatformProtocolInitError { fn from(error: serde_json::Error) -> Self { Self::SchemaDeserializationError(error) } } - -impl<'a> From> for DashPlatformProtocolInitError { - fn from(err: ValidationError<'a>) -> Self { - Self::ValidationError(into_owned(err)) - } -} diff --git a/packages/rs-dpp/src/errors/protocol_error.rs b/packages/rs-dpp/src/errors/protocol_error.rs index 1136eab12e0..13e5c005e85 100644 --- a/packages/rs-dpp/src/errors/protocol_error.rs +++ b/packages/rs-dpp/src/errors/protocol_error.rs @@ -7,12 +7,31 @@ use crate::consensus::signature::{ use crate::consensus::ConsensusError; use crate::data_contract::errors::*; use crate::document::errors::*; -#[cfg(feature = "validation")] + +#[cfg(any( + feature = "state-transition-validation", + feature = "state-transition-signing" +))] use crate::state_transition::errors::InvalidIdentityPublicKeyTypeError; + +#[cfg(any( + all(feature = "state-transitions", feature = "validation"), + feature = "state-transition-validation" +))] +use crate::state_transition::errors::StateTransitionError; + +#[cfg(any( + all(feature = "state-transitions", feature = "validation"), + feature = "state-transition-validation", + feature = "state-transition-signing", + feature = "state-transition-validation" +))] +use crate::state_transition::errors::WrongPublicKeyPurposeError; + #[cfg(feature = "state-transition-validation")] use crate::state_transition::errors::{ InvalidSignaturePublicKeyError, PublicKeyMismatchError, PublicKeySecurityLevelNotMetError, - StateTransitionError, StateTransitionIsNotSignedError, WrongPublicKeyPurposeError, + StateTransitionIsNotSignedError, }; use crate::{ CompatibleProtocolVersionIsNotDefinedError, DashPlatformProtocolInitError, @@ -90,9 +109,6 @@ pub enum ProtocolError { #[error("Invalid key contract bounds error {0}")] InvalidKeyContractBoundsError(String), - #[error("unknown storage key requirements {0}")] - UnknownStorageKeyRequirements(String), - #[error(transparent)] DataContractError(#[from] DataContractError), @@ -100,8 +116,8 @@ pub enum ProtocolError { #[error(transparent)] StateTransitionError(#[from] StateTransitionError), - #[error(transparent)] - StructureError(#[from] StructureError), + #[error("Invalid State Transition Type: {0}")] + InvalidStateTransitionType(String), #[error(transparent)] PlatformVersionError(#[from] PlatformVersionError), @@ -115,23 +131,35 @@ pub enum ProtocolError { #[error("Generic Error: {0}")] Generic(String), + #[cfg(feature = "message-signing")] + #[error("Invalid signing type error: {0}")] + InvalidSigningKeyTypeError(String), + // State Transition Errors - #[cfg(all(feature = "state-transitions", feature = "validation"))] + #[cfg(any( + feature = "state-transition-validation", + feature = "state-transition-signing" + ))] #[error(transparent)] InvalidIdentityPublicKeyTypeError(InvalidIdentityPublicKeyTypeError), - #[cfg(all(feature = "state-transitions", feature = "validation"))] + #[cfg(feature = "state-transition-validation")] #[error(transparent)] StateTransitionIsNotSignedError(StateTransitionIsNotSignedError), - #[cfg(all(feature = "state-transitions", feature = "validation"))] + #[cfg(feature = "state-transition-validation")] #[error(transparent)] PublicKeySecurityLevelNotMetError(PublicKeySecurityLevelNotMetError), - #[cfg(all(feature = "state-transitions", feature = "validation"))] + #[cfg(any( + all(feature = "state-transitions", feature = "validation"), + feature = "state-transition-validation", + feature = "state-transition-signing", + feature = "state-transition-validation" + ))] #[error(transparent)] WrongPublicKeyPurposeError(WrongPublicKeyPurposeError), - #[cfg(all(feature = "state-transitions", feature = "validation"))] + #[cfg(feature = "state-transition-validation")] #[error(transparent)] PublicKeyMismatchError(PublicKeyMismatchError), - #[cfg(all(feature = "state-transitions", feature = "validation"))] + #[cfg(feature = "state-transition-validation")] #[error(transparent)] InvalidSignaturePublicKeyError(InvalidSignaturePublicKeyError), @@ -141,13 +169,6 @@ pub enum ProtocolError { #[error(transparent)] CompatibleProtocolVersionIsNotDefinedError(#[from] CompatibleProtocolVersionIsNotDefinedError), - // Data Contract - #[error("Data Contract already exists")] - DataContractAlreadyExistsError, - - #[error(transparent)] - InvalidDataContractError(InvalidDataContractError), - #[error(transparent)] InvalidDocumentTypeError(InvalidDocumentTypeError), @@ -172,7 +193,7 @@ pub enum ProtocolError { /// Error #[error("missing key: {0}")] - DocumentKeyMissing(String), + DesiredKeyWithTypePurposeSecurityLevelMissing(String), /// Value error #[error("value error: {0}")] @@ -210,6 +231,10 @@ pub enum ProtocolError { #[error(transparent)] InvalidVectorSizeError(InvalidVectorSizeError), + + /// Invalid CBOR error + #[error("invalid cbor error: {0}")] + InvalidCBOR(String), } impl From<&str> for ProtocolError { diff --git a/packages/rs-dpp/src/fee/default_costs/constants.rs b/packages/rs-dpp/src/fee/default_costs/constants.rs index f93be480f1c..a3afb06691e 100644 --- a/packages/rs-dpp/src/fee/default_costs/constants.rs +++ b/packages/rs-dpp/src/fee/default_costs/constants.rs @@ -1,7 +1,7 @@ use crate::fee::Credits; pub const BASE_ST_PROCESSING_FEE: Credits = 10000; // 84000 -pub const FEE_MULTIPLIER: Credits = 2; +pub const DEFAULT_SYSTEM_FEE_MULTIPLIER: Credits = 2; pub const DEFAULT_USER_TIP: Credits = 0; pub const STORAGE_CREDIT_PER_BYTE: Credits = 5000; pub const PROCESSING_CREDIT_PER_BYTE: Credits = 12; diff --git a/packages/rs-dpp/src/fee/default_costs/mod.rs b/packages/rs-dpp/src/fee/default_costs/mod.rs index 25fac22371b..a91d072f596 100644 --- a/packages/rs-dpp/src/fee/default_costs/mod.rs +++ b/packages/rs-dpp/src/fee/default_costs/mod.rs @@ -29,7 +29,7 @@ //! Fee costs //! -//! Fee costs for Drive (GroveDB) operations +//! Fee costs for Known Platform operations //! use crate::block::epoch::Epoch; @@ -57,6 +57,20 @@ pub enum KnownCostItem { FetchIdentityBalanceProcessingCost, /// The cost for fetching an identity key FetchSingleIdentityKeyProcessingCost, + /// The cost for a Double SHA256 operation + DoubleSHA256, + /// The cost for a Single SHA256 operation + SingleSHA256, + /// The cost for a EcdsaSecp256k1 signature verification + VerifySignatureEcdsaSecp256k1, + /// The cost for a BLS12_381 signature verification + VerifySignatureBLS12_381, + /// The cost for a EcdsaHash160 signature verification + VerifySignatureEcdsaHash160, + /// The cost for a Bip13ScriptHash signature verification + VerifySignatureBip13ScriptHash, + /// The cost for a Eddsa25519Hash160 signature verification + VerifySignatureEddsa25519Hash160, } const EPOCH_COST_UPDATE_VERSIONS: [u16; 1] = [0]; @@ -75,6 +89,13 @@ lazy_static! { KnownCostItem::FetchSingleIdentityKeyProcessingCost, 10000u64 ), + (KnownCostItem::DoubleSHA256, 800u64), + (KnownCostItem::SingleSHA256, 500u64), + (KnownCostItem::VerifySignatureEcdsaSecp256k1, 3000u64), + (KnownCostItem::VerifySignatureBLS12_381, 6000u64), + (KnownCostItem::VerifySignatureEcdsaHash160, 4000u64), + (KnownCostItem::VerifySignatureBip13ScriptHash, 6000u64), + (KnownCostItem::VerifySignatureEddsa25519Hash160, 3000u64), ]) )]); } diff --git a/packages/rs-dpp/src/fee/fee_result/mod.rs b/packages/rs-dpp/src/fee/fee_result/mod.rs index 1956719049c..749cc834267 100644 --- a/packages/rs-dpp/src/fee/fee_result/mod.rs +++ b/packages/rs-dpp/src/fee/fee_result/mod.rs @@ -41,6 +41,7 @@ use crate::consensus::fee::fee_error::FeeError; use crate::fee::fee_result::refunds::FeeRefunds; use crate::fee::fee_result::BalanceChange::{AddToBalance, NoBalanceChange, RemoveFromBalance}; use crate::fee::Credits; +use crate::prelude::UserFeeIncrease; use crate::ProtocolError; use platform_value::Identifier; use std::cmp::Ordering; @@ -89,7 +90,7 @@ impl TryFrom>> for FeeResult { } /// The balance change for an identity -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq, Eq)] pub enum BalanceChange { /// Add Balance AddToBalance(Credits), @@ -192,6 +193,21 @@ impl FeeResult { removed_bytes_from_system: 0, } } + + /// Apply a fee multiplier to a fee result + pub fn apply_user_fee_increase(&mut self, add_fee_percentage_multiplier: UserFeeIncrease) { + let additional_processing_fee = (self.processing_fee as u128) + .saturating_mul(add_fee_percentage_multiplier as u128) + .saturating_div(100); + if additional_processing_fee > u64::MAX as u128 { + self.processing_fee = u64::MAX; + } else { + self.processing_fee = self + .processing_fee + .saturating_add(additional_processing_fee as u64); + } + } + /// Convenience method to get total fee pub fn total_base_fee(&self) -> Credits { self.storage_fee + self.processing_fee diff --git a/packages/rs-dpp/src/identity/accessors/v0/mod.rs b/packages/rs-dpp/src/identity/accessors/v0/mod.rs index 390b0037be1..f982da15cea 100644 --- a/packages/rs-dpp/src/identity/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/identity/accessors/v0/mod.rs @@ -1,4 +1,4 @@ -use crate::identity::{Identity, IdentityPublicKey, KeyID, KeyType, Purpose, SecurityLevel}; +use crate::identity::{IdentityPublicKey, KeyID, KeyType, Purpose, SecurityLevel}; use crate::prelude::Revision; use crate::ProtocolError; diff --git a/packages/rs-dpp/src/identity/conversion/cbor/mod.rs b/packages/rs-dpp/src/identity/conversion/cbor/mod.rs index c0000c8b0d4..e084dffc38f 100644 --- a/packages/rs-dpp/src/identity/conversion/cbor/mod.rs +++ b/packages/rs-dpp/src/identity/conversion/cbor/mod.rs @@ -1,2 +1 @@ mod v0; -pub use v0::*; diff --git a/packages/rs-dpp/src/identity/identities_contract_keys.rs b/packages/rs-dpp/src/identity/identities_contract_keys.rs new file mode 100644 index 00000000000..063b5dabc7f --- /dev/null +++ b/packages/rs-dpp/src/identity/identities_contract_keys.rs @@ -0,0 +1,6 @@ +use crate::identity::{IdentityPublicKey, Purpose}; +use platform_value::Identifier; +use std::collections::BTreeMap; + +pub type IdentitiesContractKeys = + BTreeMap>>; diff --git a/packages/rs-dpp/src/identity/identity.rs b/packages/rs-dpp/src/identity/identity.rs index f73288d40ca..1c8951d13b6 100644 --- a/packages/rs-dpp/src/identity/identity.rs +++ b/packages/rs-dpp/src/identity/identity.rs @@ -1,17 +1,23 @@ use crate::identity::v0::IdentityV0; use crate::identity::{IdentityPublicKey, KeyID}; -use crate::prelude::{AssetLockProof, Revision}; +use crate::prelude::Revision; +#[cfg(feature = "identity-hashing")] use crate::serialization::PlatformSerializable; +#[cfg(feature = "identity-hashing")] use crate::util::hash; use crate::version::PlatformVersion; use crate::ProtocolError; +#[cfg(feature = "identity-serialization")] use bincode::{Decode, Encode}; use derive_more::From; +#[cfg(feature = "identity-serialization")] use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; use platform_value::Identifier; +use crate::fee::Credits; +#[cfg(feature = "identity-serde-conversion")] use serde::{Deserialize, Serialize}; use std::collections::{BTreeMap, BTreeSet}; @@ -40,7 +46,7 @@ pub enum Identity { pub struct PartialIdentity { pub id: Identifier, pub loaded_public_keys: BTreeMap, - pub balance: Option, + pub balance: Option, pub revision: Option, /// These are keys that were requested but didn't exist pub not_found_public_keys: BTreeSet, @@ -50,9 +56,9 @@ impl Identity { #[cfg(feature = "identity-hashing")] /// Computes the hash of an identity pub fn hash(&self) -> Result, ProtocolError> { - Ok(hash::hash_to_vec(PlatformSerializable::serialize_to_bytes( - self, - )?)) + Ok(hash::hash_double_to_vec( + PlatformSerializable::serialize_to_bytes(self)?, + )) } pub fn default_versioned( diff --git a/packages/rs-dpp/src/identity/identity_facade.rs b/packages/rs-dpp/src/identity/identity_facade.rs index 13ae58a9197..919c68c6240 100644 --- a/packages/rs-dpp/src/identity/identity_facade.rs +++ b/packages/rs-dpp/src/identity/identity_facade.rs @@ -1,26 +1,26 @@ use dashcore::{InstantLock, Transaction}; -use platform_value::Value; -use platform_version::version::PlatformVersion; + use std::collections::BTreeMap; use crate::identity::state_transition::asset_lock_proof::chain::ChainAssetLockProof; use crate::identity::state_transition::asset_lock_proof::{AssetLockProof, InstantAssetLockProof}; -use crate::identity::{Identity, IdentityPublicKey, KeyID, TimestampMillis}; -use crate::prelude::Identifier; +use crate::identity::{Identity, IdentityPublicKey, KeyID}; +use crate::prelude::{Identifier, IdentityNonce}; use crate::identity::identity_factory::IdentityFactory; #[cfg(feature = "state-transitions")] -use crate::state_transition::identity_create_transition::IdentityCreateTransition; -#[cfg(feature = "state-transitions")] -use crate::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; -#[cfg(feature = "state-transitions")] -use crate::state_transition::identity_topup_transition::IdentityTopUpTransition; -#[cfg(feature = "state-transitions")] -use crate::state_transition::identity_update_transition::IdentityUpdateTransition; -#[cfg(feature = "state-transitions")] -use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; +use crate::state_transition::{ + identity_create_transition::IdentityCreateTransition, + identity_credit_transfer_transition::IdentityCreditTransferTransition, + identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition, + identity_topup_transition::IdentityTopUpTransition, + identity_update_transition::IdentityUpdateTransition, + public_key_in_creation::IdentityPublicKeyInCreation, +}; -use crate::{DashPlatformProtocolInitError, ProtocolError}; +use crate::identity::core_script::CoreScript; +use crate::withdrawal::Pooling; +use crate::ProtocolError; #[derive(Clone)] pub struct IdentityFacade { @@ -52,6 +52,7 @@ impl IdentityFacade { // .create_from_object(raw_identity) // } + #[cfg(all(feature = "identity-serialization", feature = "client"))] pub fn create_from_buffer( &self, buffer: Vec, @@ -82,7 +83,7 @@ impl IdentityFacade { #[cfg(feature = "state-transitions")] pub fn create_identity_create_transition( &self, - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, ) -> Result { self.factory @@ -102,29 +103,52 @@ impl IdentityFacade { #[cfg(feature = "state-transitions")] pub fn create_identity_credit_transfer_transition( &self, - identity_id: Identifier, + identity: &Identity, recipient_id: Identifier, amount: u64, + identity_nonce: IdentityNonce, ) -> Result { - self.factory - .create_identity_credit_transfer_transition(identity_id, recipient_id, amount) + self.factory.create_identity_credit_transfer_transition( + identity, + recipient_id, + amount, + identity_nonce, + ) + } + + #[cfg(feature = "state-transitions")] + pub fn create_identity_credit_withdrawal_transition( + &self, + identity_id: Identifier, + amount: u64, + core_fee_per_byte: u32, + pooling: Pooling, + output_script: CoreScript, + identity_nonce: u64, + ) -> Result { + self.factory.create_identity_credit_withdrawal_transition( + identity_id, + amount, + core_fee_per_byte, + pooling, + output_script, + identity_nonce, + ) } #[cfg(feature = "state-transitions")] pub fn create_identity_update_transition( &self, identity: Identity, + identity_nonce: u64, add_public_keys: Option>, public_key_ids_to_disable: Option>, - // Pass disable time as argument because SystemTime::now() does not work for wasm target - // https://github.com/rust-lang/rust/issues/48564 - disable_time: Option, ) -> Result { self.factory.create_identity_update_transition( identity, + identity_nonce, add_public_keys, public_key_ids_to_disable, - disable_time, ) } } diff --git a/packages/rs-dpp/src/identity/identity_factory.rs b/packages/rs-dpp/src/identity/identity_factory.rs index 42134c9ed20..c6aface5912 100644 --- a/packages/rs-dpp/src/identity/identity_factory.rs +++ b/packages/rs-dpp/src/identity/identity_factory.rs @@ -1,8 +1,11 @@ use crate::identity::state_transition::asset_lock_proof::chain::ChainAssetLockProof; -use crate::identity::state_transition::asset_lock_proof::{AssetLockProof, InstantAssetLockProof}; +#[cfg(all(feature = "state-transitions", feature = "client"))] +use crate::identity::state_transition::asset_lock_proof::AssetLockProof; +use crate::identity::state_transition::asset_lock_proof::InstantAssetLockProof; +#[cfg(all(feature = "state-transitions", feature = "client"))] use crate::identity::state_transition::AssetLockProved; #[cfg(all(feature = "state-transitions", feature = "client"))] -use crate::identity::{IdentityV0, TimestampMillis}; +use crate::identity::IdentityV0; use crate::identity::{Identity, IdentityPublicKey, KeyID}; @@ -23,6 +26,10 @@ use crate::identity::accessors::IdentityGettersV0; #[cfg(all(feature = "validation", feature = "identity-value-conversion"))] use crate::identity::conversion::platform_value::IdentityPlatformValueConversionMethodsV0; +#[cfg(all(feature = "state-transitions", feature = "client"))] +use crate::identity::core_script::CoreScript; +#[cfg(all(feature = "state-transitions", feature = "client"))] +use crate::prelude::IdentityNonce; #[cfg(all(feature = "identity-serialization", feature = "client"))] use crate::serialization::PlatformDeserializable; #[cfg(all(feature = "state-transitions", feature = "client"))] @@ -34,6 +41,10 @@ use crate::state_transition::identity_credit_transfer_transition::v0::IdentityCr #[cfg(all(feature = "state-transitions", feature = "client"))] use crate::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; #[cfg(all(feature = "state-transitions", feature = "client"))] +use crate::state_transition::identity_credit_withdrawal_transition::v0::IdentityCreditWithdrawalTransitionV0; +#[cfg(all(feature = "state-transitions", feature = "client"))] +use crate::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; +#[cfg(all(feature = "state-transitions", feature = "client"))] use crate::state_transition::identity_topup_transition::accessors::IdentityTopUpTransitionAccessorsV0; #[cfg(all(feature = "state-transitions", feature = "client"))] use crate::state_transition::identity_topup_transition::v0::IdentityTopUpTransitionV0; @@ -48,6 +59,8 @@ use crate::state_transition::identity_update_transition::IdentityUpdateTransitio #[cfg(all(feature = "state-transitions", feature = "client"))] use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; use crate::version::PlatformVersion; +#[cfg(all(feature = "state-transitions", feature = "client"))] +use crate::withdrawal::Pooling; #[cfg(any( all(feature = "identity-serialization", feature = "client"), feature = "identity-value-conversion" @@ -149,7 +162,7 @@ impl IdentityFactory { #[cfg(all(feature = "state-transitions", feature = "client"))] pub fn create_identity_create_transition( &self, - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, ) -> Result { let transition = @@ -172,8 +185,8 @@ impl IdentityFactory { revision: 0, }); - let mut identity_create_transition = IdentityCreateTransition::V0( - IdentityCreateTransitionV0::try_from_identity_v0(identity.clone(), asset_lock_proof)?, + let identity_create_transition = IdentityCreateTransition::V0( + IdentityCreateTransitionV0::try_from_identity_v0(&identity, asset_lock_proof)?, ); Ok((identity, identity_create_transition)) } @@ -187,7 +200,7 @@ impl IdentityFactory { let mut identity_topup_transition = IdentityTopUpTransitionV0::default(); identity_topup_transition.set_identity_id(identity_id); - identity_topup_transition.set_asset_lock_proof(asset_lock_proof); + identity_topup_transition.set_asset_lock_proof(asset_lock_proof)?; Ok(IdentityTopUpTransition::V0(identity_topup_transition)) } @@ -195,47 +208,68 @@ impl IdentityFactory { #[cfg(all(feature = "state-transitions", feature = "client"))] pub fn create_identity_credit_transfer_transition( &self, - identity_id: Identifier, + identity: &Identity, recipient_id: Identifier, amount: u64, + identity_nonce: IdentityNonce, ) -> Result { - let mut identity_credit_transfer_transition = IdentityCreditTransferTransitionV0::default(); - identity_credit_transfer_transition.identity_id = identity_id; - identity_credit_transfer_transition.recipient_id = recipient_id; - identity_credit_transfer_transition.amount = amount; + let identity_credit_transfer_transition = IdentityCreditTransferTransitionV0 { + identity_id: identity.id(), + recipient_id, + amount, + nonce: identity_nonce, + ..Default::default() + }; Ok(IdentityCreditTransferTransition::from( identity_credit_transfer_transition, )) } + #[cfg(all(feature = "state-transitions", feature = "client"))] + pub fn create_identity_credit_withdrawal_transition( + &self, + identity_id: Identifier, + amount: u64, + core_fee_per_byte: u32, + pooling: Pooling, + output_script: CoreScript, + identity_nonce: IdentityNonce, + ) -> Result { + let identity_credit_withdrawal_transition = IdentityCreditWithdrawalTransitionV0 { + identity_id, + amount, + core_fee_per_byte, + pooling, + output_script, + nonce: identity_nonce, + ..Default::default() + }; + + Ok(IdentityCreditWithdrawalTransition::from( + identity_credit_withdrawal_transition, + )) + } + #[cfg(all(feature = "state-transitions", feature = "client"))] pub fn create_identity_update_transition( &self, identity: Identity, + identity_nonce: u64, add_public_keys: Option>, public_key_ids_to_disable: Option>, - // Pass disable time as argument because SystemTime::now() does not work for wasm target - // https://github.com/rust-lang/rust/issues/48564 - disable_time: Option, ) -> Result { let mut identity_update_transition = IdentityUpdateTransitionV0::default(); identity_update_transition.set_identity_id(identity.id().to_owned()); identity_update_transition.set_revision(identity.revision() + 1); + identity_update_transition.set_nonce(identity_nonce); if let Some(add_public_keys) = add_public_keys { identity_update_transition.set_public_keys_to_add(add_public_keys); } if let Some(public_key_ids_to_disable) = public_key_ids_to_disable { - if disable_time.is_none() { - return Err(ProtocolError::Generic( - "Public keys disabled at must be present".to_string(), - )); - } - identity_update_transition.set_public_key_ids_to_disable(public_key_ids_to_disable); - identity_update_transition.set_public_keys_disabled_at(disable_time); } Ok(IdentityUpdateTransition::V0(identity_update_transition)) diff --git a/packages/rs-dpp/src/identity/identity_nonce.rs b/packages/rs-dpp/src/identity/identity_nonce.rs new file mode 100644 index 00000000000..fd98642a972 --- /dev/null +++ b/packages/rs-dpp/src/identity/identity_nonce.rs @@ -0,0 +1,275 @@ +use crate::ProtocolError; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use std::fmt::{Debug, Display, Formatter}; + +use crate::consensus::state::identity::invalid_identity_contract_nonce_error::InvalidIdentityNonceError; +use crate::consensus::state::state_error::StateError; +use crate::consensus::ConsensusError; +use crate::prelude::IdentityNonce; +use crate::validation::SimpleConsensusValidationResult; +use bincode::{Decode, Encode}; +use platform_value::Identifier; + +pub const IDENTITY_NONCE_VALUE_FILTER: u64 = 0xFFFFFFFFFF; +pub const MISSING_IDENTITY_REVISIONS_FILTER: u64 = 0xFFFFFF0000000000; +pub const MAX_MISSING_IDENTITY_REVISIONS: u64 = 24; +pub const MISSING_IDENTITY_REVISIONS_MAX_BYTES: u64 = MAX_MISSING_IDENTITY_REVISIONS; +pub const IDENTITY_NONCE_VALUE_FILTER_MAX_BYTES: u64 = 40; + +#[derive( + Debug, Clone, Copy, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +/// The result of the merge of the identity contract nonce +pub enum MergeIdentityNonceResult { + /// The nonce is an invalid value + /// This could be 0 + InvalidNonce, + /// The nonce is too far in the future + NonceTooFarInFuture, + /// The nonce is too far in the past + NonceTooFarInPast, + /// The nonce is already present at the tip + NonceAlreadyPresentAtTip, + /// The nonce is already present in the past + NonceAlreadyPresentInPast(u64), + /// The merge is a success + MergeIdentityNonceSuccess(IdentityNonce), +} + +impl Display for MergeIdentityNonceResult { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + f.write_str(self.error_message().unwrap_or("no error")) + } +} + +impl MergeIdentityNonceResult { + /// Gives a result from the enum + pub fn error_message(&self) -> Option<&'static str> { + match self { + MergeIdentityNonceResult::NonceTooFarInFuture => Some("nonce too far in future"), + MergeIdentityNonceResult::NonceTooFarInPast => Some("nonce too far in past"), + MergeIdentityNonceResult::NonceAlreadyPresentAtTip => { + Some("nonce already present at tip") + } + MergeIdentityNonceResult::NonceAlreadyPresentInPast(_) => { + Some("nonce already present in past") + } + MergeIdentityNonceResult::MergeIdentityNonceSuccess(_) => None, + MergeIdentityNonceResult::InvalidNonce => Some("nonce is an invalid value"), + } + } + + /// Is this result an error? + pub fn is_error(&self) -> bool { + !matches!(self, MergeIdentityNonceResult::MergeIdentityNonceSuccess(_)) + } +} + +pub fn validate_new_identity_nonce( + new_revision_nonce: IdentityNonce, + identity_id: Identifier, +) -> SimpleConsensusValidationResult { + if new_revision_nonce >= MISSING_IDENTITY_REVISIONS_MAX_BYTES { + // we are too far away from the actual revision + SimpleConsensusValidationResult::new_with_error(ConsensusError::StateError( + StateError::InvalidIdentityNonceError(InvalidIdentityNonceError { + identity_id, + current_identity_nonce: None, + setting_identity_nonce: new_revision_nonce, + error: MergeIdentityNonceResult::NonceTooFarInPast, + }), + )) + } else { + SimpleConsensusValidationResult::new() + } +} + +pub fn validate_identity_nonce_update( + existing_nonce: IdentityNonce, + new_revision_nonce: IdentityNonce, + identity_id: Identifier, +) -> SimpleConsensusValidationResult { + let actual_existing_revision = existing_nonce & IDENTITY_NONCE_VALUE_FILTER; + match actual_existing_revision.cmp(&new_revision_nonce) { + std::cmp::Ordering::Equal => { + // we were not able to update the revision as it is the same as we already had + return SimpleConsensusValidationResult::new_with_error(ConsensusError::StateError( + StateError::InvalidIdentityNonceError(InvalidIdentityNonceError { + identity_id, + current_identity_nonce: Some(existing_nonce), + setting_identity_nonce: new_revision_nonce, + error: MergeIdentityNonceResult::NonceAlreadyPresentAtTip, + }), + )); + } + std::cmp::Ordering::Less => { + if new_revision_nonce - actual_existing_revision > MISSING_IDENTITY_REVISIONS_MAX_BYTES + { + // we are too far away from the actual revision + return SimpleConsensusValidationResult::new_with_error( + ConsensusError::StateError(StateError::InvalidIdentityNonceError( + InvalidIdentityNonceError { + identity_id, + current_identity_nonce: Some(existing_nonce), + setting_identity_nonce: new_revision_nonce, + error: MergeIdentityNonceResult::NonceTooFarInFuture, + }, + )), + ); + } + } + std::cmp::Ordering::Greater => { + let previous_revision_position_from_top = actual_existing_revision - new_revision_nonce; + if previous_revision_position_from_top > MISSING_IDENTITY_REVISIONS_MAX_BYTES { + // we are too far away from the actual revision + return SimpleConsensusValidationResult::new_with_error( + ConsensusError::StateError(StateError::InvalidIdentityNonceError( + InvalidIdentityNonceError { + identity_id, + current_identity_nonce: Some(existing_nonce), + setting_identity_nonce: new_revision_nonce, + error: MergeIdentityNonceResult::NonceTooFarInPast, + }, + )), + ); + } else { + let old_missing_revisions = existing_nonce & MISSING_IDENTITY_REVISIONS_FILTER; + let old_revision_already_set = if old_missing_revisions == 0 { + true + } else { + let byte_to_unset = 1 + << (previous_revision_position_from_top - 1 + + IDENTITY_NONCE_VALUE_FILTER_MAX_BYTES); + old_missing_revisions | byte_to_unset != old_missing_revisions + }; + + if old_revision_already_set { + return SimpleConsensusValidationResult::new_with_error( + ConsensusError::StateError(StateError::InvalidIdentityNonceError( + InvalidIdentityNonceError { + identity_id, + current_identity_nonce: Some(existing_nonce), + setting_identity_nonce: new_revision_nonce, + error: MergeIdentityNonceResult::NonceAlreadyPresentInPast( + previous_revision_position_from_top, + ), + }, + )), + ); + } + } + } + } + SimpleConsensusValidationResult::new() +} + +#[cfg(test)] +mod tests { + use crate::consensus::state::state_error::StateError; + use crate::consensus::ConsensusError; + use crate::identity::identity_nonce::{ + validate_identity_nonce_update, MergeIdentityNonceResult, + }; + use platform_value::Identifier; + + #[test] + fn validate_identity_nonce_not_changed() { + let tip = 50; + let new_nonce = tip; + let identity_id = Identifier::default(); + let result = validate_identity_nonce_update(tip, new_nonce, identity_id); + + let Some(ConsensusError::StateError(StateError::InvalidIdentityNonceError(e))) = + result.errors.first() + else { + panic!("expected state error"); + }; + assert_eq!(e.error, MergeIdentityNonceResult::NonceAlreadyPresentAtTip); + } + + #[test] + fn validate_identity_nonce_update_too_far_in_past() { + let tip = 50; + let new_nonce = tip - 25; + let identity_id = Identifier::default(); + let result = validate_identity_nonce_update(tip, new_nonce, identity_id); + + let Some(ConsensusError::StateError(StateError::InvalidIdentityNonceError(e))) = + result.errors.first() + else { + panic!("expected state error"); + }; + assert_eq!(e.error, MergeIdentityNonceResult::NonceTooFarInPast); + } + + #[test] + fn validate_identity_nonce_update_too_far_in_future() { + let tip = 50; + let new_nonce = tip + 25; + let identity_id = Identifier::default(); + let result = validate_identity_nonce_update(tip, new_nonce, identity_id); + + let Some(ConsensusError::StateError(StateError::InvalidIdentityNonceError(e))) = + result.errors.first() + else { + panic!("expected state error"); + }; + assert_eq!(e.error, MergeIdentityNonceResult::NonceTooFarInFuture); + } + + #[test] + fn validate_identity_nonce_update_already_in_past_no_missing_in_nonce() { + let tip = 50; + let new_nonce = tip - 24; + let identity_id = Identifier::default(); + let result = validate_identity_nonce_update(tip, new_nonce, identity_id); + + let Some(ConsensusError::StateError(StateError::InvalidIdentityNonceError(e))) = + result.errors.first() + else { + panic!("expected state error"); + }; + assert_eq!( + e.error, + MergeIdentityNonceResult::NonceAlreadyPresentInPast(24) + ); + } + + #[test] + fn validate_identity_nonce_update_already_in_past_some_missing_in_nonce() { + let tip = 50 | 0x0FFF000000000000; + let new_nonce = 50 - 24; + let identity_id = Identifier::default(); + let result = validate_identity_nonce_update(tip, new_nonce, identity_id); + + let Some(ConsensusError::StateError(StateError::InvalidIdentityNonceError(e))) = + result.errors.first() + else { + panic!("expected state error"); + }; + assert_eq!( + e.error, + MergeIdentityNonceResult::NonceAlreadyPresentInPast(24) + ); + } + + #[test] + fn validate_identity_nonce_update_not_in_past_some_missing_in_nonce() { + let tip = 50 | 0x0FFF000000000000; + let new_nonce = 50 - 20; + let identity_id = Identifier::default(); + let result = validate_identity_nonce_update(tip, new_nonce, identity_id); + + assert!(result.errors.is_empty()) + } + + #[test] + fn validate_identity_nonce_in_close_future() { + let tip = 50 | 0x0FFF000000000000; + let new_nonce = 50 + 24; + let identity_id = Identifier::default(); + let result = validate_identity_nonce_update(tip, new_nonce, identity_id); + + assert!(result.errors.is_empty()) + } +} diff --git a/packages/rs-dpp/src/identity/identity_public_key/contract_bounds/mod.rs b/packages/rs-dpp/src/identity/identity_public_key/contract_bounds/mod.rs index b5df08e1746..2d400838b62 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/contract_bounds/mod.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/contract_bounds/mod.rs @@ -4,7 +4,7 @@ use crate::identity::identity_public_key::contract_bounds::ContractBounds::{ }; use crate::ProtocolError; use bincode::{Decode, Encode}; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; +use serde::{Deserialize, Serialize}; pub type ContractBoundsType = u8; diff --git a/packages/rs-dpp/src/identity/identity_public_key/key_type.rs b/packages/rs-dpp/src/identity/identity_public_key/key_type.rs index edf601b4ca9..8f4ad7bb5a7 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/key_type.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/key_type.rs @@ -1,11 +1,16 @@ +#[cfg(feature = "random-public-keys")] use crate::util::hash::ripemd160_sha256; use anyhow::bail; use bincode::{Decode, Encode}; #[cfg(feature = "cbor")] use ciborium::value::Value as CborValue; +#[cfg(feature = "random-public-keys")] use dashcore::secp256k1::rand::rngs::StdRng as EcdsaRng; +#[cfg(feature = "random-public-keys")] use dashcore::secp256k1::rand::SeedableRng; +#[cfg(feature = "random-public-keys")] use dashcore::secp256k1::Secp256k1; +#[cfg(feature = "random-public-keys")] use dashcore::Network; use itertools::Itertools; use lazy_static::lazy_static; @@ -13,7 +18,9 @@ use lazy_static::lazy_static; use crate::fee::Credits; use crate::version::PlatformVersion; use crate::ProtocolError; +#[cfg(feature = "random-public-keys")] use rand::rngs::StdRng; +#[cfg(feature = "random-public-keys")] use rand::Rng; use serde_repr::{Deserialize_repr, Serialize_repr}; use std::collections::HashMap; @@ -34,8 +41,11 @@ use std::convert::TryFrom; PartialOrd, Encode, Decode, + Default, + strum::EnumIter, )] pub enum KeyType { + #[default] ECDSA_SECP256K1 = 0, BLS12_381 = 1, ECDSA_HASH160 = 2, @@ -43,14 +53,8 @@ pub enum KeyType { EDDSA_25519_HASH160 = 4, } -impl Default for KeyType { - fn default() -> Self { - KeyType::ECDSA_SECP256K1 - } -} - lazy_static! { - static ref KEY_TYPE_SIZES: HashMap = vec![ + static ref KEY_TYPE_SIZES: HashMap = [ (KeyType::ECDSA_SECP256K1, 33), (KeyType::BLS12_381, 48), (KeyType::ECDSA_HASH160, 20), @@ -73,6 +77,17 @@ impl KeyType { KEY_TYPE_SIZES[self] } + /// All key types + pub fn all_key_types() -> [KeyType; 5] { + [ + Self::ECDSA_SECP256K1, + Self::BLS12_381, + Self::ECDSA_HASH160, + Self::BIP13_SCRIPT_HASH, + Self::EDDSA_25519_HASH160, + ] + } + /// Are keys of this type unique? pub fn is_unique_key_type(&self) -> bool { match self { @@ -90,11 +105,36 @@ impl KeyType { ) -> Result { match platform_version.dpp.costs.signature_verify { 0 => Ok(match self { - KeyType::ECDSA_SECP256K1 => 3000, - KeyType::BLS12_381 => 6000, - KeyType::ECDSA_HASH160 => 4000, - KeyType::BIP13_SCRIPT_HASH => 6000, - KeyType::EDDSA_25519_HASH160 => 3000, + KeyType::ECDSA_SECP256K1 => { + platform_version + .fee_version + .signature + .verify_signature_ecdsa_secp256k1 + } + KeyType::BLS12_381 => { + platform_version + .fee_version + .signature + .verify_signature_bls12_381 + } + KeyType::ECDSA_HASH160 => { + platform_version + .fee_version + .signature + .verify_signature_ecdsa_hash160 + } + KeyType::BIP13_SCRIPT_HASH => { + platform_version + .fee_version + .signature + .verify_signature_bip13_script_hash + } + KeyType::EDDSA_25519_HASH160 => { + platform_version + .fee_version + .signature + .verify_signature_eddsa25519_hash160 + } }), version => Err(ProtocolError::UnknownVersionMismatch { method: "KeyType::signature_verify_cost".to_string(), diff --git a/packages/rs-dpp/src/identity/identity_public_key/purpose.rs b/packages/rs-dpp/src/identity/identity_public_key/purpose.rs index f192d4dedf3..17612a9cd21 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/purpose.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/purpose.rs @@ -1,4 +1,4 @@ -use crate::identity::Purpose::{AUTHENTICATION, DECRYPTION, ENCRYPTION, SYSTEM, VOTING, WITHDRAW}; +use crate::identity::Purpose::{AUTHENTICATION, DECRYPTION, ENCRYPTION, SYSTEM, TRANSFER, VOTING}; use anyhow::bail; use bincode::{Decode, Encode}; #[cfg(feature = "cbor")] @@ -20,25 +20,41 @@ use std::convert::TryFrom; PartialOrd, Encode, Decode, + Default, + strum::EnumIter, )] pub enum Purpose { /// at least one authentication key must be registered for all security levels + #[default] AUTHENTICATION = 0, /// this key cannot be used for signing documents ENCRYPTION = 1, /// this key cannot be used for signing documents DECRYPTION = 2, - /// this key cannot be used for signing documents - WITHDRAW = 3, + /// this key is used to sign credit transfer and withdrawal state transitions + TRANSFER = 3, /// this key cannot be used for signing documents SYSTEM = 4, /// this key cannot be used for signing documents VOTING = 5, } -impl Default for Purpose { - fn default() -> Self { - Purpose::AUTHENTICATION +impl From for [u8; 1] { + fn from(purpose: Purpose) -> Self { + [purpose as u8] + } +} + +impl From for &'static [u8; 1] { + fn from(purpose: Purpose) -> Self { + match purpose { + AUTHENTICATION => &[0], + ENCRYPTION => &[1], + DECRYPTION => &[2], + TRANSFER => &[3], + SYSTEM => &[4], + VOTING => &[5], + } } } @@ -49,7 +65,22 @@ impl TryFrom for Purpose { 0 => Ok(AUTHENTICATION), 1 => Ok(ENCRYPTION), 2 => Ok(DECRYPTION), - 3 => Ok(WITHDRAW), + 3 => Ok(TRANSFER), + 4 => Ok(SYSTEM), + 5 => Ok(VOTING), + value => bail!("unrecognized purpose: {}", value), + } + } +} + +impl TryFrom for Purpose { + type Error = anyhow::Error; + fn try_from(value: i32) -> Result { + match value { + 0 => Ok(AUTHENTICATION), + 1 => Ok(ENCRYPTION), + 2 => Ok(DECRYPTION), + 3 => Ok(TRANSFER), 4 => Ok(SYSTEM), 5 => Ok(VOTING), value => bail!("unrecognized purpose: {}", value), @@ -72,11 +103,11 @@ impl std::fmt::Display for Purpose { impl Purpose { /// The full range of purposes pub fn full_range() -> [Purpose; 4] { - [AUTHENTICATION, ENCRYPTION, DECRYPTION, WITHDRAW] + [AUTHENTICATION, ENCRYPTION, DECRYPTION, TRANSFER] } /// Just the authentication and withdraw purposes - pub fn authentication_withdraw() -> [Purpose; 2] { - [AUTHENTICATION, WITHDRAW] + pub fn authentication_and_transfer() -> [Purpose; 2] { + [AUTHENTICATION, TRANSFER] } /// Just the encryption and decryption purposes pub fn encryption_decryption() -> [Purpose; 2] { @@ -84,6 +115,6 @@ impl Purpose { } /// The last purpose pub fn last() -> Purpose { - Self::WITHDRAW + Self::TRANSFER } } diff --git a/packages/rs-dpp/src/identity/identity_public_key/random.rs b/packages/rs-dpp/src/identity/identity_public_key/random.rs index 80c28b98296..fd5d6d5d2cb 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/random.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/random.rs @@ -1,9 +1,10 @@ use crate::identity::identity_public_key::v0::IdentityPublicKeyV0; -use crate::identity::{IdentityPublicKey, KeyCount, KeyID}; +use crate::identity::{IdentityPublicKey, KeyCount, KeyID, KeyType, Purpose, SecurityLevel}; use crate::version::PlatformVersion; use crate::ProtocolError; +use crate::identity::contract_bounds::ContractBounds; use rand::rngs::StdRng; use rand::SeedableRng; @@ -243,6 +244,60 @@ impl IdentityPublicKey { } } + /// Generates a random key based on the platform version. + /// + /// # Parameters + /// + /// * `id`: The `KeyID` for the generated key. + /// * `rng`: A mutable reference to a random number generator of type `StdRng`. + /// * `used_key_matrix`: An optional tuple that contains the count of keys that have already been used + /// and a mutable reference to a matrix (or vector) that tracks which keys have been used. + /// * `platform_version`: The platform version which determines the structure of the identity key. + /// + /// # Returns + /// + /// * `Result`: If successful, returns an instance of `Self`. + /// In case of an error, it returns a `ProtocolError`. + /// + /// # Errors + /// + /// * `ProtocolError::PublicKeyGenerationError`: This error is returned if too many keys have already been created. + /// * `ProtocolError::UnknownVersionMismatch`: This error is returned if the provided platform version is not recognized. + /// + pub fn random_key_with_known_attributes( + id: KeyID, + rng: &mut StdRng, + purpose: Purpose, + security_level: SecurityLevel, + key_type: KeyType, + contract_bounds: Option, + platform_version: &PlatformVersion, + ) -> Result<(Self, Vec), ProtocolError> { + match platform_version + .dpp + .identity_versions + .identity_key_structure_version + { + 0 => { + let (key, private_key) = IdentityPublicKeyV0::random_key_with_known_attributes( + id, + rng, + purpose, + security_level, + key_type, + contract_bounds, + platform_version, + )?; + Ok((key.into(), private_key)) + } + version => Err(ProtocolError::UnknownVersionMismatch { + method: "IdentityPublicKey::random_key_with_known_attributes".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + /// Generates a random ECDSA master authentication public key along with its corresponding private key. /// /// This method constructs a random ECDSA (using the secp256k1 curve) master authentication public key @@ -287,6 +342,33 @@ impl IdentityPublicKey { } } + /// Generates a random ECDSA master-level authentication public key along with its corresponding private key. + /// + /// This method constructs a random ECDSA (using the secp256k1 curve) high-level authentication public key + /// and returns both the public key and its corresponding private key. + /// + /// # Parameters + /// + /// * `id`: The `KeyID` for the generated key. + /// * `seed`: A seed that will create a random number generator `StdRng`. + /// + /// # Returns + /// + /// * `(Self, Vec)`: A tuple where the first element is an instance of the `IdentityPublicKey` struct, + /// and the second element is the corresponding private key. + /// + pub fn random_ecdsa_master_authentication_key( + id: KeyID, + seed: Option, + platform_version: &PlatformVersion, + ) -> Result<(Self, Vec), ProtocolError> { + let mut rng = match seed { + None => StdRng::from_entropy(), + Some(seed_value) => StdRng::seed_from_u64(seed_value), + }; + Self::random_ecdsa_master_authentication_key_with_rng(id, &mut rng, platform_version) + } + /// Generates a random ECDSA critical-level authentication public key along with its corresponding private key. /// /// This method constructs a random ECDSA (using the secp256k1 curve) high-level authentication public key @@ -507,6 +589,9 @@ impl IdentityPublicKey { used_key_matrix[0] = true; used_key_matrix[1] = true; used_key_matrix[2] = true; + used_key_matrix[4] = true; //also a master key + used_key_matrix[8] = true; //also a master key + used_key_matrix[12] = true; //also a master key main_keys.extend((3..key_count).map(|i| { Self::random_authentication_key_with_private_key_with_rng( i, diff --git a/packages/rs-dpp/src/identity/identity_public_key/security_level.rs b/packages/rs-dpp/src/identity/identity_public_key/security_level.rs index ffb3d316c10..978134016b0 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/security_level.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/security_level.rs @@ -1,10 +1,13 @@ -use anyhow::bail; use bincode::{Decode, Encode}; #[cfg(feature = "cbor")] use ciborium::value::Value as CborValue; use serde_repr::{Deserialize_repr, Serialize_repr}; +use crate::consensus::basic::data_contract::UnknownSecurityLevelError; +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; use std::convert::TryFrom; #[repr(u8)] @@ -21,20 +24,17 @@ use std::convert::TryFrom; Ord, Encode, Decode, + Default, + strum::EnumIter, )] pub enum SecurityLevel { MASTER = 0, CRITICAL = 1, + #[default] HIGH = 2, MEDIUM = 3, } -impl Default for SecurityLevel { - fn default() -> Self { - SecurityLevel::MASTER - } -} - #[cfg(feature = "cbor")] impl Into for SecurityLevel { fn into(self) -> CborValue { @@ -43,14 +43,19 @@ impl Into for SecurityLevel { } impl TryFrom for SecurityLevel { - type Error = anyhow::Error; - fn try_from(value: u8) -> Result { + type Error = ProtocolError; + fn try_from(value: u8) -> Result { match value { 0 => Ok(Self::MASTER), 1 => Ok(Self::CRITICAL), 2 => Ok(Self::HIGH), 3 => Ok(Self::MEDIUM), - value => bail!("unrecognized security level: {}", value), + value => Err(ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::UnknownSecurityLevelError( + UnknownSecurityLevelError::new(vec![0, 1, 2, 3], value), + )) + .into(), + )), } } } @@ -69,6 +74,19 @@ impl SecurityLevel { pub fn highest_level() -> SecurityLevel { Self::MASTER } + pub fn stronger_security_than(self: SecurityLevel, rhs: SecurityLevel) -> bool { + // Example: + // self: High 2 rhs: Master 0 + // Master has a stronger security level than high + // We expect False + // High < Master + // 2 < 0 <=> false + (self as u8) < (rhs as u8) + } + + pub fn stronger_or_equal_security_than(self: SecurityLevel, rhs: SecurityLevel) -> bool { + (self as u8) <= (rhs as u8) + } } impl std::fmt::Display for SecurityLevel { diff --git a/packages/rs-dpp/src/identity/identity_public_key/v0/random.rs b/packages/rs-dpp/src/identity/identity_public_key/v0/random.rs index 29c1cea85b5..2375810df23 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/v0/random.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/v0/random.rs @@ -1,3 +1,4 @@ +use crate::identity::contract_bounds::ContractBounds; use crate::identity::identity_public_key::v0::IdentityPublicKeyV0; use crate::identity::KeyType::ECDSA_SECP256K1; use crate::identity::Purpose::AUTHENTICATION; @@ -115,6 +116,32 @@ impl IdentityPublicKeyV0 { )) } + pub fn random_key_with_known_attributes( + id: KeyID, + rng: &mut StdRng, + purpose: Purpose, + security_level: SecurityLevel, + key_type: KeyType, + contract_bounds: Option, + platform_version: &PlatformVersion, + ) -> Result<(Self, Vec), ProtocolError> { + let read_only = false; + let (public_data, private_data) = + key_type.random_public_and_private_key_data(rng, platform_version)?; + let data = BinaryData::new(public_data); + let identity_public_key = IdentityPublicKeyV0 { + id, + key_type, + purpose, + security_level, + read_only, + disabled_at: None, + data, + contract_bounds, + }; + Ok((identity_public_key, private_data)) + } + pub fn random_key_with_rng( id: KeyID, rng: &mut StdRng, diff --git a/packages/rs-dpp/src/identity/methods/create_basic_identity/v0/mod.rs b/packages/rs-dpp/src/identity/methods/create_basic_identity/v0/mod.rs index a385272e662..a9a5f170b71 100644 --- a/packages/rs-dpp/src/identity/methods/create_basic_identity/v0/mod.rs +++ b/packages/rs-dpp/src/identity/methods/create_basic_identity/v0/mod.rs @@ -4,6 +4,7 @@ use platform_value::Identifier; use std::collections::BTreeMap; impl Identity { + #[inline(always)] pub(super) fn create_basic_identity_v0(id: [u8; 32]) -> Self { IdentityV0 { id: Identifier::new(id), diff --git a/packages/rs-dpp/src/identity/mod.rs b/packages/rs-dpp/src/identity/mod.rs index 4260fccf522..34ad4c34960 100644 --- a/packages/rs-dpp/src/identity/mod.rs +++ b/packages/rs-dpp/src/identity/mod.rs @@ -1,6 +1,5 @@ pub use credits_converter::*; -pub use credits_converter::*; -pub use get_biggest_possible_identity::*; + pub use identity::*; #[cfg(feature = "client")] pub use identity_facade::*; @@ -19,15 +18,17 @@ pub mod signer; pub mod accessors; pub(crate) mod conversion; -mod fields; +pub mod fields; +pub mod identities_contract_keys; #[cfg(feature = "client")] mod identity_facade; #[cfg(feature = "factories")] pub mod identity_factory; -mod methods; +pub mod identity_nonce; +pub mod methods; #[cfg(feature = "random-identities")] pub mod random; -mod v0; +pub mod v0; pub mod versions; pub use fields::*; diff --git a/packages/rs-dpp/src/identity/signer.rs b/packages/rs-dpp/src/identity/signer.rs index ff6d12d477c..51d20dd7cde 100644 --- a/packages/rs-dpp/src/identity/signer.rs +++ b/packages/rs-dpp/src/identity/signer.rs @@ -2,7 +2,7 @@ use crate::prelude::IdentityPublicKey; use crate::ProtocolError; use platform_value::BinaryData; -pub trait Signer { +pub trait Signer: Sync { /// the public key bytes are only used to look up the private key fn sign( &self, diff --git a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/chain/chain_asset_lock_proof.rs b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/chain/chain_asset_lock_proof.rs index ba16c593860..0a7b020cc1a 100644 --- a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/chain/chain_asset_lock_proof.rs +++ b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/chain/chain_asset_lock_proof.rs @@ -1,9 +1,8 @@ use ::serde::{Deserialize, Serialize}; use platform_value::Value; use std::convert::TryFrom; -use std::io; -use crate::util::hash::hash; +use crate::util::hash::hash_double; use crate::{identifier::Identifier, ProtocolError}; pub use bincode::{Decode, Encode}; use dashcore::OutPoint; @@ -44,14 +43,11 @@ impl ChainAssetLockProof { } /// Create identifier - pub fn create_identifier(&self) -> Result { - let output_vec: Vec = self - .out_point - .try_into() - .map_err(|e: io::Error| ProtocolError::EncodingError(e.to_string()))?; + pub fn create_identifier(&self) -> Identifier { + let outpoint_bytes: [u8; 36] = self.out_point.into(); - let hash = hash(output_vec); + let hash = hash_double(outpoint_bytes.as_slice()); - Ok(Identifier::new(hash)) + Identifier::new(hash) } } diff --git a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof.rs b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof.rs index 5d11032960d..a86b732fe97 100644 --- a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof.rs +++ b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof.rs @@ -1,23 +1,23 @@ use std::convert::{TryFrom, TryInto}; -use std::io; use dashcore::consensus::{deserialize, Encodable}; use dashcore::transaction::special_transaction::TransactionPayload; use dashcore::{InstantLock, OutPoint, Transaction, TxIn, TxOut}; use platform_value::{BinaryData, Value}; -use crate::consensus::basic::identity::IdentityAssetLockProofLockedTransactionMismatchError; +#[cfg(feature = "validation")] +use crate::identity::state_transition::asset_lock_proof::instant::methods; +#[cfg(feature = "validation")] +use platform_version::version::PlatformVersion; use serde::de::Error as DeError; use serde::ser::Error as SerError; use serde::{Deserialize, Deserializer, Serialize, Serializer}; -use platform_version::version::{FeatureVersion, PlatformVersion}; -use crate::identity::state_transition::asset_lock_proof::instant::methods; -use crate::identity::state_transition::asset_lock_proof::validate_asset_lock_transaction_structure::validate_asset_lock_transaction_structure; use crate::prelude::Identifier; #[cfg(feature = "cbor")] use crate::util::cbor_value::CborCanonicalMap; -use crate::util::hash::hash; +use crate::util::hash::hash_double; +#[cfg(feature = "validation")] use crate::validation::SimpleConsensusValidationResult; use crate::ProtocolError; @@ -28,11 +28,11 @@ use crate::ProtocolError; #[derive(Clone, Debug, Eq, PartialEq)] pub struct InstantAssetLockProof { /// The transaction's Instant Lock - instant_lock: InstantLock, + pub instant_lock: InstantLock, /// Asset Lock Special Transaction - transaction: Transaction, + pub transaction: Transaction, /// Index of the output in the transaction payload - output_index: u32, + pub output_index: u32, } impl Serialize for InstantAssetLockProof { @@ -131,11 +131,9 @@ impl InstantAssetLockProof { ProtocolError::IdentifierError(String::from("No output at a given index")) })?; - let output_vec: Vec = outpoint - .try_into() - .map_err(|e: io::Error| ProtocolError::EncodingError(e.to_string()))?; + let outpoint_bytes: [u8; 36] = outpoint.into(); - let hash = hash(output_vec); + let hash = hash_double(outpoint_bytes.as_slice()); Ok(Identifier::new(hash)) } diff --git a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/methods/validate_structure/mod.rs b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/methods/validate_structure/mod.rs index 9743445699b..6cd29ce70e2 100644 --- a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/methods/validate_structure/mod.rs +++ b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/methods/validate_structure/mod.rs @@ -1,3 +1,4 @@ mod v0; +#[allow(unused_imports)] // Removing causes build failures; yet clippy insists it's unused pub(in crate::identity::state_transition::asset_lock_proof::instant) use v0::validate_instant_asset_lock_proof_structure_v0; diff --git a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs index 395190bec90..2e97ad74808 100644 --- a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs +++ b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs @@ -1,18 +1,20 @@ use std::convert::{TryFrom, TryInto}; -use dashcore::{OutPoint, Transaction, TxOut}; +use dashcore::{OutPoint, Transaction}; use serde::{Deserialize, Deserializer, Serialize}; pub use bincode::{Decode, Encode}; -pub use chain::*; + pub use instant::*; use platform_value::Value; +#[cfg(feature = "validation")] use platform_version::version::PlatformVersion; use serde::de::Error; use crate::identity::state_transition::asset_lock_proof::chain::ChainAssetLockProof; use crate::prelude::Identifier; +#[cfg(feature = "validation")] use crate::validation::SimpleConsensusValidationResult; use crate::{ProtocolError, SerdeParsingError}; @@ -173,7 +175,7 @@ impl AssetLockProof { pub fn create_identifier(&self) -> Result { match self { AssetLockProof::Instant(instant_proof) => instant_proof.create_identifier(), - AssetLockProof::Chain(chain_proof) => chain_proof.create_identifier(), + AssetLockProof::Chain(chain_proof) => Ok(chain_proof.create_identifier()), } } diff --git a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/mod.rs b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/mod.rs index 64e8cdcd7c7..42255735b95 100644 --- a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/mod.rs +++ b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/mod.rs @@ -1,6 +1,6 @@ -use crate::validation::SimpleConsensusValidationResult; +use crate::validation::ConsensusValidationResult; use crate::ProtocolError; -use dashcore::Transaction; +use dashcore::{Transaction, TxOut}; use platform_version::version::PlatformVersion; mod v0; @@ -10,7 +10,7 @@ pub fn validate_asset_lock_transaction_structure( transaction: &Transaction, output_index: u32, platform_version: &PlatformVersion, -) -> Result { +) -> Result, ProtocolError> { match platform_version .dpp .state_transitions @@ -18,7 +18,10 @@ pub fn validate_asset_lock_transaction_structure( .asset_locks .validate_asset_lock_transaction_structure { - 0 => v0::validate_asset_lock_transaction_structure_v0(transaction, output_index), + 0 => Ok(v0::validate_asset_lock_transaction_structure_v0( + transaction, + output_index, + )), version => Err(ProtocolError::UnknownVersionMismatch { method: "validate_asset_lock_transaction_structure".to_string(), known_versions: vec![0], diff --git a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/v0/mod.rs b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/v0/mod.rs index 0a3bb4b1b28..e55d94cc4b4 100644 --- a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/v0/mod.rs +++ b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/v0/mod.rs @@ -2,49 +2,42 @@ use crate::consensus::basic::identity::{ IdentityAssetLockTransactionOutputNotFoundError, InvalidIdentityAssetLockTransactionError, InvalidIdentityAssetLockTransactionOutputError, }; -use crate::validation::SimpleConsensusValidationResult; -use crate::ProtocolError; +use crate::validation::ConsensusValidationResult; use dashcore::transaction::special_transaction::TransactionPayload; -use dashcore::Transaction; +use dashcore::{Transaction, TxOut}; /// Validates asset lock transaction structure -pub fn validate_asset_lock_transaction_structure_v0( +#[inline(always)] +pub(super) fn validate_asset_lock_transaction_structure_v0( transaction: &Transaction, output_index: u32, -) -> Result { - let mut result = SimpleConsensusValidationResult::default(); - +) -> ConsensusValidationResult { // It must be an Asset Lock Special Transaction let Some(TransactionPayload::AssetLockPayloadType(ref payload)) = transaction.special_transaction_payload else { - return Ok(SimpleConsensusValidationResult::new_with_error( + return ConsensusValidationResult::new_with_error( InvalidIdentityAssetLockTransactionError::new( "Funding transaction must have an Asset Lock Special Transaction Payload", ) .into(), - )); + ); }; // Output index should point to existing funding output in payload let Some(output) = payload.credit_outputs.get(output_index as usize) else { - result.add_error(IdentityAssetLockTransactionOutputNotFoundError::new( - output_index as usize, - )); - - return Ok(result); + return ConsensusValidationResult::new_with_error( + IdentityAssetLockTransactionOutputNotFoundError::new(output_index as usize).into(), + ); }; // Output should be P2PKH if !output.script_pubkey.is_p2pkh() { - result.add_error(InvalidIdentityAssetLockTransactionOutputError::new( - output_index as usize, - )); - - return Ok(result); + //Todo: better error + ConsensusValidationResult::new_with_error( + InvalidIdentityAssetLockTransactionOutputError::new(output_index as usize).into(), + ) + } else { + ConsensusValidationResult::new_with_data(output.clone()) } - - // TODO: Do we need to perform whole validation what Core supposed to do? - - Ok(result) } diff --git a/packages/rs-dpp/src/identity/state_transition/mod.rs b/packages/rs-dpp/src/identity/state_transition/mod.rs index a2b4256eb68..874928f8c58 100644 --- a/packages/rs-dpp/src/identity/state_transition/mod.rs +++ b/packages/rs-dpp/src/identity/state_transition/mod.rs @@ -16,3 +16,11 @@ pub trait AssetLockProved { /// Get asset lock proof fn asset_lock_proof(&self) -> &AssetLockProof; } + +/// Only state transitions funded with Asset Lock Transactions have Asset Lock Proofs +pub trait OptionallyAssetLockProved { + /// Returns asset lock proof if state transition implements it + fn optional_asset_lock_proof(&self) -> Option<&AssetLockProof> { + None + } +} diff --git a/packages/rs-dpp/src/identity/v0/mod.rs b/packages/rs-dpp/src/identity/v0/mod.rs index 82180d7183f..47bd892074e 100644 --- a/packages/rs-dpp/src/identity/v0/mod.rs +++ b/packages/rs-dpp/src/identity/v0/mod.rs @@ -3,16 +3,22 @@ mod conversion; pub mod random; use std::collections::BTreeMap; +#[cfg(feature = "identity-value-conversion")] use std::convert::TryFrom; use std::hash::{Hash, Hasher}; +#[cfg(feature = "identity-value-conversion")] use platform_value::Value; +#[cfg(feature = "identity-serde-conversion")] use serde::{Deserialize, Serialize}; use crate::identity::{IdentityPublicKey, KeyID, PartialIdentity}; use crate::prelude::Revision; -use crate::{errors::ProtocolError, identifier::Identifier}; +#[cfg(feature = "identity-value-conversion")] +use crate::errors::ProtocolError; +use crate::identifier::Identifier; +#[cfg(feature = "identity-serialization")] use bincode::{Decode, Encode}; /// Implement the Identity. Identity is a low-level construct that provides the foundation @@ -24,6 +30,7 @@ use bincode::{Decode, Encode}; derive(Serialize, Deserialize), serde(rename_all = "camelCase") )] + pub struct IdentityV0 { pub id: Identifier, #[cfg_attr( diff --git a/packages/rs-dpp/src/identity/v0/random.rs b/packages/rs-dpp/src/identity/v0/random.rs index 9e78a878da1..2be4a34cfe1 100644 --- a/packages/rs-dpp/src/identity/v0/random.rs +++ b/packages/rs-dpp/src/identity/v0/random.rs @@ -57,7 +57,8 @@ impl IdentityV0 { let balance = rng.gen::() >> 20; //around 175 Dash as max let (public_keys, private_keys): (BTreeMap, I) = IdentityPublicKey::main_keys_with_random_authentication_keys_with_private_keys_with_rng( - key_count, rng, + key_count, + rng, platform_version, )? .into_iter() diff --git a/packages/rs-dpp/src/lib.rs b/packages/rs-dpp/src/lib.rs index 9a648df7069..c9eb000abb4 100644 --- a/packages/rs-dpp/src/lib.rs +++ b/packages/rs-dpp/src/lib.rs @@ -35,17 +35,23 @@ mod bls; #[cfg(feature = "fixtures-and-mocks")] pub mod tests; +pub mod asset_lock; pub mod balances; pub mod block; pub mod fee; +pub mod nft; pub mod serialization; -#[cfg(feature = "validation")] +#[cfg(any( + feature = "message-signing", + feature = "message-signature-verification" +))] pub mod signing; #[cfg(feature = "system_contracts")] pub mod system_data_contracts; pub mod withdrawal; pub use async_trait; + pub use bls::*; pub mod prelude { @@ -59,14 +65,27 @@ pub mod prelude { pub use crate::identity::IdentityPublicKey; #[cfg(feature = "validation")] pub use crate::validation::ConsensusValidationResult; + + pub type BlockHeight = u64; + + pub type CoreBlockHeight = u32; pub type TimestampMillis = u64; pub type Revision = u64; + pub type IdentityNonce = u64; + + /// UserFeeIncrease is the additional percentage of the processing fee. + /// A 1 here means we pay 1% more in processing fees. A 100 means we pay 100% more. + pub type UserFeeIncrease = u16; } pub use bincode; +#[cfg(all(not(target_arch = "wasm32"), feature = "bls-signatures"))] pub use bls_signatures; +#[cfg(feature = "system_contracts")] pub use data_contracts; +#[cfg(feature = "ed25519-dalek")] pub use ed25519_dalek; +#[cfg(feature = "jsonschema")] pub use jsonschema; pub use platform_serialization; pub use platform_value; diff --git a/packages/rs-dpp/src/nft/mod.rs b/packages/rs-dpp/src/nft/mod.rs new file mode 100644 index 00000000000..884906fb1e8 --- /dev/null +++ b/packages/rs-dpp/src/nft/mod.rs @@ -0,0 +1,55 @@ +use crate::consensus::basic::data_contract::UnknownTradeModeError; +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::ProtocolError; +use std::fmt; +use std::fmt::{Display, Formatter}; + +#[derive(Debug, PartialEq, Clone, Copy)] +pub enum TradeMode { + None = 0, + DirectPurchase = 1, + // PublicOffer = 2, + // PrivateOffer = 3, +} + +impl TradeMode { + pub fn seller_sets_price(&self) -> bool { + match self { + TradeMode::None => false, + TradeMode::DirectPurchase => true, + // TradeMode::PublicOffer => true, //min price + // TradeMode::PrivateOffer => true, //min price + } + } +} + +impl Display for TradeMode { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + match self { + TradeMode::None => write!(f, "No Trading"), + TradeMode::DirectPurchase => write!(f, "Direct Purchase"), + // TradeMode::PublicOffer => write!(f, "Public Offer"), + // TradeMode::PrivateOffer => write!(f, "Private Offer"), + } + } +} + +impl TryFrom for TradeMode { + type Error = ProtocolError; + + fn try_from(value: u8) -> Result { + match value { + 0 => Ok(Self::None), + 1 => Ok(Self::DirectPurchase), + // 2 => Ok(Self::PublicOffer), + // 3 => Ok(Self::PrivateOffer), + value => Err(ProtocolError::ConsensusError( + ConsensusError::BasicError(BasicError::UnknownTradeModeError( + UnknownTradeModeError::new(vec![0, 1], value), + )) + .into(), + )), + } + } +} diff --git a/packages/rs-dpp/src/schema/document/v0/documentBase.json b/packages/rs-dpp/src/schema/document/v0/documentBase.json index d745088cd11..a8ee99ae9cb 100644 --- a/packages/rs-dpp/src/schema/document/v0/documentBase.json +++ b/packages/rs-dpp/src/schema/document/v0/documentBase.json @@ -41,6 +41,34 @@ "$updatedAt": { "type": "integer", "minimum": 0 + }, + "$transferredAt": { + "type": "integer", + "minimum": 0 + }, + "$createdAtBlockHeight": { + "type": "integer", + "minimum": 0 + }, + "$updatedAtBlockHeight": { + "type": "integer", + "minimum": 0 + }, + "$transferredAtBlockHeight": { + "type": "integer", + "minimum": 0 + }, + "$createdAtCoreBlockHeight": { + "type": "integer", + "minimum": 0 + }, + "$updatedAtCoreBlockHeight": { + "type": "integer", + "minimum": 0 + }, + "$transferredAtCoreBlockHeight": { + "type": "integer", + "minimum": 0 } }, "required": [ diff --git a/packages/rs-dpp/src/schema/identity/v0/stateTransition/identityUpdate.json b/packages/rs-dpp/src/schema/identity/v0/stateTransition/identityUpdate.json index ff241acdfcb..b31632dd9ec 100644 --- a/packages/rs-dpp/src/schema/identity/v0/stateTransition/identityUpdate.json +++ b/packages/rs-dpp/src/schema/identity/v0/stateTransition/identityUpdate.json @@ -28,10 +28,6 @@ "minimum": 0, "description": "Identity update revision" }, - "publicKeysDisabledAt": { - "type": "integer", - "minimum": 0 - }, "addPublicKeys": { "type": "array", "minItems": 1, @@ -53,14 +49,6 @@ "minimum": 0 } }, - "dependentRequired": { - "disablePublicKeys": [ - "publicKeysDisabledAt" - ], - "publicKeysDisabledAt": [ - "disablePublicKeys" - ] - }, "anyOf": [ { "type": "object", diff --git a/packages/rs-dpp/src/serialization/serialization_traits.rs b/packages/rs-dpp/src/serialization/serialization_traits.rs index 9c83fe4a566..502d2a6eb65 100644 --- a/packages/rs-dpp/src/serialization/serialization_traits.rs +++ b/packages/rs-dpp/src/serialization/serialization_traits.rs @@ -1,10 +1,17 @@ +#[cfg(any( + feature = "message-signature-verification", + feature = "message-signing" +))] use crate::identity::KeyType; use serde::{Deserialize, Serialize}; +#[cfg(feature = "message-signature-verification")] use crate::validation::SimpleConsensusValidationResult; -use crate::version::{FeatureVersion, PlatformVersion}; -use crate::{BlsModule, ProtocolError}; +use crate::version::PlatformVersion; +#[cfg(feature = "message-signing")] +use crate::BlsModule; +use crate::ProtocolError; use platform_value::Value; pub trait Signable { @@ -93,7 +100,7 @@ pub trait PlatformDeserializableWithPotentialValidationFromVersionedStructure { /// DataContractV1 (if system version is 1) fn versioned_deserialize( data: &[u8], - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result where @@ -112,7 +119,7 @@ pub trait PlatformDeserializableWithBytesLenFromVersionedStructure { /// DataContractV1 (if system version is 1) fn versioned_deserialize_with_bytes_len( data: &[u8], - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result<(Self, usize), ProtocolError> where @@ -159,13 +166,15 @@ pub trait ValueConvertible<'a>: Serialize + Deserialize<'a> { } pub trait PlatformMessageSignable { + #[cfg(feature = "message-signature-verification")] fn verify_signature( &self, public_key_type: KeyType, public_key_data: &[u8], signature: &[u8], - ) -> Result; + ) -> SimpleConsensusValidationResult; + #[cfg(feature = "message-signing")] fn sign_by_private_key( &self, private_key: &[u8], diff --git a/packages/rs-dpp/src/signing.rs b/packages/rs-dpp/src/signing.rs index ac2c7c511d3..96c810ff362 100644 --- a/packages/rs-dpp/src/signing.rs +++ b/packages/rs-dpp/src/signing.rs @@ -1,21 +1,23 @@ +#[cfg(feature = "message-signature-verification")] use crate::consensus::signature::{ BasicBLSError, BasicECDSAError, SignatureError, SignatureShouldNotBePresentError, }; use crate::identity::KeyType; use crate::serialization::PlatformMessageSignable; -#[cfg(any(feature = "state-transitions", feature = "validation"))] -use crate::state_transition::errors::InvalidIdentityPublicKeyTypeError; +#[cfg(feature = "message-signature-verification")] use crate::validation::SimpleConsensusValidationResult; +#[cfg(feature = "message-signing")] use crate::{BlsModule, ProtocolError}; use dashcore::signer; impl PlatformMessageSignable for &[u8] { + #[cfg(feature = "message-signature-verification")] fn verify_signature( &self, public_key_type: KeyType, public_key_data: &[u8], signature: &[u8], - ) -> Result { + ) -> SimpleConsensusValidationResult { let signable_data = self; match public_key_type { KeyType::ECDSA_SECP256K1 => { @@ -28,11 +30,11 @@ impl PlatformMessageSignable for &[u8] { // hex::encode(signable_data), // hex::encode(public_key_data) // )); - Ok(SimpleConsensusValidationResult::new_with_error( + SimpleConsensusValidationResult::new_with_error( SignatureError::BasicECDSAError(BasicECDSAError::new(e.to_string())).into(), - )) + ) } else { - Ok(SimpleConsensusValidationResult::default()) + SimpleConsensusValidationResult::default() } } KeyType::BLS12_381 => { @@ -40,66 +42,66 @@ impl PlatformMessageSignable for &[u8] { Ok(public_key) => public_key, Err(e) => { // dbg!(format!("bls public_key could not be recovered")); - return Ok(SimpleConsensusValidationResult::new_with_error( + return SimpleConsensusValidationResult::new_with_error( SignatureError::BasicBLSError(BasicBLSError::new(e.to_string())).into(), - )); + ); } }; let signature = match bls_signatures::Signature::from_bytes(signature) { Ok(public_key) => public_key, Err(e) => { // dbg!(format!("bls signature could not be recovered")); - return Ok(SimpleConsensusValidationResult::new_with_error( + return SimpleConsensusValidationResult::new_with_error( SignatureError::BasicBLSError(BasicBLSError::new(e.to_string())).into(), - )); + ); } }; if !public_key.verify(&signature, signable_data) { - Ok(SimpleConsensusValidationResult::new_with_error( + SimpleConsensusValidationResult::new_with_error( SignatureError::BasicBLSError(BasicBLSError::new( "bls signature was incorrect".to_string(), )) .into(), - )) + ) } else { - Ok(SimpleConsensusValidationResult::default()) + SimpleConsensusValidationResult::default() } } KeyType::ECDSA_HASH160 => { if !signature.is_empty() { - Ok(SimpleConsensusValidationResult::new_with_error( + SimpleConsensusValidationResult::new_with_error( SignatureError::SignatureShouldNotBePresentError( SignatureShouldNotBePresentError::new("ecdsa_hash160 keys should not have a signature as that would reveal the public key".to_string()), ).into() - )) + ) } else { - Ok(SimpleConsensusValidationResult::default()) + SimpleConsensusValidationResult::default() } } KeyType::BIP13_SCRIPT_HASH => { if !signature.is_empty() { - Ok(SimpleConsensusValidationResult::new_with_error( + SimpleConsensusValidationResult::new_with_error( SignatureError::SignatureShouldNotBePresentError( SignatureShouldNotBePresentError::new("script hash keys should not have a signature as that would reveal the script".to_string()) - ).into())) + ).into()) } else { - Ok(SimpleConsensusValidationResult::default()) + SimpleConsensusValidationResult::default() } } KeyType::EDDSA_25519_HASH160 => { if !signature.is_empty() { - Ok(SimpleConsensusValidationResult::new_with_error( + SimpleConsensusValidationResult::new_with_error( SignatureError::SignatureShouldNotBePresentError( SignatureShouldNotBePresentError::new("eddsa hash 160 keys should not have a signature as that would reveal the script".to_string()) ).into() - )) + ) } else { - Ok(SimpleConsensusValidationResult::default()) + SimpleConsensusValidationResult::default() } } } } - + #[cfg(feature = "message-signing")] fn sign_by_private_key( &self, private_key: &[u8], @@ -119,9 +121,10 @@ impl PlatformMessageSignable for &[u8] { // https://github.com/dashevo/platform/blob/6b02b26e5cd3a7c877c5fdfe40c4a4385a8dda15/packages/js-dpp/lib/stateTransition/AbstractStateTransition.js#L187 // is to return the error for the BIP13_SCRIPT_HASH KeyType::BIP13_SCRIPT_HASH | KeyType::EDDSA_25519_HASH160 => { - Err(ProtocolError::InvalidIdentityPublicKeyTypeError( - InvalidIdentityPublicKeyTypeError::new(key_type), - )) + Err(ProtocolError::InvalidSigningKeyTypeError(format!( + "key type {} can not sign", + key_type + ))) } } } diff --git a/packages/rs-dpp/src/state_transition/abstract_state_transition.rs b/packages/rs-dpp/src/state_transition/abstract_state_transition.rs index 47ab0473811..7bd8e8f9f1f 100644 --- a/packages/rs-dpp/src/state_transition/abstract_state_transition.rs +++ b/packages/rs-dpp/src/state_transition/abstract_state_transition.rs @@ -1,12 +1,15 @@ use serde::Serialize; +#[cfg(feature = "state-transition-json-conversion")] use serde_json::Value as JsonValue; pub mod state_transition_helpers { use super::*; use crate::ProtocolError; use platform_value::Value; + #[cfg(feature = "state-transition-json-conversion")] use std::convert::TryInto; + #[cfg(feature = "state-transition-json-conversion")] pub fn to_json<'a, I: IntoIterator>( serializable: impl Serialize, skip_signature_paths: I, diff --git a/packages/rs-dpp/src/state_transition/errors/mod.rs b/packages/rs-dpp/src/state_transition/errors/mod.rs index 59eb4570f6a..aa6cd9e5ed1 100644 --- a/packages/rs-dpp/src/state_transition/errors/mod.rs +++ b/packages/rs-dpp/src/state_transition/errors/mod.rs @@ -12,13 +12,18 @@ mod invalid_signature_public_key_error; mod public_key_mismatch_error; #[cfg(feature = "state-transition-validation")] mod public_key_security_level_not_met_error; -#[cfg(feature = "state-transition-validation")] +#[cfg(any( + all(feature = "state-transitions", feature = "validation"), + feature = "state-transition-validation" +))] mod state_transition_error; #[cfg(feature = "state-transition-validation")] mod state_transition_is_not_signed_error; #[cfg(any( + all(feature = "state-transitions", feature = "validation"), feature = "state-transition-validation", - feature = "state-transition-signing" + feature = "state-transition-signing", + feature = "state-transition-validation" ))] mod wrong_public_key_purpose_error; @@ -36,9 +41,17 @@ pub use invalid_signature_public_key_error::*; pub use public_key_mismatch_error::*; #[cfg(feature = "state-transition-validation")] pub use public_key_security_level_not_met_error::*; -#[cfg(feature = "state-transition-validation")] +#[cfg(any( + all(feature = "state-transitions", feature = "validation"), + feature = "state-transition-validation" +))] pub use state_transition_error::*; #[cfg(feature = "state-transition-validation")] pub use state_transition_is_not_signed_error::*; -#[cfg(feature = "state-transition-validation")] +#[cfg(any( + all(feature = "state-transitions", feature = "validation"), + feature = "state-transition-validation", + feature = "state-transition-signing", + feature = "state-transition-validation" +))] pub use wrong_public_key_purpose_error::*; diff --git a/packages/rs-dpp/src/state_transition/mod.rs b/packages/rs-dpp/src/state_transition/mod.rs index 73518cf73ed..8f927e020a8 100644 --- a/packages/rs-dpp/src/state_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/mod.rs @@ -1,4 +1,5 @@ use derive_more::From; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub use abstract_state_transition::state_transition_helpers; @@ -7,36 +8,66 @@ use platform_value::{BinaryData, Identifier}; pub use state_transition_types::*; use bincode::{Decode, Encode}; +#[cfg(any( + feature = "state-transition-signing", + feature = "state-transition-validation" +))] use dashcore::signer; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, PlatformSignable}; +use platform_version::version::PlatformVersion; mod abstract_state_transition; -use crate::{BlsModule, ProtocolError}; +#[cfg(any( + feature = "state-transition-signing", + feature = "state-transition-validation" +))] +use crate::BlsModule; +use crate::ProtocolError; mod state_transition_types; pub mod state_transition_factory; pub mod errors; -use crate::util::hash::{hash_to_vec, ripemd160_sha256}; +#[cfg(feature = "state-transition-signing")] +use crate::util::hash::ripemd160_sha256; +use crate::util::hash::{hash_double_to_vec, hash_single}; +pub mod proof_result; mod serialization; pub mod state_transitions; mod traits; // pub mod state_transition_fee; -pub use traits::*; - +#[cfg(feature = "state-transition-signing")] +use crate::consensus::signature::InvalidSignaturePublicKeySecurityLevelError; +#[cfg(feature = "state-transition-validation")] use crate::consensus::signature::{ - InvalidSignaturePublicKeySecurityLevelError, InvalidStateTransitionSignatureError, - PublicKeyIsDisabledError, SignatureError, + InvalidStateTransitionSignatureError, PublicKeyIsDisabledError, SignatureError, }; +#[cfg(feature = "state-transition-validation")] use crate::consensus::ConsensusError; +pub use traits::*; +use crate::balances::credits::CREDITS_PER_DUFF; +use crate::fee::Credits; +#[cfg(any( + feature = "state-transition-signing", + feature = "state-transition-validation" +))] use crate::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; -use crate::identity::{IdentityPublicKey, KeyID, KeyType, Purpose, SecurityLevel}; +use crate::identity::state_transition::OptionallyAssetLockProved; +use crate::identity::Purpose; +#[cfg(any( + feature = "state-transition-signing", + feature = "state-transition-validation" +))] +use crate::identity::{IdentityPublicKey, KeyType}; +use crate::identity::{KeyID, SecurityLevel}; +use crate::prelude::{AssetLockProof, UserFeeIncrease}; pub use state_transitions::*; use crate::serialization::Signable; @@ -49,15 +80,13 @@ use crate::state_transition::data_contract_update_transition::{ use crate::state_transition::documents_batch_transition::{ DocumentsBatchTransition, DocumentsBatchTransitionSignable, }; -#[cfg(any( - feature = "state-transition-signing", - feature = "state-transition-validation" -))] +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::errors::InvalidSignaturePublicKeyError; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::errors::WrongPublicKeyPurposeError; #[cfg(feature = "state-transition-validation")] use crate::state_transition::errors::{ - InvalidIdentityPublicKeyTypeError, InvalidSignaturePublicKeyError, PublicKeyMismatchError, - StateTransitionIsNotSignedError, + InvalidIdentityPublicKeyTypeError, PublicKeyMismatchError, StateTransitionIsNotSignedError, }; use crate::state_transition::identity_create_transition::{ IdentityCreateTransition, IdentityCreateTransitionSignable, @@ -74,6 +103,7 @@ use crate::state_transition::identity_topup_transition::{ use crate::state_transition::identity_update_transition::{ IdentityUpdateTransition, IdentityUpdateTransitionSignable, }; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::state_transitions::document::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; pub type GetDataContractSecurityLevelRequirementFn = @@ -160,6 +190,7 @@ macro_rules! call_method_identity_signed { }; } +#[cfg(feature = "state-transition-signing")] macro_rules! call_errorable_method_identity_signed { ($state_transition:expr, $method:ident, $args:tt ) => { match $state_transition { @@ -194,25 +225,25 @@ macro_rules! call_errorable_method_identity_signed { } }; } - -macro_rules! call_static_method { - ($state_transition:expr, $method:ident ) => { - match $state_transition { - StateTransition::DataContractCreate(_) => DataContractCreateTransition::$method(), - StateTransition::DataContractUpdate(_) => DataContractUpdateTransition::$method(), - StateTransition::DocumentsBatch(_) => DocumentsBatchTransition::$method(), - StateTransition::IdentityCreate(_) => IdentityCreateTransition::$method(), - StateTransition::IdentityTopUp(_) => IdentityTopUpTransition::$method(), - StateTransition::IdentityCreditWithdrawal(_) => { - IdentityCreditWithdrawalTransition::$method() - } - StateTransition::IdentityUpdate(_) => IdentityUpdateTransition::$method(), - StateTransition::IdentityCreditTransfer(_) => { - IdentityCreditTransferTransition::$method() - } - } - }; -} +// TODO unused macros below +// macro_rules! call_static_method { +// ($state_transition:expr, $method:ident ) => { +// match $state_transition { +// StateTransition::DataContractCreate(_) => DataContractCreateTransition::$method(), +// StateTransition::DataContractUpdate(_) => DataContractUpdateTransition::$method(), +// StateTransition::DocumentsBatch(_) => DocumentsBatchTransition::$method(), +// StateTransition::IdentityCreate(_) => IdentityCreateTransition::$method(), +// StateTransition::IdentityTopUp(_) => IdentityTopUpTransition::$method(), +// StateTransition::IdentityCreditWithdrawal(_) => { +// IdentityCreditWithdrawalTransition::$method() +// } +// StateTransition::IdentityUpdate(_) => IdentityUpdateTransition::$method(), +// StateTransition::IdentityCreditTransfer(_) => { +// IdentityCreditTransferTransition::$method() +// } +// } +// }; +// } #[derive( Debug, @@ -243,16 +274,13 @@ pub enum StateTransition { IdentityCreditTransfer(IdentityCreditTransferTransition), } -impl StateTransition { - /// This means we should transform into the action before validation of the structure - pub fn requires_state_to_validate_structure(&self) -> bool { - matches!(self, StateTransition::DocumentsBatch(_)) - } - /// This means we should transform into the action before validation of the identity and signatures - pub fn requires_state_to_validate_identity_and_signatures(&self) -> bool { - matches!(self, StateTransition::DocumentsBatch(_)) +impl OptionallyAssetLockProved for StateTransition { + fn optional_asset_lock_proof(&self) -> Option<&AssetLockProof> { + call_method!(self, optional_asset_lock_proof) } +} +impl StateTransition { pub fn is_identity_signed(&self) -> bool { !matches!( self, @@ -260,18 +288,45 @@ impl StateTransition { ) } + pub fn required_asset_lock_balance_for_processing_start( + &self, + platform_version: &PlatformVersion, + ) -> Credits { + match self { + StateTransition::IdentityCreate(_) => { + platform_version + .dpp + .state_transitions + .identities + .asset_locks + .required_asset_lock_duff_balance_for_processing_start_for_identity_create + * CREDITS_PER_DUFF + } + StateTransition::IdentityTopUp(_) => { + platform_version + .dpp + .state_transitions + .identities + .asset_locks + .required_asset_lock_duff_balance_for_processing_start_for_identity_top_up + * CREDITS_PER_DUFF + } + _ => 0, + } + } + fn hash(&self, skip_signature: bool) -> Result, ProtocolError> { if skip_signature { - Ok(hash_to_vec(self.signable_bytes()?)) + Ok(hash_double_to_vec(self.signable_bytes()?)) } else { - Ok(hash_to_vec( + Ok(hash_double_to_vec( crate::serialization::PlatformSerializable::serialize_to_bytes(self)?, )) } } /// Returns state transition name - pub fn name(&self) -> String { + pub fn name(&self) -> &'static str { match self { Self::DataContractCreate(_) => "DataContractCreate", Self::DataContractUpdate(_) => "DataContractUpdate", @@ -282,7 +337,6 @@ impl StateTransition { Self::IdentityUpdate(_) => "IdentityUpdate", Self::IdentityCreditTransfer(_) => "IdentityCreditTransfer", } - .to_string() } /// returns the signature as a byte-array @@ -290,26 +344,53 @@ impl StateTransition { call_method!(self, signature) } + /// returns the fee_increase additional percentage multiplier, it affects only processing costs + pub fn user_fee_increase(&self) -> UserFeeIncrease { + call_method!(self, user_fee_increase) + } + + /// The transaction id is a single hash of the data with the signature + pub fn transaction_id(&self) -> Result<[u8; 32], ProtocolError> { + Ok(hash_single( + crate::serialization::PlatformSerializable::serialize_to_bytes(self)?, + )) + } + /// returns the signature as a byte-array pub fn signature_public_key_id(&self) -> Option { call_getter_method_identity_signed!(self, signature_public_key_id) } - /// returns the signature as a byte-array + /// returns the key security level requirement for the state transition pub fn security_level_requirement(&self) -> Option> { call_getter_method_identity_signed!(self, security_level_requirement) } + /// returns the key purpose requirement for the state transition + pub fn purpose_requirement(&self) -> Option { + call_getter_method_identity_signed!(self, purpose_requirement) + } + /// returns the signature as a byte-array pub fn owner_id(&self) -> Identifier { call_method!(self, owner_id) } + /// returns the unique identifiers for the state transition + pub fn unique_identifiers(&self) -> Vec { + call_method!(self, unique_identifiers) + } + /// set a new signature pub fn set_signature(&mut self, signature: BinaryData) { call_method!(self, set_signature, signature) } + /// set fee multiplier + pub fn set_user_fee_increase(&mut self, fee_multiplier: UserFeeIncrease) { + call_method!(self, set_user_fee_increase, fee_multiplier) + } + /// set a new signature pub fn set_signature_public_key_id(&mut self, public_key_id: KeyID) { call_method_identity_signed!(self, set_signature_public_key_id, public_key_id) @@ -491,7 +572,7 @@ impl StateTransition { Ok(()) } - #[cfg(all(feature = "state-transition-validation"))] + #[cfg(feature = "state-transition-validation")] fn verify_by_raw_public_key( &self, public_key: &[u8], @@ -553,7 +634,7 @@ impl StateTransition { } } - #[cfg(all(feature = "state-transition-validation"))] + #[cfg(feature = "state-transition-validation")] fn verify_ecdsa_hash_160_signature_by_public_key_hash( &self, public_key_hash: &[u8], @@ -575,7 +656,7 @@ impl StateTransition { ) } - #[cfg(all(feature = "state-transition-validation"))] + #[cfg(feature = "state-transition-validation")] /// Verifies an ECDSA signature with the public key fn verify_ecdsa_signature_by_public_key(&self, public_key: &[u8]) -> Result<(), ProtocolError> { if self.signature().is_empty() { @@ -597,7 +678,7 @@ impl StateTransition { ) } - #[cfg(all(feature = "state-transition-validation"))] + #[cfg(feature = "state-transition-validation")] /// Verifies a BLS signature with the public key fn verify_bls_signature_by_public_key( &self, diff --git a/packages/rs-dpp/src/state_transition/proof_result.rs b/packages/rs-dpp/src/state_transition/proof_result.rs new file mode 100644 index 00000000000..6db974dc786 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/proof_result.rs @@ -0,0 +1,14 @@ +use crate::data_contract::DataContract; +use crate::document::Document; +use crate::identity::{Identity, PartialIdentity}; +use platform_value::Identifier; +use std::collections::BTreeMap; + +#[derive(Debug)] +pub enum StateTransitionProofResult { + VerifiedDataContract(DataContract), + VerifiedIdentity(Identity), + VerifiedPartialIdentity(PartialIdentity), + VerifiedBalanceTransfer(PartialIdentity, PartialIdentity), //from/to + VerifiedDocuments(BTreeMap>), +} diff --git a/packages/rs-dpp/src/state_transition/serialization.rs b/packages/rs-dpp/src/state_transition/serialization.rs index b77c3031707..c36ae53db4f 100644 --- a/packages/rs-dpp/src/state_transition/serialization.rs +++ b/packages/rs-dpp/src/state_transition/serialization.rs @@ -3,9 +3,7 @@ use crate::state_transition::StateTransition; use crate::ProtocolError; impl StateTransition { - pub fn deserialize_many( - raw_state_transitions: &Vec>, - ) -> Result, ProtocolError> { + pub fn deserialize_many(raw_state_transitions: &[Vec]) -> Result, ProtocolError> { raw_state_transitions .iter() .map(|raw_state_transition| Self::deserialize_from_bytes(raw_state_transition)) @@ -15,6 +13,7 @@ impl StateTransition { #[cfg(test)] mod tests { + use crate::bls::native_bls::NativeBlsModule; use crate::data_contract::accessors::v0::DataContractV0Getters; use crate::identity::accessors::IdentityGettersV0; use crate::identity::core_script::CoreScript; @@ -46,7 +45,7 @@ mod tests { }; use crate::version::PlatformVersion; use crate::withdrawal::Pooling; - use crate::{NativeBlsModule, ProtocolError}; + use crate::ProtocolError; use platform_version::version::LATEST_PLATFORM_VERSION; use platform_version::TryIntoPlatformVersioned; use rand::rngs::StdRng; @@ -59,11 +58,11 @@ mod tests { let platform_version = LATEST_PLATFORM_VERSION; let identity = Identity::random_identity(5, Some(5), platform_version) .expect("expected a random identity"); - let asset_lock_proof = raw_instant_asset_lock_proof_fixture(None); + let asset_lock_proof = raw_instant_asset_lock_proof_fixture(None, None); let identity_create_transition = IdentityCreateTransition::V0( IdentityCreateTransitionV0::try_from_identity( - identity, + &identity, AssetLockProof::Instant(asset_lock_proof), platform_version, ) @@ -85,11 +84,12 @@ mod tests { let platform_version = PlatformVersion::latest(); let identity = Identity::random_identity(5, Some(5), platform_version) .expect("expected a random identity"); - let asset_lock_proof = raw_instant_asset_lock_proof_fixture(None); + let asset_lock_proof = raw_instant_asset_lock_proof_fixture(None, None); let identity_topup_transition = IdentityTopUpTransitionV0 { asset_lock_proof: AssetLockProof::Instant(asset_lock_proof), identity_id: identity.id(), + user_fee_increase: 0, signature: [1u8; 65].to_vec().into(), }; let state_transition: StateTransition = identity_topup_transition.into(); @@ -123,9 +123,10 @@ mod tests { signature_public_key_id: 0, identity_id: identity.id(), revision: 1, + nonce: 1, add_public_keys: add_public_keys_in_creation, disable_public_keys: vec![], - public_keys_disabled_at: None, + user_fee_increase: 0, }; let key_signable_bytes = identity_update_transition @@ -189,9 +190,10 @@ mod tests { signature_public_key_id: 0, identity_id: identity.id(), revision: 1, + nonce: 1, add_public_keys: add_public_keys_in_creation, disable_public_keys: vec![3, 4, 5], - public_keys_disabled_at: Some(15), + user_fee_increase: 0, }; let key_signable_bytes = identity_update_transition @@ -245,7 +247,8 @@ mod tests { core_fee_per_byte: 34, pooling: Pooling::Standard, output_script: CoreScript::from_bytes((0..23).collect::>()), - revision: 1, + nonce: 1, + user_fee_increase: 0, signature_public_key_id: 0, signature: [1u8; 65].to_vec().into(), }; @@ -266,6 +269,7 @@ mod tests { .expect("expected a random identity"); let created_data_contract = get_data_contract_fixture( Some(identity.id()), + 0, LATEST_PLATFORM_VERSION.protocol_version, ); let data_contract_create_transition: DataContractCreateTransition = created_data_contract @@ -286,15 +290,16 @@ mod tests { let platform_version = PlatformVersion::latest(); let identity = Identity::random_identity(5, Some(5), platform_version) .expect("expected a random identity"); - let mut created_data_contract = - get_data_contract_fixture(Some(identity.id()), platform_version.protocol_version); - created_data_contract.set_entropy_used(Default::default()); + let created_data_contract = + get_data_contract_fixture(Some(identity.id()), 0, platform_version.protocol_version); let data_contract_update_transition = DataContractUpdateTransition::V0(DataContractUpdateTransitionV0 { + identity_contract_nonce: 1, data_contract: created_data_contract .data_contract_owned() .try_into_platform_versioned(platform_version) .expect("expected a data contract"), + user_fee_increase: 0, signature_public_key_id: 0, signature: [1u8; 65].to_vec().into(), }); @@ -310,7 +315,9 @@ mod tests { #[test] fn document_batch_transition_10_created_documents_ser_de() { let platform_version = PlatformVersion::latest(); - let data_contract = get_data_contract_fixture(None, platform_version.protocol_version) + + let mut nonces = BTreeMap::new(); + let data_contract = get_data_contract_fixture(None, 0, platform_version.protocol_version) .data_contract_owned(); let documents = get_extended_documents_fixture_with_owner_id_from_contract( &data_contract, @@ -327,12 +334,14 @@ mod tests { data_contract .document_type_for_name(extended_document.document_type_name()) .unwrap(), - extended_document.entropy().clone(), + *extended_document.entropy(), ) }) .collect::>(); - let transitions = - get_document_transitions_fixture([(DocumentTransitionActionType::Create, documents)]); + let transitions = get_document_transitions_fixture( + [(DocumentTransitionActionType::Create, documents)], + &mut nonces, + ); let documents_batch_transition: DocumentsBatchTransition = DocumentsBatchTransitionV0 { owner_id: data_contract.owner_id(), transitions, diff --git a/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_operation_fees.rs b/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_operation_fees.rs deleted file mode 100644 index c003d9553df..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_operation_fees.rs +++ /dev/null @@ -1,54 +0,0 @@ -use crate::fee::Credits; -use crate::NonConsensusError; - -use super::operations::{Operation, OperationLike}; -// -// pub fn calculate_operation_fees( -// operations: &[Operation], -// ) -> Result { -// let mut storage_fee: Credits = 0; -// let mut processing_fee: Credits = 0; -// let mut fee_refunds: Vec = Vec::new(); -// -// for operation in operations { -// storage_fee = storage_fee -// .checked_add(operation.get_storage_cost()?) -// .ok_or(NonConsensusError::Overflow("storage cost is too big"))?; -// processing_fee = processing_fee -// .checked_add(operation.get_processing_cost()?) -// .ok_or(NonConsensusError::Overflow("processing cost is too big"))?; -// -// // Merge refunds -// if let Some(operation_refunds) = operation.get_refunds() { -// for identity_refunds in operation_refunds { -// let mut existing_identity_refunds = fee_refunds -// .iter_mut() -// .find(|refund| refund.identifier == identity_refunds.identifier); -// -// if existing_identity_refunds.is_none() { -// fee_refunds.push(identity_refunds.clone()); -// continue; -// } -// -// for (epoch_index, credits) in identity_refunds.credits_per_epoch.iter() { -// if let Some(ref mut refunds) = existing_identity_refunds { -// let epoch = refunds -// .credits_per_epoch -// .entry(epoch_index.to_string()) -// .or_default(); -// -// *epoch = epoch -// .checked_add(*credits) -// .ok_or(NonConsensusError::Overflow("credits per epoch are too big"))? -// } -// } -// } -// } -// } -// -// Ok(DummyFeesResult { -// storage: storage_fee, -// processing: processing_fee, -// fee_refunds, -// }) -// } diff --git a/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_state_transition_fee.rs b/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_state_transition_fee.rs deleted file mode 100644 index 02c908fb8d8..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_state_transition_fee.rs +++ /dev/null @@ -1,59 +0,0 @@ -use crate::state_transition::StateTransitionLike; - -use super::{calculate_operations_fees, constants::DEFAULT_USER_TIP}; - -pub fn calculate_state_transition_fee(state_transition: &impl StateTransitionLike) -> i64 { - let execution_context = state_transition.get_execution_context(); - let fee = calculate_operations_fees(execution_context.get_operations()); - - // Is not implemented yet - let storage_refund = 0; - - (fee.storage + fee.processing) + DEFAULT_USER_TIP - storage_refund -} - -#[cfg(test)] -mod test { - use crate::{ - identity::{ - state_transition::identity_create_transition::IdentityCreateTransition, KeyType, - }, - state_transition::{ - fee::operations::{ - DeleteOperation, Operation, PreCalculatedOperation, ReadOperation, WriteOperation, - }, - state_transition_execution_context::StateTransitionExecutionContext, - StateTransitionLike, - }, - tests::fixtures::identity_create_transition_fixture, - NativeBlsModule, - }; - - use super::calculate_state_transition_fee; - - // TODO: Must be more comprehensive. After we settle all factors and formula. - #[test] - fn should_calculate_fee_based_on_executed_operations() { - let bls = NativeBlsModule::default(); - let private_key = - hex::decode("af432c476f65211f45f48f1d42c9c0b497e56696aa1736b40544ef1a496af837") - .unwrap(); - let mut state_transition = - IdentityCreateTransition::new(identity_create_transition_fixture(None)).unwrap(); - state_transition - .sign_by_private_key(&private_key, KeyType::ECDSA_SECP256K1, &bls) - .expect("signing should be successful"); - - let execution_context = StateTransitionExecutionContext::default(); - execution_context.add_operation(Operation::Read(ReadOperation::new(10))); - execution_context.add_operation(Operation::Write(WriteOperation::new(5, 5))); - execution_context.add_operation(Operation::Delete(DeleteOperation::new(6, 6))); - execution_context.add_operation(Operation::PreCalculated(PreCalculatedOperation::new( - 12, 12, - ))); - state_transition.set_execution_context(execution_context); - - let result = calculate_state_transition_fee(&state_transition); - assert_eq!(13616, result) - } -} diff --git a/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_state_transition_fee_factory.rs b/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_state_transition_fee_factory.rs deleted file mode 100644 index 0b100c90764..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_state_transition_fee_factory.rs +++ /dev/null @@ -1,20 +0,0 @@ -use crate::{ - state_transition::{ - StateTransition, - }, - NonConsensusError, -}; -use crate::fee::fee_result::FeeResult; -use crate::state_transition::state_transition_execution_context::StateTransitionExecutionContext; -use crate::state_transition::state_transition_fee::calculate_state_transition_fee_from_operations_factory::calculate_state_transition_fee_from_operations; - - -pub fn calculate_state_transition_fee( - state_transition: &StateTransition, - execution_context: &StateTransitionExecutionContext, -) -> Result { - calculate_state_transition_fee_from_operations( - &execution_context.get_operations(), - state_transition.owner_id(), - ) -} diff --git a/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_state_transition_fee_from_operations_factory.rs b/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_state_transition_fee_from_operations_factory.rs deleted file mode 100644 index 1a7cb983958..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transition_fee/calculate_state_transition_fee_from_operations_factory.rs +++ /dev/null @@ -1,182 +0,0 @@ -use crate::fee::fee_result::FeeResult; -use crate::state_transition::fee::calculate_operation_fees::calculate_operation_fees; -use crate::state_transition::fee::operations::Operation; -use crate::{prelude::Identifier, NonConsensusError}; - -pub fn calculate_state_transition_fee_from_operations( - operations: &[Operation], - identity_id: &Identifier, -) -> Result { - calculate_state_transition_fee_from_operations_with_custom_calculator( - operations, - identity_id, - calculate_operation_fees, - ) -} - -fn calculate_state_transition_fee_from_operations_with_custom_calculator( - operations: &[Operation], - identity_id: &Identifier, - calculate_operation_fees_fn: impl FnOnce(&[Operation]) -> Result, -) -> Result { - let calculated_fees = calculate_operation_fees_fn(operations)?; - - let storage_fee = calculated_fees.storage; - let processing_fee = calculated_fees.processing; - let fee_refunds = calculated_fees.fee_refunds; - - let mut total_refunds = 0; - - let owner_refunds = fee_refunds - .iter() - .find(|refunds| identity_id == &refunds.identifier); - - if let Some(owner_refunds) = owner_refunds { - total_refunds = owner_refunds - .credits_per_epoch - .iter() - .fold(0, |sum, (_, credits)| sum + credits); - } - - let required_amount = if storage_fee > total_refunds { - (storage_fee - total_refunds) + DEFAULT_USER_TIP - } else { - 0 - }; - - let fee_sum = storage_fee + processing_fee; - - let desired_amount = if fee_sum > total_refunds { - (fee_sum - total_refunds) + DEFAULT_USER_TIP - } else { - 0 - }; - - Ok(FeeResult { - storage_fee, - processing_fee, - fee_refunds, - total_refunds, - required_amount, - desired_amount, - }) -} - -#[cfg(test)] -mod test { - - use platform_value::Identifier; - use std::collections::HashMap; - - use crate::fee::Credits; - use crate::identity::KeyType::ECDSA_SECP256K1; - use crate::state_transition::fee::calculate_operation_fees::calculate_operation_fees; - use crate::state_transition::fee::operations::{ - PreCalculatedOperation, SignatureVerificationOperation, - }; - use crate::{ - state_transition::fee::{operations::Operation, DummyFeesResult, FeeResult, Refunds}, - tests::utils::generate_random_identifier_struct, - NonConsensusError, - }; - - use super::calculate_state_transition_fee_from_operations_with_custom_calculator; - - #[test] - fn should_calculate_fee_based_on_executed_operations() { - let identifier = generate_random_identifier_struct(); - let storage_fee = 10000; - let processing_fee = 1000; - let total_refunds = 1000 + 500; - let required_amount = storage_fee - total_refunds; - let desired_amount = storage_fee + processing_fee - total_refunds; - - let mut credits_per_epoch: HashMap = Default::default(); - credits_per_epoch.insert("0".to_string(), 1000); - credits_per_epoch.insert("1".to_string(), 500); - - let refunds = Refunds { - identifier, - credits_per_epoch, - }; - - let mock = |_operations: &[Operation]| -> Result { - Ok(DummyFeesResult { - storage: storage_fee, - processing: processing_fee, - fee_refunds: vec![refunds.clone()], - }) - }; - - let result = calculate_state_transition_fee_from_operations_with_custom_calculator( - &[], - &identifier, - mock, - ) - .expect("result should be returned"); - let expected = FeeResult { - storage_fee, - processing_fee, - desired_amount, - required_amount, - fee_refunds: vec![refunds], - total_refunds: 1500, - }; - assert_eq!(expected, result); - } - - #[test] - fn test_with_negative_credits() { - // Set of operations that produced by Document Remove Transition - let operations = vec![ - Operation::PreCalculated(PreCalculatedOperation { - storage_cost: 0, - processing_cost: 551320, - fee_refunds: vec![], - }), - Operation::SignatureVerification(SignatureVerificationOperation { - signature_type: ECDSA_SECP256K1, - }), - Operation::PreCalculated(PreCalculatedOperation { - storage_cost: 0, - processing_cost: 551320, - fee_refunds: vec![], - }), - Operation::PreCalculated(PreCalculatedOperation { - storage_cost: 0, - processing_cost: 191260, - fee_refunds: vec![], - }), - Operation::PreCalculated(PreCalculatedOperation { - storage_cost: 0, - processing_cost: 16870910, - fee_refunds: vec![Refunds { - identifier: Identifier::new([ - 130, 188, 56, 7, 78, 143, 58, 212, 133, 162, 145, 56, 186, 219, 191, 75, - 64, 112, 236, 226, 135, 75, 132, 170, 135, 243, 180, 110, 103, 161, 153, - 252, - ]), - credits_per_epoch: [("0".to_string(), 114301030)].iter().cloned().collect(), - }], - }), - ]; - - let identifier = Identifier::new([ - 130, 188, 56, 7, 78, 143, 58, 212, 133, 162, 145, 56, 186, 219, 191, 75, 64, 112, 236, - 226, 135, 75, 132, 170, 135, 243, 180, 110, 103, 161, 153, 252, - ]); - - // Panics because of negative credits - let result = calculate_state_transition_fee_from_operations_with_custom_calculator( - &operations, - &identifier, - calculate_operation_fees, - ); - - assert!(matches!(result, Ok(FeeResult { - desired_amount, - required_amount, - .. - }) if desired_amount == 0 && required_amount == 0)); - } -} diff --git a/packages/rs-dpp/src/state_transition/state_transition_fee/mod.rs b/packages/rs-dpp/src/state_transition/state_transition_fee/mod.rs deleted file mode 100644 index 21f0fa4cbfa..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transition_fee/mod.rs +++ /dev/null @@ -1,31 +0,0 @@ - -pub mod calculate_operation_fees; -pub mod calculate_state_transition_fee_factory; -pub mod calculate_state_transition_fee_from_operations_factory; -pub mod operations; -use crate::fee::fee_result::FeeResult; -use enum_map::EnumMap; -// -// #[derive(Debug, Clone, PartialEq, Eq, Default)] -// pub struct FeeResult { -// pub storage_fee: Credits, -// pub processing_fee: Credits, -// pub fee_refunds: Vec, -// pub total_refunds: Credits, -// pub desired_amount: Credits, -// pub required_amount: Credits, -// } - -// #[derive(Debug, Clone, PartialEq, Eq, Default)] -// pub struct DummyFeesResult { -// pub storage: Credits, -// pub processing: Credits, -// pub fee_refunds: Vec, -// } -// -// #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] -// #[serde(rename = "camelCase")] -// pub struct Refunds { -// pub identifier: Identifier, -// pub credits_per_epoch: HashMap, -// } diff --git a/packages/rs-dpp/src/state_transition/state_transition_fee/operations/mod.rs b/packages/rs-dpp/src/state_transition/state_transition_fee/operations/mod.rs deleted file mode 100644 index da2af583e64..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transition_fee/operations/mod.rs +++ /dev/null @@ -1,151 +0,0 @@ -mod precalculated_operation; -pub use precalculated_operation::*; - -mod read_operation; -pub use read_operation::*; - -use serde::{Deserialize, Serialize}; -use serde_json::Value; - -mod signature_verification_operation; -use crate::fee::Credits; -pub use signature_verification_operation::*; - -use crate::NonConsensusError; - - -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] -#[serde(tag = "type", rename_all = "camelCase")] -pub enum Operation { - Read(ReadOperation), - PreCalculated(PreCalculatedOperation), - SignatureVerification(SignatureVerificationOperation), -} - -pub trait OperationLike { - /// Get CPU cost of the operation - fn get_processing_cost(&self) -> Result; - /// Get storage cost of the operation - fn get_storage_cost(&self) -> Result; - - /// Get refunds - fn get_refunds(&self) -> Option<&Vec>; -} - -macro_rules! call_method { - ($operation_type:expr, $method:ident ) => { - match $operation_type { - Operation::Read(op) => op.$method(), - Operation::PreCalculated(op) => op.$method(), - Operation::SignatureVerification(op) => op.$method(), - } - }; -} - -impl OperationLike for Operation { - fn get_processing_cost(&self) -> Result { - call_method!(self, get_processing_cost) - } - - fn get_storage_cost(&self) -> Result { - call_method!(self, get_storage_cost) - } - - fn get_refunds(&self) -> Option<&Vec> { - call_method!(self, get_refunds) - } -} - -impl Operation { - fn try_from_json_str(from: &str) -> Result { - let operation = serde_json::from_str(from)?; - Ok(operation) - } - - fn try_from_json_value(from: Value) -> Result { - let operation = serde_json::from_value(from)?; - Ok(operation) - } - - fn to_json_value(&self) -> Result { - let value = serde_json::to_value(self)?; - Ok(value) - } - - fn to_json_string(&self) -> Result { - let json_string = serde_json::to_string_pretty(self)?; - Ok(json_string) - } -} - -#[cfg(test)] -mod test { - use super::{Operation, PreCalculatedOperation, ReadOperation, SignatureVerificationOperation}; - use crate::identity::KeyType; - use serde_json::json; - - struct TestCase { - json_str: String, - operation: Operation, - } - - macro_rules! json_string { - ($($json:tt)+) => { - serde_json::to_string_pretty(&json!($($json)+)).unwrap() - }; - } - - #[test] - fn test_deserialize_json_read_operation() { - let cases = vec![ - TestCase { - json_str: json_string!({ - "type": "read", - "valueSize" : 123, - }), - operation: Operation::Read(ReadOperation { value_size: 123 }), - }, - TestCase { - json_str: json_string!({ - "type": "preCalculated", - "storageCost" : 12357, - "processingCost" : 468910, - "feeRefunds" : [], - }), - operation: Operation::PreCalculated(PreCalculatedOperation { - storage_cost: 12357, - processing_cost: 468910, - fee_refunds: vec![], - }), - }, - TestCase { - json_str: json_string!({ - "type": "signatureVerification", - "signatureType" : 1, - - }), - operation: Operation::SignatureVerification(SignatureVerificationOperation { - signature_type: KeyType::BLS12_381, - }), - }, - ]; - - for case in cases { - let operation = Operation::try_from_json_str(&case.json_str) - .unwrap_or_else(|e| panic!("failed deserializing: {}: {}", case.json_str, e)); - assert_eq!( - case.operation, operation, - "failed deserializing: {}", - case.json_str - ); - assert_eq!( - case.json_str, - operation - .to_json_string() - .unwrap_or_else(|e| panic!("failed serializing: {}: {}", case.json_str, e)), - "failed serializing: {}", - case.json_str - ); - } - } -} diff --git a/packages/rs-dpp/src/state_transition/state_transition_fee/operations/precalculated_operation.rs b/packages/rs-dpp/src/state_transition/state_transition_fee/operations/precalculated_operation.rs deleted file mode 100644 index 48035cff8c5..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transition_fee/operations/precalculated_operation.rs +++ /dev/null @@ -1,50 +0,0 @@ -use serde::{Deserialize, Serialize}; - -use crate::fee::Credits; -use crate::NonConsensusError; - -use super::OperationLike; - -#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] -#[serde(rename_all = "camelCase")] -pub struct PreCalculatedOperation { - pub storage_cost: Credits, - pub processing_cost: Credits, - pub fee_refunds: Vec, -} - -impl PreCalculatedOperation { - pub fn from_fee(fee: DummyFeesResult) -> Self { - Self { - fee_refunds: fee.fee_refunds, - processing_cost: fee.processing, - storage_cost: fee.storage, - } - } - - pub fn new( - storage_cost: Credits, - processing_cost: Credits, - fee_refunds: impl IntoIterator, - ) -> Self { - Self { - storage_cost, - processing_cost, - fee_refunds: fee_refunds.into_iter().collect(), - } - } -} - -impl OperationLike for PreCalculatedOperation { - fn get_processing_cost(&self) -> Result { - Ok(self.processing_cost) - } - - fn get_storage_cost(&self) -> Result { - Ok(self.storage_cost) - } - - fn get_refunds(&self) -> Option<&Vec> { - Some(&self.fee_refunds) - } -} diff --git a/packages/rs-dpp/src/state_transition/state_transition_fee/operations/read_operation.rs b/packages/rs-dpp/src/state_transition/state_transition_fee/operations/read_operation.rs deleted file mode 100644 index e835d686d6a..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transition_fee/operations/read_operation.rs +++ /dev/null @@ -1,44 +0,0 @@ -use serde::{Deserialize, Serialize}; - -use super::OperationLike; - -use crate::fee::default_costs::constants::{PROCESSING_CREDIT_PER_BYTE, READ_BASE_PROCESSING_COST}; -use crate::fee::Credits; -use crate::NonConsensusError; - -#[derive(Default, Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] -#[serde(rename_all = "camelCase")] -pub struct ReadOperation { - pub value_size: Credits, -} - -impl ReadOperation { - pub fn new(value_size: u64) -> Self { - Self { value_size } - } -} - -impl OperationLike for ReadOperation { - fn get_processing_cost(&self) -> Result { - let value_byte_processing_cost = self - .value_size - .checked_mul(PROCESSING_CREDIT_PER_BYTE) - .ok_or(NonConsensusError::Overflow( - "value processing cost is too big", - ))?; - - READ_BASE_PROCESSING_COST - .checked_add(value_byte_processing_cost) - .ok_or(NonConsensusError::Overflow( - "can't add read base processing cost", - )) - } - - fn get_storage_cost(&self) -> Result { - Ok(0) - } - - fn get_refunds(&self) -> Option<&Vec> { - None - } -} diff --git a/packages/rs-dpp/src/state_transition/state_transition_fee/state_transition_execution_context.rs b/packages/rs-dpp/src/state_transition/state_transition_fee/state_transition_execution_context.rs deleted file mode 100644 index b2bdf383566..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transition_fee/state_transition_execution_context.rs +++ /dev/null @@ -1,92 +0,0 @@ - -use crate::state_transition::state_transition_fee::operations::Operation; - - -#[derive(Debug, Clone, Default)] -pub struct StateTransitionExecutionContext { - operations : Vec, -} -// -// #[derive(Default, Debug, Clone)] -// struct StateTransitionContextInner { -// actual_operations: Vec, -// dry_run_operations: Vec, -// is_dry_run: bool, -// } -// -// impl StateTransitionExecutionContext { -// /// Add [`Operation`] into the execution context -// pub fn add_operation(&self, operation: Operation) { -// let mut inner = self.inner.lock().unwrap(); -// if inner.is_dry_run { -// inner.dry_run_operations.push(operation); -// } else { -// inner.actual_operations.push(operation); -// } -// } -// -// /// Add more than one [`Operation`] into the execution context -// pub fn add_operations(&self, operations: impl IntoIterator) { -// let mut inner = self.inner.lock().unwrap(); -// if inner.is_dry_run { -// inner.dry_run_operations.extend(operations); -// } else { -// inner.actual_operations.extend(operations); -// } -// } -// -// /// Replace all existing operations with a new collection of operations -// pub fn set_operations(&self, operations: Vec) { -// let mut inner = self.inner.lock().unwrap(); -// inner.actual_operations = operations -// } -// -// /// Returns dry run operations -// pub fn get_dry_operations(&self) -> Vec { -// let inner = self.inner.lock().unwrap(); -// inner.dry_run_operations.to_vec() -// } -// -// /// Returns all (actual & dry run) operations -// pub fn get_operations(&self) -> Vec { -// let inner = self.inner.lock().unwrap(); -// inner -// .actual_operations -// .iter() -// // TODO remove cloning -// .cloned() -// // TODO remove cloning -// .chain(inner.dry_run_operations.iter().cloned()) -// .collect() -// } -// -// /// Enable dry run -// pub fn enable_dry_run(&self) { -// let mut inner = self.inner.lock().unwrap(); -// inner.is_dry_run = true; -// } -// -// /// Enable dry run -// pub fn with_dry_run(self) -> Self { -// let mut inner = self.inner.lock().unwrap(); -// inner.is_dry_run = true; -// drop(inner); -// self -// } -// -// /// Disable dry run -// pub fn disable_dry_run(&self) { -// let mut inner = self.inner.lock().unwrap(); -// inner.is_dry_run = false; -// } -// -// pub fn clear_dry_run_operations(&self) { -// let mut inner = self.inner.lock().unwrap(); -// inner.dry_run_operations.clear() -// } -// -// pub fn is_dry_run(&self) -> bool { -// let inner = self.inner.lock().unwrap(); -// inner.is_dry_run -// } -// } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/common_fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/common_fields.rs index fa6c117a5a5..fc9a770f231 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/common_fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/common_fields.rs @@ -1,8 +1,13 @@ pub mod property_names { pub const STATE_TRANSITION_PROTOCOL_VERSION: &str = "$version"; - pub const ENTROPY: &str = "entropy"; + pub const IDENTITY_CONTRACT_NONCE: &str = "identityContractNonce"; + pub const IDENTITY_NONCE: &str = "identityNonce"; + + pub const USER_FEE_INCREASE: &str = "userFeeIncrease"; pub const SIGNATURE_PUBLIC_KEY_ID: &str = "signaturePublicKeyId"; pub const SIGNATURE: &str = "signature"; pub const TRANSITION_TYPE: &str = "type"; pub const REVISION: &str = "revision"; + + pub const NONCE: &str = "nonce"; } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/common_fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/common_fields.rs index 2464b26f4de..d123c8b28cd 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/common_fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/common_fields.rs @@ -4,4 +4,6 @@ pub mod property_names { pub const DATA_CONTRACT_OWNER_ID: &str = "dataContract.ownerId"; pub const DATA_CONTRACT_ENTROPY: &str = "dataContract.entropy"; pub const DATA_CONTRACT_PROTOCOL_VERSION: &str = "dataContract.protocolVersion"; + + pub const IDENTITY_CONTRACT_NONCE: &str = "identityContractNonce"; } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/accessors/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/accessors/mod.rs index 9c94a833549..301bb1743ef 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/accessors/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/accessors/mod.rs @@ -2,8 +2,8 @@ mod v0; use crate::data_contract::serialized_version::DataContractInSerializationFormat; +use crate::prelude::IdentityNonce; use crate::state_transition::data_contract_create_transition::DataContractCreateTransition; -use platform_value::Bytes32; pub use v0::*; impl DataContractCreateTransitionAccessorsV0 for DataContractCreateTransition { @@ -13,9 +13,9 @@ impl DataContractCreateTransitionAccessorsV0 for DataContractCreateTransition { } } - fn entropy(&self) -> &Bytes32 { + fn identity_nonce(&self) -> IdentityNonce { match self { - DataContractCreateTransition::V0(transition) => &transition.entropy, + DataContractCreateTransition::V0(transition) => transition.identity_nonce, } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/accessors/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/accessors/v0/mod.rs index 81acd4abb1a..ff7d28fb776 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/accessors/v0/mod.rs @@ -1,10 +1,10 @@ use crate::data_contract::serialized_version::DataContractInSerializationFormat; -use platform_value::Bytes32; +use crate::prelude::IdentityNonce; pub trait DataContractCreateTransitionAccessorsV0 { fn data_contract(&self) -> &DataContractInSerializationFormat; - fn entropy(&self) -> &Bytes32; + fn identity_nonce(&self) -> IdentityNonce; fn set_data_contract(&mut self, data_contract: DataContractInSerializationFormat); } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/fields.rs index 4d29a981c1a..3ae3b41bb24 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/fields.rs @@ -1,17 +1,20 @@ use crate::state_transition::state_transitions; pub use state_transitions::common_fields::property_names::{ - ENTROPY, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, TRANSITION_TYPE, + IDENTITY_NONCE, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, }; +#[allow(unused_imports)] // Removing causes build failures; yet clippy insists it's unused +pub use state_transitions::contract::common_fields::property_names::DATA_CONTRACT; pub use state_transitions::contract::common_fields::property_names::{ - DATA_CONTRACT, DATA_CONTRACT_ENTROPY, DATA_CONTRACT_ID, DATA_CONTRACT_OWNER_ID, - DATA_CONTRACT_PROTOCOL_VERSION, + DATA_CONTRACT_ID, DATA_CONTRACT_OWNER_ID, DATA_CONTRACT_PROTOCOL_VERSION, }; pub const IDENTIFIER_FIELDS: [&str; 2] = [DATA_CONTRACT_ID, DATA_CONTRACT_OWNER_ID]; -pub const BINARY_FIELDS: [&str; 3] = [ENTROPY, DATA_CONTRACT_ENTROPY, SIGNATURE]; +pub const BINARY_FIELDS: [&str; 1] = [SIGNATURE]; pub const U32_FIELDS: [&str; 2] = [ STATE_TRANSITION_PROTOCOL_VERSION, DATA_CONTRACT_PROTOCOL_VERSION, ]; + +pub const U64_FIELDS: [&str; 1] = [IDENTITY_NONCE]; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/json_conversion.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/json_conversion.rs index b843fef9cd0..b4ddf94b09d 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/json_conversion.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/json_conversion.rs @@ -33,8 +33,8 @@ mod test { JsonStateTransitionSerializationOptions, StateTransitionJsonConvert, }; + use crate::prelude::IdentityNonce; use dpp::util::json_value::JsonValueExt; - use platform_value::Bytes32; #[test] fn should_return_state_transition_in_json_format() { @@ -68,10 +68,10 @@ mod test { ); assert_eq!( - >::into(data.created_data_contract.entropy_used_owned()), + data.created_data_contract.identity_nonce(), json_object - .remove_into::(ENTROPY) - .expect("the entropy should be present") + .remove_into::(IDENTITY_NONCE) + .expect("the identity_nonce should be present") ) } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/mod.rs index 8dd8f194cd1..b192abf21e2 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/mod.rs @@ -5,19 +5,19 @@ pub use v0::*; use crate::data_contract::DataContract; use crate::identity::signer::Signer; use crate::identity::{KeyID, PartialIdentity}; +use crate::prelude::IdentityNonce; use crate::state_transition::data_contract_create_transition::{ DataContractCreateTransition, DataContractCreateTransitionV0, }; use crate::state_transition::StateTransition; use crate::version::FeatureVersion; use crate::ProtocolError; -use platform_value::Bytes32; use platform_version::version::PlatformVersion; impl DataContractCreateTransitionMethodsV0 for DataContractCreateTransition { fn new_from_data_contract( data_contract: DataContract, - entropy: Bytes32, + identity_nonce: IdentityNonce, identity: &PartialIdentity, key_id: KeyID, signer: &S, @@ -33,7 +33,7 @@ impl DataContractCreateTransitionMethodsV0 for DataContractCreateTransition { ) { 0 => DataContractCreateTransitionV0::new_from_data_contract( data_contract, - entropy, + identity_nonce, identity, key_id, signer, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs index 145a30ebc32..638a0d0295b 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs @@ -2,10 +2,10 @@ use crate::data_contract::DataContract; use crate::identity::signer::Signer; use crate::identity::{KeyID, PartialIdentity}; +use crate::prelude::IdentityNonce; use crate::state_transition::StateTransition; use crate::version::FeatureVersion; use crate::ProtocolError; -use platform_value::Bytes32; use platform_version::version::PlatformVersion; pub trait DataContractCreateTransitionMethodsV0 { @@ -14,7 +14,7 @@ pub trait DataContractCreateTransitionMethodsV0 { /// # Arguments /// /// * `data_contract` - A mutable `DataContract` instance, to be used in the transition. - /// * `entropy` - A `Bytes32` value providing additional randomness. + /// * `identity_nonce` - A `IdentityNonce` value providing additional randomness. /// * `identity` - A reference to a `PartialIdentity` object. /// * `key_id` - A `KeyID` identifier for the public key used for signing the transition. /// * `signer` - A reference to an object implementing the `Signer` trait. @@ -28,7 +28,7 @@ pub trait DataContractCreateTransitionMethodsV0 { /// object. Otherwise, returns `ProtocolError`. fn new_from_data_contract( data_contract: DataContract, - entropy: Bytes32, + identity_nonce: IdentityNonce, identity: &PartialIdentity, key_id: KeyID, signer: &S, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/mod.rs index 0d3e8ae0f78..566dc56ea4f 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/mod.rs @@ -4,7 +4,6 @@ mod identity_signed; #[cfg(feature = "state-transition-json-conversion")] mod json_conversion; pub mod methods; -mod serialize; mod state_transition_like; mod v0; #[cfg(feature = "state-transition-value-conversion")] @@ -24,9 +23,11 @@ use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, Plat use platform_version::{TryFromPlatformVersioned, TryIntoPlatformVersioned}; use platform_versioning::PlatformVersioned; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; use crate::data_contract::created_data_contract::CreatedDataContract; +use crate::identity::state_transition::OptionallyAssetLockProved; pub use v0::*; pub type DataContractCreateTransitionLatest = DataContractCreateTransitionV0; @@ -134,7 +135,7 @@ impl StateTransitionFieldTypes for DataContractCreateTransition { } fn binary_property_paths() -> Vec<&'static str> { - vec![SIGNATURE, ENTROPY] + vec![SIGNATURE, IDENTITY_NONCE] } } @@ -146,6 +147,8 @@ impl DataContractCreateTransition { } } +impl OptionallyAssetLockProved for DataContractCreateTransition {} + #[cfg(test)] mod test { use crate::data_contract::conversion::json::DataContractJsonConversionMethodsV0; @@ -155,7 +158,6 @@ mod test { use crate::data_contract::accessors::v0::DataContractV0Getters; use crate::data_contract::conversion::value::v0::DataContractValueConversionMethodsV0; use crate::state_transition::data_contract_create_transition::accessors::DataContractCreateTransitionAccessorsV0; - use crate::state_transition::state_transitions::common_fields::property_names; use crate::state_transition::traits::StateTransitionLike; use crate::state_transition::{StateTransitionType, StateTransitionValueConvert}; use crate::tests::fixtures::get_data_contract_fixture; @@ -169,7 +171,7 @@ mod test { } pub(crate) fn get_test_data() -> TestData { - let created_data_contract = get_data_contract_fixture(None, 1); + let created_data_contract = get_data_contract_fixture(None, 0, 1); let state_transition = DataContractCreateTransition::from_object( Value::from([ @@ -181,12 +183,13 @@ mod test { .validation_and_processing .state_transitions .contract_create_state_transition - .structure, + .basic_structure + .unwrap(), ), ), ( - property_names::ENTROPY, - Value::Bytes32(created_data_contract.entropy_used().to_buffer()), + IDENTITY_NONCE, + Value::U64(created_data_contract.identity_nonce()), ), ( DATA_CONTRACT, @@ -235,6 +238,7 @@ mod test { let data_contract = DataContract::try_from_platform_versioned( data.state_transition.data_contract().clone(), false, + &mut vec![], LATEST_PLATFORM_VERSION, ) .expect("to get data contract"); diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/serialize.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/serialize.rs deleted file mode 100644 index bb8226a25a1..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/serialize.rs +++ /dev/null @@ -1,118 +0,0 @@ -// use crate::data_contract::property_names::ENTROPY; -// -// use crate::data_contract::DataContract; -// use crate::document::document_transition::document_base_transition::JsonValue; -// use crate::identity::KeyID; -// use crate::serialization::PlatformDeserializable; -// use crate::serialization::{PlatformSerializable, Signable}; -// use crate::state_transition::{StateTransitionFieldTypes, StateTransitionLike, StateTransitionType}; -// use crate::version::{PlatformVersion}; -// use crate::{ProtocolError}; -// use bincode::{config, Decode, Encode}; -// use derive_more::From; -// use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; -// use platform_versioning::PlatformVersioned; -// use platform_value::{BinaryData, Bytes32, Identifier, Value}; -// use serde::de::{MapAccess, Visitor}; -// use serde::ser::SerializeMap; -// use serde::{Deserialize, Deserializer, Serialize, Serializer}; -// -// use std::fmt; -// use crate::data_contract::state_transition::property_names::{SIGNATURE, SIGNATURE_PUBLIC_KEY_ID}; -// use crate::state_transition::data_contract_create_transition::{DataContractCreateTransition, DataContractCreateTransitionV0}; -// -// impl Serialize for DataContractCreateTransition { -// fn serialize(&self, serializer: S) -> Result -// where -// S: Serializer, -// { -// let mut state = serializer.serialize_map(None)?; -// -// match *self { -// DataContractCreateTransition::V0(ref v0) => { -// state.serialize_entry("type", &StateTransitionType::DataContractCreate)?; -// state.serialize_entry("version", &0u16)?; -// state.serialize_entry("dataContract", &v0.data_contract)?; -// state.serialize_entry("entropy", &v0.entropy)?; -// state.serialize_entry("signaturePublicKeyId", &v0.signature_public_key_id)?; -// state.serialize_entry("signature", &v0.signature)?; -// } -// } -// -// state.end() -// } -// } -// -// struct DataContractCreateTransitionVisitor; -// -// impl<'de> Visitor<'de> for DataContractCreateTransitionVisitor { -// type Value = DataContractCreateTransition; -// -// fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { -// formatter.write_str("a map representing a DataContractCreateTransition") -// } -// -// fn visit_map(self, mut map: A) -> Result -// where -// A: MapAccess<'de>, -// { -// let mut version: Option = None; -// let mut data_contract: Option = None; -// let mut entropy: Option = None; -// let mut signature_public_key_id: Option = None; -// let mut signature: Option = None; -// -// while let Some(key) = map.next_key()? { -// match key { -// "version" => { -// version = Some(map.next_value()?); -// } -// "dataContract" => { -// data_contract = Some(map.next_value()?); -// } -// "entropy" => { -// entropy = Some(map.next_value()?); -// } -// "signaturePublicKeyId" => { -// signature_public_key_id = Some(map.next_value()?); -// } -// "signature" => { -// signature = Some(map.next_value()?); -// } -// _ => {} -// } -// } -// -// let version = version.ok_or_else(|| serde::de::Error::missing_field("version"))?; -// let data_contract = -// data_contract.ok_or_else(|| serde::de::Error::missing_field("dataContract"))?; -// let entropy = entropy.ok_or_else(|| serde::de::Error::missing_field("entropy"))?; -// let signature_public_key_id = signature_public_key_id -// .ok_or_else(|| serde::de::Error::missing_field("signaturePublicKeyId"))?; -// let signature = signature.ok_or_else(|| serde::de::Error::missing_field("signature"))?; -// -// match version { -// 0 => Ok(DataContractCreateTransition::V0( -// DataContractCreateTransitionV0 { -// data_contract, -// entropy, -// signature_public_key_id, -// signature, -// }, -// )), -// _ => Err(serde::de::Error::unknown_variant( -// &format!("{}", version), -// &[], -// )), -// } -// } -// } -// -// impl<'de> Deserialize<'de> for DataContractCreateTransition { -// fn deserialize(deserializer: D) -> Result -// where -// D: Deserializer<'de>, -// { -// deserializer.deserialize_map(DataContractCreateTransitionVisitor) -// } -// } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/state_transition_like.rs index cbacd9d9aba..e8c7765558b 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/state_transition_like.rs @@ -1,3 +1,4 @@ +use crate::prelude::UserFeeIncrease; use crate::state_transition::data_contract_create_transition::DataContractCreateTransition; use crate::state_transition::{StateTransitionLike, StateTransitionType}; use crate::version::FeatureVersion; @@ -35,6 +36,21 @@ impl StateTransitionLike for DataContractCreateTransition { } } + /// returns the fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + DataContractCreateTransition::V0(transition) => transition.user_fee_increase(), + } + } + /// set a fee multiplier + fn set_user_fee_increase(&mut self, fee_multiplier: UserFeeIncrease) { + match self { + DataContractCreateTransition::V0(transition) => { + transition.set_user_fee_increase(fee_multiplier) + } + } + } + fn set_signature_bytes(&mut self, signature: Vec) { match self { DataContractCreateTransition::V0(transition) => { @@ -48,4 +64,10 @@ impl StateTransitionLike for DataContractCreateTransition { DataContractCreateTransition::V0(transition) => transition.owner_id(), } } + + fn unique_identifiers(&self) -> Vec { + match self { + DataContractCreateTransition::V0(transition) => transition.unique_identifiers(), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/identity_signed.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/identity_signed.rs index 5aec8aea2e0..c7b4464dec8 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/identity_signed.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/identity_signed.rs @@ -1,4 +1,4 @@ -use crate::identity::SecurityLevel::CRITICAL; +use crate::identity::SecurityLevel::{CRITICAL, HIGH}; use crate::identity::{KeyID, SecurityLevel}; use crate::state_transition::data_contract_create_transition::DataContractCreateTransitionV0; use crate::state_transition::StateTransitionIdentitySigned; @@ -13,6 +13,6 @@ impl StateTransitionIdentitySigned for DataContractCreateTransitionV0 { } fn security_level_requirement(&self) -> Vec { - vec![CRITICAL] + vec![CRITICAL, HIGH] } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/mod.rs index 67e6986e828..054004a6dc5 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/mod.rs @@ -10,13 +10,15 @@ mod version; use platform_serialization_derive::PlatformSignable; -use platform_value::{BinaryData, Bytes32}; +use platform_value::BinaryData; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; use crate::{data_contract::DataContract, identity::KeyID, ProtocolError}; use crate::data_contract::created_data_contract::CreatedDataContract; use crate::data_contract::serialized_version::DataContractInSerializationFormat; +use crate::prelude::{IdentityNonce, UserFeeIncrease}; use crate::state_transition::data_contract_create_transition::DataContractCreateTransition; use bincode::{Decode, Encode}; use platform_version::{TryFromPlatformVersioned, TryIntoPlatformVersioned}; @@ -34,7 +36,8 @@ use crate::version::PlatformVersion; )] pub struct DataContractCreateTransitionV0 { pub data_contract: DataContractInSerializationFormat, - pub entropy: Bytes32, + pub identity_nonce: IdentityNonce, + pub user_fee_increase: UserFeeIncrease, #[platform_signable(exclude_from_sig_hash)] pub signature_public_key_id: KeyID, #[platform_signable(exclude_from_sig_hash)] @@ -64,7 +67,8 @@ impl TryFromPlatformVersioned for DataContractCreateTransitionV0 { ) -> Result { Ok(DataContractCreateTransitionV0 { data_contract: value.try_into_platform_versioned(platform_version)?, - entropy: Default::default(), + identity_nonce: Default::default(), + user_fee_increase: 0, signature_public_key_id: 0, signature: Default::default(), }) @@ -78,10 +82,11 @@ impl TryFromPlatformVersioned for DataContractCreateTransit value: CreatedDataContract, platform_version: &PlatformVersion, ) -> Result { - let (data_contract, entropy) = value.data_contract_and_entropy_owned(); + let (data_contract, identity_nonce) = value.data_contract_and_identity_nonce(); Ok(DataContractCreateTransitionV0 { data_contract: data_contract.try_into_platform_versioned(platform_version)?, - entropy, + identity_nonce, + user_fee_increase: 0, signature_public_key_id: 0, signature: Default::default(), }) diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/state_transition_like.rs index 5110c92e422..6f879c2b7e8 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/state_transition_like.rs @@ -1,5 +1,6 @@ use platform_value::BinaryData; +use crate::prelude::UserFeeIncrease; use crate::{ prelude::Identifier, state_transition::{StateTransitionLike, StateTransitionType}, @@ -40,4 +41,20 @@ impl StateTransitionLike for DataContractCreateTransitionV0 { fn owner_id(&self) -> Identifier { self.data_contract.owner_id() } + + fn unique_identifiers(&self) -> Vec { + vec![format!( + "dcc-{}-{}", + self.data_contract.owner_id(), + self.data_contract.id() + )] + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + self.user_fee_increase + } + + fn set_user_fee_increase(&mut self, fee_multiplier: UserFeeIncrease) { + self.user_fee_increase = fee_multiplier + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/types.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/types.rs index 7e07594821f..7f3304ab27c 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/types.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/types.rs @@ -1,6 +1,6 @@ use crate::state_transition::data_contract_create_transition::DataContractCreateTransitionV0; use crate::state_transition::state_transitions::common_fields::property_names::{ - ENTROPY, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, + SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, }; use crate::state_transition::StateTransitionFieldTypes; @@ -14,6 +14,6 @@ impl StateTransitionFieldTypes for DataContractCreateTransitionV0 { } fn binary_property_paths() -> Vec<&'static str> { - vec![SIGNATURE, ENTROPY] + vec![SIGNATURE] } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/v0_methods.rs index 35da1d2aec1..ca6fe4e1480 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/v0_methods.rs @@ -1,7 +1,5 @@ use crate::state_transition::data_contract_create_transition::DataContractCreateTransitionV0; -use platform_value::Bytes32; - use crate::{data_contract::DataContract, identity::KeyID, NonConsensusError, ProtocolError}; use crate::serialization::Signable; @@ -11,6 +9,7 @@ use crate::data_contract::accessors::v0::DataContractV0Setters; use crate::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use crate::identity::signer::Signer; use crate::identity::PartialIdentity; +use crate::prelude::IdentityNonce; use crate::state_transition::data_contract_create_transition::methods::DataContractCreateTransitionMethodsV0; use crate::state_transition::data_contract_create_transition::DataContractCreateTransition; use platform_version::version::PlatformVersion; @@ -22,7 +21,7 @@ use crate::version::FeatureVersion; impl DataContractCreateTransitionMethodsV0 for DataContractCreateTransitionV0 { fn new_from_data_contract( mut data_contract: DataContract, - entropy: Bytes32, + identity_nonce: IdentityNonce, identity: &PartialIdentity, key_id: KeyID, signer: &S, @@ -31,32 +30,47 @@ impl DataContractCreateTransitionMethodsV0 for DataContractCreateTransitionV0 { ) -> Result { data_contract.set_id(DataContract::generate_data_contract_id_v0( identity.id, - entropy, + identity_nonce, )); + data_contract.set_owner_id(identity.id); + let transition = DataContractCreateTransition::V0(DataContractCreateTransitionV0 { data_contract: data_contract.try_into_platform_versioned(platform_version)?, - entropy: Default::default(), + identity_nonce, + user_fee_increase: 0, signature_public_key_id: key_id, signature: Default::default(), }); + let mut state_transition: StateTransition = transition.into(); let value = state_transition.signable_bytes()?; - let public_key = - identity - .loaded_public_keys - .get(&key_id) - .ok_or(ProtocolError::NonConsensusError( - NonConsensusError::StateTransitionCreationError( - "public key did not exist".to_string(), - ), - ))?; + + // The public key ids don't always match the keys in the map, so we need to do this. + let matching_key = identity + .loaded_public_keys + .iter() + .find_map(|(&key, public_key)| { + if public_key.id() == key_id { + Some(key) + } else { + None + } + }) + .expect("No matching public key id found in the map"); + + let public_key = identity.loaded_public_keys.get(&matching_key).ok_or( + ProtocolError::NonConsensusError(NonConsensusError::StateTransitionCreationError( + "public key did not exist".to_string(), + )), + )?; let security_level_requirements = state_transition.security_level_requirement().ok_or( ProtocolError::CorruptedCodeExecution( "expected security level requirements".to_string(), ), )?; + if !security_level_requirements.contains(&public_key.security_level()) { return Err(ProtocolError::ConsensusError(Box::new( SignatureError::InvalidSignaturePublicKeySecurityLevelError( @@ -69,7 +83,16 @@ impl DataContractCreateTransitionMethodsV0 for DataContractCreateTransitionV0 { ))); } - state_transition.set_signature(signer.sign(public_key, &value)?); + // There was an error here where the public key supplied was not one belonging to the signer. + match signer.sign(public_key, &value) { + Ok(signature) => { + state_transition.set_signature(signature); + } + Err(e) => { + return Err(e); + } + } + Ok(state_transition) } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/value_conversion.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/value_conversion.rs index be5c2ec1937..f79c2f765fd 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/value_conversion.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/v0/value_conversion.rs @@ -11,6 +11,7 @@ use crate::data_contract::conversion::value::v0::DataContractValueConversionMeth use crate::state_transition::{StateTransitionFieldTypes, StateTransitionValueConvert}; use crate::state_transition::data_contract_create_transition::{DataContractCreateTransitionV0}; use crate::state_transition::data_contract_create_transition::fields::*; +use crate::state_transition::state_transitions::common_fields::property_names::USER_FEE_INCREASE; use crate::state_transition::state_transitions::contract::data_contract_create_transition::fields::{BINARY_FIELDS, IDENTIFIER_FIELDS, U32_FIELDS}; impl<'a> StateTransitionValueConvert<'a> for DataContractCreateTransitionV0 { @@ -27,8 +28,8 @@ impl<'a> StateTransitionValueConvert<'a> for DataContractCreateTransitionV0 { .get_optional_integer(SIGNATURE_PUBLIC_KEY_ID) .map_err(ProtocolError::ValueError)? .unwrap_or_default(), - entropy: raw_object - .remove_optional_bytes_32(ENTROPY) + identity_nonce: raw_object + .get_optional_integer(IDENTITY_NONCE) .map_err(ProtocolError::ValueError)? .unwrap_or_default(), data_contract: DataContract::from_value( @@ -41,6 +42,10 @@ impl<'a> StateTransitionValueConvert<'a> for DataContractCreateTransitionV0 { platform_version, )? .try_into_platform_versioned(platform_version)?, + user_fee_increase: raw_object + .get_optional_integer(USER_FEE_INCREASE) + .map_err(ProtocolError::ValueError)? + .unwrap_or_default(), }) } @@ -57,8 +62,8 @@ impl<'a> StateTransitionValueConvert<'a> for DataContractCreateTransitionV0 { .remove_optional_integer(SIGNATURE_PUBLIC_KEY_ID) .map_err(ProtocolError::ValueError)? .unwrap_or_default(), - entropy: raw_value_map - .remove_optional_bytes_32(ENTROPY) + identity_nonce: raw_value_map + .remove_optional_integer(IDENTITY_NONCE) .map_err(ProtocolError::ValueError)? .unwrap_or_default(), data_contract: DataContract::from_value( @@ -71,6 +76,10 @@ impl<'a> StateTransitionValueConvert<'a> for DataContractCreateTransitionV0 { platform_version, )? .try_into_platform_versioned(platform_version)?, + user_fee_increase: raw_value_map + .remove_optional_integer(USER_FEE_INCREASE) + .map_err(ProtocolError::ValueError)? + .unwrap_or_default(), }) } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/accessors/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/accessors/mod.rs index c1d823b6b1b..a928d77b220 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/accessors/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/accessors/mod.rs @@ -2,6 +2,7 @@ mod v0; use crate::data_contract::serialized_version::DataContractInSerializationFormat; +use crate::prelude::IdentityNonce; use crate::state_transition::data_contract_update_transition::DataContractUpdateTransition; pub use v0::*; @@ -19,4 +20,10 @@ impl DataContractUpdateTransitionAccessorsV0 for DataContractUpdateTransition { } } } + + fn identity_contract_nonce(&self) -> IdentityNonce { + match self { + DataContractUpdateTransition::V0(transition) => transition.identity_contract_nonce, + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/accessors/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/accessors/v0/mod.rs index 66cbeab4b4b..49907ccd405 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/accessors/v0/mod.rs @@ -1,6 +1,9 @@ use crate::data_contract::serialized_version::DataContractInSerializationFormat; +use crate::prelude::IdentityNonce; pub trait DataContractUpdateTransitionAccessorsV0 { fn data_contract(&self) -> &DataContractInSerializationFormat; fn set_data_contract(&mut self, data_contract: DataContractInSerializationFormat); + + fn identity_contract_nonce(&self) -> IdentityNonce; } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/fields.rs index c0e7dfab8b3..90fc0adf6ae 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/fields.rs @@ -1,7 +1,9 @@ use crate::state_transition::state_transitions; +use crate::state_transition::state_transitions::contract::common_fields::property_names::IDENTITY_CONTRACT_NONCE; pub use state_transitions::common_fields::property_names::{ - ENTROPY, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, TRANSITION_TYPE, + IDENTITY_NONCE, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, + TRANSITION_TYPE, }; pub use state_transitions::contract::common_fields::property_names::{ DATA_CONTRACT, DATA_CONTRACT_ENTROPY, DATA_CONTRACT_ID, DATA_CONTRACT_OWNER_ID, @@ -10,7 +12,8 @@ pub use state_transitions::contract::common_fields::property_names::{ pub const IDENTIFIER_FIELDS: [&str; 2] = [DATA_CONTRACT_ID, DATA_CONTRACT_OWNER_ID]; pub const BINARY_FIELDS: [&str; 2] = [DATA_CONTRACT_ENTROPY, SIGNATURE]; -pub const U32_FIELDS: [&str; 2] = [ +pub const U32_FIELDS: [&str; 3] = [ STATE_TRANSITION_PROTOCOL_VERSION, DATA_CONTRACT_PROTOCOL_VERSION, + IDENTITY_CONTRACT_NONCE, ]; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/methods/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/methods/mod.rs index b31ecf4a939..98522c59720 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/methods/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/methods/mod.rs @@ -12,6 +12,7 @@ use crate::state_transition::StateTransition; use crate::version::FeatureVersion; use crate::ProtocolError; +use crate::prelude::{IdentityNonce, UserFeeIncrease}; use platform_version::version::PlatformVersion; impl DataContractUpdateTransitionMethodsV0 for DataContractUpdateTransition { @@ -19,6 +20,8 @@ impl DataContractUpdateTransitionMethodsV0 for DataContractUpdateTransition { data_contract: DataContract, identity: &PartialIdentity, key_id: KeyID, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, feature_version: Option, @@ -34,6 +37,8 @@ impl DataContractUpdateTransitionMethodsV0 for DataContractUpdateTransition { data_contract, identity, key_id, + identity_contract_nonce, + user_fee_increase, signer, platform_version, feature_version, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/methods/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/methods/v0/mod.rs index f114ca9bb3b..1dd2d579b34 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/methods/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/methods/v0/mod.rs @@ -2,6 +2,7 @@ use crate::data_contract::DataContract; use crate::identity::signer::Signer; use crate::identity::{KeyID, PartialIdentity}; +use crate::prelude::{IdentityNonce, UserFeeIncrease}; use crate::state_transition::StateTransition; use crate::version::FeatureVersion; use crate::ProtocolError; @@ -25,6 +26,8 @@ pub trait DataContractUpdateTransitionMethodsV0 { data_contract: DataContract, identity: &PartialIdentity, key_id: KeyID, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, feature_version: Option, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/mod.rs index 56b7003ac0c..85b5a7317a6 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/mod.rs @@ -6,6 +6,7 @@ use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, Plat use platform_versioning::PlatformVersioned; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub mod accessors; @@ -27,6 +28,8 @@ use platform_version::{TryFromPlatformVersioned, TryIntoPlatformVersioned}; use crate::data_contract::DataContract; +use crate::identity::state_transition::OptionallyAssetLockProved; +use crate::prelude::IdentityNonce; pub use v0::*; pub type DataContractUpdateTransitionLatest = DataContractUpdateTransitionV0; @@ -57,11 +60,11 @@ pub enum DataContractUpdateTransition { V0(DataContractUpdateTransitionV0), } -impl TryFromPlatformVersioned for DataContractUpdateTransition { +impl TryFromPlatformVersioned<(DataContract, IdentityNonce)> for DataContractUpdateTransition { type Error = ProtocolError; fn try_from_platform_versioned( - value: DataContract, + value: (DataContract, IdentityNonce), platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -99,6 +102,8 @@ impl StateTransitionFieldTypes for DataContractUpdateTransition { } } +impl OptionallyAssetLockProved for DataContractUpdateTransition {} + #[cfg(test)] mod test { use crate::data_contract::DataContract; @@ -120,11 +125,10 @@ mod test { fn get_test_data() -> TestData { let platform_version = PlatformVersion::first(); - let data_contract = get_data_contract_fixture(None, platform_version.protocol_version) + let data_contract = get_data_contract_fixture(None, 0, platform_version.protocol_version) .data_contract_owned(); - let state_transition: DataContractUpdateTransition = data_contract - .clone() + let state_transition: DataContractUpdateTransition = (data_contract.clone(), 1) .try_into_platform_versioned(platform_version) .expect("expected to get transition"); diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/state_transition_like.rs index 1b6be85e7f2..7c03a33becc 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/state_transition_like.rs @@ -1,3 +1,4 @@ +use crate::prelude::UserFeeIncrease; use crate::state_transition::data_contract_update_transition::DataContractUpdateTransition; use crate::state_transition::{StateTransitionLike, StateTransitionType}; use crate::version::FeatureVersion; @@ -48,4 +49,25 @@ impl StateTransitionLike for DataContractUpdateTransition { DataContractUpdateTransition::V0(transition) => transition.owner_id(), } } + + fn unique_identifiers(&self) -> Vec { + match self { + DataContractUpdateTransition::V0(transition) => transition.unique_identifiers(), + } + } + + /// returns the fee increase multiplier + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + DataContractUpdateTransition::V0(transition) => transition.user_fee_increase(), + } + } + /// set a fee increase multiplier + fn set_user_fee_increase(&mut self, user_fee_increase: UserFeeIncrease) { + match self { + DataContractUpdateTransition::V0(transition) => { + transition.set_user_fee_increase(user_fee_increase) + } + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/mod.rs index 698560017b9..144d706ecca 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/mod.rs @@ -9,6 +9,7 @@ mod value_conversion; mod version; use platform_value::BinaryData; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; use bincode::{Decode, Encode}; @@ -17,6 +18,7 @@ use platform_version::version::PlatformVersion; use platform_version::{TryFromPlatformVersioned, TryIntoPlatformVersioned}; use crate::data_contract::serialized_version::DataContractInSerializationFormat; +use crate::prelude::{IdentityNonce, UserFeeIncrease}; use crate::state_transition::data_contract_update_transition::DataContractUpdateTransition; use crate::state_transition::StateTransition; use crate::{data_contract::DataContract, identity::KeyID, ProtocolError}; @@ -29,22 +31,30 @@ use crate::{data_contract::DataContract, identity::KeyID, ProtocolError}; )] pub struct DataContractUpdateTransitionV0 { + #[cfg_attr( + feature = "state-transition-serde-conversion", + serde(rename = "$identity-contract-nonce") + )] + pub identity_contract_nonce: IdentityNonce, pub data_contract: DataContractInSerializationFormat, + pub user_fee_increase: UserFeeIncrease, #[platform_signable(exclude_from_sig_hash)] pub signature_public_key_id: KeyID, #[platform_signable(exclude_from_sig_hash)] pub signature: BinaryData, } -impl TryFromPlatformVersioned for DataContractUpdateTransitionV0 { +impl TryFromPlatformVersioned<(DataContract, IdentityNonce)> for DataContractUpdateTransitionV0 { type Error = ProtocolError; fn try_from_platform_versioned( - value: DataContract, + value: (DataContract, IdentityNonce), platform_version: &PlatformVersion, ) -> Result { Ok(DataContractUpdateTransitionV0 { - data_contract: value.try_into_platform_versioned(platform_version)?, + identity_contract_nonce: value.1, + data_contract: value.0.try_into_platform_versioned(platform_version)?, + user_fee_increase: 0, signature_public_key_id: 0, signature: Default::default(), }) diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/state_transition_like.rs index 858883b8b23..94936be6a1c 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/state_transition_like.rs @@ -1,5 +1,8 @@ +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use platform_value::BinaryData; +use crate::prelude::UserFeeIncrease; use crate::{ prelude::Identifier, state_transition::{StateTransitionLike, StateTransitionType}, @@ -40,4 +43,21 @@ impl StateTransitionLike for DataContractUpdateTransitionV0 { fn owner_id(&self) -> Identifier { self.data_contract.owner_id() } + + fn unique_identifiers(&self) -> Vec { + vec![format!( + "{}-{}-{:x}", + BASE64_STANDARD.encode(self.data_contract.owner_id()), + BASE64_STANDARD.encode(self.data_contract.id()), + self.identity_contract_nonce + )] + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + self.user_fee_increase + } + + fn set_user_fee_increase(&mut self, fee_multiplier: UserFeeIncrease) { + self.user_fee_increase = fee_multiplier + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/v0_methods.rs index 425a5f00a54..732b684b7ac 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/v0_methods.rs @@ -3,6 +3,7 @@ use crate::identity::signer::Signer; use crate::identity::{KeyID, PartialIdentity}; use crate::serialization::Signable; +use crate::prelude::{IdentityNonce, UserFeeIncrease}; use crate::state_transition::data_contract_update_transition::methods::DataContractUpdateTransitionMethodsV0; use crate::state_transition::data_contract_update_transition::{ DataContractUpdateTransition, DataContractUpdateTransitionV0, @@ -18,12 +19,16 @@ impl DataContractUpdateTransitionMethodsV0 for DataContractUpdateTransitionV0 { data_contract: DataContract, identity: &PartialIdentity, key_id: KeyID, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, _feature_version: Option, ) -> Result { let transition = DataContractUpdateTransition::V0(DataContractUpdateTransitionV0 { + identity_contract_nonce, data_contract: data_contract.try_into_platform_versioned(platform_version)?, + user_fee_increase, signature_public_key_id: key_id, signature: Default::default(), }); diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/value_conversion.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/value_conversion.rs index 30d02d93379..9759ab775b4 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/value_conversion.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_update_transition/v0/value_conversion.rs @@ -4,6 +4,9 @@ use crate::state_transition::data_contract_update_transition::fields::*; use crate::state_transition::data_contract_update_transition::{ DataContractUpdateTransitionV0, BINARY_FIELDS, IDENTIFIER_FIELDS, U32_FIELDS, }; +use crate::state_transition::state_transitions::common_fields::property_names::{ + IDENTITY_CONTRACT_NONCE, USER_FEE_INCREASE, +}; use crate::state_transition::StateTransitionFieldTypes; use crate::state_transition::StateTransitionValueConvert; use crate::ProtocolError; @@ -49,6 +52,14 @@ impl<'a> StateTransitionValueConvert<'a> for DataContractUpdateTransitionV0 { platform_version: &PlatformVersion, ) -> Result { Ok(DataContractUpdateTransitionV0 { + identity_contract_nonce: raw_object.remove_integer(IDENTITY_CONTRACT_NONCE).map_err( + |_| { + ProtocolError::DecodingError( + "identity contract nonce missing on data contract update state transition" + .to_string(), + ) + }, + )?, signature: raw_object .remove_optional_binary_data(SIGNATURE) .map_err(ProtocolError::ValueError)? @@ -67,6 +78,10 @@ impl<'a> StateTransitionValueConvert<'a> for DataContractUpdateTransitionV0 { platform_version, )? .try_into_platform_versioned(platform_version)?, + user_fee_increase: raw_object + .get_optional_integer(USER_FEE_INCREASE) + .map_err(ProtocolError::ValueError)? + .unwrap_or_default(), }) } @@ -75,6 +90,14 @@ impl<'a> StateTransitionValueConvert<'a> for DataContractUpdateTransitionV0 { platform_version: &PlatformVersion, ) -> Result { Ok(DataContractUpdateTransitionV0 { + identity_contract_nonce: raw_value_map + .remove_integer(IDENTITY_CONTRACT_NONCE) + .map_err(|_| { + ProtocolError::DecodingError( + "identity contract nonce missing on data contract update state transition" + .to_string(), + ) + })?, signature: raw_value_map .remove_optional_binary_data(SIGNATURE) .map_err(ProtocolError::ValueError)? @@ -93,6 +116,10 @@ impl<'a> StateTransitionValueConvert<'a> for DataContractUpdateTransitionV0 { platform_version, )? .try_into_platform_versioned(platform_version)?, + user_fee_increase: raw_value_map + .remove_optional_integer(USER_FEE_INCREASE) + .map_err(ProtocolError::ValueError)? + .unwrap_or_default(), }) } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/action_type.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/action_type.rs index f8e4b467d3b..fd7c376f7b9 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/action_type.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/action_type.rs @@ -7,6 +7,10 @@ pub enum DocumentTransitionActionType { Create, //the entropy used Replace, Delete, + Transfer, + Purchase, + UpdatePrice, + IgnoreWhileBumpingRevision, } pub trait TransitionActionTypeGetter { @@ -19,6 +23,9 @@ impl TransitionActionTypeGetter for DocumentTransition { DocumentTransition::Create(_) => DocumentTransitionActionType::Create, DocumentTransition::Delete(_) => DocumentTransitionActionType::Delete, DocumentTransition::Replace(_) => DocumentTransitionActionType::Replace, + DocumentTransition::Transfer(_) => DocumentTransitionActionType::Transfer, + DocumentTransition::UpdatePrice(_) => DocumentTransitionActionType::UpdatePrice, + DocumentTransition::Purchase(_) => DocumentTransitionActionType::Purchase, } } } @@ -31,6 +38,7 @@ impl TryFrom<&str> for DocumentTransitionActionType { "create" => Ok(DocumentTransitionActionType::Create), "replace" => Ok(DocumentTransitionActionType::Replace), "delete" => Ok(DocumentTransitionActionType::Delete), + "transfer" => Ok(DocumentTransitionActionType::Transfer), action_type => Err(ProtocolError::Generic(format!( "unknown action type {action_type}" ))), diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/fields.rs index cbbd27c0eaf..b7e0135ed04 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/fields.rs @@ -3,6 +3,7 @@ pub(in crate::state_transition::state_transitions::document::documents_batch_tra pub const DATA_CONTRACT_ID: &str = "$dataContractId"; pub const DOCUMENT_TYPE: &str = "$type"; pub const ACTION: &str = "$action"; + pub const IDENTITY_CONTRACT_NONCE: &str = "$identityContractNonce"; } pub const IDENTIFIER_FIELDS: [&str; 2] = [property_names::ID, property_names::DATA_CONTRACT_ID]; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/from_document.rs index 37044e028f6..e500bbd5bd5 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/from_document.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/from_document.rs @@ -1,5 +1,6 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::document::Document; +use crate::prelude::IdentityNonce; use crate::state_transition::documents_batch_transition::document_base_transition::v0::DocumentBaseTransitionV0; use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; use crate::ProtocolError; @@ -9,6 +10,7 @@ impl DocumentBaseTransition { pub fn from_document( document: &Document, document_type: DocumentTypeRef, + identity_contract_nonce: IdentityNonce, platform_version: &PlatformVersion, feature_version: Option, ) -> Result { @@ -19,7 +21,12 @@ impl DocumentBaseTransition { .document_base_state_transition .default_current_version, ) { - 0 => Ok(DocumentBaseTransitionV0::from_document(document, document_type).into()), + 0 => Ok(DocumentBaseTransitionV0::from_document( + document, + document_type, + identity_contract_nonce, + ) + .into()), version => Err(ProtocolError::UnknownVersionMismatch { method: "DocumentBaseTransition::from_document".to_string(), known_versions: vec![0], diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/mod.rs index 71c8be92158..25dd569fb3e 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/mod.rs @@ -3,18 +3,32 @@ mod from_document; pub mod v0; mod v0_methods; +#[cfg(any( + feature = "state-transition-value-conversion", + feature = "state-transition-json-conversion" +))] use crate::data_contract::DataContract; use crate::state_transition::documents_batch_transition::document_base_transition::v0::{ DocumentBaseTransitionV0, DocumentTransitionObjectLike, }; +#[cfg(any( + feature = "state-transition-value-conversion", + feature = "state-transition-json-conversion" +))] use crate::ProtocolError; use bincode::{Decode, Encode}; use derive_more::{Display, From}; pub use fields::*; +#[cfg(any( + feature = "state-transition-value-conversion", + feature = "state-transition-json-conversion" +))] use platform_value::Value; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; #[cfg(feature = "state-transition-json-conversion")] use serde_json::Value as JsonValue; +#[cfg(feature = "state-transition-value-conversion")] use std::collections::BTreeMap; #[derive(Debug, Clone, Encode, Decode, PartialEq, Display, From)] diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/from_document.rs index 236927bc074..7d3e6ef348b 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/from_document.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/from_document.rs @@ -1,15 +1,18 @@ use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; use crate::data_contract::document_type::DocumentTypeRef; use crate::document::{Document, DocumentV0Getters}; +use crate::prelude::IdentityNonce; use crate::state_transition::documents_batch_transition::document_base_transition::v0::DocumentBaseTransitionV0; impl DocumentBaseTransitionV0 { pub(in crate::state_transition::state_transitions::document::documents_batch_transition::document_transition::document_base_transition) fn from_document( document: &Document, document_type: DocumentTypeRef, + identity_contract_nonce: IdentityNonce, ) -> Self { DocumentBaseTransitionV0 { id: document.id(), + identity_contract_nonce, document_type_name: document_type.name().to_string(), data_contract_id: document_type.data_contract_id(), } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/mod.rs index 44ad4a334f5..8392b812230 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/mod.rs @@ -1,19 +1,32 @@ pub mod from_document; pub mod v0_methods; +#[cfg(feature = "state-transition-value-conversion")] use std::collections::BTreeMap; use bincode::{Decode, Encode}; use derive_more::Display; +#[cfg(feature = "state-transition-value-conversion")] use platform_value::btreemap_extensions::BTreeValueRemoveFromMapHelper; +#[cfg(feature = "state-transition-value-conversion")] use platform_value::Value; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; +#[cfg(feature = "state-transition-json-conversion")] use serde_json::Value as JsonValue; +#[cfg(feature = "state-transition-value-conversion")] use crate::data_contract::accessors::v0::DataContractV0Getters; +use crate::identifier::Identifier; +use crate::prelude::IdentityNonce; +#[cfg(feature = "state-transition-value-conversion")] use crate::state_transition::documents_batch_transition::document_base_transition::property_names; -use crate::{data_contract::DataContract, errors::ProtocolError, identifier::Identifier}; +#[cfg(any( + feature = "state-transition-json-conversion", + feature = "state-transition-value-conversion" +))] +use crate::{data_contract::DataContract, errors::ProtocolError}; #[derive(Debug, Clone, Encode, Decode, Default, PartialEq, Display)] #[cfg_attr( @@ -31,6 +44,11 @@ pub struct DocumentBaseTransitionV0 { /// The document ID #[cfg_attr(feature = "state-transition-serde-conversion", serde(rename = "$id"))] pub id: Identifier, + #[cfg_attr( + feature = "state-transition-serde-conversion", + serde(rename = "$identity-contract-nonce") + )] + pub identity_contract_nonce: IdentityNonce, /// Name of document type found int the data contract associated with the `data_contract_id` #[cfg_attr(feature = "state-transition-serde-conversion", serde(rename = "$type"))] pub document_type_name: String, @@ -47,12 +65,14 @@ impl DocumentBaseTransitionV0 { pub fn from_value_map_consume( map: &mut BTreeMap, data_contract: DataContract, + identity_contract_nonce: IdentityNonce, ) -> Result { Ok(DocumentBaseTransitionV0 { id: Identifier::from( map.remove_hash256_bytes(property_names::ID) .map_err(ProtocolError::ValueError)?, ), + identity_contract_nonce, document_type_name: map .remove_string(property_names::DOCUMENT_TYPE) .map_err(ProtocolError::ValueError)?, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/v0_methods.rs index f14e445d823..c332648a547 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0/v0_methods.rs @@ -1,5 +1,6 @@ use crate::state_transition::documents_batch_transition::document_base_transition::v0::DocumentBaseTransitionV0; +use crate::prelude::IdentityNonce; use platform_value::Identifier; /// A trait that contains getter and setter methods for `DocumentBaseTransitionV0` @@ -22,6 +23,8 @@ pub trait DocumentBaseTransitionV0Methods { /// Sets the data contract ID. fn set_data_contract_id(&mut self, data_contract_id: Identifier); + fn identity_contract_nonce(&self) -> IdentityNonce; + fn set_identity_contract_nonce(&mut self, identity_contract_nonce: IdentityNonce); } impl DocumentBaseTransitionV0Methods for DocumentBaseTransitionV0 { @@ -52,4 +55,12 @@ impl DocumentBaseTransitionV0Methods for DocumentBaseTransitionV0 { fn set_data_contract_id(&mut self, data_contract_id: Identifier) { self.data_contract_id = data_contract_id; } + + fn identity_contract_nonce(&self) -> IdentityNonce { + self.identity_contract_nonce + } + + fn set_identity_contract_nonce(&mut self, identity_contract_nonce: IdentityNonce) { + self.identity_contract_nonce = identity_contract_nonce; + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0_methods.rs index 803e6c5835b..c7a543b5551 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_base_transition/v0_methods.rs @@ -2,6 +2,7 @@ use crate::state_transition::documents_batch_transition::document_base_transitio use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; +use crate::prelude::IdentityNonce; use platform_value::Identifier; impl DocumentBaseTransitionV0Methods for DocumentBaseTransition { @@ -46,4 +47,16 @@ impl DocumentBaseTransitionV0Methods for DocumentBaseTransition { DocumentBaseTransition::V0(v0) => v0.set_data_contract_id(data_contract_id), } } + + fn identity_contract_nonce(&self) -> IdentityNonce { + match self { + DocumentBaseTransition::V0(v0) => v0.identity_contract_nonce, + } + } + + fn set_identity_contract_nonce(&mut self, identity_contract_nonce: IdentityNonce) { + match self { + DocumentBaseTransition::V0(v0) => v0.identity_contract_nonce = identity_contract_nonce, + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/convertible.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/convertible.rs index 9c52c268a69..bca79958bad 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/convertible.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/convertible.rs @@ -1,21 +1,58 @@ +#[cfg(feature = "state-transition-json-conversion")] use crate::data_contract::accessors::v0::DataContractV0Getters; +#[cfg(feature = "state-transition-json-conversion")] use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; +#[cfg(any( + feature = "state-transition-json-conversion", + feature = "state-transition-value-conversion" +))] use crate::prelude::DataContract; +#[cfg(feature = "state-transition-json-conversion")] use crate::state_transition::data_contract_update_transition::IDENTIFIER_FIELDS; +#[cfg(any( + feature = "state-transition-json-conversion", + feature = "state-transition-value-conversion" +))] use crate::state_transition::documents_batch_transition::document_base_transition::v0::DocumentTransitionObjectLike; +#[cfg(feature = "state-transition-json-conversion")] use crate::state_transition::documents_batch_transition::document_create_transition::v0::BINARY_FIELDS; -use crate::state_transition::documents_batch_transition::document_create_transition::{ - DocumentCreateTransition, DocumentCreateTransitionV0, -}; +#[cfg(any( + feature = "state-transition-json-conversion", + feature = "state-transition-value-conversion" +))] +use crate::state_transition::documents_batch_transition::document_create_transition::DocumentCreateTransition; +#[cfg(feature = "state-transition-value-conversion")] +use crate::state_transition::documents_batch_transition::document_create_transition::DocumentCreateTransitionV0; +#[cfg(feature = "state-transition-value-conversion")] use crate::state_transition::documents_batch_transition::fields::property_names::STATE_TRANSITION_PROTOCOL_VERSION; +#[cfg(any( + feature = "state-transition-json-conversion", + feature = "state-transition-value-conversion" +))] use crate::ProtocolError; +#[cfg(any( + feature = "state-transition-json-conversion", + feature = "state-transition-value-conversion" +))] use platform_value::btreemap_extensions::{ BTreeValueMapHelper, BTreeValueMapReplacementPathHelper, BTreeValueRemoveFromMapHelper, }; -use platform_value::{ReplacementType, Value}; +#[cfg(feature = "state-transition-json-conversion")] +use platform_value::ReplacementType; +#[cfg(any( + feature = "state-transition-json-conversion", + feature = "state-transition-value-conversion" +))] +use platform_value::Value; +#[cfg(feature = "state-transition-json-conversion")] use serde_json::Value as JsonValue; +#[cfg(feature = "state-transition-value-conversion")] use std::collections::BTreeMap; +#[cfg(any( + feature = "state-transition-json-conversion", + feature = "state-transition-value-conversion" +))] impl DocumentTransitionObjectLike for DocumentCreateTransition { #[cfg(feature = "state-transition-json-conversion")] fn from_json_object( diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/from_document.rs index 82ad07502bd..e275f726479 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/from_document.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/from_document.rs @@ -1,5 +1,6 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::document::Document; +use crate::prelude::IdentityNonce; use crate::state_transition::documents_batch_transition::document_create_transition::DocumentCreateTransitionV0; use crate::state_transition::documents_batch_transition::document_transition::DocumentCreateTransition; use crate::ProtocolError; @@ -10,6 +11,7 @@ impl DocumentCreateTransition { document: Document, document_type: DocumentTypeRef, entropy: [u8; 32], + identity_contract_nonce: IdentityNonce, platform_version: &PlatformVersion, feature_version: Option, base_feature_version: Option, @@ -26,6 +28,7 @@ impl DocumentCreateTransition { document, document_type, entropy, + identity_contract_nonce, platform_version, base_feature_version, )? diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/mod.rs index 752e0ad1d5f..2af4a2174f8 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/mod.rs @@ -3,8 +3,16 @@ pub mod from_document; pub mod v0; mod v0_methods; +use crate::block::block_info::BlockInfo; +use crate::data_contract::document_type::DocumentTypeRef; +use crate::document::Document; +use crate::state_transition::documents_batch_transition::document_create_transition::v0::DocumentFromCreateTransitionV0; +use crate::ProtocolError; use bincode::{Decode, Encode}; use derive_more::{Display, From}; +use platform_value::Identifier; +use platform_version::version::PlatformVersion; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub use v0::DocumentCreateTransitionV0; @@ -23,3 +31,96 @@ impl Default for DocumentCreateTransition { DocumentCreateTransition::V0(DocumentCreateTransitionV0::default()) // since only v0 } } + +/// document from create transition +pub trait DocumentFromCreateTransition { + /// Attempts to create a new `Document` from the given `DocumentCreateTransition` reference, `owner_id`, and additional metadata. + /// + /// # Arguments + /// + /// * `document_create_transition` - A reference to the `DocumentCreateTransition` containing information about the document being created. + /// * `owner_id` - The `Identifier` of the document's owner. + /// * `block_info` - The block info containing information about the current block such as block time, block height and core block height. + /// * `document_type` - A reference to the `DocumentTypeRef` associated with this document, defining its structure and rules. + /// * `platform_version` - A reference to the `PlatformVersion` indicating the version of the platform for compatibility. + /// + /// # Returns + /// + /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. + fn try_from_create_transition( + document_create_transition: &DocumentCreateTransition, + owner_id: Identifier, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; + + /// Attempts to create a new `Document` from the given `DocumentCreateTransition` instance, `owner_id`, and additional metadata. + /// + /// # Arguments + /// + /// * `document_create_transition` - A `DocumentCreateTransition` instance containing information about the document being created. + /// * `owner_id` - The `Identifier` of the document's owner. + /// * `block_info` - The block info containing information about the current block such as block time, block height and core block height. + /// * `document_type` - A reference to the `DocumentTypeRef` associated with this document, defining its structure and rules. + /// * `platform_version` - A reference to the `PlatformVersion` indicating the version of the platform for compatibility. + /// + /// # Returns + /// + /// * `Result` - A new `Document` object if successful, otherwise a `ProtocolError`. + fn try_from_owned_create_transition( + document_create_transition: DocumentCreateTransition, + owner_id: Identifier, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; +} + +impl DocumentFromCreateTransition for Document { + fn try_from_create_transition( + document_create_transition: &DocumentCreateTransition, + owner_id: Identifier, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized, + { + match document_create_transition { + DocumentCreateTransition::V0(v0) => Self::try_from_create_transition_v0( + v0, + owner_id, + block_info, + document_type, + platform_version, + ), + } + } + + fn try_from_owned_create_transition( + document_create_transition: DocumentCreateTransition, + owner_id: Identifier, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized, + { + match document_create_transition { + DocumentCreateTransition::V0(v0) => Self::try_from_owned_create_transition_v0( + v0, + owner_id, + block_info, + document_type, + platform_version, + ), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/from_document.rs index 3ef8cfd5b4a..ea399612f42 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/from_document.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/from_document.rs @@ -1,5 +1,6 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::document::{Document, DocumentV0Getters}; +use crate::prelude::IdentityNonce; use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; use crate::state_transition::documents_batch_transition::document_create_transition::DocumentCreateTransitionV0; use crate::ProtocolError; @@ -10,6 +11,7 @@ impl DocumentCreateTransitionV0 { document: Document, document_type: DocumentTypeRef, entropy: [u8; 32], + identity_contract_nonce: IdentityNonce, platform_version: &PlatformVersion, base_feature_version: Option, ) -> Result { @@ -17,12 +19,11 @@ impl DocumentCreateTransitionV0 { base: DocumentBaseTransition::from_document( &document, document_type, + identity_contract_nonce, platform_version, base_feature_version, )?, entropy, - created_at: document.created_at(), - updated_at: document.updated_at(), data: document.properties_consumed(), }) } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/mod.rs index 35bc26c463b..63e03389fa7 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/mod.rs @@ -3,28 +3,38 @@ pub mod v0_methods; use bincode::{Decode, Encode}; +#[cfg(feature = "state-transition-value-conversion")] use platform_value::btreemap_extensions::BTreeValueRemoveFromMapHelper; -use platform_value::Value; +use platform_value::{Identifier, Value}; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; use std::collections::BTreeMap; use std::string::ToString; -use crate::identity::TimestampMillis; +#[cfg(feature = "state-transition-value-conversion")] +use crate::data_contract::DataContract; -use crate::{data_contract::DataContract, errors::ProtocolError}; +use crate::{document, errors::ProtocolError}; -use crate::state_transition::documents_batch_transition::document_base_transition::v0::{ - DocumentBaseTransitionV0, DocumentTransitionObjectLike, -}; +use crate::block::block_info::BlockInfo; +use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; +use crate::data_contract::document_type::methods::DocumentTypeV0Methods; +use crate::data_contract::document_type::DocumentTypeRef; +use crate::document::{Document, DocumentV0}; +use crate::state_transition::documents_batch_transition::document_base_transition::v0::DocumentBaseTransitionV0; +#[cfg(feature = "state-transition-value-conversion")] +use crate::state_transition::documents_batch_transition::document_base_transition::v0::DocumentTransitionObjectLike; use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; use derive_more::Display; +use platform_version::version::PlatformVersion; -pub(self) mod property_names { +#[cfg(feature = "state-transition-value-conversion")] +use crate::state_transition::documents_batch_transition; + +mod property_names { pub const ENTROPY: &str = "$entropy"; - pub const CREATED_AT: &str = "$createdAt"; - pub const UPDATED_AT: &str = "$updatedAt"; } /// The Binary fields in [`DocumentCreateTransition`] @@ -38,14 +48,7 @@ pub use super::super::document_base_transition::IDENTIFIER_FIELDS; derive(Serialize, Deserialize), serde(rename_all = "camelCase") )] -#[display( - fmt = "Base: {}, Entropy: {:?}, Created At: {:?}, Updated At: {:?}, Data: {:?}", - "base", - "entropy", - "created_at", - "updated_at", - "data" -)] +#[display(fmt = "Base: {}, Entropy: {:?}, Data: {:?}", "base", "entropy", "data")] pub struct DocumentCreateTransitionV0 { /// Document Base Transition #[cfg_attr(feature = "state-transition-serde-conversion", serde(flatten))] @@ -58,18 +61,6 @@ pub struct DocumentCreateTransitionV0 { )] pub entropy: [u8; 32], - #[cfg_attr( - feature = "state-transition-serde-conversion", - serde(rename = "$createdAt", skip_serializing_if = "Option::is_none") - )] - pub created_at: Option, - // TODO: It should be moved to update transition - #[cfg_attr( - feature = "state-transition-serde-conversion", - serde(rename = "$updatedAt", skip_serializing_if = "Option::is_none") - )] - pub updated_at: Option, - #[cfg_attr(feature = "state-transition-serde-conversion", serde(flatten))] pub data: BTreeMap, } @@ -132,20 +123,18 @@ impl DocumentCreateTransitionV0 { mut map: BTreeMap, data_contract: DataContract, ) -> Result { + let identity_contract_nonce = map + .remove_integer(documents_batch_transition::document_base_transition::property_names::IDENTITY_CONTRACT_NONCE) + .map_err(ProtocolError::ValueError)?; Ok(Self { base: DocumentBaseTransition::V0(DocumentBaseTransitionV0::from_value_map_consume( &mut map, data_contract, + identity_contract_nonce, )?), entropy: map .remove_hash256_bytes(property_names::ENTROPY) .map_err(ProtocolError::ValueError)?, - created_at: map - .remove_optional_integer(property_names::CREATED_AT) - .map_err(ProtocolError::ValueError)?, - updated_at: map - .remove_optional_integer(property_names::UPDATED_AT) - .map_err(ProtocolError::ValueError)?, data: map, }) } @@ -157,18 +146,6 @@ impl DocumentCreateTransitionV0 { property_names::ENTROPY.to_string(), Value::Bytes(self.entropy.to_vec()), ); - if let Some(created_at) = self.created_at { - transition_base_map.insert( - property_names::CREATED_AT.to_string(), - Value::U64(created_at), - ); - } - if let Some(updated_at) = self.updated_at { - transition_base_map.insert( - property_names::UPDATED_AT.to_string(), - Value::U64(updated_at), - ); - } transition_base_map.extend(self.data.clone()); @@ -176,6 +153,264 @@ impl DocumentCreateTransitionV0 { } } +/// documents from create transition v0 +pub trait DocumentFromCreateTransitionV0 { + /// Attempts to create a new `Document` from the given `DocumentCreateTransitionV0` instance, incorporating additional metadata such as ownership and block information. + /// + /// This function is responsible for taking an owned `DocumentCreateTransitionV0` instance, which encapsulates the initial data for a document, and augmenting this with metadata including the document owner's identifier, block information, and the requirement status of `created_at` and `updated_at` timestamps, as dictated by the associated data contract and the current platform version. + /// + /// # Arguments + /// + /// * `v0` - An owned `DocumentCreateTransitionV0` instance containing the initial data for the document being created. + /// * `owner_id` - The `Identifier` of the document's owner, specifying who will own the newly created document. + /// * `block_info` - A reference to the `BlockInfo`, which provides context about the block height and other block-related metadata at the time of document creation. + /// * `document_type` - A reference to the `DocumentTypeRef` associated with this document, defining its structure and rules. + /// * `platform_version` - A reference to the `PlatformVersion`, which may influence the creation process or validation logic based on the version-specific rules or features of the platform. + /// + /// # Returns + /// + /// * `Result` - On successful creation, returns a new `Document` object populated with the provided data and augmented with necessary metadata. If the creation process encounters any validation failures or other issues, it returns a `ProtocolError`. + /// + fn try_from_owned_create_transition_v0( + v0: DocumentCreateTransitionV0, + owner_id: Identifier, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; + /// Attempts to create a new `Document` from the given `DocumentCreateTransitionV0` reference, incorporating additional metadata like ownership and block information. + /// + /// This function takes a `DocumentCreateTransitionV0` reference, which contains the initial data for the document, and combines it with metadata such as the document owner's identifier, block information, and requirements for timestamp fields based on the associated data contract and platform version. + /// + /// # Arguments + /// + /// * `v0` - A reference to the `DocumentCreateTransitionV0` containing initial data for the document being created. + /// * `owner_id` - The `Identifier` of the document's owner. + /// * `block_info` - A reference to the `BlockInfo` containing the block height at which the document is being created. + /// * `document_type` - A reference to the `DocumentTypeRef` associated with this document, defining its structure and rules. + /// * `platform_version` - A reference to the `PlatformVersion` indicating the version of the platform under which the document is being created. + /// + /// # Returns + /// + /// * `Result` - A new `Document` object if successful, populated with the provided data and metadata. Returns a `ProtocolError` if the creation fails due to issues like missing required fields, incorrect types, or other validation failures. + /// + fn try_from_create_transition_v0( + v0: &DocumentCreateTransitionV0, + owner_id: Identifier, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; +} + +impl DocumentFromCreateTransitionV0 for Document { + fn try_from_owned_create_transition_v0( + v0: DocumentCreateTransitionV0, + owner_id: Identifier, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized, + { + let DocumentCreateTransitionV0 { base, data, .. } = v0; + + match base { + DocumentBaseTransition::V0(base_v0) => { + let DocumentBaseTransitionV0 { id, .. } = base_v0; + + let requires_created_at = document_type + .required_fields() + .contains(document::property_names::CREATED_AT); + let requires_updated_at = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT); + + let requires_created_at_block_height = document_type + .required_fields() + .contains(document::property_names::CREATED_AT_BLOCK_HEIGHT); + let requires_updated_at_block_height = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT_BLOCK_HEIGHT); + + let requires_created_at_core_block_height = document_type + .required_fields() + .contains(document::property_names::CREATED_AT_CORE_BLOCK_HEIGHT); + let requires_updated_at_core_block_height = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT_CORE_BLOCK_HEIGHT); + + let created_at = if requires_created_at { + Some(block_info.time_ms) + } else { + None + }; + let updated_at = if requires_updated_at { + Some(block_info.time_ms) + } else { + None + }; + + let created_at_block_height = if requires_created_at_block_height { + Some(block_info.height) + } else { + None + }; + let updated_at_block_height = if requires_updated_at_block_height { + Some(block_info.height) + } else { + None + }; + + let created_at_core_block_height = if requires_created_at_core_block_height { + Some(block_info.core_height) + } else { + None + }; + let updated_at_core_block_height = if requires_updated_at_core_block_height { + Some(block_info.core_height) + } else { + None + }; + + match platform_version + .dpp + .document_versions + .document_structure_version + { + 0 => Ok(DocumentV0 { + id, + owner_id, + properties: data, + revision: document_type.initial_revision(), + created_at, + updated_at, + transferred_at: None, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height: None, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height: None, + } + .into()), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "Document::try_from_create_transition_v0".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + } + } + + fn try_from_create_transition_v0( + v0: &DocumentCreateTransitionV0, + owner_id: Identifier, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized, + { + let DocumentCreateTransitionV0 { base, data, .. } = v0; + + match base { + DocumentBaseTransition::V0(base_v0) => { + let DocumentBaseTransitionV0 { id, .. } = base_v0; + + let requires_created_at = document_type + .required_fields() + .contains(document::property_names::CREATED_AT); + let requires_updated_at = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT); + + let requires_created_at_block_height = document_type + .required_fields() + .contains(document::property_names::CREATED_AT_BLOCK_HEIGHT); + let requires_updated_at_block_height = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT_BLOCK_HEIGHT); + + let requires_created_at_core_block_height = document_type + .required_fields() + .contains(document::property_names::CREATED_AT_CORE_BLOCK_HEIGHT); + let requires_updated_at_core_block_height = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT_CORE_BLOCK_HEIGHT); + + let created_at = if requires_created_at { + Some(block_info.time_ms) + } else { + None + }; + let updated_at = if requires_updated_at { + Some(block_info.time_ms) + } else { + None + }; + + let created_at_block_height = if requires_created_at_block_height { + Some(block_info.height) + } else { + None + }; + let updated_at_block_height = if requires_updated_at_block_height { + Some(block_info.height) + } else { + None + }; + + let created_at_core_block_height = if requires_created_at_core_block_height { + Some(block_info.core_height) + } else { + None + }; + let updated_at_core_block_height = if requires_updated_at_core_block_height { + Some(block_info.core_height) + } else { + None + }; + + match platform_version + .dpp + .document_versions + .document_structure_version + { + 0 => Ok(DocumentV0 { + id: *id, + owner_id, + properties: data.clone(), + revision: document_type.initial_revision(), + created_at, + updated_at, + transferred_at: None, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height: None, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height: None, + } + .into()), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "Document::try_from_owned_create_transition_v0".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + } + } +} + #[cfg(test)] mod test { use crate::data_contract::data_contract::DataContractV0; @@ -280,6 +515,7 @@ mod test { "id" : id, "$type" : "test", "$dataContractId" : data_contract_id, + "$identityContractNonce": 0u64, "revision" : 1u32, "alphaBinary" : alpha_binary, "alphaIdentifier" : alpha_identifier, @@ -311,7 +547,7 @@ mod test { } #[test] - fn covert_to_object_from_json_value_with_dynamic_binary_paths() { + fn convert_to_object_from_json_value_with_dynamic_binary_paths() { let data_contract = data_contract_with_dynamic_properties(); let alpha_value = vec![10_u8; 32]; let id = vec![11_u8; 32]; @@ -324,6 +560,7 @@ mod test { "$id" : id, "$type" : "test", "$dataContractId" : data_contract_id, + "$identityContractNonce": 0u64, "revision" : 1, "alphaBinary" : alpha_value, "alphaIdentifier" : alpha_value, @@ -340,7 +577,6 @@ mod test { .into_btree_string_map() .unwrap(); - println!("{:?}", object_transition); let v0 = object_transition.get("V0").expect("to get V0"); let right_id = Identifier::from_bytes(&id).unwrap(); let right_data_contract_id = Identifier::from_bytes(&data_contract_id).unwrap(); diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/v0_methods.rs index 62b19c64ada..e15c8b6dc2d 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0/v0_methods.rs @@ -1,5 +1,3 @@ -use crate::identity::TimestampMillis; - use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; use crate::state_transition::documents_batch_transition::document_create_transition::DocumentCreateTransitionV0; @@ -31,26 +29,6 @@ pub trait DocumentCreateTransitionV0Methods { /// * `entropy` - An array of 32 bytes to set. fn set_entropy(&mut self, entropy: [u8; 32]); - /// Returns a reference to the `created_at` field of the `DocumentCreateTransitionV0`. - fn created_at(&self) -> Option; - - /// Sets the value of the `created_at` field in the `DocumentCreateTransitionV0`. - /// - /// # Arguments - /// - /// * `created_at` - An `Option` containing a `TimestampMillis` value to set. - fn set_created_at(&mut self, created_at: Option); - - /// Returns a reference to the `updated_at` field of the `DocumentCreateTransitionV0`. - fn updated_at(&self) -> Option; - - /// Sets the value of the `updated_at` field in the `DocumentCreateTransitionV0`. - /// - /// # Arguments - /// - /// * `updated_at` - An `Option` containing a `TimestampMillis` value to set. - fn set_updated_at(&mut self, updated_at: Option); - /// Returns an optional reference to the `data` field of the `DocumentCreateTransitionV0`. fn data(&self) -> &BTreeMap; @@ -86,22 +64,6 @@ impl DocumentCreateTransitionV0Methods for DocumentCreateTransitionV0 { self.entropy = entropy; } - fn created_at(&self) -> Option { - self.created_at - } - - fn set_created_at(&mut self, created_at: Option) { - self.created_at = created_at; - } - - fn updated_at(&self) -> Option { - self.updated_at - } - - fn set_updated_at(&mut self, updated_at: Option) { - self.updated_at = updated_at; - } - fn data(&self) -> &BTreeMap { &self.data } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0_methods.rs index 3d7be5840b3..ac937493d7a 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_create_transition/v0_methods.rs @@ -1,6 +1,5 @@ use std::collections::BTreeMap; use platform_value::{Value}; -use crate::identity::TimestampMillis; use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; use crate::state_transition::documents_batch_transition::document_create_transition::DocumentCreateTransition; use crate::state_transition::documents_batch_transition::document_create_transition::v0::v0_methods::DocumentCreateTransitionV0Methods; @@ -36,30 +35,6 @@ impl DocumentCreateTransitionV0Methods for DocumentCreateTransition { } } - fn created_at(&self) -> Option { - match self { - DocumentCreateTransition::V0(v0) => v0.created_at, - } - } - - fn set_created_at(&mut self, created_at: Option) { - match self { - DocumentCreateTransition::V0(v0) => v0.created_at = created_at, - } - } - - fn updated_at(&self) -> Option { - match self { - DocumentCreateTransition::V0(v0) => v0.updated_at, - } - } - - fn set_updated_at(&mut self, updated_at: Option) { - match self { - DocumentCreateTransition::V0(v0) => v0.updated_at = updated_at, - } - } - fn data(&self) -> &BTreeMap { match self { DocumentCreateTransition::V0(v0) => &v0.data, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/from_document.rs index c177c2e369d..3c6dfa6b80a 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/from_document.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/from_document.rs @@ -1,5 +1,6 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::document::Document; +use crate::prelude::IdentityNonce; use crate::ProtocolError; use platform_version::version::{FeatureVersion, PlatformVersion}; @@ -10,6 +11,7 @@ impl DocumentDeleteTransition { pub fn from_document( document: Document, document_type: DocumentTypeRef, + identity_contract_nonce: IdentityNonce, platform_version: &PlatformVersion, feature_version: Option, base_feature_version: Option, @@ -25,6 +27,7 @@ impl DocumentDeleteTransition { 0 => Ok(DocumentDeleteTransitionV0::from_document( document, document_type, + identity_contract_nonce, platform_version, base_feature_version, )? diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/mod.rs index 94f386fbdb9..7a0f8fb2a62 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/mod.rs @@ -1,9 +1,10 @@ mod from_document; pub mod v0; -mod v0_methods; +pub mod v0_methods; use bincode::{Decode, Encode}; use derive_more::{Display, From}; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub use v0::*; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/v0/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/v0/from_document.rs index 59a1f3a2453..4fac1aff9f4 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/v0/from_document.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/v0/from_document.rs @@ -1,6 +1,7 @@ use platform_version::version::{FeatureVersion, PlatformVersion}; use crate::data_contract::document_type::{DocumentTypeRef}; use crate::document::{Document}; +use crate::prelude::IdentityNonce; use crate::ProtocolError; use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; use crate::state_transition::documents_batch_transition::document_transition::document_delete_transition::DocumentDeleteTransitionV0; @@ -9,6 +10,7 @@ impl DocumentDeleteTransitionV0 { pub(crate) fn from_document( document: Document, document_type: DocumentTypeRef, + identity_contract_nonce: IdentityNonce, platform_version: &PlatformVersion, base_feature_version: Option, ) -> Result { @@ -16,6 +18,7 @@ impl DocumentDeleteTransitionV0 { base: DocumentBaseTransition::from_document( &document, document_type, + identity_contract_nonce, platform_version, base_feature_version, )?, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/v0/mod.rs index d858b37db8a..813ea0b2ddf 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_delete_transition/v0/mod.rs @@ -6,6 +6,7 @@ use crate::state_transition::documents_batch_transition::document_base_transitio use bincode::{Decode, Encode}; use derive_more::Display; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub use super::super::document_base_transition::IDENTIFIER_FIELDS; @@ -21,92 +22,3 @@ pub struct DocumentDeleteTransitionV0 { #[cfg_attr(feature = "state-transition-serde-conversion", serde(flatten))] pub base: DocumentBaseTransition, } -// -// impl DocumentTransitionObjectLike for DocumentDeleteTransitionV0 { -// #[cfg(feature = "state-transition-json-conversion")] -// fn from_json_object( -// json_value: JsonValue, -// data_contract: DataContract, -// ) -> Result { -// let mut document: DocumentDeleteTransitionV0 = serde_json::from_value(json_value)?; -// document.base.data_contract = data_contract; -// -// Ok(document) -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn from_object( -// raw_transition: Value, -// data_contract: DataContract, -// ) -> Result { -// let base = DocumentBaseTransition::from_object(raw_transition, data_contract)?; -// -// Ok(DocumentDeleteTransitionV0 { base }) -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn from_value_map( -// mut map: BTreeMap, -// data_contract: DataContract, -// ) -> Result -// where -// Self: Sized, -// { -// let base = DocumentBaseTransition::from_value_map_consume(&mut map, data_contract)?; -// -// Ok(DocumentDeleteTransitionV0 { base }) -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn to_object(&self) -> Result { -// self.base.to_object() -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn to_value_map(&self) -> Result, ProtocolError> { -// self.base.to_value_map() -// } -// -// #[cfg(feature = "state-transition-json-conversion")] -// fn to_json(&self) -> Result { -// self.base.to_json() -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn to_cleaned_object(&self) -> Result { -// self.base.to_cleaned_object() -// } -// } -// -// #[cfg(test)] -// mod test { -// use crate::state_transition::documents_batch_transition::document_base_transition::v0::DocumentBaseTransitionV0Methods; -// use super::*; -// -// fn init() { -// let _ = env_logger::builder() -// .filter_level(log::LevelFilter::Debug) -// .try_init(); -// } -// -// #[test] -// fn test_deserialize_serialize_to_json() { -// init(); -// let transition_json = r#"{ -// "$action": 3, -// "$dataContractId": "5wpZAEWndYcTeuwZpkmSa8s49cHXU5q2DhdibesxFSu8", -// "$id": "6oCKUeLVgjr7VZCyn1LdGbrepqKLmoabaff5WQqyTKYP", -// "$type": "note" -// }"#; -// -// let cdt: DocumentDeleteTransitionV0 = -// serde_json::from_str(transition_json).expect("no error"); -// -// assert_eq!(cdt.base.document_type_name(), "note"); -// -// let mut json_no_whitespace = transition_json.to_string(); -// json_no_whitespace.retain(|v| !v.is_whitespace()); -// -// assert_eq!(cdt.to_json().unwrap().to_string(), json_no_whitespace); -// } -// } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/from_document.rs new file mode 100644 index 00000000000..d4b913405f0 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/from_document.rs @@ -0,0 +1,45 @@ +use crate::data_contract::document_type::DocumentTypeRef; +use crate::document::Document; +use crate::fee::Credits; +use crate::prelude::IdentityNonce; +use crate::ProtocolError; +use platform_version::version::{FeatureVersion, PlatformVersion}; + +use crate::state_transition::documents_batch_transition::document_transition::{DocumentPurchaseTransition}; +use crate::state_transition::documents_batch_transition::document_transition::document_purchase_transition::DocumentPurchaseTransitionV0; + +impl DocumentPurchaseTransition { + pub fn from_document( + document: Document, + document_type: DocumentTypeRef, + price: Credits, + identity_contract_nonce: IdentityNonce, + platform_version: &PlatformVersion, + feature_version: Option, + base_feature_version: Option, + ) -> Result { + match feature_version.unwrap_or( + platform_version + .dpp + .state_transition_serialization_versions + .document_purchase_state_transition + .bounds + .default_current_version, + ) { + 0 => Ok(DocumentPurchaseTransitionV0::from_document( + document, + document_type, + price, + identity_contract_nonce, + platform_version, + base_feature_version, + )? + .into()), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DocumentPurchaseTransition::from_document".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/mod.rs new file mode 100644 index 00000000000..9a5664cfaae --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/mod.rs @@ -0,0 +1,19 @@ +mod from_document; +pub mod v0; +pub mod v0_methods; + +use bincode::{Decode, Encode}; +use derive_more::{Display, From}; +#[cfg(feature = "state-transition-serde-conversion")] +use serde::{Deserialize, Serialize}; +pub use v0::*; + +#[derive(Debug, Clone, Encode, Decode, PartialEq, Display, From)] +#[cfg_attr( + feature = "state-transition-serde-conversion", + derive(Serialize, Deserialize) +)] +pub enum DocumentPurchaseTransition { + #[display(fmt = "V0({})", "_0")] + V0(DocumentPurchaseTransitionV0), +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0/from_document.rs new file mode 100644 index 00000000000..80bfc2115c5 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0/from_document.rs @@ -0,0 +1,40 @@ +use platform_version::version::{FeatureVersion, PlatformVersion}; +use crate::data_contract::document_type::{DocumentTypeRef}; +use crate::document::{Document, DocumentV0Getters}; +use crate::document::errors::DocumentError; +use crate::fee::Credits; +use crate::prelude::IdentityNonce; +use crate::ProtocolError; +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; +use crate::state_transition::documents_batch_transition::document_transition::document_purchase_transition::DocumentPurchaseTransitionV0; + +impl DocumentPurchaseTransitionV0 { + pub(crate) fn from_document( + document: Document, + document_type: DocumentTypeRef, + price: Credits, + identity_contract_nonce: IdentityNonce, + platform_version: &PlatformVersion, + base_feature_version: Option, + ) -> Result { + let Some(revision) = document.revision() else { + return Err(ProtocolError::Document(Box::new( + DocumentError::DocumentNoRevisionError { + document: Box::new(document.clone()), + }, + ))); + }; + + Ok(DocumentPurchaseTransitionV0 { + base: DocumentBaseTransition::from_document( + &document, + document_type, + identity_contract_nonce, + platform_version, + base_feature_version, + )?, + revision, + price, + }) + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0/mod.rs new file mode 100644 index 00000000000..255310c394c --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0/mod.rs @@ -0,0 +1,33 @@ +mod from_document; +pub mod v0_methods; + +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; + +use bincode::{Decode, Encode}; +use derive_more::Display; + +use crate::fee::Credits; +use crate::prelude::Revision; +#[cfg(feature = "state-transition-serde-conversion")] +use serde::{Deserialize, Serialize}; + +pub use super::super::document_base_transition::IDENTIFIER_FIELDS; + +#[derive(Debug, Clone, Default, Encode, Decode, PartialEq, Display)] +#[cfg_attr( + feature = "state-transition-serde-conversion", + derive(Serialize, Deserialize), + serde(rename_all = "camelCase") +)] +#[display(fmt = "Base: {}", "base")] +pub struct DocumentPurchaseTransitionV0 { + #[cfg_attr(feature = "state-transition-serde-conversion", serde(flatten))] + pub base: DocumentBaseTransition, + #[cfg_attr( + feature = "state-transition-serde-conversion", + serde(rename = "$revision") + )] + pub revision: Revision, + #[cfg_attr(feature = "state-transition-serde-conversion", serde(rename = "price"))] + pub price: Credits, +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0/v0_methods.rs new file mode 100644 index 00000000000..95333296e41 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0/v0_methods.rs @@ -0,0 +1,50 @@ +use crate::fee::Credits; +use crate::prelude::Revision; +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; +use crate::state_transition::documents_batch_transition::document_transition::document_purchase_transition::DocumentPurchaseTransitionV0; + +pub trait DocumentPurchaseTransitionV0Methods { + /// Returns a reference to the `base` field of the `DocumentCreateTransitionV0`. + fn base(&self) -> &DocumentBaseTransition; + fn base_mut(&mut self) -> &mut DocumentBaseTransition; + + /// Sets the value of the `base` field in the `DocumentCreateTransitionV0`. + /// + /// # Arguments + /// + /// * `base` - A value of type `DocumentBaseTransition` to set. + fn set_base(&mut self, base: DocumentBaseTransition); + + /// Returns a reference to the `revision` field of the `DocumentReplaceTransitionV0`. + fn revision(&self) -> Revision; + + /// Sets the value of the `revision` field in the `DocumentReplaceTransitionV0`. + fn set_revision(&mut self, revision: Revision); + fn price(&self) -> Credits; +} + +impl DocumentPurchaseTransitionV0Methods for DocumentPurchaseTransitionV0 { + fn base(&self) -> &DocumentBaseTransition { + &self.base + } + + fn base_mut(&mut self) -> &mut DocumentBaseTransition { + &mut self.base + } + + fn set_base(&mut self, base: DocumentBaseTransition) { + self.base = base + } + + fn revision(&self) -> Revision { + self.revision + } + + fn set_revision(&mut self, revision: Revision) { + self.revision = revision; + } + + fn price(&self) -> Credits { + self.price + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0_methods.rs new file mode 100644 index 00000000000..86c2fe8f193 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_purchase_transition/v0_methods.rs @@ -0,0 +1,43 @@ +use crate::fee::Credits; +use crate::prelude::Revision; +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; +use crate::state_transition::documents_batch_transition::document_transition::document_purchase_transition::v0::v0_methods::DocumentPurchaseTransitionV0Methods; +use crate::state_transition::documents_batch_transition::document_transition::DocumentPurchaseTransition; + +impl DocumentPurchaseTransitionV0Methods for DocumentPurchaseTransition { + fn base(&self) -> &DocumentBaseTransition { + match self { + DocumentPurchaseTransition::V0(v0) => &v0.base, + } + } + + fn base_mut(&mut self) -> &mut DocumentBaseTransition { + match self { + DocumentPurchaseTransition::V0(v0) => &mut v0.base, + } + } + + fn set_base(&mut self, base: DocumentBaseTransition) { + match self { + DocumentPurchaseTransition::V0(v0) => v0.base = base, + } + } + + fn revision(&self) -> Revision { + match self { + DocumentPurchaseTransition::V0(v0) => v0.revision, + } + } + + fn set_revision(&mut self, revision: Revision) { + match self { + DocumentPurchaseTransition::V0(v0) => v0.revision = revision, + } + } + + fn price(&self) -> Credits { + match self { + DocumentPurchaseTransition::V0(v0) => v0.price, + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/from_document.rs index 33fe7617b7d..059da81c223 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/from_document.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/from_document.rs @@ -1,6 +1,7 @@ use platform_version::version::{FeatureVersion, PlatformVersion}; use crate::data_contract::document_type::{DocumentTypeRef}; use crate::document::{Document}; +use crate::prelude::IdentityNonce; use crate::ProtocolError; use crate::state_transition::documents_batch_transition::document_transition::{DocumentReplaceTransition}; use crate::state_transition::documents_batch_transition::document_transition::document_replace_transition::DocumentReplaceTransitionV0; @@ -9,6 +10,7 @@ impl DocumentReplaceTransition { pub fn from_document( document: Document, document_type: DocumentTypeRef, + identity_contract_nonce: IdentityNonce, platform_version: &PlatformVersion, feature_version: Option, base_feature_version: Option, @@ -24,6 +26,7 @@ impl DocumentReplaceTransition { 0 => Ok(DocumentReplaceTransitionV0::from_document( document, document_type, + identity_contract_nonce, platform_version, base_feature_version, )? diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/mod.rs index ea9cc31e767..8e805318b5e 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/mod.rs @@ -1,9 +1,17 @@ mod from_document; pub mod v0; -mod v0_methods; +pub mod v0_methods; +use crate::block::block_info::BlockInfo; +use crate::data_contract::document_type::DocumentTypeRef; +use crate::document::Document; +use crate::prelude::{BlockHeight, CoreBlockHeight, TimestampMillis}; +use crate::ProtocolError; use bincode::{Decode, Encode}; use derive_more::{Display, From}; +use platform_value::Identifier; +use platform_version::version::PlatformVersion; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub use v0::*; @@ -16,3 +24,144 @@ pub enum DocumentReplaceTransition { #[display(fmt = "V0({})", "_0")] V0(DocumentReplaceTransitionV0), } + +/// document from replace transition +pub trait DocumentFromReplaceTransition { + /// Attempts to create a new `Document` from the given `DocumentReplaceTransition` reference, incorporating `owner_id`, creation metadata, and additional blockchain-related information. + /// + /// This method is designed to replace an existing document with new information, while also preserving and incorporating specific metadata about the document's creation and update history. + /// + /// # Arguments + /// + /// * `document_replace_transition_action` - A reference to the `DocumentReplaceTransition` containing the new information for the document being replaced. + /// * `owner_id` - The `Identifier` of the document's owner. + /// * `created_at` - An optional timestamp indicating when the original document was created. + /// * `created_at_block_height` - An optional block height indicating when the original document was created. + /// * `created_at_core_block_height` - An optional core block height indicating when the original document was created. + /// * `block_info` - Current block information used for updating document metadata. + /// * `document_type` - Reference to the document type to ensure compatibility and proper validation. + /// * `platform_version` - Reference to the current platform version to check for compatibility and apply version-specific logic. + /// + /// # Returns + /// + /// * `Result` - On successful document replacement, returns a new `Document` object populated with the provided data and metadata. On failure, returns a `ProtocolError` detailing the issue. + /// + /// # Errors + /// + /// This function may return `ProtocolError` if there are validation errors related to document data, missing required metadata, or incompatibilities with the current platform version. + fn try_from_replace_transition( + document_replace_transition_action: &DocumentReplaceTransition, + owner_id: Identifier, + created_at: Option, + created_at_block_height: Option, + created_at_core_block_height: Option, + transferred_at: Option, + transferred_at_block_height: Option, + transferred_at_core_block_height: Option, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; + + /// Attempts to create a new `Document` from the given `DocumentReplaceTransition` instance, incorporating `owner_id`, creation metadata, and additional blockchain-related information. + /// + /// This method functions similarly to `try_from_replace_transition`, but it consumes the `DocumentReplaceTransition` instance, making it suitable for use cases where the transition is not needed after document creation. + /// + /// # Arguments + /// + /// * `document_replace_transition_action` - An owned `DocumentReplaceTransition` instance containing the new information for the document being replaced. + /// * `owner_id` - The `Identifier` of the document's owner. + /// * `created_at` - An optional timestamp indicating when the original document was created. + /// * `created_at_block_height` - An optional block height indicating when the original document was created. + /// * `created_at_core_block_height` - An optional core block height indicating when the original document was created. + /// * `block_info` - Current block information used for updating document metadata. + /// * `document_type` - Reference to the document type to ensure compatibility and proper validation. + /// * `platform_version` - Reference to the current platform version to check for compatibility and apply version-specific logic. + /// + /// # Returns + /// + /// * `Result` - On successful document replacement, returns a new `Document` object. On failure, returns a `ProtocolError` detailing the issue. + /// + /// # Errors + /// + /// This function may return `ProtocolError` for the same reasons as `try_from_replace_transition`, including validation failures, missing metadata, or platform incompatibilities. + fn try_from_owned_replace_transition( + document_replace_transition_action: DocumentReplaceTransition, + owner_id: Identifier, + created_at: Option, + created_at_block_height: Option, + created_at_core_block_height: Option, + transferred_at: Option, + transferred_at_block_height: Option, + transferred_at_core_block_height: Option, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; +} + +impl DocumentFromReplaceTransition for Document { + fn try_from_replace_transition( + document_replace_transition: &DocumentReplaceTransition, + owner_id: Identifier, + created_at: Option, + created_at_block_height: Option, + created_at_core_block_height: Option, + transferred_at: Option, + transferred_at_block_height: Option, + transferred_at_core_block_height: Option, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + match document_replace_transition { + DocumentReplaceTransition::V0(v0) => Self::try_from_replace_transition_v0( + v0, + owner_id, + created_at, + created_at_block_height, + created_at_core_block_height, + transferred_at, + transferred_at_block_height, + transferred_at_core_block_height, + block_info, + document_type, + platform_version, + ), + } + } + + fn try_from_owned_replace_transition( + document_replace_transition: DocumentReplaceTransition, + owner_id: Identifier, + created_at: Option, + created_at_block_height: Option, + created_at_core_block_height: Option, + transferred_at: Option, + transferred_at_block_height: Option, + transferred_at_core_block_height: Option, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + match document_replace_transition { + DocumentReplaceTransition::V0(v0) => Self::try_from_owned_replace_transition_v0( + v0, + owner_id, + created_at, + created_at_block_height, + created_at_core_block_height, + transferred_at, + transferred_at_block_height, + transferred_at_core_block_height, + block_info, + document_type, + platform_version, + ), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/from_document.rs index e0df4cef72a..5fbd783eb67 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/from_document.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/from_document.rs @@ -2,6 +2,7 @@ use platform_version::version::{FeatureVersion, PlatformVersion}; use crate::data_contract::document_type::{DocumentTypeRef}; use crate::document::{Document, DocumentV0Getters}; use crate::document::errors::DocumentError; +use crate::prelude::IdentityNonce; use crate::ProtocolError; use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; use crate::state_transition::documents_batch_transition::document_transition::document_replace_transition::DocumentReplaceTransitionV0; @@ -10,6 +11,7 @@ impl DocumentReplaceTransitionV0 { pub(crate) fn from_document( document: Document, document_type: DocumentTypeRef, + identity_contract_nonce: IdentityNonce, platform_version: &PlatformVersion, base_feature_version: Option, ) -> Result { @@ -17,6 +19,7 @@ impl DocumentReplaceTransitionV0 { base: DocumentBaseTransition::from_document( &document, document_type, + identity_contract_nonce, platform_version, base_feature_version, )?, @@ -25,7 +28,6 @@ impl DocumentReplaceTransitionV0 { document: Box::new(document.clone()), })) })?, - updated_at: document.updated_at(), data: document.properties_consumed(), }) } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/mod.rs index 5b546fbc01d..2c7f96e8e4c 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/mod.rs @@ -1,22 +1,28 @@ mod from_document; pub mod v0_methods; -use crate::identity::TimestampMillis; -use crate::prelude::Revision; +use crate::prelude::{BlockHeight, CoreBlockHeight, Revision, TimestampMillis}; use bincode::{Decode, Encode}; use derive_more::Display; -use platform_value::Value; +use platform_value::{Identifier, Value}; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; +use crate::block::block_info::BlockInfo; +use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; +use crate::data_contract::document_type::DocumentTypeRef; +use crate::document::{Document, DocumentV0}; +use crate::{document, ProtocolError}; +use platform_version::version::PlatformVersion; use std::collections::BTreeMap; pub use super::super::document_base_transition::IDENTIFIER_FIELDS; +use crate::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; -pub(self) mod property_names { +mod property_names { pub const REVISION: &str = "$revision"; - pub const UPDATED_AT: &str = "$updatedAt"; } #[derive(Debug, Clone, Default, Encode, Decode, PartialEq, Display)] @@ -25,13 +31,7 @@ pub(self) mod property_names { derive(Serialize, Deserialize), serde(rename_all = "camelCase") )] -#[display( - fmt = "Base: {}, Revision: {}, Updated At: {:?}, Data: {:?}", - "base", - "revision", - "updated_at", - "data" -)] +#[display(fmt = "Base: {}, Revision: {}, Data: {:?}", "base", "revision", "data")] pub struct DocumentReplaceTransitionV0 { #[cfg_attr(feature = "state-transition-serde-conversion", serde(flatten))] pub base: DocumentBaseTransition, @@ -40,215 +40,241 @@ pub struct DocumentReplaceTransitionV0 { serde(rename = "$revision") )] pub revision: Revision, - #[cfg_attr( - feature = "state-transition-serde-conversion", - serde(skip_serializing_if = "Option::is_none", rename = "$updatedAt") - )] - pub updated_at: Option, #[cfg_attr(feature = "state-transition-serde-conversion", serde(flatten))] pub data: BTreeMap, } -// -// impl DocumentReplaceTransitionV0 { -// pub(crate) fn to_document_for_dry_run( -// &self, -// owner_id: Identifier, -// ) -> Result { -// let properties = self.data.clone().unwrap_or_default(); -// Ok(Document { -// id: self.base.id, -// owner_id, -// properties, -// created_at: self.updated_at, // we can use the same time, as it can't be worse -// updated_at: self.updated_at, -// revision: Some(self.revision), -// }) -// } -// -// pub(crate) fn to_extended_document_for_dry_run( -// &self, -// owner_id: Identifier, -// platform_version -// ) -> Result { -// Ok(ExtendedDocument { -// feature_version: LATEST_PLATFORM_VERSION -// .extended_document -// .default_current_version, -// document_type_name: self.base.document_type_name.clone(), -// data_contract_id: self.base.data_contract_id, -// document: self.to_document_for_dry_run(owner_id)?, -// data_contract: self.base.data_contract.clone(), -// metadata: None, -// entropy: Bytes32::default(), -// }) -// } -// -// pub(crate) fn replace_document(&self, document: &mut Document) -> Result<(), ProtocolError> { -// let properties = self.data.clone().unwrap_or_default(); -// document.revision = Some(self.revision); -// document.updated_at = self.updated_at; -// document.properties = properties; -// Ok(()) -// } -// -// pub(crate) fn replace_extended_document( -// &self, -// document: &mut ExtendedDocument, -// ) -> Result<(), ProtocolError> { -// let properties = self.data.clone().unwrap_or_default(); -// document.document.revision = Some(self.revision); -// document.document.updated_at = self.updated_at; -// document.document.properties = properties; -// Ok(()) -// } -// -// pub(crate) fn patch_document(self, document: &mut Document) -> Result<(), ProtocolError> { -// let properties = self.data.clone().unwrap_or_default(); -// document.revision = Some(self.revision); -// document.updated_at = self.updated_at; -// document.properties.extend(properties); -// Ok(()) -// } -// -// pub(crate) fn patch_extended_document( -// self, -// document: &mut ExtendedDocument, -// ) -> Result<(), ProtocolError> { -// let properties = self.data.clone().unwrap_or_default(); -// document.document.revision = Some(self.revision); -// document.document.updated_at = self.updated_at; -// document.document.properties.extend(properties); -// Ok(()) -// } -// } -// -// impl DocumentTransitionObjectLike for DocumentReplaceTransitionV0 { -// #[cfg(feature = "state-transition-json-conversion")] -// fn from_json_object( -// json_value: JsonValue, -// data_contract: DataContract, -// ) -> Result { -// let value: Value = json_value.into(); -// let mut map = value -// .into_btree_string_map() -// .map_err(ProtocolError::ValueError)?; -// -// let document_type = map.get_str("$type")?; -// -// let (identifiers_paths, binary_paths): (Vec<_>, Vec<_>) = -// data_contract.get_identifiers_and_binary_paths_owned(document_type)?; -// -// map.replace_at_paths(binary_paths.into_iter(), ReplacementType::BinaryBytes)?; -// -// map.replace_at_paths( -// identifiers_paths -// .into_iter() -// .chain(IDENTIFIER_FIELDS.iter().map(|a| a.to_string())), -// ReplacementType::Identifier, -// )?; -// let document = Self::from_value_map(map, data_contract)?; -// -// Ok(document) -// } -// -// fn from_object( -// raw_transition: Value, -// data_contract: DataContract, -// ) -> Result { -// let map = raw_transition -// .into_btree_string_map() -// .map_err(ProtocolError::ValueError)?; -// Self::from_value_map(map, data_contract) -// } -// -// fn from_value_map( -// mut map: BTreeMap, -// data_contract: DataContract, -// ) -> Result -// where -// Self: Sized, -// { -// Ok(DocumentReplaceTransitionV0 { -// base: DocumentBaseTransition::from_value_map_consume(&mut map, data_contract)?, -// revision: map -// .remove_integer(property_names::REVISION) -// .map_err(ProtocolError::ValueError)?, -// updated_at: map -// .remove_optional_integer(property_names::UPDATED_AT) -// .map_err(ProtocolError::ValueError)?, -// data: Some(map), -// }) -// } -// -// fn to_object(&self) -> Result { -// Ok(self.to_value_map()?.into()) -// } -// -// fn to_value_map(&self) -> Result, ProtocolError> { -// let mut transition_base_map = self.base.to_value_map()?; -// transition_base_map.insert( -// property_names::REVISION.to_string(), -// Value::U64(self.revision), -// ); -// if let Some(updated_at) = self.updated_at { -// transition_base_map.insert( -// property_names::UPDATED_AT.to_string(), -// Value::U64(updated_at), -// ); -// } -// if let Some(properties) = self.data.clone() { -// transition_base_map.extend(properties) -// } -// Ok(transition_base_map) -// } -// -// fn to_json(&self) -> Result { -// self.to_cleaned_object()? -// .try_into() -// .map_err(ProtocolError::ValueError) -// } -// -// fn to_cleaned_object(&self) -> Result { -// Ok(self.to_value_map()?.into()) -// } -// } -// -// #[cfg(test)] -// mod test { -// use crate::state_transition::documents_batch_transition::document_base_transition::v0::DocumentBaseTransitionV0Methods; -// use super::*; -// -// fn init() { -// let _ = env_logger::builder() -// .filter_level(log::LevelFilter::Debug) -// .try_init(); -// } -// -// #[test] -// fn test_deserialize_serialize_to_json() { -// init(); -// let transition_json = r#"{ -// "$action": 1, -// "$dataContractId": "5wpZAEWndYcTeuwZpkmSa8s49cHXU5q2DhdibesxFSu8", -// "$id": "6oCKUeLVgjr7VZCyn1LdGbrepqKLmoabaff5WQqyTKYP", -// "$revision" : 1, -// "$type": "note", -// "message": "example_message_replace" -// }"#; -// -// let cdt: DocumentReplaceTransitionV0 = -// serde_json::from_str(transition_json).expect("no error"); -// -// assert_eq!(cdt.base.document_type_name(), "note"); -// assert_eq!(cdt.revision, 1); -// assert_eq!( -// cdt.data.as_ref().unwrap().get_str("message").unwrap(), -// "example_message_replace" -// ); -// -// let mut json_no_whitespace = transition_json.to_string(); -// json_no_whitespace.retain(|v| !v.is_whitespace()); -// -// assert_eq!(cdt.to_json().unwrap().to_string(), json_no_whitespace); -// } -// } + +/// document from replace transition v0 +pub trait DocumentFromReplaceTransitionV0 { + /// Attempts to create a new `Document` from the given `DocumentReplaceTransitionV0` reference. This operation is typically used to replace or update an existing document with new information. + /// + /// # Arguments + /// + /// * `value` - A reference to the `DocumentReplaceTransitionV0` containing the new information for the document. + /// * `owner_id` - The `Identifier` of the document's owner. + /// * `created_at` - An optional timestamp representing when the original document was created. This is preserved during replacement. + /// * `created_at_block_height` - An optional height of the block at which the original document was created. This is preserved during replacement. + /// * `created_at_core_block_height` - An optional core block height at which the original document was created. This is preserved during replacement. + /// * `block_info` - Information about the current block at the time of this replace transition. + /// * `document_type` - A reference to the `DocumentTypeRef` indicating the type of the document being replaced. + /// * `platform_version` - A reference to the `PlatformVersion` indicating the version of the platform under which the document is being replaced. + /// + /// # Returns + /// + /// * `Result` - On successful replacement, returns a new `Document` object populated with the provided data. Returns a `ProtocolError` if the replacement fails due to validation errors or other issues. + /// + /// # Errors + /// + /// This function may return a `ProtocolError` if validation fails, required fields are missing, or if there are mismatches between field types and the schema defined in the data contract. + fn try_from_replace_transition_v0( + value: &DocumentReplaceTransitionV0, + owner_id: Identifier, + created_at: Option, + created_at_block_height: Option, + created_at_core_block_height: Option, + transferred_at: Option, + transferred_at_block_height: Option, + transferred_at_core_block_height: Option, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; + /// Attempts to create a new `Document` from the given `DocumentReplaceTransitionV0` instance. This function is similar to `try_from_replace_transition_v0` but consumes the `DocumentReplaceTransitionV0` instance, making it suitable for scenarios where the transition is owned and should not be reused after document creation. + /// + /// # Arguments + /// + /// * `value` - An owned `DocumentReplaceTransitionV0` instance containing the new information for the document. + /// * `owner_id` - The `Identifier` of the document's owner. + /// * `created_at` - An optional timestamp representing when the original document was created. This is preserved during replacement. + /// * `created_at_block_height` - An optional height of the block at which the original document was created. This is preserved during replacement. + /// * `created_at_core_block_height` - An optional core block height at which the original document was created. This is preserved during replacement. + /// * `block_info` - Information about the current block at the time of this replace transition. + /// * `document_type` - A reference to the `DocumentTypeRef` indicating the type of the document being replaced. + /// * `platform_version` - A reference to the `PlatformVersion` indicating the version of the platform under which the document is being replaced. + /// + /// # Returns + /// + /// * `Result` - On successful replacement, returns a new `Document` object populated with the provided data. Returns a `ProtocolError` if the replacement fails due to validation errors or other issues. + /// + /// # Errors + /// + /// This function may return a `ProtocolError` for the same reasons as `try_from_replace_transition_v0`, including validation failures, missing required fields, or schema mismatches. + fn try_from_owned_replace_transition_v0( + value: DocumentReplaceTransitionV0, + owner_id: Identifier, + created_at: Option, + created_at_block_height: Option, + created_at_core_block_height: Option, + transferred_at: Option, + transferred_at_block_height: Option, + transferred_at_core_block_height: Option, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result + where + Self: Sized; +} + +impl DocumentFromReplaceTransitionV0 for Document { + fn try_from_replace_transition_v0( + value: &DocumentReplaceTransitionV0, + owner_id: Identifier, + created_at: Option, + created_at_block_height: Option, + created_at_core_block_height: Option, + transferred_at: Option, + transferred_at_block_height: Option, + transferred_at_core_block_height: Option, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + let DocumentReplaceTransitionV0 { + base, + revision, + data, + } = value; + + let id = base.id(); + + let requires_updated_at = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT); + + let requires_updated_at_block_height = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT_BLOCK_HEIGHT); + + let requires_updated_at_core_block_height = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT_CORE_BLOCK_HEIGHT); + + let updated_at = if requires_updated_at { + Some(block_info.time_ms) + } else { + None + }; + + let updated_at_block_height = if requires_updated_at_block_height { + Some(block_info.height) + } else { + None + }; + + let updated_at_core_block_height = if requires_updated_at_core_block_height { + Some(block_info.core_height) + } else { + None + }; + + match platform_version + .dpp + .document_versions + .document_structure_version + { + 0 => Ok(DocumentV0 { + id, + owner_id, + properties: data.clone(), + revision: Some(*revision), + created_at, + updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, + } + .into()), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "Document::try_from_replace_transition".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + + fn try_from_owned_replace_transition_v0( + value: DocumentReplaceTransitionV0, + owner_id: Identifier, + created_at: Option, + created_at_block_height: Option, + created_at_core_block_height: Option, + transferred_at: Option, + transferred_at_block_height: Option, + transferred_at_core_block_height: Option, + block_info: &BlockInfo, + document_type: &DocumentTypeRef, + platform_version: &PlatformVersion, + ) -> Result { + let DocumentReplaceTransitionV0 { + base, + revision, + data, + } = value; + + let id = base.id(); + + let requires_updated_at = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT); + + let requires_updated_at_block_height = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT_BLOCK_HEIGHT); + + let requires_updated_at_core_block_height = document_type + .required_fields() + .contains(document::property_names::UPDATED_AT_CORE_BLOCK_HEIGHT); + + let updated_at = if requires_updated_at { + Some(block_info.time_ms) + } else { + None + }; + + let updated_at_block_height = if requires_updated_at_block_height { + Some(block_info.height) + } else { + None + }; + + let updated_at_core_block_height = if requires_updated_at_core_block_height { + Some(block_info.core_height) + } else { + None + }; + match platform_version + .dpp + .document_versions + .document_structure_version + { + 0 => Ok(DocumentV0 { + id, + owner_id, + properties: data, + revision: Some(revision), + created_at, + updated_at, + transferred_at, + created_at_block_height, + updated_at_block_height, + transferred_at_block_height, + created_at_core_block_height, + updated_at_core_block_height, + transferred_at_core_block_height, + } + .into()), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "Document::try_from_replace_transition".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/v0_methods.rs index bc27aeb63c3..9bee325bb1b 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0/v0_methods.rs @@ -2,7 +2,6 @@ use platform_value::Value; use std::collections::BTreeMap; -use crate::identity::TimestampMillis; use crate::prelude::Revision; use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; @@ -24,12 +23,6 @@ pub trait DocumentReplaceTransitionV0Methods { /// Sets the value of the `revision` field in the `DocumentReplaceTransitionV0`. fn set_revision(&mut self, revision: Revision); - /// Returns a reference to the `updated_at` field of the `DocumentReplaceTransitionV0`. - fn updated_at(&self) -> Option; - - /// Sets the value of the `updated_at` field in the `DocumentReplaceTransitionV0`. - fn set_updated_at(&mut self, updated_at: Option); - /// Returns a reference to the `data` field of the `DocumentReplaceTransitionV0`. fn data(&self) -> &BTreeMap; @@ -61,14 +54,6 @@ impl DocumentReplaceTransitionV0Methods for DocumentReplaceTransitionV0 { self.revision = revision; } - fn updated_at(&self) -> Option { - self.updated_at - } - - fn set_updated_at(&mut self, updated_at: Option) { - self.updated_at = updated_at; - } - fn data(&self) -> &BTreeMap { &self.data } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0_methods.rs index 41c6f54104a..29f79a05e22 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_replace_transition/v0_methods.rs @@ -1,6 +1,5 @@ use std::collections::BTreeMap; use platform_value::Value; -use crate::identity::TimestampMillis; use crate::prelude::Revision; use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; use crate::state_transition::documents_batch_transition::document_transition::document_replace_transition::v0::v0_methods::DocumentReplaceTransitionV0Methods; @@ -37,18 +36,6 @@ impl DocumentReplaceTransitionV0Methods for DocumentReplaceTransition { } } - fn updated_at(&self) -> Option { - match self { - DocumentReplaceTransition::V0(v0) => v0.updated_at, - } - } - - fn set_updated_at(&mut self, updated_at: Option) { - match self { - DocumentReplaceTransition::V0(v0) => v0.updated_at = updated_at, - } - } - fn data(&self) -> &BTreeMap { match self { DocumentReplaceTransition::V0(v0) => &v0.data, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/from_document.rs new file mode 100644 index 00000000000..abfbf806df5 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/from_document.rs @@ -0,0 +1,43 @@ +use platform_value::Identifier; +use platform_version::version::{FeatureVersion, PlatformVersion}; +use crate::data_contract::document_type::{DocumentTypeRef}; +use crate::document::{Document}; +use crate::prelude::IdentityNonce; +use crate::ProtocolError; +use crate::state_transition::documents_batch_transition::document_transition::document_transfer_transition::{DocumentTransferTransition, DocumentTransferTransitionV0}; + +impl DocumentTransferTransition { + pub fn from_document( + document: Document, + document_type: DocumentTypeRef, + identity_contract_nonce: IdentityNonce, + recipient_owner_id: Identifier, + platform_version: &PlatformVersion, + feature_version: Option, + base_feature_version: Option, + ) -> Result { + match feature_version.unwrap_or( + platform_version + .dpp + .state_transition_serialization_versions + .document_transfer_state_transition + .bounds + .default_current_version, + ) { + 0 => Ok(DocumentTransferTransitionV0::from_document( + document, + document_type, + identity_contract_nonce, + recipient_owner_id, + platform_version, + base_feature_version, + )? + .into()), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DocumentTransferTransition::from_document".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/mod.rs new file mode 100644 index 00000000000..e2185f76b08 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/mod.rs @@ -0,0 +1,19 @@ +mod from_document; +pub mod v0; +pub mod v0_methods; + +use bincode::{Decode, Encode}; +use derive_more::{Display, From}; +#[cfg(feature = "state-transition-serde-conversion")] +use serde::{Deserialize, Serialize}; +pub use v0::*; + +#[derive(Debug, Clone, Encode, Decode, PartialEq, Display, From)] +#[cfg_attr( + feature = "state-transition-serde-conversion", + derive(Serialize, Deserialize) +)] +pub enum DocumentTransferTransition { + #[display(fmt = "V0({})", "_0")] + V0(DocumentTransferTransitionV0), +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0/from_document.rs new file mode 100644 index 00000000000..77a4d59c6d3 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0/from_document.rs @@ -0,0 +1,36 @@ +use platform_value::Identifier; +use platform_version::version::{FeatureVersion, PlatformVersion}; +use crate::data_contract::document_type::{DocumentTypeRef}; +use crate::document::{Document, DocumentV0Getters}; +use crate::document::errors::DocumentError; +use crate::prelude::IdentityNonce; +use crate::ProtocolError; +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; +use crate::state_transition::documents_batch_transition::document_transition::document_transfer_transition::DocumentTransferTransitionV0; + +impl DocumentTransferTransitionV0 { + pub(crate) fn from_document( + document: Document, + document_type: DocumentTypeRef, + identity_contract_nonce: IdentityNonce, + recipient_owner_id: Identifier, + platform_version: &PlatformVersion, + base_feature_version: Option, + ) -> Result { + Ok(DocumentTransferTransitionV0 { + base: DocumentBaseTransition::from_document( + &document, + document_type, + identity_contract_nonce, + platform_version, + base_feature_version, + )?, + revision: document.revision().ok_or_else(|| { + ProtocolError::Document(Box::new(DocumentError::DocumentNoRevisionError { + document: Box::new(document.clone()), + })) + })?, + recipient_owner_id, + }) + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0/mod.rs new file mode 100644 index 00000000000..c51f80cdb7b --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0/mod.rs @@ -0,0 +1,46 @@ +mod from_document; +pub mod v0_methods; + +use crate::prelude::Revision; +use bincode::{Decode, Encode}; +use derive_more::Display; + +use platform_value::Identifier; +#[cfg(feature = "state-transition-serde-conversion")] +use serde::{Deserialize, Serialize}; + +pub use super::super::document_base_transition::IDENTIFIER_FIELDS; +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; + +mod property_names { + pub const REVISION: &str = "$revision"; + + pub const RECIPIENT_OWNER_ID: &str = "recipientOwnerId"; +} + +#[derive(Debug, Clone, Default, Encode, Decode, PartialEq, Display)] +#[cfg_attr( + feature = "state-transition-serde-conversion", + derive(Serialize, Deserialize), + serde(rename_all = "camelCase") +)] +#[display( + fmt = "Base: {}, Revision: {}, Recipient: {:?}", + "base", + "revision", + "recipient_owner_id" +)] +pub struct DocumentTransferTransitionV0 { + #[cfg_attr(feature = "state-transition-serde-conversion", serde(flatten))] + pub base: DocumentBaseTransition, + #[cfg_attr( + feature = "state-transition-serde-conversion", + serde(rename = "$revision") + )] + pub revision: Revision, + #[cfg_attr( + feature = "state-transition-serde-conversion", + serde(rename = "recipientOwnerId") + )] + pub recipient_owner_id: Identifier, +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0/v0_methods.rs new file mode 100644 index 00000000000..6e4b8331155 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0/v0_methods.rs @@ -0,0 +1,66 @@ +use platform_value::Identifier; + +use crate::prelude::Revision; + +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; + +use crate::state_transition::documents_batch_transition::document_transition::document_transfer_transition::DocumentTransferTransitionV0; + +pub trait DocumentTransferTransitionV0Methods { + /// Returns a reference to the `base` field of the `DocumentReplaceTransitionV0`. + fn base(&self) -> &DocumentBaseTransition; + /// Returns a mut reference to the `base` field of the `DocumentReplaceTransitionV0`. + fn base_mut(&mut self) -> &mut DocumentBaseTransition; + + /// Sets the value of the `base` field in the `DocumentReplaceTransitionV0`. + fn set_base(&mut self, base: DocumentBaseTransition); + + /// Returns a reference to the `revision` field of the `DocumentReplaceTransitionV0`. + fn revision(&self) -> Revision; + + /// Sets the value of the `revision` field in the `DocumentReplaceTransitionV0`. + fn set_revision(&mut self, revision: Revision); + + /// Returns the `recipient_owner_id` field of the `DocumentReplaceTransitionV0`. + fn recipient_owner_id(&self) -> Identifier; + + /// Returns a reference to the `recipient_owner_id` field of the `DocumentReplaceTransitionV0`. + fn recipient_owner_id_ref(&self) -> &Identifier; + + /// Sets the value of the `recipient_owner_id` field in the `DocumentReplaceTransitionV0`. + fn set_recipient_owner_id(&mut self, recipient_owner_id: Identifier); +} + +impl DocumentTransferTransitionV0Methods for DocumentTransferTransitionV0 { + fn base(&self) -> &DocumentBaseTransition { + &self.base + } + + fn base_mut(&mut self) -> &mut DocumentBaseTransition { + &mut self.base + } + + fn set_base(&mut self, base: DocumentBaseTransition) { + self.base = base; + } + + fn revision(&self) -> Revision { + self.revision + } + + fn set_revision(&mut self, revision: Revision) { + self.revision = revision; + } + + fn recipient_owner_id(&self) -> Identifier { + self.recipient_owner_id + } + + fn recipient_owner_id_ref(&self) -> &Identifier { + &self.recipient_owner_id + } + + fn set_recipient_owner_id(&mut self, recipient_owner_id: Identifier) { + self.recipient_owner_id = recipient_owner_id; + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0_methods.rs new file mode 100644 index 00000000000..adeff540c05 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_transfer_transition/v0_methods.rs @@ -0,0 +1,55 @@ +use platform_value::Identifier; +use crate::prelude::Revision; +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; +use crate::state_transition::documents_batch_transition::document_transition::document_transfer_transition::v0::v0_methods::DocumentTransferTransitionV0Methods; +use crate::state_transition::documents_batch_transition::document_transition::DocumentTransferTransition; + +impl DocumentTransferTransitionV0Methods for DocumentTransferTransition { + fn base(&self) -> &DocumentBaseTransition { + match self { + DocumentTransferTransition::V0(v0) => &v0.base, + } + } + + fn base_mut(&mut self) -> &mut DocumentBaseTransition { + match self { + DocumentTransferTransition::V0(v0) => &mut v0.base, + } + } + + fn set_base(&mut self, base: DocumentBaseTransition) { + match self { + DocumentTransferTransition::V0(v0) => v0.base = base, + } + } + + fn revision(&self) -> Revision { + match self { + DocumentTransferTransition::V0(v0) => v0.revision, + } + } + + fn set_revision(&mut self, revision: Revision) { + match self { + DocumentTransferTransition::V0(v0) => v0.revision = revision, + } + } + + fn recipient_owner_id(&self) -> Identifier { + match self { + DocumentTransferTransition::V0(v0) => v0.recipient_owner_id, + } + } + + fn recipient_owner_id_ref(&self) -> &Identifier { + match self { + DocumentTransferTransition::V0(v0) => &v0.recipient_owner_id, + } + } + + fn set_recipient_owner_id(&mut self, recipient_owner_id: Identifier) { + match self { + DocumentTransferTransition::V0(v0) => v0.recipient_owner_id = recipient_owner_id, + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/from_document.rs new file mode 100644 index 00000000000..4f26ff90bd7 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/from_document.rs @@ -0,0 +1,44 @@ +use platform_version::version::{FeatureVersion, PlatformVersion}; +use crate::data_contract::document_type::{DocumentTypeRef}; +use crate::document::{Document}; +use crate::fee::Credits; +use crate::prelude::IdentityNonce; +use crate::ProtocolError; +use crate::state_transition::documents_batch_transition::document_transition::DocumentUpdatePriceTransition; +use crate::state_transition::documents_batch_transition::document_transition::document_update_price_transition::DocumentUpdatePriceTransitionV0; + +impl DocumentUpdatePriceTransition { + pub fn from_document( + document: Document, + document_type: DocumentTypeRef, + price: Credits, + identity_contract_nonce: IdentityNonce, + platform_version: &PlatformVersion, + feature_version: Option, + base_feature_version: Option, + ) -> Result { + match feature_version.unwrap_or( + platform_version + .dpp + .state_transition_serialization_versions + .document_update_price_state_transition + .bounds + .default_current_version, + ) { + 0 => Ok(DocumentUpdatePriceTransitionV0::from_document( + document, + document_type, + price, + identity_contract_nonce, + platform_version, + base_feature_version, + )? + .into()), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DocumentUpdatePriceTransition::from_document".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/mod.rs new file mode 100644 index 00000000000..25a16a09ae3 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/mod.rs @@ -0,0 +1,19 @@ +mod from_document; +pub mod v0; +pub mod v0_methods; + +use bincode::{Decode, Encode}; +use derive_more::{Display, From}; +#[cfg(feature = "state-transition-serde-conversion")] +use serde::{Deserialize, Serialize}; +pub use v0::*; + +#[derive(Debug, Clone, Encode, Decode, PartialEq, Display, From)] +#[cfg_attr( + feature = "state-transition-serde-conversion", + derive(Serialize, Deserialize) +)] +pub enum DocumentUpdatePriceTransition { + #[display(fmt = "V0({})", "_0")] + V0(DocumentUpdatePriceTransitionV0), +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0/from_document.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0/from_document.rs new file mode 100644 index 00000000000..570a3fb5610 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0/from_document.rs @@ -0,0 +1,36 @@ +use platform_version::version::{FeatureVersion, PlatformVersion}; +use crate::data_contract::document_type::{DocumentTypeRef}; +use crate::document::{Document, DocumentV0Getters}; +use crate::document::errors::DocumentError; +use crate::fee::Credits; +use crate::prelude::IdentityNonce; +use crate::ProtocolError; +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; +use crate::state_transition::documents_batch_transition::document_transition::document_update_price_transition::DocumentUpdatePriceTransitionV0; + +impl DocumentUpdatePriceTransitionV0 { + pub(crate) fn from_document( + document: Document, + document_type: DocumentTypeRef, + price: Credits, + identity_contract_nonce: IdentityNonce, + platform_version: &PlatformVersion, + base_feature_version: Option, + ) -> Result { + Ok(DocumentUpdatePriceTransitionV0 { + base: DocumentBaseTransition::from_document( + &document, + document_type, + identity_contract_nonce, + platform_version, + base_feature_version, + )?, + revision: document.revision().ok_or_else(|| { + ProtocolError::Document(Box::new(DocumentError::DocumentNoRevisionError { + document: Box::new(document.clone()), + })) + })?, + price, + }) + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0/mod.rs new file mode 100644 index 00000000000..fe1e11cae18 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0/mod.rs @@ -0,0 +1,277 @@ +mod from_document; +pub mod v0_methods; + +use crate::prelude::Revision; +use bincode::{Decode, Encode}; +use derive_more::Display; + +#[cfg(feature = "state-transition-serde-conversion")] +use serde::{Deserialize, Serialize}; + +use crate::fee::Credits; + +pub use super::super::document_base_transition::IDENTIFIER_FIELDS; +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; + +mod property_names { + pub const REVISION: &str = "$revision"; +} + +#[derive(Debug, Clone, Default, Encode, Decode, PartialEq, Display)] +#[cfg_attr( + feature = "state-transition-serde-conversion", + derive(Serialize, Deserialize), + serde(rename_all = "camelCase") +)] +#[display(fmt = "Base: {}, Revision: {}, Price: {}", "base", "revision", "price")] +pub struct DocumentUpdatePriceTransitionV0 { + #[cfg_attr(feature = "state-transition-serde-conversion", serde(flatten))] + pub base: DocumentBaseTransition, + #[cfg_attr( + feature = "state-transition-serde-conversion", + serde(rename = "$revision") + )] + pub revision: Revision, + #[cfg_attr( + feature = "state-transition-serde-conversion", + serde(rename = "$price") + )] + pub price: Credits, +} +// +// /// document from update_price transition v0 +// pub trait DocumentFromUpdatePriceTransitionV0 { +// /// Attempts to create a new `Document` from the given `DocumentUpdatePriceTransitionV0` reference. This operation is typically used to update_price or update an existing document with new information. +// /// +// /// # Arguments +// /// +// /// * `value` - A reference to the `DocumentUpdatePriceTransitionV0` containing the new information for the document. +// /// * `owner_id` - The `Identifier` of the document's owner. +// /// * `created_at` - An optional timestamp representing when the original document was created. This is preserved during update_pricement. +// /// * `created_at_block_height` - An optional height of the block at which the original document was created. This is preserved during update_pricement. +// /// * `created_at_core_block_height` - An optional core block height at which the original document was created. This is preserved during update_pricement. +// /// * `block_info` - Information about the current block at the time of this update_price transition. +// /// * `document_type` - A reference to the `DocumentTypeRef` indicating the type of the document being update_priced. +// /// * `platform_version` - A reference to the `PlatformVersion` indicating the version of the platform under which the document is being update_priced. +// /// +// /// # Returns +// /// +// /// * `Result` - On successful update_pricement, returns a new `Document` object populated with the provided data. Returns a `ProtocolError` if the update_pricement fails due to validation errors or other issues. +// /// +// /// # Errors +// /// +// /// This function may return a `ProtocolError` if validation fails, required fields are missing, or if there are mismatches between field types and the schema defined in the data contract. +// fn try_from_update_price_transition_v0( +// value: &DocumentUpdatePriceTransitionV0, +// owner_id: Identifier, +// created_at: Option, +// created_at_block_height: Option, +// created_at_core_block_height: Option, +// transferred_at: Option, +// transferred_at_block_height: Option, +// transferred_at_core_block_height: Option, +// block_info: &BlockInfo, +// document_type: &DocumentTypeRef, +// platform_version: &PlatformVersion, +// ) -> Result +// where +// Self: Sized; +// /// Attempts to create a new `Document` from the given `DocumentUpdatePriceTransitionV0` instance. This function is similar to `try_from_update_price_transition_v0` but consumes the `DocumentUpdatePriceTransitionV0` instance, making it suitable for scenarios where the transition is owned and should not be reused after document creation. +// /// +// /// # Arguments +// /// +// /// * `value` - An owned `DocumentUpdatePriceTransitionV0` instance containing the new information for the document. +// /// * `owner_id` - The `Identifier` of the document's owner. +// /// * `created_at` - An optional timestamp representing when the original document was created. This is preserved during update_pricement. +// /// * `created_at_block_height` - An optional height of the block at which the original document was created. This is preserved during update_pricement. +// /// * `created_at_core_block_height` - An optional core block height at which the original document was created. This is preserved during update_pricement. +// /// * `block_info` - Information about the current block at the time of this update_price transition. +// /// * `document_type` - A reference to the `DocumentTypeRef` indicating the type of the document being update_priced. +// /// * `platform_version` - A reference to the `PlatformVersion` indicating the version of the platform under which the document is being update_priced. +// /// +// /// # Returns +// /// +// /// * `Result` - On successful update_pricement, returns a new `Document` object populated with the provided data. Returns a `ProtocolError` if the update_pricement fails due to validation errors or other issues. +// /// +// /// # Errors +// /// +// /// This function may return a `ProtocolError` for the same reasons as `try_from_update_price_transition_v0`, including validation failures, missing required fields, or schema mismatches. +// fn try_from_owned_update_price_transition_v0( +// value: DocumentUpdatePriceTransitionV0, +// owner_id: Identifier, +// created_at: Option, +// created_at_block_height: Option, +// created_at_core_block_height: Option, +// transferred_at: Option, +// transferred_at_block_height: Option, +// transferred_at_core_block_height: Option, +// block_info: &BlockInfo, +// document_type: &DocumentTypeRef, +// platform_version: &PlatformVersion, +// ) -> Result +// where +// Self: Sized; +// } +// +// impl DocumentFromUpdatePriceTransitionV0 for Document { +// fn try_from_update_price_transition_v0( +// value: &DocumentUpdatePriceTransitionV0, +// owner_id: Identifier, +// created_at: Option, +// created_at_block_height: Option, +// created_at_core_block_height: Option, +// transferred_at: Option, +// transferred_at_block_height: Option, +// transferred_at_core_block_height: Option, +// block_info: &BlockInfo, +// document_type: &DocumentTypeRef, +// platform_version: &PlatformVersion, +// ) -> Result { +// let DocumentUpdatePriceTransitionV0 { +// base, +// revision, +// price, +// } = value; +// +// let id = base.id(); +// +// let requires_updated_at = document_type +// .required_fields() +// .contains(document::property_names::UPDATED_AT); +// +// let requires_updated_at_block_height = document_type +// .required_fields() +// .contains(document::property_names::UPDATED_AT_BLOCK_HEIGHT); +// +// let requires_updated_at_core_block_height = document_type +// .required_fields() +// .contains(document::property_names::UPDATED_AT_CORE_BLOCK_HEIGHT); +// +// let updated_at = if requires_updated_at { +// Some(block_info.time_ms) +// } else { +// None +// }; +// +// let updated_at_block_height = if requires_updated_at_block_height { +// Some(block_info.height) +// } else { +// None +// }; +// +// let updated_at_core_block_height = if requires_updated_at_core_block_height { +// Some(block_info.core_height) +// } else { +// None +// }; +// +// data +// +// match platform_version +// .dpp +// .document_versions +// .document_structure_version +// { +// 0 => Ok(DocumentV0 { +// id, +// owner_id, +// properties: data.clone(), +// revision: Some(*revision), +// created_at, +// updated_at, +// transferred_at, +// created_at_block_height, +// updated_at_block_height, +// transferred_at_block_height, +// created_at_core_block_height, +// updated_at_core_block_height, +// transferred_at_core_block_height, +// } +// .into()), +// version => Err(ProtocolError::UnknownVersionMismatch { +// method: "Document::try_from_update_price_transition".to_string(), +// known_versions: vec![0], +// received: version, +// }), +// } +// } +// +// fn try_from_owned_update_price_transition_v0( +// value: DocumentUpdatePriceTransitionV0, +// owner_id: Identifier, +// created_at: Option, +// created_at_block_height: Option, +// created_at_core_block_height: Option, +// transferred_at: Option, +// transferred_at_block_height: Option, +// transferred_at_core_block_height: Option, +// block_info: &BlockInfo, +// document_type: &DocumentTypeRef, +// platform_version: &PlatformVersion, +// ) -> Result { +// let DocumentUpdatePriceTransitionV0 { +// base, +// revision, +// price, +// } = value; +// +// let id = base.id(); +// +// let requires_updated_at = document_type +// .required_fields() +// .contains(document::property_names::UPDATED_AT); +// +// let requires_updated_at_block_height = document_type +// .required_fields() +// .contains(document::property_names::UPDATED_AT_BLOCK_HEIGHT); +// +// let requires_updated_at_core_block_height = document_type +// .required_fields() +// .contains(document::property_names::UPDATED_AT_CORE_BLOCK_HEIGHT); +// +// let updated_at = if requires_updated_at { +// Some(block_info.time_ms) +// } else { +// None +// }; +// +// let updated_at_block_height = if requires_updated_at_block_height { +// Some(block_info.height) +// } else { +// None +// }; +// +// let updated_at_core_block_height = if requires_updated_at_core_block_height { +// Some(block_info.core_height) +// } else { +// None +// }; +// match platform_version +// .dpp +// .document_versions +// .document_structure_version +// { +// 0 => Ok(DocumentV0 { +// id, +// owner_id, +// properties: data, +// revision: Some(revision), +// created_at, +// updated_at, +// transferred_at, +// created_at_block_height, +// updated_at_block_height, +// transferred_at_block_height, +// created_at_core_block_height, +// updated_at_core_block_height, +// transferred_at_core_block_height, +// } +// .into()), +// version => Err(ProtocolError::UnknownVersionMismatch { +// method: "Document::try_from_update_price_transition".to_string(), +// known_versions: vec![0], +// received: version, +// }), +// } +// } +// } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0/v0_methods.rs new file mode 100644 index 00000000000..74b27a3589d --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0/v0_methods.rs @@ -0,0 +1,58 @@ +use crate::fee::Credits; +use crate::prelude::Revision; + +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; + +use crate::state_transition::documents_batch_transition::document_transition::document_update_price_transition::DocumentUpdatePriceTransitionV0; + +pub trait DocumentUpdatePriceTransitionV0Methods { + /// Returns a reference to the `base` field of the `DocumentUpdatePriceTransitionV0`. + fn base(&self) -> &DocumentBaseTransition; + /// Returns a mut reference to the `base` field of the `DocumentUpdatePriceTransitionV0`. + fn base_mut(&mut self) -> &mut DocumentBaseTransition; + + /// Sets the value of the `base` field in the `DocumentUpdatePriceTransitionV0`. + fn set_base(&mut self, base: DocumentBaseTransition); + + /// Returns a reference to the `revision` field of the `DocumentUpdatePriceTransitionV0`. + fn revision(&self) -> Revision; + + /// Sets the value of the `revision` field in the `DocumentUpdatePriceTransitionV0`. + fn set_revision(&mut self, revision: Revision); + + /// Returns a reference to the `price` field of the `DocumentUpdatePriceTransitionV0`. + fn price(&self) -> Credits; + + /// Sets the value of the `price` field in the `DocumentUpdatePriceTransitionV0`. + fn set_price(&mut self, price: Credits); +} + +impl DocumentUpdatePriceTransitionV0Methods for DocumentUpdatePriceTransitionV0 { + fn base(&self) -> &DocumentBaseTransition { + &self.base + } + + fn base_mut(&mut self) -> &mut DocumentBaseTransition { + &mut self.base + } + + fn set_base(&mut self, base: DocumentBaseTransition) { + self.base = base; + } + + fn revision(&self) -> Revision { + self.revision + } + + fn set_revision(&mut self, revision: Revision) { + self.revision = revision; + } + + fn price(&self) -> Credits { + self.price + } + + fn set_price(&mut self, price: Credits) { + self.price = price; + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0_methods.rs new file mode 100644 index 00000000000..3b605d7431c --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/document_update_price_transition/v0_methods.rs @@ -0,0 +1,49 @@ +use crate::fee::Credits; +use crate::prelude::Revision; +use crate::state_transition::documents_batch_transition::document_base_transition::DocumentBaseTransition; +use crate::state_transition::documents_batch_transition::document_transition::document_update_price_transition::v0::v0_methods::DocumentUpdatePriceTransitionV0Methods; +use crate::state_transition::documents_batch_transition::document_transition::DocumentUpdatePriceTransition; + +impl DocumentUpdatePriceTransitionV0Methods for DocumentUpdatePriceTransition { + fn base(&self) -> &DocumentBaseTransition { + match self { + DocumentUpdatePriceTransition::V0(v0) => &v0.base, + } + } + + fn base_mut(&mut self) -> &mut DocumentBaseTransition { + match self { + DocumentUpdatePriceTransition::V0(v0) => &mut v0.base, + } + } + + fn set_base(&mut self, base: DocumentBaseTransition) { + match self { + DocumentUpdatePriceTransition::V0(v0) => v0.base = base, + } + } + + fn revision(&self) -> Revision { + match self { + DocumentUpdatePriceTransition::V0(v0) => v0.revision, + } + } + + fn set_revision(&mut self, revision: Revision) { + match self { + DocumentUpdatePriceTransition::V0(v0) => v0.revision = revision, + } + } + + fn price(&self) -> Credits { + match self { + DocumentUpdatePriceTransition::V0(v0) => v0.price, + } + } + + fn set_price(&mut self, price: Credits) { + match self { + DocumentUpdatePriceTransition::V0(v0) => v0.price = price, + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs index 10bd184e2dc..00e566b2a80 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs @@ -2,42 +2,43 @@ use std::collections::BTreeMap; use bincode::{Decode, Encode}; use derive_more::From; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; -use crate::prelude::Identifier; +use crate::prelude::{Identifier, IdentityNonce}; use document_base_transition::DocumentBaseTransition; pub mod action_type; pub mod document_base_transition; pub mod document_create_transition; pub mod document_delete_transition; +pub mod document_purchase_transition; pub mod document_replace_transition; +pub mod document_transfer_transition; +pub mod document_update_price_transition; -use crate::identity::TimestampMillis; use crate::prelude::Revision; use crate::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; use derive_more::Display; pub use document_create_transition::DocumentCreateTransition; pub use document_delete_transition::DocumentDeleteTransition; pub use document_replace_transition::DocumentReplaceTransition; +pub use document_transfer_transition::DocumentTransferTransition; +pub use document_purchase_transition::DocumentPurchaseTransition; +pub use document_update_price_transition::DocumentUpdatePriceTransition; use platform_value::Value; +use crate::state_transition::documents_batch_transition::document_transition::document_purchase_transition::v0::v0_methods::DocumentPurchaseTransitionV0Methods; +use crate::state_transition::documents_batch_transition::document_transition::document_update_price_transition::v0::v0_methods::DocumentUpdatePriceTransitionV0Methods; use crate::state_transition::state_transitions::document::documents_batch_transition::document_transition::document_create_transition::v0::v0_methods::DocumentCreateTransitionV0Methods; use crate::state_transition::state_transitions::document::documents_batch_transition::document_transition::document_replace_transition::v0::v0_methods::DocumentReplaceTransitionV0Methods; use crate::state_transition::state_transitions::document::documents_batch_transition::document_transition::document_delete_transition::v0::v0_methods::DocumentDeleteTransitionV0Methods; +use crate::state_transition::state_transitions::document::documents_batch_transition::document_transition::document_transfer_transition::v0::v0_methods::DocumentTransferTransitionV0Methods; pub const PROPERTY_ACTION: &str = "$action"; pub trait DocumentTransitionV0Methods { fn base(&self) -> &DocumentBaseTransition; - /// returns the creation timestamp (in milliseconds) if it exists for given type of document transition - fn created_at(&self) -> Option; - /// returns the update timestamp (in milliseconds) if it exists for given type of document transition - fn updated_at(&self) -> Option; - /// set the created_at (in milliseconds) if it exists - fn set_created_at(&mut self, timestamp_millis: Option); - /// set the updated_at (in milliseconds) if it exists - fn set_updated_at(&mut self, timestamp_millis: Option); /// returns the value of dynamic property. The dynamic property is a property that is not specified in protocol /// the `path` supports dot-syntax: i.e: property.internal_property fn get_dynamic_property(&self, path: &str) -> Option<&Value>; @@ -51,6 +52,9 @@ pub trait DocumentTransitionV0Methods { fn data(&self) -> Option<&BTreeMap>; /// get the revision of transition if exits fn revision(&self) -> Option; + + /// get the identity contract nonce + fn identity_contract_nonce(&self) -> IdentityNonce; #[cfg(test)] /// Inserts the dynamic property into the document fn insert_dynamic_property(&mut self, property_name: String, value: Value); @@ -61,6 +65,9 @@ pub trait DocumentTransitionV0Methods { // sets revision of the transition fn set_revision(&mut self, revision: Revision); + + // sets identity contract nonce + fn set_identity_contract_nonce(&mut self, nonce: IdentityNonce); } #[derive(Debug, Clone, Encode, Decode, From, PartialEq, Display)] @@ -77,115 +84,16 @@ pub enum DocumentTransition { #[display(fmt = "DeleteDocumentTransition({})", "_0")] Delete(DocumentDeleteTransition), -} -// -// impl AsRef for DocumentTransition { -// fn as_ref(&self) -> &Self { -// self -// } -// } -// -// macro_rules! call_method { -// ($state_transition:expr, $method:ident, $args:tt ) => { -// match $state_transition { -// DocumentTransition::Create(st) => st.$method($args), -// DocumentTransition::Replace(st) => st.$method($args), -// DocumentTransition::Delete(st) => st.$method($args), -// } -// }; -// ($state_transition:expr, $method:ident ) => { -// match $state_transition { -// DocumentTransition::Create(st) => st.$method(), -// DocumentTransition::Replace(st) => st.$method(), -// DocumentTransition::Delete(st) => st.$method(), -// } -// }; -// } -// -// impl DocumentTransitionObjectLike for DocumentTransition { -// #[cfg(feature = "state-transition-json-conversion")] -// fn from_json_object( -// json_value: JsonValue, -// data_contract: DataContract, -// ) -> Result -// where -// Self: Sized, -// { -// let action: Action = TryFrom::try_from(json_value.get_u64(PROPERTY_ACTION)? as u8) -// .context("invalid document transition action")?; -// -// Ok(match action { -// Action::Create => DocumentTransition::Create( -// DocumentCreateTransition::from_json_object(json_value, data_contract)?, -// ), -// Action::Replace => DocumentTransition::Replace( -// DocumentReplaceTransitionV0::from_json_object(json_value, data_contract)?, -// ), -// Action::Delete => DocumentTransition::Delete( -// DocumentDeleteTransition::from_json_object(json_value, data_contract)?, -// ), -// }) -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn from_object( -// raw_transition: Value, -// data_contract: DataContract, -// ) -> Result -// where -// Self: Sized, -// { -// let map = raw_transition -// .into_btree_string_map() -// .map_err(ProtocolError::ValueError)?; -// Self::from_value_map(map, data_contract) -// } -// -// #[cfg(feature = "state-transition-json-conversion")] -// fn to_json(&self) -> Result { -// call_method!(self, to_json) -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn to_value_map(&self) -> Result, ProtocolError> { -// call_method!(self, to_value_map) -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn to_object(&self) -> Result { -// call_method!(self, to_object) -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn to_cleaned_object(&self) -> Result { -// call_method!(self, to_cleaned_object) -// } -// -// #[cfg(feature = "state-transition-value-conversion")] -// fn from_value_map( -// map: BTreeMap, -// data_contract: DataContract, -// ) -> Result -// where -// Self: Sized, -// { -// let action: Action = map.get_integer::(PROPERTY_ACTION)?.try_into()?; -// Ok(match action { -// Action::Create => DocumentTransition::Create(DocumentCreateTransition::from_value_map( -// map, -// data_contract, -// )?), -// Action::Replace => DocumentTransition::Replace( -// DocumentReplaceTransitionV0::from_value_map(map, data_contract)?, -// ), -// Action::Delete => DocumentTransition::Delete(DocumentDeleteTransition::from_value_map( -// map, -// data_contract, -// )?), -// }) -// } -// } + #[display(fmt = "TransferDocumentTransition({})", "_0")] + Transfer(DocumentTransferTransition), + + #[display(fmt = "UpdatePriceDocumentTransition({})", "_0")] + UpdatePrice(DocumentUpdatePriceTransition), + + #[display(fmt = "PurchaseDocumentTransition({})", "_0")] + Purchase(DocumentPurchaseTransition), +} impl DocumentTransition { pub fn as_transition_create(&self) -> Option<&DocumentCreateTransition> { @@ -210,55 +118,33 @@ impl DocumentTransition { None } } -} - -impl DocumentTransitionV0Methods for DocumentTransition { - fn base(&self) -> &DocumentBaseTransition { - match self { - DocumentTransition::Create(t) => t.base(), - DocumentTransition::Replace(t) => t.base(), - DocumentTransition::Delete(t) => t.base(), - } - } - fn created_at(&self) -> Option { - match self { - DocumentTransition::Create(t) => t.created_at(), - DocumentTransition::Replace(_) => None, - DocumentTransition::Delete(_) => None, - } - } - - fn updated_at(&self) -> Option { - match self { - DocumentTransition::Create(t) => t.updated_at(), - DocumentTransition::Replace(t) => t.updated_at(), - DocumentTransition::Delete(_) => None, - } - } - - // TODO: it's confusing to set a value and internally it's not setting if your variant doesn't have it. - fn set_created_at(&mut self, timestamp_millis: Option) { - match self { - DocumentTransition::Create(ref mut t) => t.set_created_at(timestamp_millis), - DocumentTransition::Replace(_) => {} - DocumentTransition::Delete(_) => {} + pub fn as_transition_transfer(&self) -> Option<&DocumentTransferTransition> { + if let Self::Transfer(ref t) = self { + Some(t) + } else { + None } } - fn set_updated_at(&mut self, timestamp_millis: Option) { - match self { - DocumentTransition::Create(ref mut t) => t.set_updated_at(timestamp_millis), - DocumentTransition::Replace(ref mut t) => t.set_updated_at(timestamp_millis), - DocumentTransition::Delete(_) => {} + pub fn as_transition_purchase(&self) -> Option<&DocumentPurchaseTransition> { + if let Self::Purchase(ref t) = self { + Some(t) + } else { + None } } +} - fn set_revision(&mut self, revision: Revision) { +impl DocumentTransitionV0Methods for DocumentTransition { + fn base(&self) -> &DocumentBaseTransition { match self { - DocumentTransition::Create(_) => {} - DocumentTransition::Replace(ref mut t) => t.set_revision(revision), - DocumentTransition::Delete(_) => {} + DocumentTransition::Create(t) => t.base(), + DocumentTransition::Replace(t) => t.base(), + DocumentTransition::Delete(t) => t.base(), + DocumentTransition::Transfer(t) => t.base(), + DocumentTransition::UpdatePrice(t) => t.base(), + DocumentTransition::Purchase(t) => t.base(), } } @@ -267,6 +153,9 @@ impl DocumentTransitionV0Methods for DocumentTransition { DocumentTransition::Create(t) => t.data().get(path), DocumentTransition::Replace(t) => t.data().get(path), DocumentTransition::Delete(_) => None, + DocumentTransition::Transfer(_) => None, + DocumentTransition::UpdatePrice(_) => None, + DocumentTransition::Purchase(_) => None, } } @@ -287,6 +176,9 @@ impl DocumentTransitionV0Methods for DocumentTransition { DocumentTransition::Create(t) => Some(t.data()), DocumentTransition::Replace(t) => Some(t.data()), DocumentTransition::Delete(_) => None, + DocumentTransition::Transfer(_) => None, + DocumentTransition::UpdatePrice(_) => None, + DocumentTransition::Purchase(_) => None, } } @@ -295,6 +187,20 @@ impl DocumentTransitionV0Methods for DocumentTransition { DocumentTransition::Create(_) => Some(1), DocumentTransition::Replace(t) => Some(t.revision()), DocumentTransition::Delete(_) => None, + DocumentTransition::Transfer(t) => Some(t.revision()), + DocumentTransition::UpdatePrice(t) => Some(t.revision()), + DocumentTransition::Purchase(t) => Some(t.revision()), + } + } + + fn identity_contract_nonce(&self) -> IdentityNonce { + match self { + DocumentTransition::Create(t) => t.base().identity_contract_nonce(), + DocumentTransition::Replace(t) => t.base().identity_contract_nonce(), + DocumentTransition::Delete(t) => t.base().identity_contract_nonce(), + DocumentTransition::Transfer(t) => t.base().identity_contract_nonce(), + DocumentTransition::UpdatePrice(t) => t.base().identity_contract_nonce(), + DocumentTransition::Purchase(t) => t.base().identity_contract_nonce(), } } @@ -312,6 +218,9 @@ impl DocumentTransitionV0Methods for DocumentTransition { .insert(property_name, value); } DocumentTransition::Delete(_) => {} + DocumentTransition::Transfer(_) => {} + DocumentTransition::UpdatePrice(_) => {} + DocumentTransition::Purchase(_) => {} } } @@ -324,6 +233,9 @@ impl DocumentTransitionV0Methods for DocumentTransition { DocumentTransition::Create(t) => t.base_mut(), DocumentTransition::Replace(t) => t.base_mut(), DocumentTransition::Delete(t) => t.base_mut(), + DocumentTransition::Transfer(t) => t.base_mut(), + DocumentTransition::UpdatePrice(t) => t.base_mut(), + DocumentTransition::Purchase(t) => t.base_mut(), } } @@ -332,6 +244,31 @@ impl DocumentTransitionV0Methods for DocumentTransition { DocumentTransition::Create(t) => Some(t.data_mut()), DocumentTransition::Replace(t) => Some(t.data_mut()), DocumentTransition::Delete(_) => None, + DocumentTransition::Transfer(_) => None, + DocumentTransition::UpdatePrice(_) => None, + DocumentTransition::Purchase(_) => None, + } + } + + fn set_revision(&mut self, revision: Revision) { + match self { + DocumentTransition::Create(_) => {} + DocumentTransition::Replace(ref mut t) => t.set_revision(revision), + DocumentTransition::Delete(_) => {} + DocumentTransition::Transfer(ref mut t) => t.set_revision(revision), + DocumentTransition::UpdatePrice(ref mut t) => t.set_revision(revision), + DocumentTransition::Purchase(ref mut t) => t.set_revision(revision), + } + } + + fn set_identity_contract_nonce(&mut self, nonce: IdentityNonce) { + match self { + DocumentTransition::Create(t) => t.base_mut().set_identity_contract_nonce(nonce), + DocumentTransition::Replace(t) => t.base_mut().set_identity_contract_nonce(nonce), + DocumentTransition::Delete(t) => t.base_mut().set_identity_contract_nonce(nonce), + DocumentTransition::Transfer(t) => t.base_mut().set_identity_contract_nonce(nonce), + DocumentTransition::UpdatePrice(t) => t.base_mut().set_identity_contract_nonce(nonce), + DocumentTransition::Purchase(t) => t.base_mut().set_identity_contract_nonce(nonce), } } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/fields.rs index 8bcc2affc8b..06f39e42fc0 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/fields.rs @@ -5,7 +5,8 @@ use crate::state_transition::documents_batch_transition::fields::property_names: OWNER_ID, TRANSITIONS_DATA_CONTRACT_ID, TRANSITIONS_ID, }; pub use state_transitions::common_fields::property_names::{ - ENTROPY, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, TRANSITION_TYPE, + IDENTITY_NONCE, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, + TRANSITION_TYPE, }; pub mod property_names { diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/methods/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/methods/mod.rs index 544d5d776d4..6d2b9a451a8 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/methods/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/methods/mod.rs @@ -1,31 +1,60 @@ +#[cfg(feature = "state-transition-signing")] use crate::data_contract::document_type::DocumentTypeRef; +#[cfg(feature = "state-transition-signing")] use crate::document::Document; +use crate::fee::Credits; +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] use crate::identity::IdentityPublicKey; +use crate::prelude::IdentityNonce; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::UserFeeIncrease; use crate::state_transition::documents_batch_transition::document_transition::DocumentTransition; use crate::state_transition::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; -use crate::state_transition::documents_batch_transition::{ - DocumentsBatchTransition, DocumentsBatchTransitionV0, -}; +use crate::state_transition::documents_batch_transition::DocumentsBatchTransition; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::documents_batch_transition::DocumentsBatchTransitionV0; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::StateTransition; +#[cfg(feature = "state-transition-signing")] use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] +use platform_value::Identifier; +#[cfg(feature = "state-transition-signing")] use platform_version::version::{FeatureVersion, PlatformVersion}; pub mod v0; impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransition { + fn all_purchases_amount(&self) -> Option { + match self { + DocumentsBatchTransition::V0(v0) => v0.all_purchases_amount(), + } + } + fn set_transitions(&mut self, transitions: Vec) { match self { DocumentsBatchTransition::V0(v0) => v0.set_transitions(transitions), } } + fn set_identity_contract_nonce(&mut self, identity_contract_nonce: IdentityNonce) { + match self { + DocumentsBatchTransition::V0(v0) => { + v0.set_identity_contract_nonce(identity_contract_nonce) + } + } + } + #[cfg(feature = "state-transition-signing")] fn new_document_creation_transition_from_document( document: Document, document_type: DocumentTypeRef, entropy: [u8; 32], identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, batch_feature_version: Option, @@ -45,6 +74,8 @@ impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransition { document_type, entropy, identity_public_key, + identity_contract_nonce, + user_fee_increase, signer, platform_version, batch_feature_version, @@ -65,10 +96,12 @@ impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransition { document: Document, document_type: DocumentTypeRef, identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, batch_feature_version: Option, - update_feature_version: Option, + replace_feature_version: Option, base_feature_version: Option, ) -> Result { match batch_feature_version.unwrap_or( @@ -83,10 +116,12 @@ impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransition { document, document_type, identity_public_key, + identity_contract_nonce, + user_fee_increase, signer, platform_version, batch_feature_version, - update_feature_version, + replace_feature_version, base_feature_version, )?, ), @@ -99,4 +134,186 @@ impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransition { }), } } + + #[cfg(feature = "state-transition-signing")] + fn new_document_transfer_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + recipient_owner_id: Identifier, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + batch_feature_version: Option, + transfer_feature_version: Option, + base_feature_version: Option, + ) -> Result { + match batch_feature_version.unwrap_or( + platform_version + .dpp + .state_transition_serialization_versions + .documents_batch_state_transition + .default_current_version, + ) { + 0 => Ok( + DocumentsBatchTransitionV0::new_document_transfer_transition_from_document( + document, + document_type, + recipient_owner_id, + identity_public_key, + identity_contract_nonce, + user_fee_increase, + signer, + platform_version, + batch_feature_version, + transfer_feature_version, + base_feature_version, + )?, + ), + version => Err(ProtocolError::UnknownVersionMismatch { + method: + "DocumentsBatchTransition::new_document_replacement_transition_from_document" + .to_string(), + known_versions: vec![0], + received: version, + }), + } + } + + #[cfg(feature = "state-transition-signing")] + fn new_document_deletion_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + batch_feature_version: Option, + delete_feature_version: Option, + base_feature_version: Option, + ) -> Result { + match batch_feature_version.unwrap_or( + platform_version + .dpp + .state_transition_serialization_versions + .documents_batch_state_transition + .default_current_version, + ) { + 0 => Ok( + DocumentsBatchTransitionV0::new_document_deletion_transition_from_document( + document, + document_type, + identity_public_key, + identity_contract_nonce, + user_fee_increase, + signer, + platform_version, + batch_feature_version, + delete_feature_version, + base_feature_version, + )?, + ), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DocumentsBatchTransition::new_document_deletion_transition_from_document" + .to_string(), + known_versions: vec![0], + received: version, + }), + } + } + + #[cfg(feature = "state-transition-signing")] + fn new_document_update_price_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + price: Credits, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + batch_feature_version: Option, + update_price_feature_version: Option, + base_feature_version: Option, + ) -> Result { + match batch_feature_version.unwrap_or( + platform_version + .dpp + .state_transition_serialization_versions + .documents_batch_state_transition + .default_current_version, + ) { + 0 => Ok( + DocumentsBatchTransitionV0::new_document_update_price_transition_from_document( + document, + document_type, + price, + identity_public_key, + identity_contract_nonce, + user_fee_increase, + signer, + platform_version, + batch_feature_version, + update_price_feature_version, + base_feature_version, + )?, + ), + version => Err(ProtocolError::UnknownVersionMismatch { + method: + "DocumentsBatchTransition::new_document_update_price_transition_from_document" + .to_string(), + known_versions: vec![0], + received: version, + }), + } + } + + #[cfg(feature = "state-transition-signing")] + fn new_document_purchase_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + new_owner_id: Identifier, + price: Credits, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + batch_feature_version: Option, + purchase_feature_version: Option, + base_feature_version: Option, + ) -> Result { + match batch_feature_version.unwrap_or( + platform_version + .dpp + .state_transition_serialization_versions + .documents_batch_state_transition + .default_current_version, + ) { + 0 => Ok( + DocumentsBatchTransitionV0::new_document_purchase_transition_from_document( + document, + document_type, + new_owner_id, + price, + identity_public_key, + identity_contract_nonce, + user_fee_increase, + signer, + platform_version, + batch_feature_version, + purchase_feature_version, + base_feature_version, + )?, + ), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DocumentsBatchTransition::new_document_purchase_transition_from_document" + .to_string(), + known_versions: vec![0], + received: version, + }), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/methods/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/methods/v0/mod.rs index dbe2d89242a..a21448ea48c 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/methods/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/methods/v0/mod.rs @@ -1,15 +1,26 @@ +#[cfg(feature = "state-transition-signing")] use crate::data_contract::document_type::DocumentTypeRef; +#[cfg(feature = "state-transition-signing")] use crate::document::Document; +use crate::fee::Credits; +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; -use crate::identity::{IdentityPublicKey, SecurityLevel}; +#[cfg(feature = "state-transition-signing")] +use crate::identity::IdentityPublicKey; +use crate::identity::SecurityLevel; +use crate::prelude::IdentityNonce; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::UserFeeIncrease; use crate::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; use crate::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; use crate::state_transition::documents_batch_transition::document_transition::{ DocumentTransition, DocumentTransitionV0Methods, }; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::StateTransition; use crate::ProtocolError; use platform_value::Identifier; +#[cfg(feature = "state-transition-signing")] use platform_version::version::{FeatureVersion, PlatformVersion}; use std::convert::TryFrom; @@ -20,6 +31,8 @@ pub trait DocumentsBatchTransitionMethodsV0: DocumentsBatchTransitionAccessorsV0 document_type: DocumentTypeRef, entropy: [u8; 32], identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, batch_feature_version: Option, @@ -32,10 +45,72 @@ pub trait DocumentsBatchTransitionMethodsV0: DocumentsBatchTransitionAccessorsV0 document: Document, document_type: DocumentTypeRef, identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, _batch_feature_version: Option, - update_feature_version: Option, + replace_feature_version: Option, + base_feature_version: Option, + ) -> Result; + + #[cfg(feature = "state-transition-signing")] + fn new_document_deletion_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + _batch_feature_version: Option, + delete_feature_version: Option, + base_feature_version: Option, + ) -> Result; + + #[cfg(feature = "state-transition-signing")] + fn new_document_transfer_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + recipient_owner_id: Identifier, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + _batch_feature_version: Option, + transfer_feature_version: Option, + base_feature_version: Option, + ) -> Result; + + #[cfg(feature = "state-transition-signing")] + fn new_document_update_price_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + price: Credits, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + batch_feature_version: Option, + update_price_feature_version: Option, + base_feature_version: Option, + ) -> Result; + + #[cfg(feature = "state-transition-signing")] + fn new_document_purchase_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + new_owner_id: Identifier, + price: Credits, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + batch_feature_version: Option, + purchase_feature_version: Option, base_feature_version: Option, ) -> Result; @@ -78,4 +153,8 @@ pub trait DocumentsBatchTransitionMethodsV0: DocumentsBatchTransitionAccessorsV0 } fn set_transitions(&mut self, transitions: Vec); + + fn set_identity_contract_nonce(&mut self, identity_contract_nonce: IdentityNonce); + + fn all_purchases_amount(&self) -> Option; } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/mod.rs index 51678da4b61..f62e971fb7e 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/mod.rs @@ -5,6 +5,7 @@ use std::convert::TryInto; use derive_more::From; use platform_value::Value; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; use crate::ProtocolError; @@ -41,6 +42,7 @@ use crate::state_transition::data_contract_update_transition::{ use crate::state_transition::documents_batch_transition::fields::property_names; +use crate::identity::state_transition::OptionallyAssetLockProved; pub use v0::*; #[derive( @@ -94,7 +96,7 @@ pub enum DocumentsBatchTransition { // let maybe_signature = json_value.get_string(property_names::SIGNATURE).ok(); // let signature = if let Some(signature) = maybe_signature { // Some(BinaryData( -// base64::decode(signature).context("signature exists but isn't valid base64")?, +// BASE64_STANDARD.decode(signature).context("signature exists but isn't valid base64")?, // )) // } else { // None @@ -559,7 +561,7 @@ pub fn get_security_level_requirement(v: &Value, default: SecurityLevel) -> Secu // let data_contract_id = // Identifier::from_string(data_contract_id_base58, Encoding::Base58).unwrap(); // let owner_id = Identifier::from_string(owner_id_base58, Encoding::Base58).unwrap(); -// let entropy_bytes: [u8; 32] = base64::decode(entropy_base64).unwrap().try_into().unwrap(); +// let entropy_bytes: [u8; 32] = BASE64_STANDARD.decode(entropy_base64).unwrap().try_into().unwrap(); // // let mut data_contract = get_data_contract_fixture(Some(owner_id)).data_contract; // data_contract.id = data_contract_id; @@ -593,3 +595,4 @@ pub fn get_security_level_requirement(v: &Value, default: SecurityLevel) -> Secu // assert_eq!(hex::encode(expected_bytes), hex::encode(bytes)); // } // } +impl OptionallyAssetLockProved for DocumentsBatchTransition {} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/state_transition_like.rs index 4bd3c12a507..40f051e36a4 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/state_transition_like.rs @@ -1,3 +1,4 @@ +use crate::prelude::UserFeeIncrease; use crate::state_transition::documents_batch_transition::DocumentsBatchTransition; use crate::state_transition::{StateTransitionLike, StateTransitionType}; use crate::version::FeatureVersion; @@ -41,9 +42,30 @@ impl StateTransitionLike for DocumentsBatchTransition { } } + /// returns the fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + DocumentsBatchTransition::V0(transition) => transition.user_fee_increase(), + } + } + /// set a fee multiplier + fn set_user_fee_increase(&mut self, fee_multiplier: UserFeeIncrease) { + match self { + DocumentsBatchTransition::V0(transition) => { + transition.set_user_fee_increase(fee_multiplier) + } + } + } + fn owner_id(&self) -> Identifier { match self { DocumentsBatchTransition::V0(transition) => transition.owner_id(), } } + + fn unique_identifiers(&self) -> Vec { + match self { + DocumentsBatchTransition::V0(transition) => transition.unique_identifiers(), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/identity_signed.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/identity_signed.rs index c93ce54bca0..fd4916864aa 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/identity_signed.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/identity_signed.rs @@ -1,4 +1,4 @@ -use crate::identity::SecurityLevel::HIGH; +use crate::identity::SecurityLevel::{CRITICAL, HIGH, MEDIUM}; use crate::identity::{KeyID, SecurityLevel}; use crate::state_transition::documents_batch_transition::DocumentsBatchTransitionV0; @@ -14,7 +14,10 @@ impl StateTransitionIdentitySigned for DocumentsBatchTransitionV0 { } fn security_level_requirement(&self) -> Vec { - // TODO: should use contract_based_security_level_requirement instead - vec![HIGH] + // These are the available key levels that must sign the state transition + // However the fact that it is signed by one of these does not guarantee that it + // meets the security level requirement, as that is dictated from within the data + // contract + vec![CRITICAL, HIGH, MEDIUM] } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/mod.rs index 11556521d3c..4f301bb4520 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/mod.rs @@ -15,7 +15,9 @@ use crate::ProtocolError; use bincode::{Decode, Encode}; use platform_serialization_derive::PlatformSignable; +use crate::prelude::UserFeeIncrease; use platform_value::{BinaryData, Identifier}; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, PartialEq, Encode, Decode, PlatformSignable)] @@ -27,6 +29,7 @@ use serde::{Deserialize, Serialize}; pub struct DocumentsBatchTransitionV0 { pub owner_id: Identifier, pub transitions: Vec, + pub user_fee_increase: UserFeeIncrease, #[platform_signable(exclude_from_sig_hash)] pub signature_public_key_id: KeyID, #[platform_signable(exclude_from_sig_hash)] diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/state_transition_like.rs index 2a3943b4c5e..3ce7628de14 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/state_transition_like.rs @@ -1,3 +1,4 @@ +use crate::prelude::UserFeeIncrease; use crate::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; use crate::state_transition::documents_batch_transition::document_transition::DocumentTransitionV0Methods; use crate::state_transition::documents_batch_transition::{ @@ -6,6 +7,8 @@ use crate::state_transition::documents_batch_transition::{ use crate::state_transition::StateTransitionType::DocumentsBatch; use crate::state_transition::{StateTransition, StateTransitionLike, StateTransitionType}; use crate::version::FeatureVersion; +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use platform_value::{BinaryData, Identifier}; impl From for StateTransition { @@ -45,4 +48,27 @@ impl StateTransitionLike for DocumentsBatchTransitionV0 { fn owner_id(&self) -> Identifier { self.owner_id } + + /// We create a list of unique identifiers for the batch + fn unique_identifiers(&self) -> Vec { + self.transitions + .iter() + .map(|transition| { + format!( + "{}-{}-{:x}", + BASE64_STANDARD.encode(self.owner_id), + BASE64_STANDARD.encode(transition.data_contract_id()), + transition.identity_contract_nonce() + ) + }) + .collect() + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + self.user_fee_increase + } + + fn set_user_fee_increase(&mut self, fee_multiplier: UserFeeIncrease) { + self.user_fee_increase = fee_multiplier + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/v0_methods.rs index 60b61615b96..397de6c5e57 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/v0/v0_methods.rs @@ -1,20 +1,42 @@ +#[cfg(feature = "state-transition-signing")] use crate::data_contract::document_type::DocumentTypeRef; +#[cfg(feature = "state-transition-signing")] use crate::document::{Document, DocumentV0Getters}; +use crate::fee::Credits; +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] use crate::identity::SecurityLevel; +use crate::prelude::IdentityNonce; +#[cfg(feature = "state-transition-signing")] use crate::prelude::IdentityPublicKey; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::UserFeeIncrease; use crate::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::documents_batch_transition::document_create_transition::DocumentCreateTransition; use crate::state_transition::documents_batch_transition::document_transition::{ - DocumentReplaceTransition, DocumentTransition, + DocumentTransition, DocumentTransitionV0Methods, +}; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::documents_batch_transition::document_transition::{ + DocumentReplaceTransition, DocumentTransferTransition, DocumentPurchaseTransition, DocumentUpdatePriceTransition, }; use crate::state_transition::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; +use crate::state_transition::documents_batch_transition::DocumentsBatchTransitionV0; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::documents_batch_transition::{ - DocumentsBatchTransition, DocumentsBatchTransitionV0, + DocumentDeleteTransition, DocumentsBatchTransition, }; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::StateTransition; +#[cfg(feature = "state-transition-signing")] use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] +use platform_value::Identifier; +#[cfg(feature = "state-transition-signing")] use platform_version::version::{FeatureVersion, PlatformVersion}; +use crate::state_transition::documents_batch_transition::document_transition::document_purchase_transition::v0::v0_methods::DocumentPurchaseTransitionV0Methods; impl DocumentsBatchTransitionAccessorsV0 for DocumentsBatchTransitionV0 { fn transitions(&self) -> &Vec { @@ -33,6 +55,8 @@ impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransitionV0 { document_type: DocumentTypeRef, entropy: [u8; 32], identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, _batch_feature_version: Option, @@ -44,6 +68,7 @@ impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransitionV0 { document, document_type, entropy, + identity_contract_nonce, platform_version, create_feature_version, base_feature_version, @@ -51,6 +76,7 @@ impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransitionV0 { let documents_batch_transition: DocumentsBatchTransition = DocumentsBatchTransitionV0 { owner_id, transitions: vec![create_transition.into()], + user_fee_increase, signature_public_key_id: 0, signature: Default::default(), } @@ -69,23 +95,189 @@ impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransitionV0 { document: Document, document_type: DocumentTypeRef, identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, _batch_feature_version: Option, - update_feature_version: Option, + replace_feature_version: Option, base_feature_version: Option, ) -> Result { let owner_id = document.owner_id(); let replace_transition = DocumentReplaceTransition::from_document( document, document_type, + identity_contract_nonce, platform_version, - update_feature_version, + replace_feature_version, base_feature_version, )?; let documents_batch_transition: DocumentsBatchTransition = DocumentsBatchTransitionV0 { owner_id, transitions: vec![replace_transition.into()], + user_fee_increase, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + let mut state_transition: StateTransition = documents_batch_transition.into(); + state_transition.sign_external( + identity_public_key, + signer, + Some(|_, _| Ok(SecurityLevel::HIGH)), + )?; + Ok(state_transition) + } + + #[cfg(feature = "state-transition-signing")] + fn new_document_transfer_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + recipient_owner_id: Identifier, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + _batch_feature_version: Option, + transfer_feature_version: Option, + base_feature_version: Option, + ) -> Result { + let owner_id = document.owner_id(); + let transfer_transition = DocumentTransferTransition::from_document( + document, + document_type, + identity_contract_nonce, + recipient_owner_id, + platform_version, + transfer_feature_version, + base_feature_version, + )?; + let documents_batch_transition: DocumentsBatchTransition = DocumentsBatchTransitionV0 { + owner_id, + transitions: vec![transfer_transition.into()], + user_fee_increase, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + let mut state_transition: StateTransition = documents_batch_transition.into(); + state_transition.sign_external( + identity_public_key, + signer, + Some(|_, _| Ok(SecurityLevel::HIGH)), + )?; + Ok(state_transition) + } + + #[cfg(feature = "state-transition-signing")] + fn new_document_deletion_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + _batch_feature_version: Option, + delete_feature_version: Option, + base_feature_version: Option, + ) -> Result { + let owner_id = document.owner_id(); + let delete_transition = DocumentDeleteTransition::from_document( + document, + document_type, + identity_contract_nonce, + platform_version, + delete_feature_version, + base_feature_version, + )?; + let documents_batch_transition: DocumentsBatchTransition = DocumentsBatchTransitionV0 { + owner_id, + transitions: vec![delete_transition.into()], + user_fee_increase, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + let mut state_transition: StateTransition = documents_batch_transition.into(); + state_transition.sign_external( + identity_public_key, + signer, + Some(|_, _| Ok(SecurityLevel::HIGH)), + )?; + Ok(state_transition) + } + + #[cfg(feature = "state-transition-signing")] + fn new_document_update_price_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + price: Credits, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + _batch_feature_version: Option, + update_price_feature_version: Option, + base_feature_version: Option, + ) -> Result { + let owner_id = document.owner_id(); + let transfer_transition = DocumentUpdatePriceTransition::from_document( + document, + document_type, + price, + identity_contract_nonce, + platform_version, + update_price_feature_version, + base_feature_version, + )?; + let documents_batch_transition: DocumentsBatchTransition = DocumentsBatchTransitionV0 { + owner_id, + transitions: vec![transfer_transition.into()], + user_fee_increase, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + let mut state_transition: StateTransition = documents_batch_transition.into(); + state_transition.sign_external( + identity_public_key, + signer, + Some(|_, _| Ok(SecurityLevel::HIGH)), + )?; + Ok(state_transition) + } + + #[cfg(feature = "state-transition-signing")] + fn new_document_purchase_transition_from_document( + document: Document, + document_type: DocumentTypeRef, + new_owner_id: Identifier, + price: Credits, + identity_public_key: &IdentityPublicKey, + identity_contract_nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, + signer: &S, + platform_version: &PlatformVersion, + _batch_feature_version: Option, + purchase_feature_version: Option, + base_feature_version: Option, + ) -> Result { + let purchase_transition = DocumentPurchaseTransition::from_document( + document, + document_type, + price, + identity_contract_nonce, + platform_version, + purchase_feature_version, + base_feature_version, + )?; + let documents_batch_transition: DocumentsBatchTransition = DocumentsBatchTransitionV0 { + owner_id: new_owner_id, + transitions: vec![purchase_transition.into()], + user_fee_increase, signature_public_key_id: 0, signature: Default::default(), } @@ -102,4 +294,28 @@ impl DocumentsBatchTransitionMethodsV0 for DocumentsBatchTransitionV0 { fn set_transitions(&mut self, transitions: Vec) { self.transitions = transitions; } + + fn set_identity_contract_nonce(&mut self, identity_contract_nonce: IdentityNonce) { + self.transitions + .iter_mut() + .for_each(|transition| transition.set_identity_contract_nonce(identity_contract_nonce)); + } + + fn all_purchases_amount(&self) -> Option { + let (total, any_purchases) = self + .transitions + .iter() + .filter_map(|transition| { + transition + .as_transition_purchase() + .map(|purchase| purchase.price()) + }) + .fold((0, false), |(acc, _), price| (acc + price, true)); + + if any_purchases { + Some(total) // Return the sum as Some(Credits) if there were any purchases + } else { + None // Return None if no purchases were found + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/find_duplicates_by_id/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/find_duplicates_by_id/v0/mod.rs index 0d03d710352..14409746e4c 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/find_duplicates_by_id/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/find_duplicates_by_id/v0/mod.rs @@ -66,12 +66,11 @@ mod test { DocumentTransition::Create(DocumentCreateTransition::V0(DocumentCreateTransitionV0 { base: DocumentBaseTransition::V0(DocumentBaseTransitionV0 { id: Identifier::random(), + identity_contract_nonce: 0, document_type_name: "a".to_string(), data_contract_id: Identifier::random(), }), entropy: Default::default(), - created_at: None, - updated_at: None, data: Default::default(), })); @@ -81,11 +80,11 @@ mod test { DocumentReplaceTransitionV0 { base: DocumentBaseTransition::V0(DocumentBaseTransitionV0 { id: Identifier::random(), + identity_contract_nonce: 1, document_type_name: "a".to_string(), data_contract_id: Identifier::random(), }), revision: Default::default(), - updated_at: None, data: Default::default(), }, )); @@ -94,6 +93,7 @@ mod test { DocumentTransition::Delete(DocumentDeleteTransition::V0(DocumentDeleteTransitionV0 { base: DocumentBaseTransition::V0(DocumentBaseTransitionV0 { id: Identifier::random(), + identity_contract_nonce: 2, document_type_name: "c".to_string(), data_contract_id: Identifier::random(), }), diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/mod.rs index 9dbc8c2b9ad..ada331ac037 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/mod.rs @@ -1,2 +1,2 @@ mod find_duplicates_by_id; -pub mod validate_base_structure; +pub mod validate_basic_structure; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_base_structure/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_base_structure/mod.rs deleted file mode 100644 index 400433a814e..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_base_structure/mod.rs +++ /dev/null @@ -1,29 +0,0 @@ -use crate::state_transition::documents_batch_transition::DocumentsBatchTransition; -use crate::validation::SimpleConsensusValidationResult; -use crate::ProtocolError; -use platform_version::version::PlatformVersion; - -mod v0; - -impl DocumentsBatchTransition { - pub fn validate_base_structure<'d>( - &self, - platform_version: &PlatformVersion, - ) -> Result { - match platform_version - .dpp - .state_transitions - .documents - .documents_batch_transition - .validation - .validate_base_structure - { - 0 => self.validate_base_structure_v0(platform_version), - version => Err(ProtocolError::UnknownVersionMismatch { - method: "DocumentsBatchTransition::validate".to_string(), - known_versions: vec![0], - received: version, - }), - } - } -} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_base_structure/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_base_structure/v0/mod.rs deleted file mode 100644 index 7907d36993b..00000000000 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_base_structure/v0/mod.rs +++ /dev/null @@ -1,82 +0,0 @@ -use crate::consensus::basic::document::{ - DocumentTransitionsAreAbsentError, DuplicateDocumentTransitionsWithIdsError, - MaxDocumentsTransitionsExceededError, -}; -use crate::consensus::basic::BasicError; - -use crate::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; -use crate::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; -use crate::state_transition::documents_batch_transition::document_transition::{ - DocumentTransition, DocumentTransitionV0Methods, -}; -use crate::state_transition::documents_batch_transition::validation::find_duplicates_by_id::find_duplicates_by_id; -use crate::state_transition::documents_batch_transition::DocumentsBatchTransition; -use crate::validation::SimpleConsensusValidationResult; -use crate::ProtocolError; -use platform_value::Identifier; -use platform_version::version::PlatformVersion; -use std::collections::btree_map::Entry; -use std::collections::BTreeMap; - -const MAX_TRANSITIONS_IN_BATCH: usize = 1; - -impl DocumentsBatchTransition { - pub(super) fn validate_base_structure_v0<'d>( - &self, - platform_version: &PlatformVersion, - ) -> Result { - if self.transitions().is_empty() { - return Ok(SimpleConsensusValidationResult::new_with_error( - DocumentTransitionsAreAbsentError::new().into(), - )); - } - - if self.transitions().len() > MAX_TRANSITIONS_IN_BATCH { - return Ok(SimpleConsensusValidationResult::new_with_error( - MaxDocumentsTransitionsExceededError::new(MAX_TRANSITIONS_IN_BATCH as u32).into(), - )); - } - - // Group transitions by contract ID - let mut document_transitions_by_contracts: BTreeMap> = - BTreeMap::new(); - - self.transitions().iter().for_each(|document_transition| { - let contract_identifier = document_transition.data_contract_id(); - - match document_transitions_by_contracts.entry(contract_identifier) { - Entry::Vacant(vacant) => { - vacant.insert(vec![document_transition]); - } - Entry::Occupied(mut identifiers) => { - identifiers.get_mut().push(document_transition); - } - }; - }); - - let mut result = SimpleConsensusValidationResult::default(); - - for transitions in document_transitions_by_contracts.values() { - // Make sure we don't have duplicate transitions - let duplicate_transitions = find_duplicates_by_id(transitions, platform_version)?; - - if !duplicate_transitions.is_empty() { - let references: Vec<(String, [u8; 32])> = duplicate_transitions - .into_iter() - .map(|transition| { - Ok(( - transition.base().document_type_name().clone(), - transition.base().id().to_buffer(), - )) - }) - .collect::, anyhow::Error>>()?; - - result.add_error(BasicError::DuplicateDocumentTransitionsWithIdsError( - DuplicateDocumentTransitionsWithIdsError::new(references), - )); - } - } - - Ok(result) - } -} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_basic_structure/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_basic_structure/mod.rs new file mode 100644 index 00000000000..69891782113 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_basic_structure/mod.rs @@ -0,0 +1,29 @@ +use crate::state_transition::documents_batch_transition::DocumentsBatchTransition; +use crate::validation::SimpleConsensusValidationResult; +use crate::ProtocolError; +use platform_version::version::PlatformVersion; + +mod v0; + +impl DocumentsBatchTransition { + pub fn validate_base_structure( + &self, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .state_transitions + .documents + .documents_batch_transition + .validation + .validate_base_structure + { + 0 => self.validate_base_structure_v0(platform_version), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "DocumentsBatchTransition::validate_base_structure".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_basic_structure/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_basic_structure/v0/mod.rs new file mode 100644 index 00000000000..84ccb224aa5 --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/validation/validate_basic_structure/v0/mod.rs @@ -0,0 +1,106 @@ +use crate::consensus::basic::document::{ + DocumentTransitionsAreAbsentError, DuplicateDocumentTransitionsWithIdsError, + MaxDocumentsTransitionsExceededError, NonceOutOfBoundsError, +}; +use crate::consensus::basic::BasicError; + +use crate::identity::identity_nonce::MISSING_IDENTITY_REVISIONS_FILTER; +use crate::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; +use crate::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; +use crate::state_transition::documents_batch_transition::document_transition::{ + DocumentTransition, DocumentTransitionV0Methods, +}; +use crate::state_transition::documents_batch_transition::validation::find_duplicates_by_id::find_duplicates_by_id; +use crate::state_transition::documents_batch_transition::DocumentsBatchTransition; +use crate::validation::SimpleConsensusValidationResult; +use crate::ProtocolError; +use platform_value::Identifier; +use platform_version::version::PlatformVersion; +use std::collections::btree_map::Entry; +use std::collections::BTreeMap; + +impl DocumentsBatchTransition { + #[inline(always)] + pub(super) fn validate_base_structure_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result { + if self.transitions().is_empty() { + return Ok(SimpleConsensusValidationResult::new_with_error( + DocumentTransitionsAreAbsentError::new().into(), + )); + } + + let transitions_len = self.transitions().len(); + + if transitions_len > u16::MAX as usize + || transitions_len as u16 + > platform_version + .dpp + .state_transitions + .max_transitions_in_documents_batch + { + return Ok(SimpleConsensusValidationResult::new_with_error( + MaxDocumentsTransitionsExceededError::new( + platform_version + .dpp + .state_transitions + .max_transitions_in_documents_batch, + ) + .into(), + )); + } + + // Group transitions by contract ID + let mut document_transitions_by_contracts: BTreeMap> = + BTreeMap::new(); + + self.transitions().iter().for_each(|document_transition| { + let contract_identifier = document_transition.data_contract_id(); + + match document_transitions_by_contracts.entry(contract_identifier) { + Entry::Vacant(vacant) => { + vacant.insert(vec![document_transition]); + } + Entry::Occupied(mut identifiers) => { + identifiers.get_mut().push(document_transition); + } + }; + }); + + let mut result = SimpleConsensusValidationResult::default(); + + for transitions in document_transitions_by_contracts.values() { + for transition in transitions { + // We need to make sure that the identity contract nonce is within the allowed bounds + // This means that it is stored on 40 bits + if transition.identity_contract_nonce() & MISSING_IDENTITY_REVISIONS_FILTER > 0 { + result.add_error(BasicError::NonceOutOfBoundsError( + NonceOutOfBoundsError::new(transition.identity_contract_nonce()), + )); + } + } + + // Make sure we don't have duplicate transitions + let duplicate_transitions = find_duplicates_by_id(transitions, platform_version)?; + + if !duplicate_transitions.is_empty() { + let references: Vec<(String, [u8; 32])> = duplicate_transitions + .into_iter() + .map(|transition| { + Ok(( + transition.base().document_type_name().clone(), + transition.base().id().to_buffer(), + )) + }) + .collect::, anyhow::Error>>()?; + + result.add_error(BasicError::DuplicateDocumentTransitionsWithIdsError( + DuplicateDocumentTransitionsWithIdsError::new(references), + )); + } + } + + Ok(result) + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/accessors/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/accessors/mod.rs index eefb63b3181..64ea5ff381f 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/accessors/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/accessors/mod.rs @@ -1,9 +1,8 @@ mod v0; -use crate::prelude::AssetLockProof; use crate::state_transition::identity_create_transition::IdentityCreateTransition; use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; -use crate::NonConsensusError; + use platform_value::Identifier; pub use v0::*; @@ -14,6 +13,12 @@ impl IdentityCreateTransitionAccessorsV0 for IdentityCreateTransition { } } + fn public_keys_mut(&mut self) -> &mut Vec { + match self { + IdentityCreateTransition::V0(transition) => transition.public_keys_mut(), + } + } + fn set_public_keys(&mut self, public_keys: Vec) { match self { IdentityCreateTransition::V0(transition) => transition.set_public_keys(public_keys), diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/accessors/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/accessors/v0/mod.rs index 6ed97a53fc8..04de1f7e3a7 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/accessors/v0/mod.rs @@ -4,6 +4,10 @@ use platform_value::Identifier; pub trait IdentityCreateTransitionAccessorsV0 { /// Get identity public keys fn public_keys(&self) -> &[IdentityPublicKeyInCreation]; + + /// Get identity public keys as a mutable vec + fn public_keys_mut(&mut self) -> &mut Vec; + /// Replaces existing set of public keys with a new one fn set_public_keys(&mut self, public_keys: Vec); /// Adds public keys to the existing public keys array diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/fields.rs index 40b5fc6173c..25602cb8b07 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/fields.rs @@ -1,10 +1,14 @@ use crate::state_transition::state_transitions; pub use state_transitions::common_fields::property_names::{ - ENTROPY, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, TRANSITION_TYPE, + SIGNATURE, STATE_TRANSITION_PROTOCOL_VERSION, }; +#[allow(unused_imports)] // Removing causes build failures; yet clippy insists it's unused pub use state_transitions::identity::common_fields::property_names::{ - ASSET_LOCK_PROOF, IDENTITY_ID, PUBLIC_KEYS, PUBLIC_KEYS_DATA, PUBLIC_KEYS_SIGNATURE, + ASSET_LOCK_PROOF, PUBLIC_KEYS, +}; +pub use state_transitions::identity::common_fields::property_names::{ + IDENTITY_ID, PUBLIC_KEYS_DATA, PUBLIC_KEYS_SIGNATURE, }; pub const IDENTIFIER_FIELDS: [&str; 1] = [IDENTITY_ID]; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/methods/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/methods/mod.rs index 0128b6ce3d8..83f90d6dad7 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/methods/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/methods/mod.rs @@ -2,24 +2,34 @@ mod v0; pub use v0::*; +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] use crate::identity::Identity; +#[cfg(feature = "state-transition-signing")] use crate::prelude::AssetLockProof; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::UserFeeIncrease; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::identity_create_transition::v0::IdentityCreateTransitionV0; use crate::state_transition::identity_create_transition::IdentityCreateTransition; - -use crate::state_transition::{StateTransition, StateTransitionType}; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::StateTransition; +use crate::state_transition::StateTransitionType; +#[cfg(feature = "state-transition-signing")] use crate::version::PlatformVersion; +#[cfg(feature = "state-transition-signing")] use crate::{BlsModule, ProtocolError}; impl IdentityCreateTransitionMethodsV0 for IdentityCreateTransition { #[cfg(feature = "state-transition-signing")] fn try_from_identity_with_signer( - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, asset_lock_proof_private_key: &[u8], signer: &S, bls: &impl BlsModule, + user_fee_increase: UserFeeIncrease, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -33,6 +43,7 @@ impl IdentityCreateTransitionMethodsV0 for IdentityCreateTransition { asset_lock_proof_private_key, signer, bls, + user_fee_increase, platform_version, )?), v => Err(ProtocolError::UnknownVersionError(format!( diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/methods/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/methods/v0/mod.rs index 65343d67c57..9fdc3f989f6 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/methods/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/methods/v0/mod.rs @@ -1,18 +1,28 @@ +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] use crate::identity::Identity; +#[cfg(feature = "state-transition-signing")] use crate::prelude::AssetLockProof; -use crate::state_transition::{StateTransition, StateTransitionType}; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::UserFeeIncrease; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::StateTransition; +use crate::state_transition::StateTransitionType; +#[cfg(feature = "state-transition-signing")] use crate::{BlsModule, ProtocolError}; +#[cfg(feature = "state-transition-signing")] use platform_version::version::PlatformVersion; pub trait IdentityCreateTransitionMethodsV0 { #[cfg(feature = "state-transition-signing")] fn try_from_identity_with_signer( - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, asset_lock_proof_private_key: &[u8], signer: &S, bls: &impl BlsModule, + user_fee_increase: UserFeeIncrease, platform_version: &PlatformVersion, ) -> Result; /// Get State Transition type diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/mod.rs index 91aab6d4997..0691ae08284 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/mod.rs @@ -21,6 +21,7 @@ use fields::*; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, PlatformSignable}; use platform_version::version::PlatformVersion; use platform_versioning::PlatformVersioned; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub type IdentityCreateTransitionLatest = IdentityCreateTransitionV0; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/proved.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/proved.rs index 79954d54f93..cee34c9d4be 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/proved.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/proved.rs @@ -1,8 +1,14 @@ -use crate::identity::state_transition::AssetLockProved; +use crate::identity::state_transition::{AssetLockProved, OptionallyAssetLockProved}; use crate::prelude::AssetLockProof; use crate::state_transition::identity_create_transition::IdentityCreateTransition; use crate::ProtocolError; +impl OptionallyAssetLockProved for IdentityCreateTransition { + fn optional_asset_lock_proof(&self) -> Option<&AssetLockProof> { + Some(self.asset_lock_proof()) + } +} + impl AssetLockProved for IdentityCreateTransition { fn set_asset_lock_proof( &mut self, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/state_transition_like.rs index 06d6a06d543..4c4c51d055b 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/state_transition_like.rs @@ -1,3 +1,4 @@ +use crate::prelude::UserFeeIncrease; use crate::state_transition::identity_create_transition::IdentityCreateTransition; use crate::state_transition::{StateTransitionLike, StateTransitionType}; use crate::version::FeatureVersion; @@ -41,9 +42,30 @@ impl StateTransitionLike for IdentityCreateTransition { } } + /// returns the fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + IdentityCreateTransition::V0(transition) => transition.user_fee_increase(), + } + } + /// set a fee multiplier + fn set_user_fee_increase(&mut self, fee_multiplier: UserFeeIncrease) { + match self { + IdentityCreateTransition::V0(transition) => { + transition.set_user_fee_increase(fee_multiplier) + } + } + } + fn owner_id(&self) -> Identifier { match self { IdentityCreateTransition::V0(transition) => transition.owner_id(), } } + + fn unique_identifiers(&self) -> Vec { + match self { + IdentityCreateTransition::V0(transition) => transition.unique_identifiers(), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs index 9b246d266b0..36fba74378f 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs @@ -14,11 +14,12 @@ use bincode::{Decode, Encode}; use platform_serialization_derive::PlatformSignable; use platform_value::BinaryData; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; use crate::identity::state_transition::asset_lock_proof::AssetLockProof; use crate::identity::Identity; -use crate::prelude::Identifier; +use crate::prelude::{Identifier, UserFeeIncrease}; use crate::identity::accessors::IdentityGettersV0; use crate::identity::state_transition::AssetLockProved; @@ -45,6 +46,7 @@ pub struct IdentityCreateTransitionV0 { #[platform_signable(into = "Vec")] pub public_keys: Vec, pub asset_lock_proof: AssetLockProof, + pub user_fee_increase: UserFeeIncrease, #[platform_signable(exclude_from_sig_hash)] pub signature: BinaryData, #[cfg_attr(feature = "state-transition-serde-conversion", serde(skip))] @@ -62,7 +64,7 @@ struct IdentityCreateTransitionV0Inner { public_keys: Vec, asset_lock_proof: AssetLockProof, // Generic identity ST fields - // protocol_version: u32, + user_fee_increase: UserFeeIncrease, signature: BinaryData, } @@ -73,12 +75,14 @@ impl TryFrom for IdentityCreateTransitionV0 { let IdentityCreateTransitionV0Inner { public_keys, asset_lock_proof, + user_fee_increase, signature, } = value; let identity_id = asset_lock_proof.create_identifier()?; Ok(Self { public_keys, asset_lock_proof, + user_fee_increase, signature, identity_id, }) @@ -89,7 +93,7 @@ impl TryFrom for IdentityCreateTransitionV0 { impl IdentityCreateTransitionV0 { pub fn try_from_identity_v0( - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, ) -> Result { let mut identity_create_transition = IdentityCreateTransitionV0::default(); @@ -109,7 +113,7 @@ impl IdentityCreateTransitionV0 { } pub fn try_from_identity( - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, platform_version: &PlatformVersion, ) -> Result { diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/state_transition_like.rs index 54a321e9887..1d20954a389 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/state_transition_like.rs @@ -1,5 +1,8 @@ +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use platform_value::BinaryData; +use crate::prelude::UserFeeIncrease; use crate::state_transition::identity_create_transition::IdentityCreateTransition; use crate::{ prelude::Identifier, @@ -49,4 +52,17 @@ impl StateTransitionLike for IdentityCreateTransitionV0 { fn owner_id(&self) -> Identifier { self.identity_id } + + /// this is based on the asset lock + fn unique_identifiers(&self) -> Vec { + vec![BASE64_STANDARD.encode(self.identity_id)] + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + self.user_fee_increase + } + + fn set_user_fee_increase(&mut self, fee_multiplier: UserFeeIncrease) { + self.user_fee_increase = fee_multiplier + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs index cec855002f7..da69511b197 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs @@ -1,36 +1,52 @@ -use crate::{ - prelude::Identifier, state_transition::StateTransitionType, BlsModule, NonConsensusError, - ProtocolError, -}; +use crate::{prelude::Identifier, state_transition::StateTransitionType}; +#[cfg(feature = "state-transition-signing")] +use crate::{BlsModule, ProtocolError}; +#[cfg(feature = "state-transition-signing")] use crate::identity::accessors::IdentityGettersV0; +#[cfg(feature = "state-transition-signing")] use crate::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] use crate::identity::state_transition::AssetLockProved; +#[cfg(feature = "state-transition-signing")] use crate::identity::Identity; +#[cfg(feature = "state-transition-signing")] use crate::identity::KeyType::ECDSA_HASH160; +#[cfg(feature = "state-transition-signing")] use crate::prelude::AssetLockProof; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::UserFeeIncrease; +#[cfg(feature = "state-transition-signing")] use crate::serialization::Signable; use crate::state_transition::identity_create_transition::accessors::IdentityCreateTransitionAccessorsV0; use crate::state_transition::identity_create_transition::methods::IdentityCreateTransitionMethodsV0; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::public_key_in_creation::accessors::IdentityPublicKeyInCreationV0Setters; use crate::state_transition::identity_create_transition::v0::IdentityCreateTransitionV0; use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::StateTransition; +#[cfg(feature = "state-transition-signing")] use crate::version::PlatformVersion; impl IdentityCreateTransitionMethodsV0 for IdentityCreateTransitionV0 { #[cfg(feature = "state-transition-signing")] fn try_from_identity_with_signer( - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, asset_lock_proof_private_key: &[u8], signer: &S, bls: &impl BlsModule, + user_fee_increase: UserFeeIncrease, _platform_version: &PlatformVersion, ) -> Result { - let mut identity_create_transition = IdentityCreateTransitionV0::default(); + let mut identity_create_transition = IdentityCreateTransitionV0 { + user_fee_increase, + ..Default::default() + }; let public_keys = identity .public_keys() .iter() @@ -78,6 +94,11 @@ impl IdentityCreateTransitionAccessorsV0 for IdentityCreateTransitionV0 { &self.public_keys } + /// Get identity public keys + fn public_keys_mut(&mut self) -> &mut Vec { + &mut self.public_keys + } + /// Replaces existing set of public keys with a new one fn set_public_keys(&mut self, public_keys: Vec) { self.public_keys = public_keys; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/accessors/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/accessors/mod.rs index abb71ed145a..e263f3faebd 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/accessors/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/accessors/mod.rs @@ -1,5 +1,6 @@ mod v0; +use crate::prelude::IdentityNonce; use crate::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; use platform_value::Identifier; pub use v0::*; @@ -46,4 +47,16 @@ impl IdentityCreditTransferTransitionAccessorsV0 for IdentityCreditTransferTrans } } } + + fn set_nonce(&mut self, nonce: IdentityNonce) { + match self { + IdentityCreditTransferTransition::V0(transition) => transition.nonce = nonce, + } + } + + fn nonce(&self) -> IdentityNonce { + match self { + IdentityCreditTransferTransition::V0(transition) => transition.nonce, + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/accessors/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/accessors/v0/mod.rs index 425248a8ba7..63e2229d279 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/accessors/v0/mod.rs @@ -1,3 +1,5 @@ +use crate::prelude::IdentityNonce; + use platform_value::Identifier; pub trait IdentityCreditTransferTransitionAccessorsV0 { @@ -7,4 +9,6 @@ pub trait IdentityCreditTransferTransitionAccessorsV0 { fn set_identity_id(&mut self, identity_id: Identifier); fn recipient_id(&self) -> Identifier; fn set_recipient_id(&mut self, recipient_id: Identifier); + fn set_nonce(&mut self, nonce: IdentityNonce); + fn nonce(&self) -> IdentityNonce; } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/fields.rs index 5107fcbe3ca..6b5813e902b 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/fields.rs @@ -2,7 +2,8 @@ use crate::state_transition::state_transitions; use crate::state_transition::identity_credit_transfer_transition::fields::property_names::RECIPIENT_ID; pub use state_transitions::common_fields::property_names::{ - ENTROPY, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, TRANSITION_TYPE, + IDENTITY_NONCE, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, + TRANSITION_TYPE, }; pub use state_transitions::identity::common_fields::property_names::IDENTITY_ID; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/identity_signed.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/identity_signed.rs index 0100b34f87d..4b3b448eb54 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/identity_signed.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/identity_signed.rs @@ -1,4 +1,4 @@ -use crate::identity::{KeyID, SecurityLevel}; +use crate::identity::{KeyID, Purpose, SecurityLevel}; use crate::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; use crate::state_transition::StateTransitionIdentitySigned; @@ -26,4 +26,10 @@ impl StateTransitionIdentitySigned for IdentityCreditTransferTransition { } } } + + fn purpose_requirement(&self) -> Purpose { + match self { + IdentityCreditTransferTransition::V0(transition) => transition.purpose_requirement(), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/mod.rs index ebe10ef16a9..b991b7402b8 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/mod.rs @@ -15,6 +15,7 @@ use crate::state_transition::identity_credit_transfer_transition::v0::IdentityCr use crate::state_transition::identity_credit_transfer_transition::v0::IdentityCreditTransferTransitionV0Signable; use crate::state_transition::StateTransitionFieldTypes; +use crate::identity::state_transition::OptionallyAssetLockProved; use crate::ProtocolError; use bincode::{Decode, Encode}; use derive_more::From; @@ -22,6 +23,7 @@ use fields::*; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, PlatformSignable}; use platform_version::version::PlatformVersion; use platform_versioning::PlatformVersioned; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub type IdentityCreditTransferTransitionLatest = IdentityCreditTransferTransitionV0; @@ -71,6 +73,8 @@ impl IdentityCreditTransferTransition { } } +impl OptionallyAssetLockProved for IdentityCreditTransferTransition {} + impl StateTransitionFieldTypes for IdentityCreditTransferTransition { fn signature_property_paths() -> Vec<&'static str> { vec![SIGNATURE] diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/state_transition_like.rs index 04a99304b60..dd5cede96be 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/state_transition_like.rs @@ -1,3 +1,4 @@ +use crate::prelude::UserFeeIncrease; use crate::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; use crate::state_transition::{StateTransitionLike, StateTransitionType}; use crate::version::FeatureVersion; @@ -43,9 +44,30 @@ impl StateTransitionLike for IdentityCreditTransferTransition { } } + /// returns the fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + IdentityCreditTransferTransition::V0(transition) => transition.user_fee_increase(), + } + } + /// set a fee multiplier + fn set_user_fee_increase(&mut self, fee_multiplier: UserFeeIncrease) { + match self { + IdentityCreditTransferTransition::V0(transition) => { + transition.set_user_fee_increase(fee_multiplier) + } + } + } + fn owner_id(&self) -> Identifier { match self { IdentityCreditTransferTransition::V0(transition) => transition.owner_id(), } } + + fn unique_identifiers(&self) -> Vec { + match self { + IdentityCreditTransferTransition::V0(transition) => transition.unique_identifiers(), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/identity_signed.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/identity_signed.rs index bee0594ba1b..bcab635e228 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/identity_signed.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/identity_signed.rs @@ -1,5 +1,5 @@ use crate::identity::SecurityLevel::CRITICAL; -use crate::identity::{KeyID, SecurityLevel}; +use crate::identity::{KeyID, Purpose, SecurityLevel}; use crate::state_transition::identity_credit_transfer_transition::v0::IdentityCreditTransferTransitionV0; use crate::state_transition::StateTransitionIdentitySigned; @@ -15,4 +15,8 @@ impl StateTransitionIdentitySigned for IdentityCreditTransferTransitionV0 { fn security_level_requirement(&self) -> Vec { vec![CRITICAL] } + + fn purpose_requirement(&self) -> Purpose { + Purpose::TRANSFER + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/mod.rs index 55063239839..b04b6f3f761 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/mod.rs @@ -10,12 +10,13 @@ mod version; use crate::identity::KeyID; -use crate::prelude::Identifier; +use crate::prelude::{Identifier, IdentityNonce, UserFeeIncrease}; use crate::ProtocolError; use bincode::{Decode, Encode}; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, PlatformSignable}; use platform_value::BinaryData; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; #[derive( @@ -40,6 +41,8 @@ pub struct IdentityCreditTransferTransitionV0 { pub identity_id: Identifier, pub recipient_id: Identifier, pub amount: u64, + pub nonce: IdentityNonce, + pub user_fee_increase: UserFeeIncrease, #[platform_signable(exclude_from_sig_hash)] pub signature_public_key_id: KeyID, #[platform_signable(exclude_from_sig_hash)] @@ -76,6 +79,8 @@ mod test { identity_id: Identifier::random(), recipient_id: Identifier::random(), amount: rng.gen(), + nonce: 1, + user_fee_increase: 0, signature_public_key_id: rng.gen(), signature: [0; 65].to_vec().into(), }; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/state_transition_like.rs index fb741a89f88..f8bde2b5272 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/v0/state_transition_like.rs @@ -1,5 +1,8 @@ +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use platform_value::BinaryData; +use crate::prelude::UserFeeIncrease; use crate::{ prelude::Identifier, state_transition::{StateTransitionLike, StateTransitionType}, @@ -49,4 +52,21 @@ impl StateTransitionLike for IdentityCreditTransferTransitionV0 { fn owner_id(&self) -> Identifier { self.identity_id } + + /// We want things to be unique based on the nonce, so we don't add the transition type + fn unique_identifiers(&self) -> Vec { + vec![format!( + "{}-{:x}", + BASE64_STANDARD.encode(self.identity_id), + self.nonce + )] + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + self.user_fee_increase + } + + fn set_user_fee_increase(&mut self, fee_multiplier: UserFeeIncrease) { + self.user_fee_increase = fee_multiplier + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/accessors/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/accessors/mod.rs index 187a59c4ae2..dbf33c5a56e 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/accessors/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/accessors/mod.rs @@ -4,7 +4,7 @@ use crate::identity::core_script::CoreScript; use platform_value::Identifier; pub use v0::*; -use crate::prelude::Revision; +use crate::prelude::IdentityNonce; use crate::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; use crate::withdrawal::Pooling; @@ -16,21 +16,37 @@ impl IdentityCreditWithdrawalTransitionAccessorsV0 for IdentityCreditWithdrawalT } } + fn set_identity_id(&mut self, identity_id: Identifier) { + match self { + IdentityCreditWithdrawalTransition::V0(transition) => { + transition.identity_id = identity_id; + } + } + } + fn amount(&self) -> u64 { match self { IdentityCreditWithdrawalTransition::V0(transition) => transition.amount, } } - fn set_revision(&mut self, revision: Revision) { + fn set_amount(&mut self, amount: u64) { + match self { + IdentityCreditWithdrawalTransition::V0(transition) => { + transition.amount = amount; + } + } + } + + fn set_nonce(&mut self, nonce: IdentityNonce) { match self { - IdentityCreditWithdrawalTransition::V0(transition) => transition.revision = revision, + IdentityCreditWithdrawalTransition::V0(transition) => transition.nonce = nonce, } } - fn revision(&self) -> Revision { + fn nonce(&self) -> IdentityNonce { match self { - IdentityCreditWithdrawalTransition::V0(transition) => transition.revision, + IdentityCreditWithdrawalTransition::V0(transition) => transition.nonce, } } @@ -40,15 +56,39 @@ impl IdentityCreditWithdrawalTransitionAccessorsV0 for IdentityCreditWithdrawalT } } + fn set_pooling(&mut self, pooling: Pooling) { + match self { + IdentityCreditWithdrawalTransition::V0(transition) => { + transition.pooling = pooling; + } + } + } + fn core_fee_per_byte(&self) -> u32 { match self { IdentityCreditWithdrawalTransition::V0(transition) => transition.core_fee_per_byte, } } + fn set_core_fee_per_byte(&mut self, core_fee_per_byte: u32) { + match self { + IdentityCreditWithdrawalTransition::V0(transition) => { + transition.core_fee_per_byte = core_fee_per_byte; + } + } + } + fn output_script(&self) -> CoreScript { match self { IdentityCreditWithdrawalTransition::V0(transition) => transition.output_script.clone(), } } + + fn set_output_script(&mut self, output_script: CoreScript) { + match self { + IdentityCreditWithdrawalTransition::V0(transition) => { + transition.output_script = output_script; + } + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/accessors/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/accessors/v0/mod.rs index f59529f8f88..1bcd8b29459 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/accessors/v0/mod.rs @@ -1,14 +1,19 @@ use crate::identity::core_script::CoreScript; -use crate::prelude::Revision; +use crate::prelude::IdentityNonce; use crate::withdrawal::Pooling; use platform_value::Identifier; pub trait IdentityCreditWithdrawalTransitionAccessorsV0 { fn identity_id(&self) -> Identifier; + fn set_identity_id(&mut self, identity_id: Identifier); fn amount(&self) -> u64; - fn set_revision(&mut self, revision: Revision); - fn revision(&self) -> Revision; + fn set_amount(&mut self, amount: u64); + fn nonce(&self) -> IdentityNonce; + fn set_nonce(&mut self, nonce: IdentityNonce); fn pooling(&self) -> Pooling; + fn set_pooling(&mut self, pooling: Pooling); fn core_fee_per_byte(&self) -> u32; + fn set_core_fee_per_byte(&mut self, amount: u32); fn output_script(&self) -> CoreScript; + fn set_output_script(&mut self, output_script: CoreScript); } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/identity_signed.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/identity_signed.rs index 1455089e1e4..2dd369f3b39 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/identity_signed.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/identity_signed.rs @@ -1,4 +1,4 @@ -use crate::identity::{KeyID, SecurityLevel}; +use crate::identity::{KeyID, Purpose, SecurityLevel}; use crate::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; use crate::state_transition::StateTransitionIdentitySigned; @@ -26,4 +26,10 @@ impl StateTransitionIdentitySigned for IdentityCreditWithdrawalTransition { } } } + + fn purpose_requirement(&self) -> Purpose { + match self { + IdentityCreditWithdrawalTransition::V0(transition) => transition.purpose_requirement(), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/methods/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/methods/mod.rs index 6b3e0a53c00..3aaef91f3c4 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/methods/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/methods/mod.rs @@ -1,5 +1,65 @@ mod v0; + use crate::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; +#[cfg(feature = "state-transition-signing")] +use platform_version::version::FeatureVersion; pub use v0::*; -impl IdentityCreditWithdrawalTransitionMethodsV0 for IdentityCreditWithdrawalTransition {} +#[cfg(feature = "state-transition-signing")] +use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] +use crate::identity::Identity; + +#[cfg(feature = "state-transition-signing")] +use crate::identity::core_script::CoreScript; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::{IdentityNonce, UserFeeIncrease}; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::identity_credit_withdrawal_transition::v0::IdentityCreditWithdrawalTransitionV0; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::StateTransition; +#[cfg(feature = "state-transition-signing")] +use crate::version::PlatformVersion; +#[cfg(feature = "state-transition-signing")] +use crate::withdrawal::Pooling; +#[cfg(feature = "state-transition-signing")] +use crate::ProtocolError; + +impl IdentityCreditWithdrawalTransitionMethodsV0 for IdentityCreditWithdrawalTransition { + #[cfg(feature = "state-transition-signing")] + fn try_from_identity( + identity: &Identity, + output_script: CoreScript, + amount: u64, + pooling: Pooling, + core_fee_per_byte: u32, + user_fee_increase: UserFeeIncrease, + signer: S, + nonce: IdentityNonce, + platform_version: &PlatformVersion, + version: Option, + ) -> Result { + match version.unwrap_or( + platform_version + .dpp + .state_transition_conversion_versions + .identity_to_identity_withdrawal_transition, + ) { + 0 => Ok(IdentityCreditWithdrawalTransitionV0::try_from_identity( + identity, + output_script, + amount, + pooling, + core_fee_per_byte, + user_fee_increase, + signer, + nonce, + platform_version, + version, + )?), + v => Err(ProtocolError::UnknownVersionError(format!( + "Unknown IdentityCreditWithdrawalTransition version for try_from_identity {v}" + ))), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/methods/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/methods/v0/mod.rs index d6cf5253ffb..c739eadb0eb 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/methods/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/methods/v0/mod.rs @@ -1,6 +1,36 @@ +#[cfg(feature = "state-transition-signing")] +use crate::identity::core_script::CoreScript; +#[cfg(feature = "state-transition-signing")] +use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] +use crate::identity::Identity; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::{IdentityNonce, UserFeeIncrease}; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::StateTransition; use crate::state_transition::StateTransitionType; +#[cfg(feature = "state-transition-signing")] +use crate::withdrawal::Pooling; +#[cfg(feature = "state-transition-signing")] +use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] +use platform_version::version::{FeatureVersion, PlatformVersion}; pub trait IdentityCreditWithdrawalTransitionMethodsV0 { + #[cfg(feature = "state-transition-signing")] + fn try_from_identity( + identity: &Identity, + output_script: CoreScript, + amount: u64, + pooling: Pooling, + core_fee_per_byte: u32, + user_fee_increase: UserFeeIncrease, + signer: S, + nonce: IdentityNonce, + _platform_version: &PlatformVersion, + _version: Option, + ) -> Result; + /// Get State Transition Type fn get_type() -> StateTransitionType { StateTransitionType::IdentityCreditWithdrawal diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/mod.rs index 7dc6a29030f..f7732969360 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/mod.rs @@ -1,7 +1,7 @@ use crate::state_transition::identity_credit_withdrawal_transition::v0::IdentityCreditWithdrawalTransitionV0; pub mod accessors; -mod fields; +pub mod fields; mod identity_signed; #[cfg(feature = "state-transition-json-conversion")] mod json_conversion; @@ -15,13 +15,15 @@ mod version; use crate::state_transition::identity_credit_withdrawal_transition::v0::IdentityCreditWithdrawalTransitionV0Signable; use crate::state_transition::StateTransitionFieldTypes; +use crate::identity::state_transition::OptionallyAssetLockProved; use crate::ProtocolError; use bincode::{Decode, Encode}; -use data_contracts::withdrawals_contract::document_types::withdrawal::properties::OUTPUT_SCRIPT; use derive_more::From; use fields::*; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, PlatformSignable}; +use platform_version::version::PlatformVersion; use platform_versioning::PlatformVersioned; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub type IdentityCreditWithdrawalTransitionLatest = IdentityCreditWithdrawalTransitionV0; @@ -52,6 +54,25 @@ pub enum IdentityCreditWithdrawalTransition { V0(IdentityCreditWithdrawalTransitionV0), } +impl IdentityCreditWithdrawalTransition { + pub fn default_versioned(platform_version: &PlatformVersion) -> Result { + match platform_version + .dpp + .identity_versions + .identity_structure_version + { + 0 => Ok(IdentityCreditWithdrawalTransition::V0( + IdentityCreditWithdrawalTransitionV0::default(), + )), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "IdentityCreditWithdrawalTransition::default_versioned".to_string(), + known_versions: vec![0], + received: version, + }), + } + } +} + impl StateTransitionFieldTypes for IdentityCreditWithdrawalTransition { fn signature_property_paths() -> Vec<&'static str> { vec![SIGNATURE, SIGNATURE_PUBLIC_KEY_ID] @@ -65,3 +86,5 @@ impl StateTransitionFieldTypes for IdentityCreditWithdrawalTransition { vec![SIGNATURE, OUTPUT_SCRIPT] } } + +impl OptionallyAssetLockProved for IdentityCreditWithdrawalTransition {} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/state_transition_like.rs index 2addd0674cd..dc21b8c52db 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/state_transition_like.rs @@ -1,3 +1,4 @@ +use crate::prelude::UserFeeIncrease; use crate::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; use crate::state_transition::{StateTransitionLike, StateTransitionType}; use crate::version::FeatureVersion; @@ -39,6 +40,21 @@ impl StateTransitionLike for IdentityCreditWithdrawalTransition { } } + /// returns the fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + IdentityCreditWithdrawalTransition::V0(transition) => transition.user_fee_increase(), + } + } + /// set a fee multiplier + fn set_user_fee_increase(&mut self, fee_multiplier: UserFeeIncrease) { + match self { + IdentityCreditWithdrawalTransition::V0(transition) => { + transition.set_user_fee_increase(fee_multiplier) + } + } + } + fn set_signature_bytes(&mut self, signature: Vec) { match self { IdentityCreditWithdrawalTransition::V0(transition) => { @@ -52,4 +68,10 @@ impl StateTransitionLike for IdentityCreditWithdrawalTransition { IdentityCreditWithdrawalTransition::V0(transition) => transition.owner_id(), } } + + fn unique_identifiers(&self) -> Vec { + match self { + IdentityCreditWithdrawalTransition::V0(transition) => transition.unique_identifiers(), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/identity_signed.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/identity_signed.rs index 7207aa59e20..2c8011f2fd1 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/identity_signed.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/identity_signed.rs @@ -1,5 +1,5 @@ use crate::identity::SecurityLevel::CRITICAL; -use crate::identity::{KeyID, SecurityLevel}; +use crate::identity::{KeyID, Purpose, SecurityLevel}; use crate::state_transition::identity_credit_withdrawal_transition::v0::IdentityCreditWithdrawalTransitionV0; use crate::state_transition::StateTransitionIdentitySigned; @@ -16,4 +16,8 @@ impl StateTransitionIdentitySigned for IdentityCreditWithdrawalTransitionV0 { fn security_level_requirement(&self) -> Vec { vec![CRITICAL] } + + fn purpose_requirement(&self) -> Purpose { + Purpose::TRANSFER + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/mod.rs index 485801e5486..2a5246b9ab7 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/mod.rs @@ -3,22 +3,34 @@ mod identity_signed; mod json_conversion; mod state_transition_like; mod types; +mod v0_methods; #[cfg(feature = "state-transition-value-conversion")] mod value_conversion; mod version; use bincode::{Decode, Encode}; +use dashcore::transaction::special_transaction::asset_unlock::qualified_asset_unlock::ASSET_UNLOCK_TX_SIZE; use platform_serialization_derive::PlatformSignable; use platform_value::BinaryData; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; +use crate::balances::credits::CREDITS_PER_DUFF; +use crate::prelude::{IdentityNonce, UserFeeIncrease}; use crate::{ identity::{core_script::CoreScript, KeyID}, - prelude::{Identifier, Revision}, + prelude::Identifier, + withdrawal::Pooling, ProtocolError, }; -use crate::withdrawal::Pooling; +// TODO: unsafe - we must use actual relay fee from core +/// Minimal core per byte. Must be a fibonacci number +pub const MIN_CORE_FEE_PER_BYTE: u32 = 1; + +/// Minimal amount in credits (x1000) to avoid "dust" error in Core +pub const MIN_WITHDRAWAL_AMOUNT: u64 = + (ASSET_UNLOCK_TX_SIZE as u64) * (MIN_CORE_FEE_PER_BYTE as u64) * CREDITS_PER_DUFF; #[derive(Debug, Clone, Encode, Decode, PlatformSignable, PartialEq)] #[cfg_attr( @@ -33,7 +45,8 @@ pub struct IdentityCreditWithdrawalTransitionV0 { pub core_fee_per_byte: u32, pub pooling: Pooling, pub output_script: CoreScript, - pub revision: Revision, + pub nonce: IdentityNonce, + pub user_fee_increase: UserFeeIncrease, #[platform_signable(exclude_from_sig_hash)] pub signature_public_key_id: KeyID, #[platform_signable(exclude_from_sig_hash)] diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/state_transition_like.rs index 54f2ac1b7ab..b433e7f78bf 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/state_transition_like.rs @@ -1,5 +1,8 @@ +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use platform_value::BinaryData; +use crate::prelude::UserFeeIncrease; use crate::{ prelude::Identifier, state_transition::{StateTransitionLike, StateTransitionType}, @@ -50,4 +53,21 @@ impl StateTransitionLike for IdentityCreditWithdrawalTransitionV0 { fn owner_id(&self) -> Identifier { self.identity_id } + + /// We want things to be unique based on the nonce, so we don't add the transition type + fn unique_identifiers(&self) -> Vec { + vec![format!( + "{}-{:x}", + BASE64_STANDARD.encode(self.identity_id), + self.nonce + )] + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + self.user_fee_increase + } + + fn set_user_fee_increase(&mut self, fee_multiplier: UserFeeIncrease) { + self.user_fee_increase = fee_multiplier + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/v0_methods.rs new file mode 100644 index 00000000000..53200c82e9a --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/v0/v0_methods.rs @@ -0,0 +1,70 @@ +#[cfg(feature = "state-transition-signing")] +use crate::identity::accessors::IdentityGettersV0; +#[cfg(feature = "state-transition-signing")] +use crate::identity::core_script::CoreScript; +#[cfg(feature = "state-transition-signing")] +use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] +use crate::identity::{Identity, KeyType, Purpose, SecurityLevel}; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::{IdentityNonce, UserFeeIncrease}; +#[cfg(feature = "state-transition-signing")] +use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] +use platform_version::version::{FeatureVersion, PlatformVersion}; + +use crate::state_transition::identity_credit_withdrawal_transition::methods::IdentityCreditWithdrawalTransitionMethodsV0; +use crate::state_transition::identity_credit_withdrawal_transition::v0::IdentityCreditWithdrawalTransitionV0; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::{GetDataContractSecurityLevelRequirementFn, StateTransition}; +#[cfg(feature = "state-transition-signing")] +use crate::withdrawal::Pooling; + +impl IdentityCreditWithdrawalTransitionMethodsV0 for IdentityCreditWithdrawalTransitionV0 { + #[cfg(feature = "state-transition-signing")] + fn try_from_identity( + identity: &Identity, + output_script: CoreScript, + amount: u64, + pooling: Pooling, + core_fee_per_byte: u32, + user_fee_increase: UserFeeIncrease, + signer: S, + nonce: IdentityNonce, + _platform_version: &PlatformVersion, + _version: Option, + ) -> Result { + let mut transition: StateTransition = IdentityCreditWithdrawalTransitionV0 { + identity_id: identity.id(), + amount, + core_fee_per_byte, + pooling, + output_script, + nonce, + user_fee_increase, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let identity_public_key = identity + .get_first_public_key_matching( + Purpose::TRANSFER, + SecurityLevel::full_range().into(), + KeyType::all_key_types().into(), + ) + .ok_or( + ProtocolError::DesiredKeyWithTypePurposeSecurityLevelMissing( + "no withdrawal public key".to_string(), + ), + )?; + + transition.sign_external( + identity_public_key, + &signer, + None::, + )?; + + Ok(transition) + } +} diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/accessors/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/accessors/mod.rs index 2f9df88f1a2..41e8bfd9c53 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/accessors/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/accessors/mod.rs @@ -2,7 +2,6 @@ mod v0; pub use v0::*; -use crate::prelude::AssetLockProof; use crate::state_transition::identity_topup_transition::IdentityTopUpTransition; use platform_value::Identifier; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/fields.rs index 2b2b09ca236..2d7db38ece0 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/fields.rs @@ -1,7 +1,8 @@ use crate::state_transition::state_transitions; pub use state_transitions::common_fields::property_names::{ - ENTROPY, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, TRANSITION_TYPE, + IDENTITY_NONCE, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, + TRANSITION_TYPE, }; pub use state_transitions::identity::common_fields::property_names::{ ASSET_LOCK_PROOF, IDENTITY_ID, PUBLIC_KEYS, PUBLIC_KEYS_DATA, PUBLIC_KEYS_SIGNATURE, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/methods/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/methods/mod.rs index 43e807d321d..243117c2945 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/methods/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/methods/mod.rs @@ -2,38 +2,44 @@ mod v0; pub use v0::*; +#[cfg(feature = "state-transition-signing")] use crate::identity::Identity; -use crate::prelude::AssetLockProof; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::{AssetLockProof, UserFeeIncrease}; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::identity_topup_transition::v0::IdentityTopUpTransitionV0; use crate::state_transition::identity_topup_transition::IdentityTopUpTransition; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::StateTransition; +#[cfg(feature = "state-transition-signing")] use crate::version::FeatureVersion; -use crate::{BlsModule, ProtocolError}; +#[cfg(feature = "state-transition-signing")] +use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] use platform_version::version::PlatformVersion; impl IdentityTopUpTransitionMethodsV0 for IdentityTopUpTransition { #[cfg(feature = "state-transition-signing")] fn try_from_identity( - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, asset_lock_proof_private_key: &[u8], - bls: &impl BlsModule, + user_fee_increase: UserFeeIncrease, platform_version: &PlatformVersion, version: Option, ) -> Result { match version.unwrap_or( platform_version .dpp - .state_transition_serialization_versions - .identity_top_up_state_transition - .default_current_version, + .state_transition_conversion_versions + .identity_to_identity_top_up_transition, ) { 0 => Ok(IdentityTopUpTransitionV0::try_from_identity( identity, asset_lock_proof, asset_lock_proof_private_key, - bls, + user_fee_increase, platform_version, version, )?), diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/methods/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/methods/v0/mod.rs index 65328f50721..d314b9325a7 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/methods/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/methods/v0/mod.rs @@ -1,16 +1,22 @@ +#[cfg(feature = "state-transition-signing")] use crate::identity::Identity; -use crate::prelude::AssetLockProof; -use crate::state_transition::{StateTransition, StateTransitionType}; -use crate::{BlsModule, ProtocolError}; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::{AssetLockProof, UserFeeIncrease}; +#[cfg(feature = "state-transition-signing")] +use crate::state_transition::StateTransition; +use crate::state_transition::StateTransitionType; +#[cfg(feature = "state-transition-signing")] +use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] use platform_version::version::{FeatureVersion, PlatformVersion}; pub trait IdentityTopUpTransitionMethodsV0 { #[cfg(feature = "state-transition-signing")] fn try_from_identity( - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, asset_lock_proof_private_key: &[u8], - bls: &impl BlsModule, + user_fee_increase: UserFeeIncrease, platform_version: &PlatformVersion, version: Option, ) -> Result; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/mod.rs index 21f72678d8a..d336359e84c 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/mod.rs @@ -22,6 +22,7 @@ use derive_more::From; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, PlatformSignable}; use platform_version::version::PlatformVersion; use platform_versioning::PlatformVersioned; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; #[derive( diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/proved.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/proved.rs index 3d992128085..d664ee5ab91 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/proved.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/proved.rs @@ -1,8 +1,14 @@ -use crate::identity::state_transition::AssetLockProved; +use crate::identity::state_transition::{AssetLockProved, OptionallyAssetLockProved}; use crate::prelude::AssetLockProof; use crate::state_transition::identity_topup_transition::IdentityTopUpTransition; use crate::ProtocolError; +impl OptionallyAssetLockProved for IdentityTopUpTransition { + fn optional_asset_lock_proof(&self) -> Option<&AssetLockProof> { + Some(self.asset_lock_proof()) + } +} + impl AssetLockProved for IdentityTopUpTransition { fn set_asset_lock_proof( &mut self, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/state_transition_like.rs index 63bec1d429f..ced05743a77 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/state_transition_like.rs @@ -1,3 +1,4 @@ +use crate::prelude::UserFeeIncrease; use crate::state_transition::identity_topup_transition::IdentityTopUpTransition; use crate::state_transition::{StateTransitionLike, StateTransitionType}; use crate::version::FeatureVersion; @@ -41,9 +42,30 @@ impl StateTransitionLike for IdentityTopUpTransition { } } + /// returns the fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + IdentityTopUpTransition::V0(transition) => transition.user_fee_increase(), + } + } + /// set a fee multiplier + fn set_user_fee_increase(&mut self, fee_multiplier: UserFeeIncrease) { + match self { + IdentityTopUpTransition::V0(transition) => { + transition.set_user_fee_increase(fee_multiplier) + } + } + } + fn owner_id(&self) -> Identifier { match self { IdentityTopUpTransition::V0(transition) => transition.owner_id(), } } + + fn unique_identifiers(&self) -> Vec { + match self { + IdentityTopUpTransition::V0(transition) => transition.unique_identifiers(), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/mod.rs index f2bd2b06162..8541ad0e7b8 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/mod.rs @@ -13,11 +13,12 @@ use platform_serialization_derive::PlatformSignable; use platform_value::BinaryData; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; use crate::identity::state_transition::asset_lock_proof::AssetLockProof; -use crate::prelude::Identifier; +use crate::prelude::{Identifier, UserFeeIncrease}; use crate::ProtocolError; @@ -40,6 +41,7 @@ pub struct IdentityTopUpTransitionV0 { // Own ST fields pub asset_lock_proof: AssetLockProof, pub identity_id: Identifier, + pub user_fee_increase: UserFeeIncrease, #[platform_signable(exclude_from_sig_hash)] pub signature: BinaryData, } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/state_transition_like.rs index c1fee0d3a77..c0e84b249ea 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/state_transition_like.rs @@ -1,5 +1,8 @@ +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use platform_value::BinaryData; +use crate::prelude::UserFeeIncrease; use crate::state_transition::identity_topup_transition::IdentityTopUpTransition; use crate::{ prelude::Identifier, @@ -49,4 +52,28 @@ impl StateTransitionLike for IdentityTopUpTransitionV0 { fn owner_id(&self) -> Identifier { self.identity_id } + + /// We want transactions to be unique based on the asset lock proof, here there is a + /// conflict on purpose with identity create transitions + fn unique_identifiers(&self) -> Vec { + let identifier = self.asset_lock_proof.create_identifier(); + match identifier { + Ok(identifier) => { + vec![BASE64_STANDARD.encode(identifier)] + } + Err(_) => { + // no unique identifier, this won't actually occur on Platform + // as we ask for the unique identifier after validation + vec![String::default()] + } + } + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + self.user_fee_increase + } + + fn set_user_fee_increase(&mut self, fee_multiplier: UserFeeIncrease) { + self.user_fee_increase = fee_multiplier + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/v0_methods.rs index fb69de73202..da2b8f680b3 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/v0_methods.rs @@ -1,38 +1,52 @@ -use crate::{prelude::Identifier, BlsModule, ProtocolError}; - +#[cfg(feature = "state-transition-signing")] use crate::identity::accessors::IdentityGettersV0; +#[cfg(feature = "state-transition-signing")] use crate::identity::Identity; -use crate::identity::KeyType::ECDSA_HASH160; -use crate::prelude::AssetLockProof; +use crate::prelude::Identifier; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::{AssetLockProof, UserFeeIncrease}; +#[cfg(feature = "state-transition-signing")] +use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] +use dashcore::signer; use crate::state_transition::identity_topup_transition::accessors::IdentityTopUpTransitionAccessorsV0; use crate::state_transition::identity_topup_transition::methods::IdentityTopUpTransitionMethodsV0; +#[cfg(feature = "state-transition-signing")] +use crate::serialization::Signable; +#[cfg(feature = "state-transition-signing")] use platform_version::version::PlatformVersion; use crate::state_transition::identity_topup_transition::v0::IdentityTopUpTransitionV0; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::StateTransition; +#[cfg(feature = "state-transition-signing")] use crate::version::FeatureVersion; impl IdentityTopUpTransitionMethodsV0 for IdentityTopUpTransitionV0 { #[cfg(feature = "state-transition-signing")] fn try_from_identity( - identity: Identity, + identity: &Identity, asset_lock_proof: AssetLockProof, asset_lock_proof_private_key: &[u8], - bls: &impl BlsModule, + user_fee_increase: UserFeeIncrease, _platform_version: &PlatformVersion, _version: Option, ) -> Result { let identity_top_up_transition = IdentityTopUpTransitionV0 { asset_lock_proof, identity_id: identity.id(), + user_fee_increase, signature: Default::default(), }; let mut state_transition: StateTransition = identity_top_up_transition.into(); - state_transition.sign_by_private_key(asset_lock_proof_private_key, ECDSA_HASH160, bls)?; + let data = state_transition.signable_bytes()?; + + let signature = signer::sign(&data, asset_lock_proof_private_key)?; + state_transition.set_signature(signature.to_vec().into()); Ok(state_transition) } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/value_conversion.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/value_conversion.rs index d1dd35f4c4e..46ba75bd23a 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/value_conversion.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_topup_transition/v0/value_conversion.rs @@ -11,6 +11,7 @@ use crate::state_transition::identity_topup_transition::fields::*; use crate::state_transition::identity_topup_transition::v0::IdentityTopUpTransitionV0; use crate::state_transition::StateTransitionValueConvert; +use crate::state_transition::state_transitions::common_fields::property_names::USER_FEE_INCREASE; use platform_version::version::PlatformVersion; impl<'a> StateTransitionValueConvert<'a> for IdentityTopUpTransitionV0 { @@ -33,10 +34,16 @@ impl<'a> StateTransitionValueConvert<'a> for IdentityTopUpTransitionV0 { .map_err(ProtocolError::ValueError)?; let asset_lock_proof = AssetLockProof::try_from(raw_asset_lock_proof)?; + let user_fee_increase = raw_object + .get_optional_integer(USER_FEE_INCREASE) + .map_err(ProtocolError::ValueError)? + .unwrap_or_default(); + Ok(IdentityTopUpTransitionV0 { signature, identity_id, asset_lock_proof, + user_fee_increase, }) } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/accessors/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/accessors/mod.rs index 9225779e547..858f0ee423c 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/accessors/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/accessors/mod.rs @@ -1,7 +1,7 @@ mod v0; -use crate::identity::{KeyID, TimestampMillis}; -use crate::prelude::Revision; +use crate::identity::KeyID; +use crate::prelude::{IdentityNonce, Revision}; use crate::state_transition::identity_update_transition::IdentityUpdateTransition; use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; use platform_value::Identifier; @@ -32,6 +32,18 @@ impl IdentityUpdateTransitionAccessorsV0 for IdentityUpdateTransition { } } + fn set_nonce(&mut self, nonce: IdentityNonce) { + match self { + IdentityUpdateTransition::V0(transition) => transition.set_nonce(nonce), + } + } + + fn nonce(&self) -> IdentityNonce { + match self { + IdentityUpdateTransition::V0(transition) => transition.nonce(), + } + } + fn set_public_keys_to_add(&mut self, add_public_keys: Vec) { match self { IdentityUpdateTransition::V0(transition) => { @@ -66,20 +78,6 @@ impl IdentityUpdateTransitionAccessorsV0 for IdentityUpdateTransition { } } - fn set_public_keys_disabled_at(&mut self, public_keys_disabled_at: Option) { - match self { - IdentityUpdateTransition::V0(transition) => { - transition.set_public_keys_disabled_at(public_keys_disabled_at) - } - } - } - - fn public_keys_disabled_at(&self) -> Option { - match self { - IdentityUpdateTransition::V0(transition) => transition.public_keys_disabled_at(), - } - } - fn owner_id(&self) -> Identifier { match self { IdentityUpdateTransition::V0(transition) => transition.owner_id(), diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/accessors/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/accessors/v0/mod.rs index 8fece6aceb7..30a8daf5150 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/accessors/v0/mod.rs @@ -1,7 +1,8 @@ +use crate::prelude::IdentityNonce; use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; use crate::{ identity::KeyID, - prelude::{Identifier, Revision, TimestampMillis}, + prelude::{Identifier, Revision}, }; pub trait IdentityUpdateTransitionAccessorsV0 { @@ -9,12 +10,12 @@ pub trait IdentityUpdateTransitionAccessorsV0 { fn identity_id(&self) -> Identifier; fn set_revision(&mut self, revision: Revision); fn revision(&self) -> Revision; + fn set_nonce(&mut self, nonce: IdentityNonce); + fn nonce(&self) -> IdentityNonce; fn set_public_keys_to_add(&mut self, add_public_keys: Vec); fn public_keys_to_add(&self) -> &[IdentityPublicKeyInCreation]; fn public_keys_to_add_mut(&mut self) -> &mut [IdentityPublicKeyInCreation]; fn set_public_key_ids_to_disable(&mut self, disable_public_keys: Vec); fn public_key_ids_to_disable(&self) -> &[KeyID]; - fn set_public_keys_disabled_at(&mut self, public_keys_disabled_at: Option); - fn public_keys_disabled_at(&self) -> Option; fn owner_id(&self) -> Identifier; } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/fields.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/fields.rs index 673ff93b7d6..115e5cc3260 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/fields.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/fields.rs @@ -4,8 +4,8 @@ use crate::state_transition::identity_update_transition::fields::property_names: ADD_PUBLIC_KEYS_DATA, ADD_PUBLIC_KEYS_SIGNATURE, }; pub use state_transitions::common_fields::property_names::{ - ENTROPY, REVISION, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, STATE_TRANSITION_PROTOCOL_VERSION, - TRANSITION_TYPE, + IDENTITY_NONCE, REVISION, SIGNATURE, SIGNATURE_PUBLIC_KEY_ID, + STATE_TRANSITION_PROTOCOL_VERSION, TRANSITION_TYPE, }; pub use state_transitions::identity::common_fields::property_names::IDENTITY_ID; @@ -14,7 +14,6 @@ pub mod property_names { pub const ADD_PUBLIC_KEYS_SIGNATURE: &str = "addPublicKeys[].signature"; pub const ADD_PUBLIC_KEYS: &str = "addPublicKeys"; pub const DISABLE_PUBLIC_KEYS: &str = "disablePublicKeys"; - pub const PUBLIC_KEYS_DISABLED_AT: &str = "publicKeysDisabledAt"; } pub const IDENTIFIER_FIELDS: [&str; 1] = [IDENTITY_ID]; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/methods/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/methods/mod.rs index 7ec7c165a63..dc530225de4 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/methods/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/methods/mod.rs @@ -1,16 +1,25 @@ mod v0; pub use v0::*; +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] use crate::identity::{Identity, IdentityPublicKey, KeyID}; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::identity_update_transition::v0::IdentityUpdateTransitionV0; use crate::state_transition::identity_update_transition::IdentityUpdateTransition; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::StateTransition; +#[cfg(feature = "state-transition-signing")] use crate::version::FeatureVersion; +#[cfg(feature = "state-transition-signing")] use crate::ProtocolError; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::{IdentityNonce, UserFeeIncrease}; +#[cfg(feature = "state-transition-signing")] use platform_version::version::PlatformVersion; impl IdentityUpdateTransitionMethodsV0 for IdentityUpdateTransition { @@ -20,7 +29,8 @@ impl IdentityUpdateTransitionMethodsV0 for IdentityUpdateTransition { master_public_key_id: &KeyID, add_public_keys: Vec, disable_public_keys: Vec, - public_keys_disabled_at: Option, + nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, version: Option, @@ -37,7 +47,8 @@ impl IdentityUpdateTransitionMethodsV0 for IdentityUpdateTransition { master_public_key_id, add_public_keys, disable_public_keys, - public_keys_disabled_at, + nonce, + user_fee_increase, signer, platform_version, version, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/methods/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/methods/v0/mod.rs index b692416b593..338f5afc448 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/methods/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/methods/v0/mod.rs @@ -1,10 +1,18 @@ -use platform_version::version::PlatformVersion; - +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] use crate::identity::{Identity, IdentityPublicKey}; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::{IdentityNonce, UserFeeIncrease}; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::StateTransition; +use crate::state_transition::StateTransitionType; +#[cfg(feature = "state-transition-signing")] use crate::version::FeatureVersion; -use crate::{identity::KeyID, state_transition::StateTransitionType, ProtocolError}; +#[cfg(feature = "state-transition-signing")] +use crate::{identity::KeyID, ProtocolError}; +#[cfg(feature = "state-transition-signing")] +use platform_version::version::PlatformVersion; pub trait IdentityUpdateTransitionMethodsV0 { #[cfg(feature = "state-transition-signing")] @@ -13,7 +21,8 @@ pub trait IdentityUpdateTransitionMethodsV0 { master_public_key_id: &KeyID, add_public_keys: Vec, disable_public_keys: Vec, - public_keys_disabled_at: Option, + nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, platform_version: &PlatformVersion, version: Option, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/mod.rs index 0ef9d4c5d7e..c886979839f 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/mod.rs @@ -17,12 +17,14 @@ use crate::state_transition::identity_update_transition::v0::IdentityUpdateTrans use crate::state_transition::StateTransitionFieldTypes; use fields::*; +use crate::identity::state_transition::OptionallyAssetLockProved; use crate::ProtocolError; use bincode::{Decode, Encode}; use derive_more::From; use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize, PlatformSignable}; use platform_version::version::PlatformVersion; use platform_versioning::PlatformVersioned; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; #[derive( @@ -70,6 +72,8 @@ impl IdentityUpdateTransition { } } +impl OptionallyAssetLockProved for IdentityUpdateTransition {} + impl StateTransitionFieldTypes for IdentityUpdateTransition { fn binary_property_paths() -> Vec<&'static str> { vec![SIGNATURE, ADD_PUBLIC_KEYS_SIGNATURE] diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/state_transition_like.rs index 09084cf474d..ccd82e9af96 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/state_transition_like.rs @@ -1,3 +1,4 @@ +use crate::prelude::UserFeeIncrease; use crate::state_transition::identity_update_transition::IdentityUpdateTransition; use crate::state_transition::{StateTransitionLike, StateTransitionType}; use crate::version::FeatureVersion; @@ -41,9 +42,30 @@ impl StateTransitionLike for IdentityUpdateTransition { } } + /// returns the fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease { + match self { + IdentityUpdateTransition::V0(transition) => transition.user_fee_increase(), + } + } + /// set a fee multiplier + fn set_user_fee_increase(&mut self, fee_multiplier: UserFeeIncrease) { + match self { + IdentityUpdateTransition::V0(transition) => { + transition.set_user_fee_increase(fee_multiplier) + } + } + } + fn owner_id(&self) -> Identifier { match self { IdentityUpdateTransition::V0(transition) => transition.owner_id(), } } + + fn unique_identifiers(&self) -> Vec { + match self { + IdentityUpdateTransition::V0(transition) => transition.unique_identifiers(), + } + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/json_conversion.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/json_conversion.rs index 57959d7983f..1a0fe9b27d4 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/json_conversion.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/json_conversion.rs @@ -15,6 +15,7 @@ mod test { }; use crate::tests::fixtures::identity_v0_fixture; use crate::tests::utils::generate_random_identifier_struct; + use assert_matches::assert_matches; use platform_value::BinaryData; use serde_json::Value as JsonValue; @@ -25,9 +26,10 @@ mod test { let transition: IdentityUpdateTransition = IdentityUpdateTransitionV0 { identity_id: generate_random_identifier_struct(), revision: 0, + nonce: 1, add_public_keys: vec![public_key.into()], disable_public_keys: vec![], - public_keys_disabled_at: None, + user_fee_increase: 0, signature_public_key_id: 0, signature: BinaryData::new(buffer.to_vec()), } @@ -39,11 +41,8 @@ mod test { into_validating_json: false, }) .expect("conversion to json shouldn't fail"); - assert!(matches!(result[IDENTITY_ID], JsonValue::String(_))); - assert!(matches!(result[SIGNATURE], JsonValue::String(_))); - assert!(matches!( - result[ADD_PUBLIC_KEYS][0]["data"], - JsonValue::String(_) - )); + assert_matches!(result[IDENTITY_ID], JsonValue::String(_)); + assert_matches!(result[SIGNATURE], JsonValue::String(_)); + assert_matches!(result[ADD_PUBLIC_KEYS][0]["data"], JsonValue::String(_)); } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/mod.rs index 6cd7af74de0..55fb52ba7f5 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/mod.rs @@ -11,6 +11,7 @@ mod version; use bincode::{Decode, Encode}; use platform_serialization_derive::PlatformSignable; use platform_value::{BinaryData, Value}; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; use std::convert::{TryFrom, TryInto}; @@ -18,9 +19,10 @@ use std::convert::{TryFrom, TryInto}; use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreationSignable; +use crate::prelude::{IdentityNonce, UserFeeIncrease}; use crate::{ identity::KeyID, - prelude::{Identifier, Revision, TimestampMillis}, + prelude::{Identifier, Revision}, ProtocolError, }; @@ -39,9 +41,12 @@ pub struct IdentityUpdateTransitionV0 { /// Unique identifier of the identity to be updated pub identity_id: Identifier, - /// Identity Update revision number + /// The revision of the identity after update pub revision: Revision, + /// Identity nonce for this transition to prevent replay attacks + pub nonce: IdentityNonce, + /// Public Keys to add to the Identity /// we want to skip serialization of transitions, as we does it manually in `to_object()` and `to_json()` #[cfg_attr(feature = "state-transition-serde-conversion", serde(default))] @@ -52,8 +57,8 @@ pub struct IdentityUpdateTransitionV0 { #[cfg_attr(feature = "state-transition-serde-conversion", serde(default))] pub disable_public_keys: Vec, - /// Timestamp when keys were disabled - pub public_keys_disabled_at: Option, + /// The fee multiplier + pub user_fee_increase: UserFeeIncrease, /// The ID of the public key used to sing the State Transition #[platform_signable(exclude_from_sig_hash)] diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/state_transition_like.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/state_transition_like.rs index e44568fff41..0b5f4090805 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/state_transition_like.rs @@ -1,5 +1,8 @@ +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use platform_value::BinaryData; +use crate::prelude::UserFeeIncrease; use crate::{ prelude::Identifier, state_transition::{StateTransitionLike, StateTransitionType}, @@ -49,4 +52,21 @@ impl StateTransitionLike for IdentityUpdateTransitionV0 { fn owner_id(&self) -> Identifier { self.identity_id } + + /// We want things to be unique based on the nonce, so we don't add the transition type + fn unique_identifiers(&self) -> Vec { + vec![format!( + "{}-{:x}", + BASE64_STANDARD.encode(self.identity_id), + self.nonce + )] + } + + fn user_fee_increase(&self) -> UserFeeIncrease { + self.user_fee_increase + } + + fn set_user_fee_increase(&mut self, fee_multiplier: UserFeeIncrease) { + self.user_fee_increase = fee_multiplier + } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/v0_methods.rs index 8f46eb0b5f1..26af0304de5 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/v0_methods.rs @@ -1,29 +1,43 @@ +#[cfg(feature = "state-transition-signing")] use crate::serialization::Signable; +#[cfg(feature = "state-transition-signing")] use platform_version::version::PlatformVersion; +#[cfg(feature = "state-transition-signing")] use crate::consensus::signature::{ InvalidSignaturePublicKeySecurityLevelError, MissingPublicKeyError, SignatureError, }; +#[cfg(feature = "state-transition-signing")] use crate::consensus::ConsensusError; +#[cfg(feature = "state-transition-signing")] use crate::identity::signer::Signer; +#[cfg(feature = "state-transition-signing")] use crate::identity::{Identity, IdentityPublicKey}; +#[cfg(feature = "state-transition-signing")] use crate::identity::accessors::IdentityGettersV0; +#[cfg(feature = "state-transition-signing")] use crate::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; +use crate::prelude::IdentityNonce; +#[cfg(feature = "state-transition-signing")] +use crate::prelude::UserFeeIncrease; use crate::state_transition::identity_update_transition::accessors::IdentityUpdateTransitionAccessorsV0; use crate::state_transition::identity_update_transition::methods::IdentityUpdateTransitionMethodsV0; use crate::state_transition::identity_update_transition::v0::IdentityUpdateTransitionV0; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::public_key_in_creation::accessors::IdentityPublicKeyInCreationV0Setters; use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; +#[cfg(feature = "state-transition-signing")] use crate::state_transition::{GetDataContractSecurityLevelRequirementFn, StateTransition}; +#[cfg(feature = "state-transition-signing")] use crate::version::FeatureVersion; use crate::{ - identity::{KeyID, SecurityLevel}, - prelude::{Identifier, Revision, TimestampMillis}, - ProtocolError, + identity::KeyID, + prelude::{Identifier, Revision}, }; - +#[cfg(feature = "state-transition-signing")] +use crate::{identity::SecurityLevel, ProtocolError}; impl IdentityUpdateTransitionMethodsV0 for IdentityUpdateTransitionV0 { #[cfg(feature = "state-transition-signing")] fn try_from_identity_with_signer<'a, S: Signer>( @@ -31,7 +45,8 @@ impl IdentityUpdateTransitionMethodsV0 for IdentityUpdateTransitionV0 { master_public_key_id: &KeyID, add_public_keys: Vec, disable_public_keys: Vec, - public_keys_disabled_at: Option, + nonce: IdentityNonce, + user_fee_increase: UserFeeIncrease, signer: &S, _platform_version: &PlatformVersion, _version: Option, @@ -46,9 +61,10 @@ impl IdentityUpdateTransitionMethodsV0 for IdentityUpdateTransitionV0 { signature_public_key_id: 0, identity_id: identity.id(), revision: identity.revision(), + nonce, add_public_keys: add_public_keys_in_creation, disable_public_keys, - public_keys_disabled_at, + user_fee_increase, }; let state_transition: StateTransition = identity_update_transition.clone().into(); @@ -114,6 +130,14 @@ impl IdentityUpdateTransitionAccessorsV0 for IdentityUpdateTransitionV0 { self.revision } + fn set_nonce(&mut self, nonce: IdentityNonce) { + self.nonce = nonce; + } + + fn nonce(&self) -> IdentityNonce { + self.nonce + } + fn set_public_keys_to_add(&mut self, add_public_keys: Vec) { self.add_public_keys = add_public_keys; } @@ -134,14 +158,6 @@ impl IdentityUpdateTransitionAccessorsV0 for IdentityUpdateTransitionV0 { &self.disable_public_keys } - fn set_public_keys_disabled_at(&mut self, public_keys_disabled_at: Option) { - self.public_keys_disabled_at = public_keys_disabled_at; - } - - fn public_keys_disabled_at(&self) -> Option { - self.public_keys_disabled_at - } - fn owner_id(&self) -> Identifier { self.identity_id } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/value_conversion.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/value_conversion.rs index de82f22067b..67c42289be7 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/value_conversion.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_update_transition/v0/value_conversion.rs @@ -9,6 +9,9 @@ use crate::state_transition::identity_update_transition::v0::{ use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; use crate::state_transition::StateTransitionValueConvert; +use crate::state_transition::state_transitions::common_fields::property_names::{ + NONCE, USER_FEE_INCREASE, +}; use platform_version::version::PlatformVersion; impl<'a> StateTransitionValueConvert<'a> for IdentityUpdateTransitionV0 { @@ -29,6 +32,13 @@ impl<'a> StateTransitionValueConvert<'a> for IdentityUpdateTransitionV0 { let revision = raw_object .get_integer(REVISION) .map_err(ProtocolError::ValueError)?; + let nonce = raw_object + .get_integer(NONCE) + .map_err(ProtocolError::ValueError)?; + let user_fee_increase = raw_object + .get_optional_integer(USER_FEE_INCREASE) + .map_err(ProtocolError::ValueError)? + .unwrap_or_default(); let add_public_keys = raw_object .remove_optional_array(property_names::ADD_PUBLIC_KEYS) .map_err(ProtocolError::ValueError)? @@ -38,18 +48,16 @@ impl<'a> StateTransitionValueConvert<'a> for IdentityUpdateTransitionV0 { .collect::, ProtocolError>>()?; let disable_public_keys = remove_integer_list_or_default(&mut raw_object, property_names::DISABLE_PUBLIC_KEYS)?; - let public_keys_disabled_at = raw_object - .remove_optional_integer(property_names::PUBLIC_KEYS_DISABLED_AT) - .map_err(ProtocolError::ValueError)?; Ok(IdentityUpdateTransitionV0 { signature, signature_public_key_id, identity_id, revision, + nonce, add_public_keys, disable_public_keys, - public_keys_disabled_at, + user_fee_increase, }) } @@ -108,8 +116,6 @@ impl<'a> StateTransitionValueConvert<'a> for IdentityUpdateTransitionV0 { value.remove_optional_value_if_empty_array(property_names::DISABLE_PUBLIC_KEYS)?; - value.remove_optional_value_if_null(property_names::PUBLIC_KEYS_DISABLED_AT)?; - Ok(value) } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/accessors.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/accessors.rs index 6e43c60aeb6..9be50be2d67 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/accessors.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/accessors.rs @@ -40,6 +40,8 @@ pub trait IdentityPublicKeyInCreationV0Setters { fn set_security_level(&mut self, security_level: SecurityLevel); + fn set_contract_bounds(&mut self, contract_bounds: Option); + fn set_read_only(&mut self, read_only: bool); } @@ -80,6 +82,12 @@ impl IdentityPublicKeyInCreationV0Setters for IdentityPublicKeyInCreation { } } + fn set_contract_bounds(&mut self, contract_bounds: Option) { + match self { + IdentityPublicKeyInCreation::V0(v0) => v0.contract_bounds = contract_bounds, + } + } + fn set_read_only(&mut self, read_only: bool) { match self { IdentityPublicKeyInCreation::V0(v0) => v0.read_only = read_only, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/duplicated_key_ids_witness/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/duplicated_key_ids_witness/v0/mod.rs index 8e79c3037f3..2c8d2fcaa48 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/duplicated_key_ids_witness/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/duplicated_key_ids_witness/v0/mod.rs @@ -5,6 +5,7 @@ use std::collections::HashMap; impl IdentityPublicKeyInCreation { /// Find duplicate key ids + #[inline(always)] pub(super) fn duplicated_key_ids_witness_v0( public_keys: &[IdentityPublicKeyInCreation], ) -> Vec { diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/duplicated_keys_witness/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/duplicated_keys_witness/v0/mod.rs index 0d180f6121e..99ee267e7ad 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/duplicated_keys_witness/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/duplicated_keys_witness/v0/mod.rs @@ -4,6 +4,7 @@ use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation use std::collections::HashMap; impl IdentityPublicKeyInCreation { + #[inline(always)] pub(super) fn duplicated_keys_witness_v0( public_keys: &[IdentityPublicKeyInCreation], ) -> Vec { diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/from_public_key_signed_with_private_key/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/from_public_key_signed_with_private_key/v0/mod.rs index 99fbe9a9581..9aa0eea8632 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/from_public_key_signed_with_private_key/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/from_public_key_signed_with_private_key/v0/mod.rs @@ -6,6 +6,7 @@ use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation use crate::{BlsModule, ProtocolError}; impl IdentityPublicKeyInCreation { + #[inline(always)] pub(super) fn from_public_key_signed_with_private_key_v0( public_key: IdentityPublicKey, state_transition_bytes: &[u8], diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/hash/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/hash/mod.rs index 697425d22f7..69e746b3661 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/hash/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/hash/mod.rs @@ -2,18 +2,17 @@ mod v0; use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; use crate::ProtocolError; -use platform_version::version::PlatformVersion; impl IdentityPublicKeyInCreation { pub fn hash(&self) -> Result<[u8; 20], ProtocolError> { match self { - IdentityPublicKeyInCreation::V0(v0) => self.hash_v0(), + IdentityPublicKeyInCreation::V0(_v0) => self.hash_v0(), } } pub fn hash_as_vec(&self) -> Result, ProtocolError> { match self { - IdentityPublicKeyInCreation::V0(v0) => self.hash_v0().map(|hash| hash.to_vec()), + IdentityPublicKeyInCreation::V0(_v0) => self.hash_v0().map(|hash| hash.to_vec()), } } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/hash/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/hash/v0/mod.rs index 1892b3be624..deb51c0f7a3 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/hash/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/hash/v0/mod.rs @@ -2,18 +2,11 @@ use crate::identity::identity_public_key::methods::hash::IdentityPublicKeyHashMe use crate::identity::IdentityPublicKey; use crate::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; use crate::ProtocolError; -use std::convert::TryInto; impl IdentityPublicKeyInCreation { /// Get the original public key hash + #[inline(always)] pub(super) fn hash_v0(&self) -> Result<[u8; 20], ProtocolError> { - Into::::into(self.clone()) - .hash()? - .try_into() - .map_err(|_| { - ProtocolError::CorruptedCodeExecution( - "hash should always output 20 bytes".to_string(), - ) - }) + Into::::into(self.clone()).hash() } } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/validate_identity_public_keys_structure/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/validate_identity_public_keys_structure/mod.rs index f186a2e424d..e002fffb270 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/validate_identity_public_keys_structure/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/validate_identity_public_keys_structure/mod.rs @@ -8,6 +8,7 @@ pub mod v0; impl IdentityPublicKeyInCreation { pub fn validate_identity_public_keys_structure( identity_public_keys_with_witness: &[IdentityPublicKeyInCreation], + in_create_identity: bool, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -18,6 +19,7 @@ impl IdentityPublicKeyInCreation { { 0 => Self::validate_identity_public_keys_structure_v0( identity_public_keys_with_witness, + in_create_identity, platform_version, ), version => Err(ProtocolError::UnknownVersionMismatch { diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/validate_identity_public_keys_structure/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/validate_identity_public_keys_structure/v0/mod.rs index 5c54f71e172..81b489092b5 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/validate_identity_public_keys_structure/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/validate_identity_public_keys_structure/v0/mod.rs @@ -1,11 +1,12 @@ use crate::consensus::basic::identity::{ - DuplicatedIdentityPublicKeyIdBasicError, InvalidIdentityPublicKeySecurityLevelError, + DuplicatedIdentityPublicKeyBasicError, DuplicatedIdentityPublicKeyIdBasicError, + InvalidIdentityPublicKeySecurityLevelError, MissingMasterPublicKeyError, + TooManyMasterPublicKeyError, }; use crate::consensus::basic::BasicError; use lazy_static::lazy_static; use std::collections::HashMap; -use crate::consensus::state::identity::duplicated_identity_public_key_state_error::DuplicatedIdentityPublicKeyStateError; use crate::consensus::state::identity::max_identity_public_key_limit_reached_error::MaxIdentityPublicKeyLimitReachedError; use crate::consensus::state::state_error::StateError; @@ -17,8 +18,6 @@ use crate::validation::SimpleConsensusValidationResult; use crate::ProtocolError; use platform_version::version::PlatformVersion; -const MAX_PUBLIC_KEYS: usize = 10; - lazy_static! { static ref ALLOWED_SECURITY_LEVELS: HashMap> = { let mut m = HashMap::new(); @@ -33,7 +32,7 @@ lazy_static! { ); m.insert(Purpose::ENCRYPTION, vec![SecurityLevel::MEDIUM]); m.insert(Purpose::DECRYPTION, vec![SecurityLevel::MEDIUM]); - m.insert(Purpose::WITHDRAW, vec![SecurityLevel::CRITICAL]); + m.insert(Purpose::TRANSFER, vec![SecurityLevel::CRITICAL]); m }; } @@ -41,14 +40,28 @@ impl IdentityPublicKeyInCreation { /// This validation will validate the count of new keys, that there are no duplicates either by /// id or by data. This is done before signature and state validation to remove potential /// attack vectors. + #[inline(always)] pub(super) fn validate_identity_public_keys_structure_v0( identity_public_keys_with_witness: &[IdentityPublicKeyInCreation], + in_create_identity: bool, platform_version: &PlatformVersion, ) -> Result { - if identity_public_keys_with_witness.len() > MAX_PUBLIC_KEYS { + if identity_public_keys_with_witness.len() + > platform_version + .dpp + .state_transitions + .identities + .max_public_keys_in_creation as usize + { return Ok(SimpleConsensusValidationResult::new_with_error( StateError::MaxIdentityPublicKeyLimitReachedError( - MaxIdentityPublicKeyLimitReachedError::new(MAX_PUBLIC_KEYS), + MaxIdentityPublicKeyLimitReachedError::new( + platform_version + .dpp + .state_transitions + .identities + .max_public_keys_in_creation as usize, + ), ) .into(), )); @@ -75,13 +88,33 @@ impl IdentityPublicKeyInCreation { )?; if !duplicated_key_ids.is_empty() { return Ok(SimpleConsensusValidationResult::new_with_error( - StateError::DuplicatedIdentityPublicKeyStateError( - DuplicatedIdentityPublicKeyStateError::new(duplicated_key_ids), + BasicError::DuplicatedIdentityPublicKeyBasicError( + DuplicatedIdentityPublicKeyBasicError::new(duplicated_key_ids), ) .into(), )); } + if in_create_identity { + // We should check that we are only adding one master authentication key + + let master_key_count = identity_public_keys_with_witness + .iter() + .filter(|key| key.security_level() == SecurityLevel::MASTER) + .count(); + if master_key_count == 0 { + return Ok(SimpleConsensusValidationResult::new_with_error( + BasicError::MissingMasterPublicKeyError(MissingMasterPublicKeyError::new()) + .into(), + )); + } else if master_key_count > 1 { + return Ok(SimpleConsensusValidationResult::new_with_error( + BasicError::TooManyMasterPublicKeyError(TooManyMasterPublicKeyError::new()) + .into(), + )); + } + } + // We should check all the security levels let validation_errors = identity_public_keys_with_witness .iter() diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/mod.rs index 93f9d4f3762..63bd4949c68 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/mod.rs @@ -7,6 +7,7 @@ use derive_more::From; use platform_serialization_derive::PlatformSignable; use platform_version::version::PlatformVersion; +#[cfg(feature = "state-transition-serde-conversion")] use serde::{Deserialize, Serialize}; pub mod accessors; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/v0/mod.rs index 1b9e9c2e0e6..8170f2a7b2a 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/v0/mod.rs @@ -103,6 +103,10 @@ impl IdentityPublicKeyInCreationV0Setters for IdentityPublicKeyInCreationV0 { self.security_level = security_level; } + fn set_contract_bounds(&mut self, contract_bounds: Option) { + self.contract_bounds = contract_bounds; + } + fn set_purpose(&mut self, purpose: Purpose) { self.purpose = purpose; } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/mod.rs index 92b259f4950..7de5b5a368b 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/mod.rs @@ -2,6 +2,7 @@ mod common_fields; mod contract; pub(crate) mod document; pub mod identity; +pub mod signable_bytes_hasher; pub use contract::*; pub use document::*; diff --git a/packages/rs-dpp/src/state_transition/state_transitions/signable_bytes_hasher.rs b/packages/rs-dpp/src/state_transition/state_transitions/signable_bytes_hasher.rs new file mode 100644 index 00000000000..d644279e58c --- /dev/null +++ b/packages/rs-dpp/src/state_transition/state_transitions/signable_bytes_hasher.rs @@ -0,0 +1,48 @@ +use crate::util::hash::hash_double; +use platform_value::Bytes32; + +/// This is a structure to hash signable bytes when we are not sure if we will need the hashing +#[derive(Debug, Clone)] +pub enum SignableBytesHasher { + Bytes(Vec), + PreHashed(Bytes32), +} + +impl SignableBytesHasher { + pub fn into_hashed_bytes(self) -> Bytes32 { + match self { + SignableBytesHasher::Bytes(signable_bytes) => hash_double(signable_bytes).into(), + SignableBytesHasher::PreHashed(pre_hashed) => pre_hashed, + } + } + + pub fn to_hashed_bytes(&self) -> Bytes32 { + match self { + SignableBytesHasher::Bytes(signable_bytes) => hash_double(signable_bytes).into(), + SignableBytesHasher::PreHashed(pre_hashed) => *pre_hashed, + } + } + + pub fn hash_bytes(&mut self) -> Bytes32 { + match self { + SignableBytesHasher::Bytes(signable_bytes) => { + let bytes_32: Bytes32 = hash_double(signable_bytes).into(); + *self = SignableBytesHasher::PreHashed(bytes_32); + bytes_32 + } + SignableBytesHasher::PreHashed(pre_hashed) => *pre_hashed, + } + } + + pub fn hash_bytes_and_check_if_vec_contains(&mut self, vec: &[Bytes32]) -> bool { + match self { + SignableBytesHasher::Bytes(signable_bytes) => { + let bytes_32: Bytes32 = hash_double(signable_bytes).into(); + let contains = vec.contains(&bytes_32); + *self = SignableBytesHasher::PreHashed(bytes_32); + contains + } + SignableBytesHasher::PreHashed(pre_hashed) => vec.contains(pre_hashed), + } + } +} diff --git a/packages/rs-dpp/src/state_transition/traits/state_transition_identity_signed.rs b/packages/rs-dpp/src/state_transition/traits/state_transition_identity_signed.rs index 4b19b3cda40..c81029a7fe1 100644 --- a/packages/rs-dpp/src/state_transition/traits/state_transition_identity_signed.rs +++ b/packages/rs-dpp/src/state_transition/traits/state_transition_identity_signed.rs @@ -1,18 +1,31 @@ -use anyhow::anyhow; -use dashcore::secp256k1::{PublicKey as RawPublicKey, SecretKey as RawSecretKey}; - +#[cfg(any( + feature = "state-transition-signing", + feature = "state-transition-validation" +))] use crate::consensus::signature::{ InvalidSignaturePublicKeySecurityLevelError, PublicKeyIsDisabledError, }; +use anyhow::anyhow; +use dashcore::secp256k1::{PublicKey as RawPublicKey, SecretKey as RawSecretKey}; #[cfg(feature = "state-transition-validation")] use crate::state_transition::errors::WrongPublicKeyPurposeError; +#[cfg(any( + feature = "state-transition-signing", + feature = "state-transition-validation" +))] use crate::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use crate::state_transition::StateTransitionLike; +#[cfg(any( + feature = "state-transition-signing", + feature = "state-transition-validation" +))] +use crate::identity::IdentityPublicKey; +use crate::identity::Purpose; use crate::{ - identity::{IdentityPublicKey, KeyID, Purpose, SecurityLevel}, + identity::{KeyID, SecurityLevel}, prelude::*, }; @@ -45,9 +58,9 @@ pub trait StateTransitionIdentitySigned: StateTransitionLike { )); } - if public_key.purpose() != Purpose::AUTHENTICATION { + if public_key.purpose() != self.purpose_requirement() { return Err(ProtocolError::WrongPublicKeyPurposeError( - WrongPublicKeyPurposeError::new(public_key.purpose(), Purpose::AUTHENTICATION), + WrongPublicKeyPurposeError::new(public_key.purpose(), self.purpose_requirement()), )); } Ok(()) @@ -73,6 +86,13 @@ pub trait StateTransitionIdentitySigned: StateTransitionLike { /// Returns minimal key security level that can be used to sign this ST. /// Override this method if the ST requires a different security level. fn security_level_requirement(&self) -> Vec; + + /// The purpose requirement for the signing key + /// The default is authentication + /// However for Withdrawals and Fund Transfers the requirement is TRANSFER + fn purpose_requirement(&self) -> Purpose { + Purpose::AUTHENTICATION + } } pub fn get_compressed_public_ec_key(private_key: &[u8]) -> Result<[u8; 33], ProtocolError> { diff --git a/packages/rs-dpp/src/state_transition/traits/state_transition_like.rs b/packages/rs-dpp/src/state_transition/traits/state_transition_like.rs index 28d53f16dc7..a1d78449bee 100644 --- a/packages/rs-dpp/src/state_transition/traits/state_transition_like.rs +++ b/packages/rs-dpp/src/state_transition/traits/state_transition_like.rs @@ -2,7 +2,7 @@ use std::fmt::Debug; use platform_value::BinaryData; -use crate::prelude::Identifier; +use crate::prelude::{Identifier, UserFeeIncrease}; use crate::version::FeatureVersion; use crate::state_transition::StateTransitionType; @@ -11,11 +11,12 @@ use crate::state_transition::{StateTransition, StateTransitionFieldTypes}; pub const DOCUMENT_TRANSITION_TYPES: [StateTransitionType; 1] = [StateTransitionType::DocumentsBatch]; -pub const IDENTITY_TRANSITION_TYPE: [StateTransitionType; 4] = [ +pub const IDENTITY_TRANSITION_TYPE: [StateTransitionType; 5] = [ StateTransitionType::IdentityCreate, StateTransitionType::IdentityTopUp, StateTransitionType::IdentityUpdate, StateTransitionType::IdentityCreditTransfer, + StateTransitionType::IdentityCreditWithdrawal, ]; pub const DATA_CONTRACT_TRANSITION_TYPES: [StateTransitionType; 2] = [ @@ -36,6 +37,10 @@ pub trait StateTransitionLike: fn signature(&self) -> &BinaryData; /// set a new signature fn set_signature(&mut self, signature: BinaryData); + /// returns the fee multiplier + fn user_fee_increase(&self) -> UserFeeIncrease; + /// set a fee multiplier + fn set_user_fee_increase(&mut self, fee_multiplier: UserFeeIncrease); /// get modified ids list fn modified_data_ids(&self) -> Vec; @@ -56,4 +61,8 @@ pub trait StateTransitionLike: /// Get owner ID fn owner_id(&self) -> Identifier; + + /// unique identifiers for the state transition + /// This is often only one String except in the case of a documents batch state transition + fn unique_identifiers(&self) -> Vec; } diff --git a/packages/rs-dpp/src/system_data_contracts.rs b/packages/rs-dpp/src/system_data_contracts.rs index 7857cf112a1..dab3df0c552 100644 --- a/packages/rs-dpp/src/system_data_contracts.rs +++ b/packages/rs-dpp/src/system_data_contracts.rs @@ -5,18 +5,21 @@ use std::collections::{BTreeMap, BTreeSet}; use crate::data_contract::accessors::v0::DataContractV0Setters; pub use data_contracts::*; +use platform_version::version::PlatformVersion; fn create_data_contract( factory: &DataContractFactory, system_contract: SystemDataContract, + platform_version: &PlatformVersion, ) -> Result { let DataContractSource { id_bytes, owner_id_bytes, + version, definitions, document_schemas, } = system_contract - .source() + .source(platform_version) .map_err(|e| ProtocolError::Generic(e.to_string()))?; let id = Identifier::from(id_bytes); @@ -24,35 +27,37 @@ fn create_data_contract( let mut data_contract = factory.create_with_value_config( owner_id, + 0, document_schemas.into(), None, definitions.map(|def| def.into()), )?; data_contract.data_contract_mut().set_id(id); + data_contract.data_contract_mut().set_version(version); Ok(data_contract.data_contract_owned()) } pub fn load_system_data_contract( system_contract: SystemDataContract, - protocol_version: u32, + platform_version: &PlatformVersion, ) -> Result { - let factory = DataContractFactory::new(protocol_version, None)?; + let factory = DataContractFactory::new(platform_version.protocol_version)?; - create_data_contract(&factory, system_contract) + create_data_contract(&factory, system_contract, platform_version) } pub fn load_system_data_contracts( system_contracts: BTreeSet, - protocol_version: u32, + platform_version: &PlatformVersion, ) -> Result, ProtocolError> { - let factory = DataContractFactory::new(protocol_version, None)?; + let factory = DataContractFactory::new(platform_version.protocol_version)?; system_contracts .into_iter() .map(|system_contract| { - let data_contract = create_data_contract(&factory, system_contract)?; + let data_contract = create_data_contract(&factory, system_contract, platform_version)?; Ok((system_contract, data_contract)) }) diff --git a/packages/rs-dpp/src/tests/fixtures/get_dashpay_contract_fixture.rs b/packages/rs-dpp/src/tests/fixtures/get_dashpay_contract_fixture.rs index 078d486e86e..5a0320c2089 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_dashpay_contract_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_dashpay_contract_fixture.rs @@ -4,21 +4,26 @@ use crate::{ }; use crate::data_contract::created_data_contract::CreatedDataContract; +use crate::prelude::IdentityNonce; use data_contracts::SystemDataContract; +use platform_version::version::PlatformVersion; pub fn get_dashpay_contract_fixture( owner_id: Option, + identity_nonce: IdentityNonce, protocol_version: u32, ) -> CreatedDataContract { - let factory = - DataContractFactory::new(protocol_version, None).expect("expected to create factory"); - let dpns_schema = SystemDataContract::Dashpay - .source() + let factory = DataContractFactory::new(protocol_version).expect("expected to create factory"); + + let platform_version = PlatformVersion::get(protocol_version).expect("expected to get version"); + + let dashpay_schema = SystemDataContract::Dashpay + .source(platform_version) .expect("DPNS contract must be defined") .document_schemas; let owner_id = owner_id.unwrap_or_else(generate_random_identifier_struct); factory - .create_with_value_config(owner_id, dpns_schema.into(), None, None) + .create_with_value_config(owner_id, identity_nonce, dashpay_schema.into(), None, None) .expect("data in fixture should be correct") } diff --git a/packages/rs-dpp/src/tests/fixtures/get_dashpay_contract_with_generalized_encryption_key_fixture.rs b/packages/rs-dpp/src/tests/fixtures/get_dashpay_contract_with_generalized_encryption_key_fixture.rs index 61d3ac61732..f018d69a588 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_dashpay_contract_with_generalized_encryption_key_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_dashpay_contract_with_generalized_encryption_key_fixture.rs @@ -6,16 +6,21 @@ use crate::{ use crate::data_contract::config::v0::DataContractConfigV0; use crate::data_contract::created_data_contract::CreatedDataContract; use crate::data_contract::storage_requirements::keys_for_document_type::StorageKeyRequirements; +use crate::prelude::IdentityNonce; use data_contracts::SystemDataContract; +use platform_version::version::PlatformVersion; pub fn get_dashpay_contract_with_generalized_encryption_key_fixture( owner_id: Option, + identity_nonce: IdentityNonce, protocol_version: u32, ) -> CreatedDataContract { - let factory = - DataContractFactory::new(protocol_version, None).expect("expected to create factory"); + let factory = DataContractFactory::new(protocol_version).expect("expected to create factory"); + + let platform_version = PlatformVersion::get(protocol_version).expect("expected to get version"); + let dpns_schema = SystemDataContract::Dashpay - .source() + .source(platform_version) .expect("DPNS contract must be defined") .document_schemas; let owner_id = owner_id.unwrap_or_else(generate_random_identifier_struct); @@ -23,6 +28,7 @@ pub fn get_dashpay_contract_with_generalized_encryption_key_fixture( factory .create( owner_id, + identity_nonce, dpns_schema.into(), Some( DataContractConfigV0 { diff --git a/packages/rs-dpp/src/tests/fixtures/get_dashpay_document_fixture.rs b/packages/rs-dpp/src/tests/fixtures/get_dashpay_document_fixture.rs index 78d33da4ae8..7c8fe9a581e 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_dashpay_document_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_dashpay_document_fixture.rs @@ -9,14 +9,17 @@ use super::get_dashpay_contract_fixture; #[cfg(feature = "extended-document")] use crate::document::ExtendedDocument; +use crate::prelude::IdentityNonce; pub fn get_contact_request_document_fixture( owner_id: Option, + identity_nonce: IdentityNonce, additional_data: Option, protocol_version: u32, ) -> Document { let owner_id = owner_id.unwrap_or_else(generate_random_identifier_struct); - let data_contract = get_dashpay_contract_fixture(None, protocol_version).data_contract_owned(); + let data_contract = + get_dashpay_contract_fixture(None, identity_nonce, protocol_version).data_contract_owned(); let factory = DocumentFactory::new(protocol_version) .expect("expected to create factory for get_contact_request_document_fixture"); @@ -41,11 +44,13 @@ pub fn get_contact_request_document_fixture( #[cfg(feature = "extended-document")] pub fn get_contact_request_extended_document_fixture( owner_id: Option, + identity_nonce: IdentityNonce, additional_data: Option, protocol_version: u32, ) -> ExtendedDocument { let owner_id = owner_id.unwrap_or_else(generate_random_identifier_struct); - let data_contract = get_dashpay_contract_fixture(None, protocol_version).data_contract_owned(); + let data_contract = + get_dashpay_contract_fixture(None, identity_nonce, protocol_version).data_contract_owned(); let factory = DocumentFactory::new(protocol_version).expect("expected document factory"); diff --git a/packages/rs-dpp/src/tests/fixtures/get_data_contract.rs b/packages/rs-dpp/src/tests/fixtures/get_data_contract.rs index 4770ebede1b..bfd9eb1563d 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_data_contract.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_data_contract.rs @@ -8,6 +8,7 @@ use crate::{ pub fn get_data_contract_fixture( owner_id: Option, + identity_nonce: IdentityNonce, protocol_version: u32, ) -> CreatedDataContract { let defs = platform_value!( @@ -191,7 +192,15 @@ pub fn get_data_contract_fixture( "byteArrayField": "asc" } ] - } + }, + { + "name": "index2", + "properties": [ + { + "identifierField": "asc" + } + ] + }, ], "properties": { "byteArrayField": { @@ -284,12 +293,11 @@ pub fn get_data_contract_fixture( } }); - let factory = - DataContractFactory::new(protocol_version, None).expect("expected to create a factory"); + let factory = DataContractFactory::new(protocol_version).expect("expected to create a factory"); let owner_id = owner_id.unwrap_or_else(generate_random_identifier_struct); factory - .create_with_value_config(owner_id, documents, None, Some(defs)) + .create_with_value_config(owner_id, identity_nonce, documents, None, Some(defs)) .expect("data in fixture should be correct") } diff --git a/packages/rs-dpp/src/tests/fixtures/get_document_transitions_fixture.rs b/packages/rs-dpp/src/tests/fixtures/get_document_transitions_fixture.rs index 5b4cd5709e5..dfb531b5546 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_document_transitions_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_document_transitions_fixture.rs @@ -1,7 +1,8 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::document::document_factory::DocumentFactory; -use platform_value::Bytes32; +use platform_value::{Bytes32, Identifier}; use platform_version::version::PlatformVersion; +use std::collections::BTreeMap; use crate::document::Document; use crate::state_transition::documents_batch_transition::document_transition::action_type::DocumentTransitionActionType; @@ -9,8 +10,6 @@ use crate::state_transition::documents_batch_transition::document_transition::Do use crate::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; -use super::get_data_contract_fixture; - pub fn get_document_transitions_fixture<'a>( documents: impl IntoIterator< Item = ( @@ -18,13 +17,14 @@ pub fn get_document_transitions_fixture<'a>( Vec<(Document, DocumentTypeRef<'a>, Bytes32)>, ), >, + nonce_counter: &mut BTreeMap<(Identifier, Identifier), u64>, //IdentityID/ContractID -> nonce ) -> Vec { let protocol_version = PlatformVersion::latest().protocol_version; let document_factory = DocumentFactory::new(protocol_version).expect("expected to get document factory"); document_factory - .create_state_transition(documents) + .create_state_transition(documents, nonce_counter) .expect("the transitions should be created") .transitions() .to_owned() diff --git a/packages/rs-dpp/src/tests/fixtures/get_documents_fixture.rs b/packages/rs-dpp/src/tests/fixtures/get_documents_fixture.rs index 8af470b1487..647203d72ea 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_documents_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_documents_fixture.rs @@ -198,7 +198,7 @@ pub fn get_withdrawal_document_fixture( }; let document_type = data_contract.document_type_for_name( - data_contracts::withdrawals_contract::document_types::withdrawal::NAME, + data_contracts::withdrawals_contract::v1::document_types::withdrawal::NAME, )?; let properties = data @@ -211,6 +211,8 @@ pub fn get_withdrawal_document_fixture( document_type.create_document_with_prevalidated_properties( id, owner_id, + 0, + 0, properties, platform_version, ) diff --git a/packages/rs-dpp/src/tests/fixtures/get_dpns_data_contract.rs b/packages/rs-dpp/src/tests/fixtures/get_dpns_data_contract.rs index 3ac0e29d57d..56a36dd445d 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_dpns_data_contract.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_dpns_data_contract.rs @@ -1,6 +1,5 @@ use data_contracts::{DataContractSource, SystemDataContract}; -use platform_value::platform_value; -use serde_json::json; +use platform_version::version::PlatformVersion; use crate::data_contract::created_data_contract::CreatedDataContract; use crate::data_contract::DataContractFactory; @@ -9,22 +8,31 @@ use crate::tests::utils::generate_random_identifier_struct; pub fn get_dpns_data_contract_fixture( owner_id: Option, + identity_nonce: IdentityNonce, protocol_version: u32, ) -> CreatedDataContract { - let factory = DataContractFactory::new(protocol_version, None) + let factory = DataContractFactory::new(protocol_version) .expect("expected to create a factory for get_dpns_data_contract_fixture"); let owner_id = owner_id.unwrap_or_else(generate_random_identifier_struct); + let platform_version = + PlatformVersion::get(protocol_version).expect("expected to get platform version"); + let DataContractSource { - mut document_schemas, - .. + document_schemas, .. } = SystemDataContract::DPNS - .source() + .source(platform_version) .expect("should return DPNS data contract source"); //Todo create config factory - .create_with_value_config(owner_id, document_schemas.into(), None, None) + .create_with_value_config( + owner_id, + identity_nonce, + document_schemas.into(), + None, + None, + ) .expect("data in fixture should be correct") } diff --git a/packages/rs-dpp/src/tests/fixtures/get_dpns_document_fixture.rs b/packages/rs-dpp/src/tests/fixtures/get_dpns_document_fixture.rs index ab9b000eb73..d68f1d0842a 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_dpns_document_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_dpns_document_fixture.rs @@ -11,11 +11,13 @@ use super::get_dpns_data_contract_fixture; #[cfg(feature = "extended-document")] use crate::document::ExtendedDocument; +use crate::prelude::IdentityNonce; use crate::util::strings::convert_to_homograph_safe_chars; pub struct ParentDocumentOptions { pub label: String, pub owner_id: Identifier, + pub identity_nonce: IdentityNonce, } impl Default for ParentDocumentOptions { @@ -23,6 +25,7 @@ impl Default for ParentDocumentOptions { Self { label: String::from("Parent"), owner_id: generate_random_identifier_struct(), + identity_nonce: 0, } } } @@ -31,7 +34,11 @@ pub fn get_dpns_parent_document_fixture( options: ParentDocumentOptions, protocol_version: u32, ) -> Document { - let data_contract = get_dpns_data_contract_fixture(Some(options.owner_id), protocol_version); + let data_contract = get_dpns_data_contract_fixture( + Some(options.owner_id), + options.identity_nonce, + protocol_version, + ); let document_factory = DocumentFactory::new(protocol_version).expect("expected to get document factory"); let mut pre_order_salt = [0u8; 32]; @@ -79,7 +86,11 @@ pub fn get_dpns_parent_extended_document_fixture( options: ParentDocumentOptions, protocol_version: u32, ) -> ExtendedDocument { - let data_contract = get_dpns_data_contract_fixture(Some(options.owner_id), protocol_version); + let data_contract = get_dpns_data_contract_fixture( + Some(options.owner_id), + options.identity_nonce, + protocol_version, + ); let document_factory = DocumentFactory::new(protocol_version).expect("expected to get document factory"); let mut pre_order_salt = [0u8; 32]; diff --git a/packages/rs-dpp/src/tests/fixtures/get_identity_update_transition_fixture.rs b/packages/rs-dpp/src/tests/fixtures/get_identity_update_transition_fixture.rs index b2a93207804..65f4df81f28 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_identity_update_transition_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_identity_update_transition_fixture.rs @@ -40,7 +40,6 @@ pub fn get_identity_update_transition_fixture( } .into()], disable_public_keys: vec![0], - public_keys_disabled_at: Some(1234567), ..Default::default() } .into(), diff --git a/packages/rs-dpp/src/tests/fixtures/get_masternode_reward_shares_documents_fixture.rs b/packages/rs-dpp/src/tests/fixtures/get_masternode_reward_shares_documents_fixture.rs index 66b50f6df10..b6f0ae7cefa 100644 --- a/packages/rs-dpp/src/tests/fixtures/get_masternode_reward_shares_documents_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/get_masternode_reward_shares_documents_fixture.rs @@ -8,14 +8,19 @@ use crate::{ }; use data_contracts::SystemDataContract; use platform_value::platform_value; +use platform_version::version::PlatformVersion; pub fn get_masternode_reward_shares_documents_fixture( protocol_version: u32, ) -> (Vec, DataContract) { let owner_id = generate_random_identifier_struct(); let pay_to_id = generate_random_identifier_struct(); + + let platform_version = + PlatformVersion::get(protocol_version).expect("expected to get platform version"); + let data_contract = - load_system_data_contract(SystemDataContract::MasternodeRewards, protocol_version) + load_system_data_contract(SystemDataContract::MasternodeRewards, platform_version) .expect("should load masternode rewards contract"); let factory = DocumentFactory::new(protocol_version).expect("expected to make factory"); @@ -37,7 +42,9 @@ pub fn get_masternode_reward_shares_documents_fixture( } pub fn get_masternode_reward_shares_data_contract_fixture(protocol_version: u32) -> DataContract { - load_system_data_contract(SystemDataContract::MasternodeRewards, protocol_version) + let platform_version = PlatformVersion::get(protocol_version).expect("expected to get version"); + + load_system_data_contract(SystemDataContract::MasternodeRewards, platform_version) .expect("should load masternode rewards contract") } @@ -45,10 +52,12 @@ pub fn get_masternode_reward_shares_data_contract_fixture(protocol_version: u32) pub fn get_masternode_reward_shares_extended_documents_fixture( protocol_version: u32, ) -> (Vec, DataContract) { + let platform_version = PlatformVersion::get(protocol_version).expect("expected to get version"); + let owner_id = generate_random_identifier_struct(); let pay_to_id = generate_random_identifier_struct(); let data_contract = - load_system_data_contract(SystemDataContract::MasternodeRewards, protocol_version) + load_system_data_contract(SystemDataContract::MasternodeRewards, platform_version) .expect("should load masternode rewards contract"); let factory = DocumentFactory::new(protocol_version).expect("expected to make factory"); diff --git a/packages/rs-dpp/src/tests/fixtures/identity_create_transition_fixture.rs b/packages/rs-dpp/src/tests/fixtures/identity_create_transition_fixture.rs index 0e4c03dbeb2..e46fe4009c8 100644 --- a/packages/rs-dpp/src/tests/fixtures/identity_create_transition_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/identity_create_transition_fixture.rs @@ -11,7 +11,7 @@ use platform_value::string_encoding::{decode, Encoding}; //[198, 23, 40, 120, 58, 93, 0, 165, 27, 49, 4, 117, 107, 204, 67, 46, 164, 216, 230, 135, 201, 92, 31, 155, 62, 131, 211, 177, 139, 175, 163, 237] pub fn identity_create_transition_fixture(one_time_private_key: Option) -> Value { - let asset_lock_proof = raw_instant_asset_lock_proof_fixture(one_time_private_key); + let asset_lock_proof = raw_instant_asset_lock_proof_fixture(one_time_private_key, None); platform_value!({ "protocolVersion": version::LATEST_VERSION, diff --git a/packages/rs-dpp/src/tests/fixtures/identity_fixture.rs b/packages/rs-dpp/src/tests/fixtures/identity_fixture.rs index b8ff26652ab..b0e92a5850d 100644 --- a/packages/rs-dpp/src/tests/fixtures/identity_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/identity_fixture.rs @@ -1,9 +1,10 @@ use crate::identity::identity_public_key::v0::IdentityPublicKeyV0; -use crate::identity::{IdentityV0, KeyType, Purpose, SecurityLevel}; +use crate::identity::{IdentityPublicKey, IdentityV0, KeyType, Purpose, SecurityLevel}; use platform_value::platform_value; use platform_value::string_encoding::Encoding; use platform_value::BinaryData; use serde_json::json; +use std::collections::BTreeMap; use crate::prelude::{Identifier, Identity}; diff --git a/packages/rs-dpp/src/tests/fixtures/identity_topup_transition_fixture.rs b/packages/rs-dpp/src/tests/fixtures/identity_topup_transition_fixture.rs index 5d88046a632..6573cd74d0c 100644 --- a/packages/rs-dpp/src/tests/fixtures/identity_topup_transition_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/identity_topup_transition_fixture.rs @@ -9,7 +9,7 @@ use crate::version; //[198, 23, 40, 120, 58, 93, 0, 165, 27, 49, 4, 117, 107, 204, 67, 46, 164, 216, 230, 135, 201, 92, 31, 155, 62, 131, 211, 177, 139, 175, 163, 237] pub fn identity_topup_transition_fixture(one_time_private_key: Option) -> Value { - let asset_lock_proof = raw_instant_asset_lock_proof_fixture(one_time_private_key); + let asset_lock_proof = raw_instant_asset_lock_proof_fixture(one_time_private_key, None); platform_value!({ "protocolVersion": version::LATEST_VERSION, "type": StateTransitionType::IdentityTopUp as u8, diff --git a/packages/rs-dpp/src/tests/fixtures/instant_asset_lock_proof_fixture.rs b/packages/rs-dpp/src/tests/fixtures/instant_asset_lock_proof_fixture.rs index 9a1a627f0bf..f00af679eda 100644 --- a/packages/rs-dpp/src/tests/fixtures/instant_asset_lock_proof_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/instant_asset_lock_proof_fixture.rs @@ -2,7 +2,8 @@ use std::str::FromStr; use dashcore::bls_sig_utils::BLSSignature; use dashcore::hash_types::CycleHash; -use dashcore::hashes::Hash; + +use crate::balances::credits::Duffs; use dashcore::secp256k1::rand::thread_rng; use dashcore::secp256k1::Secp256k1; use dashcore::transaction::special_transaction::asset_lock::AssetLockPayload; @@ -13,15 +14,15 @@ use dashcore::{ }; use crate::identity::state_transition::asset_lock_proof::{AssetLockProof, InstantAssetLockProof}; -use crate::util::vec::hex_to_array; //3bufpwQjL5qsvuP4fmCKgXJrKG852DDMYfi9J6XKqPAT //[198, 23, 40, 120, 58, 93, 0, 165, 27, 49, 4, 117, 107, 204, 67, 46, 164, 216, 230, 135, 201, 92, 31, 155, 62, 131, 211, 177, 139, 175, 163, 237] pub fn raw_instant_asset_lock_proof_fixture( one_time_private_key: Option, + amount: Option, ) -> InstantAssetLockProof { - let transaction = instant_asset_lock_proof_transaction_fixture(one_time_private_key); + let transaction = instant_asset_lock_proof_transaction_fixture(one_time_private_key, amount); let instant_lock = instant_asset_lock_is_lock_fixture(transaction.txid()); @@ -30,8 +31,9 @@ pub fn raw_instant_asset_lock_proof_fixture( pub fn instant_asset_lock_proof_fixture( one_time_private_key: Option, + amount: Option, ) -> AssetLockProof { - let transaction = instant_asset_lock_proof_transaction_fixture(one_time_private_key); + let transaction = instant_asset_lock_proof_transaction_fixture(one_time_private_key, amount); let instant_lock = instant_asset_lock_is_lock_fixture(transaction.txid()); @@ -42,6 +44,7 @@ pub fn instant_asset_lock_proof_fixture( pub fn instant_asset_lock_proof_transaction_fixture( one_time_private_key: Option, + amount: Option, ) -> Transaction { let mut rng = thread_rng(); let secp = Secp256k1::new(); @@ -75,12 +78,12 @@ pub fn instant_asset_lock_proof_transaction_fixture( let one_time_key_hash = one_time_public_key.pubkey_hash(); let funding_output = TxOut { - value: 100000000, // 1 Dash + value: amount.unwrap_or(100000000), // 1 Dash script_pubkey: ScriptBuf::new_p2pkh(&one_time_key_hash), }; let burn_output = TxOut { - value: 100000000, // 1 Dash + value: amount.unwrap_or(100000000), // 1 Dash script_pubkey: ScriptBuf::new_op_return(&[]), }; diff --git a/packages/rs-dpp/src/tests/fixtures/mod.rs b/packages/rs-dpp/src/tests/fixtures/mod.rs index 7d999752c4e..60b5cd4dfe2 100644 --- a/packages/rs-dpp/src/tests/fixtures/mod.rs +++ b/packages/rs-dpp/src/tests/fixtures/mod.rs @@ -7,7 +7,7 @@ pub use get_document_transitions_fixture::*; pub use get_documents_fixture::*; pub use get_dpns_data_contract::*; pub use get_dpns_document_fixture::*; -pub use get_dpp::*; + #[cfg(feature = "state-transitions")] pub use get_identity_update_transition_fixture::*; #[cfg(feature = "state-transitions")] @@ -29,8 +29,6 @@ mod get_document_transitions_fixture; pub use get_masternode_reward_shares_documents_fixture::*; -pub use get_documents_fixture::*; - mod get_dashpay_contract_fixture; mod get_dashpay_contract_with_generalized_encryption_key_fixture; mod get_data_contract; diff --git a/packages/rs-dpp/src/tests/json_document.rs b/packages/rs-dpp/src/tests/json_document.rs index 9fb9de83bc6..d0b80a33585 100644 --- a/packages/rs-dpp/src/tests/json_document.rs +++ b/packages/rs-dpp/src/tests/json_document.rs @@ -8,7 +8,7 @@ use crate::data_contract::created_data_contract::CreatedDataContract; use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; use crate::data_contract::document_type::DocumentTypeRef; use crate::document::{Document, DocumentV0}; -use crate::prelude::DataContract; +use crate::prelude::{DataContract, IdentityNonce}; #[cfg(feature = "data-contract-cbor-conversion")] use crate::util::cbor_serializer::serializable_value_to_cbor; use crate::version::PlatformVersion; @@ -65,12 +65,12 @@ pub fn json_document_to_cbor( #[cfg(feature = "data-contract-json-conversion")] pub fn json_document_to_contract( path: impl AsRef, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { let value = json_document_to_json_value(path)?; - DataContract::from_json(value, validate, platform_version) + DataContract::from_json(value, full_validation, platform_version) } #[cfg(all( @@ -80,14 +80,15 @@ pub fn json_document_to_contract( /// Reads a JSON file and converts it a contract. pub fn json_document_to_created_contract( path: impl AsRef, - validate: bool, + identity_nonce: IdentityNonce, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { - let data_contract = json_document_to_contract(path, validate, platform_version)?; + let data_contract = json_document_to_contract(path, full_validation, platform_version)?; Ok(CreatedDataContractV0 { data_contract, - entropy_used: Default::default(), + identity_nonce, } .into()) } @@ -98,12 +99,12 @@ pub fn json_document_to_contract_with_ids( path: impl AsRef, id: Option, owner_id: Option, - validate: bool, + full_validation: bool, platform_version: &PlatformVersion, ) -> Result { let value = json_document_to_json_value(path)?; - let mut contract = DataContract::from_json(value, validate, platform_version)?; + let mut contract = DataContract::from_json(value, full_validation, platform_version)?; if let Some(id) = id { contract.set_id(id); @@ -139,6 +140,14 @@ pub fn json_document_to_document( revision: data.remove_optional_integer("$revision")?, created_at: data.remove_optional_integer("$createdAt")?, updated_at: data.remove_optional_integer("$updatedAt")?, + transferred_at: data.remove_optional_integer("$transferredAt")?, + created_at_block_height: data.remove_optional_integer("$createdAtBlockHeight")?, + updated_at_block_height: data.remove_optional_integer("$updatedAtBlockHeight")?, + transferred_at_block_height: data.remove_optional_integer("$transferredAtBlockHeight")?, + created_at_core_block_height: data.remove_optional_integer("$createdAtCoreBlockHeight")?, + updated_at_core_block_height: data.remove_optional_integer("$updatedAtCoreBlockHeight")?, + transferred_at_core_block_height: data + .remove_optional_integer("$transferredAtCoreBlockHeight")?, }; data.replace_at_paths( diff --git a/packages/rs-dpp/src/tests/utils/error_helpers.rs b/packages/rs-dpp/src/tests/utils/error_helpers.rs deleted file mode 100644 index fe53c3bb7ac..00000000000 --- a/packages/rs-dpp/src/tests/utils/error_helpers.rs +++ /dev/null @@ -1,110 +0,0 @@ -use crate::consensus::basic::json_schema_error::JsonSchemaError; -use crate::consensus::basic::value_error::ValueError; -use crate::consensus::basic::BasicError; -use crate::consensus::fee::fee_error::FeeError; -use crate::consensus::signature::SignatureError; -use crate::consensus::state::state_error::StateError; -use crate::consensus::ConsensusError; -use crate::validation::{ConsensusValidationResult, SimpleConsensusValidationResult}; - -pub fn get_schema_error( - result: &SimpleConsensusValidationResult, - number: usize, -) -> &JsonSchemaError { - json_schema_error( - result - .errors - .get(number) - .expect("the error should be returned in validation result"), - ) -} - -pub fn get_basic_error(consensus_error: &ConsensusError) -> &BasicError { - match consensus_error { - ConsensusError::BasicError(basic_error) => basic_error, - _ => panic!("error '{:?}' isn't a basic error", consensus_error), - } -} - -// TODO: Not sure it should be here. Looks more like a test helper -pub fn json_schema_error(consensus_error: &ConsensusError) -> &JsonSchemaError { - match consensus_error { - ConsensusError::BasicError(BasicError::JsonSchemaError(err)) => err, - _ => panic!("error '{:?}' isn't a json schema error", consensus_error), - } -} - -pub fn value_error(consensus_error: &ConsensusError) -> &ValueError { - match consensus_error { - ConsensusError::BasicError(BasicError::ValueError(err)) => err, - _ => panic!("error '{:?}' isn't a value error", consensus_error), - } -} - -pub fn get_state_error_from_result( - result: &ConsensusValidationResult, - error_number: usize, -) -> &StateError { - match result - .errors - .get(error_number) - .expect("error should be found") - { - ConsensusError::StateError(state_error) => state_error, - _ => panic!( - "error '{:?}' isn't a state error", - result.errors[error_number] - ), - } -} - -pub fn get_basic_error_from_result( - result: &SimpleConsensusValidationResult, - error_number: usize, -) -> &BasicError { - match result - .errors - .get(error_number) - .expect("basic error should be found") - { - ConsensusError::BasicError(basic_error) => basic_error, - _ => panic!( - "error '{:?}' isn't a Basic error", - result.errors[error_number] - ), - } -} - -pub fn get_signature_error_from_result( - result: &ConsensusValidationResult, - error_number: usize, -) -> &SignatureError { - match result - .errors - .get(error_number) - .expect("error should be found") - { - ConsensusError::SignatureError(signature_error) => signature_error, - _ => panic!( - "error '{:?}' isn't a Signature error", - result.errors[error_number] - ), - } -} - -pub fn get_fee_error_from_result( - result: &ConsensusValidationResult, - error_number: usize, -) -> &FeeError { - match result - .errors - .get(error_number) - .expect("error should be found") - { - ConsensusError::FeeError(signature_error) => signature_error, - _ => panic!( - "error '{:?}' isn't a Fee error", - result.errors[error_number] - ), - } -} diff --git a/packages/rs-dpp/src/tests/utils/mod.rs b/packages/rs-dpp/src/tests/utils/mod.rs index ad4055a61b8..0fc0b6d0e91 100644 --- a/packages/rs-dpp/src/tests/utils/mod.rs +++ b/packages/rs-dpp/src/tests/utils/mod.rs @@ -1,5 +1,2 @@ -pub use error_helpers::*; pub use utils::*; - -mod error_helpers; mod utils; diff --git a/packages/rs-dpp/src/util/cbor_value/convert.rs b/packages/rs-dpp/src/util/cbor_value/convert.rs index 18e8af258c6..fc1698e7668 100644 --- a/packages/rs-dpp/src/util/cbor_value/convert.rs +++ b/packages/rs-dpp/src/util/cbor_value/convert.rs @@ -1,3 +1,5 @@ +use base64::prelude::BASE64_STANDARD; +use base64::Engine; use std::convert::TryInto; use ciborium::value::Value as CborValue; @@ -40,7 +42,7 @@ pub(super) fn convert_to( FieldType::StringBase64 => { let text = cbor_value.as_text()?; - base64::decode(text).ok()? + BASE64_STANDARD.decode(text).ok()? } }; @@ -56,7 +58,7 @@ pub(super) fn convert_to( } FieldType::StringBase64 => { - let encoded = base64::encode(data_bytes); + let encoded = BASE64_STANDARD.encode(data_bytes); CborValue::Text(encoded) } }; @@ -96,6 +98,9 @@ mod tests { let result = convert_to(&cbor_value, FieldType::ArrayInt, FieldType::StringBase64) .expect("no error"); - assert_eq!(CborValue::Text(base64::encode(vec![0_u8; 32])), result); + assert_eq!( + CborValue::Text(BASE64_STANDARD.encode(vec![0_u8; 32])), + result + ); } } diff --git a/packages/rs-dpp/src/util/deserializer.rs b/packages/rs-dpp/src/util/deserializer.rs index caddd4303e0..301bdf24d27 100644 --- a/packages/rs-dpp/src/util/deserializer.rs +++ b/packages/rs-dpp/src/util/deserializer.rs @@ -1,5 +1,8 @@ +#[cfg(feature = "cbor")] use crate::consensus::basic::decode::ProtocolVersionParsingError; +#[cfg(feature = "cbor")] use crate::consensus::basic::BasicError; +#[cfg(feature = "cbor")] use crate::consensus::ConsensusError; use integer_encoding::VarInt; use platform_version::version::FeatureVersion; @@ -66,13 +69,16 @@ pub fn split_cbor_feature_version( } pub mod serde_entropy { + use base64::prelude::BASE64_STANDARD; + use base64::Engine; use std::convert::TryInto; use serde::{Deserialize, Deserializer, Serializer}; pub fn deserialize<'de, D: Deserializer<'de>>(d: D) -> Result<[u8; 32], D::Error> { let data: String = Deserialize::deserialize(d)?; - base64::decode(&data) + BASE64_STANDARD + .decode(&data) .map_err(|e| { serde::de::Error::custom(format!("Unable to decode {}' with base64 - {}", data, e)) })? @@ -89,6 +95,6 @@ pub mod serde_entropy { where S: Serializer, { - serializer.serialize_str(&base64::encode(buffer)) + serializer.serialize_str(&BASE64_STANDARD.encode(buffer)) } } diff --git a/packages/rs-dpp/src/util/hash.rs b/packages/rs-dpp/src/util/hash.rs index c21ce76edc7..6f7e1235fcd 100644 --- a/packages/rs-dpp/src/util/hash.rs +++ b/packages/rs-dpp/src/util/hash.rs @@ -1,16 +1,20 @@ use dashcore::hashes::{ripemd160, sha256, Hash}; use sha2::{Digest, Sha256}; -pub fn hash_to_vec(payload: impl AsRef<[u8]>) -> Vec { +pub fn hash_double_to_vec(payload: impl AsRef<[u8]>) -> Vec { Sha256::digest(Sha256::digest(payload)).to_vec() } -pub fn hash(payload: impl AsRef<[u8]>) -> [u8; 32] { +pub fn hash_double(payload: impl AsRef<[u8]>) -> [u8; 32] { Sha256::digest(Sha256::digest(payload)).into() } +pub fn hash_single(payload: impl AsRef<[u8]>) -> [u8; 32] { + Sha256::digest(payload).into() +} + pub fn hash_to_hex_string(payload: impl AsRef<[u8]>) -> String { - hex::encode(hash(payload)) + hex::encode(hash_double(payload)) } pub fn ripemd160_sha256(data: &[u8]) -> [u8; 20] { diff --git a/packages/rs-dpp/src/util/is_fibonacci_number.rs b/packages/rs-dpp/src/util/is_fibonacci_number.rs index fab42b93875..4c736e0a9a0 100644 --- a/packages/rs-dpp/src/util/is_fibonacci_number.rs +++ b/packages/rs-dpp/src/util/is_fibonacci_number.rs @@ -1,7 +1,20 @@ -fn is_perfect_square(number: u32) -> bool { +fn is_perfect_square(number: u64) -> bool { (number as f64).sqrt().fract() == 0.0 } -pub fn is_fibonacci_number(number: u32) -> bool { - is_perfect_square(5 * number * number + 4) || is_perfect_square(5 * number * number - 4) +pub fn is_fibonacci_number(number: u64) -> bool { + let square_check_up = 5u64 + .checked_mul(number) + .and_then(|n| n.checked_mul(number)) + .and_then(|n| n.checked_add(4)); + + let square_check_down = 5u64 + .checked_mul(number) + .and_then(|n| n.checked_mul(number)) + .and_then(|n| n.checked_sub(4)); + + match (square_check_up, square_check_down) { + (Some(n1), Some(n2)) => is_perfect_square(n1) || is_perfect_square(n2), + _ => false, // Return false if either calculation overflows + } } diff --git a/packages/rs-dpp/src/util/json_schema.rs b/packages/rs-dpp/src/util/json_schema.rs index 60103f715c0..0e6459083dd 100644 --- a/packages/rs-dpp/src/util/json_schema.rs +++ b/packages/rs-dpp/src/util/json_schema.rs @@ -2,7 +2,8 @@ use anyhow::{anyhow, bail}; use platform_value::Value; use serde_json::Value as JsonValue; -use crate::{identifier, ProtocolError}; +use crate::data_contract::errors::DataContractError; +use crate::identifier; pub trait JsonSchemaExt { /// returns true if json value contains property 'type`, and it equals 'object' @@ -25,17 +26,15 @@ pub trait JsonSchemaExt { fn is_type_of_identifier(&self) -> bool; } -pub fn resolve_uri<'a>(value: &'a Value, uri: &str) -> Result<&'a Value, ProtocolError> { +pub fn resolve_uri<'a>(value: &'a Value, uri: &str) -> Result<&'a Value, DataContractError> { if !uri.starts_with("#/") { - return Err(ProtocolError::Generic( - "only local references are allowed".to_string(), + return Err(DataContractError::InvalidURI( + "only local uri references are allowed".to_string(), )); } let string_path = uri.strip_prefix("#/").unwrap().replace('/', "."); - value - .get_value_at_path(&string_path) - .map_err(ProtocolError::ValueError) + value.get_value_at_path(&string_path).map_err(|e| e.into()) } impl JsonSchemaExt for JsonValue { @@ -214,6 +213,8 @@ mod test { false, false, false, + false, + &mut vec![], LATEST_PLATFORM_VERSION, ) .unwrap(); diff --git a/packages/rs-dpp/src/util/mod.rs b/packages/rs-dpp/src/util/mod.rs index a4ae012dca4..2dee13be293 100644 --- a/packages/rs-dpp/src/util/mod.rs +++ b/packages/rs-dpp/src/util/mod.rs @@ -13,4 +13,5 @@ pub mod json_value; pub mod protocol_data; pub mod strings; +pub mod units; pub mod vec; diff --git a/packages/rs-dpp/src/util/units.rs b/packages/rs-dpp/src/util/units.rs new file mode 100644 index 00000000000..ca00561cf05 --- /dev/null +++ b/packages/rs-dpp/src/util/units.rs @@ -0,0 +1,29 @@ +#[macro_export] +macro_rules! dash_to_credits { + // The macro takes a string literal representing the Dash amount. + ($dash:expr) => {{ + let dash_str = stringify!($dash); + + // Parsing the input string to separate the whole and fractional parts. + let parts: Vec<&str> = dash_str.split('.').collect(); + let mut credits: u128 = 0; + + // Process the whole number part if it exists. + if let Some(whole) = parts.get(0) { + if let Ok(whole_number) = whole.parse::() { + credits += whole_number * 100_000_000_000; // Whole Dash amount to credits + } + } + + // Process the fractional part if it exists. + if let Some(fraction) = parts.get(1) { + let fraction_length = fraction.len(); + let fraction_number = fraction.parse::().unwrap_or(0); + // Calculate the multiplier based on the number of digits in the fraction. + let multiplier = 10u128.pow(11 - fraction_length as u32); + credits += fraction_number * multiplier; // Fractional Dash to credits + } + + credits as u64 + }}; +} diff --git a/packages/rs-dpp/src/validation/block_time_window/mod.rs b/packages/rs-dpp/src/validation/block_time_window/mod.rs deleted file mode 100644 index a73df453ffc..00000000000 --- a/packages/rs-dpp/src/validation/block_time_window/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod validate_time_in_block_time_window; -pub mod validation_result; diff --git a/packages/rs-dpp/src/validation/block_time_window/validate_time_in_block_time_window/mod.rs b/packages/rs-dpp/src/validation/block_time_window/validate_time_in_block_time_window/mod.rs deleted file mode 100644 index b47bd9fdc93..00000000000 --- a/packages/rs-dpp/src/validation/block_time_window/validate_time_in_block_time_window/mod.rs +++ /dev/null @@ -1,31 +0,0 @@ -use crate::identity::TimestampMillis; -use crate::validation::block_time_window::validate_time_in_block_time_window::v0::validate_time_in_block_time_window_v0; -use crate::validation::block_time_window::validation_result::TimeWindowValidationResult; -use crate::version::PlatformVersion; -use crate::NonConsensusError; - -pub mod v0; - -pub fn validate_time_in_block_time_window( - last_block_header_time_millis: TimestampMillis, - time_to_check_millis: TimestampMillis, - average_block_spacing_ms: u64, //in the event of very long blocks we need to add this - platform_version: &PlatformVersion, -) -> Result { - match platform_version - .dpp - .validation - .validate_time_in_block_time_window - { - 0 => validate_time_in_block_time_window_v0( - last_block_header_time_millis, - time_to_check_millis, - average_block_spacing_ms, - ), - version => Err(NonConsensusError::UnknownVersionMismatch { - method: "validate_time_in_block_time_window".to_string(), - known_versions: vec![0], - received: version, - }), - } -} diff --git a/packages/rs-dpp/src/validation/block_time_window/validate_time_in_block_time_window/v0/mod.rs b/packages/rs-dpp/src/validation/block_time_window/validate_time_in_block_time_window/v0/mod.rs deleted file mode 100644 index 200045be69e..00000000000 --- a/packages/rs-dpp/src/validation/block_time_window/validate_time_in_block_time_window/v0/mod.rs +++ /dev/null @@ -1,52 +0,0 @@ -use crate::validation::block_time_window::validation_result::TimeWindowValidationResult; -use crate::{prelude::TimestampMillis, NonConsensusError}; - -pub const BLOCK_TIME_WINDOW_MINUTES: u64 = 5; -pub const BLOCK_TIME_WINDOW_MILLIS: u64 = BLOCK_TIME_WINDOW_MINUTES * 60 * 1000; - -/// Validates whether the provided timestamp (`time_to_check_millis`) falls within a calculated -/// time window based on the timestamp of the last block header (`last_block_header_time_millis`). -/// The window is calculated as `BLOCK_TIME_WINDOW_MILLIS` before and after -/// the `last_block_header_time_millis`, plus the `average_block_spacing_ms` to the end window. -/// -/// Returns a `TimeWindowValidationResult` with information about the calculated time window -/// and a validity flag indicating whether the time_to_check falls within this window. -/// -/// # Arguments -/// -/// * `last_block_header_time_millis` - The timestamp in milliseconds of the last block header. -/// * `time_to_check_millis` - The timestamp in milliseconds that needs to be checked against the time window. -/// * `average_block_spacing_ms` - The average spacing in milliseconds between blocks, added to the end of the time window. -/// -/// # Errors -/// -/// If any arithmetic operation (subtraction or addition) overflows, an `NonConsensusError::Overflow` error is returned. -pub(super) fn validate_time_in_block_time_window_v0( - last_block_header_time_millis: TimestampMillis, - time_to_check_millis: TimestampMillis, - average_block_spacing_ms: u64, //in the event of very long blocks we need to add this -) -> Result { - let time_window_start = last_block_header_time_millis - .checked_sub(BLOCK_TIME_WINDOW_MILLIS) - .ok_or(NonConsensusError::Overflow( - "calculation of start window failed", - ))?; - let time_window_end = last_block_header_time_millis - .checked_add(BLOCK_TIME_WINDOW_MILLIS) - .ok_or(NonConsensusError::Overflow( - "calculation of end window failed: block time window overflow", - ))? - .checked_add(average_block_spacing_ms) - .ok_or(NonConsensusError::Overflow( - "calculation of end window failed: average block spacing overflow", - ))?; - - let valid = - time_to_check_millis >= time_window_start && time_to_check_millis <= time_window_end; - - Ok(TimeWindowValidationResult { - time_window_start, - time_window_end, - valid, - }) -} diff --git a/packages/rs-dpp/src/validation/block_time_window/validation_result.rs b/packages/rs-dpp/src/validation/block_time_window/validation_result.rs deleted file mode 100644 index a75d4a60005..00000000000 --- a/packages/rs-dpp/src/validation/block_time_window/validation_result.rs +++ /dev/null @@ -1,14 +0,0 @@ -// We can safely assume that this will not need to ever be updated -// @immutable -/// Holds the result of a time window validation. -/// -/// This includes whether the validation was successful (`valid`) as well as -/// the start and end timestamps of the time window that was validated. -pub struct TimeWindowValidationResult { - /// Indicates whether the validation was successful. - pub valid: bool, - /// The start timestamp of the time window that was validated. - pub time_window_start: u64, - /// The end timestamp of the time window that was validated. - pub time_window_end: u64, -} diff --git a/packages/rs-dpp/src/validation/json_schema_validator/methods/compile/mod.rs b/packages/rs-dpp/src/validation/json_schema_validator/methods/compile/mod.rs index 834ad2cc75e..fdeb79f2c9e 100644 --- a/packages/rs-dpp/src/validation/json_schema_validator/methods/compile/mod.rs +++ b/packages/rs-dpp/src/validation/json_schema_validator/methods/compile/mod.rs @@ -1,5 +1,5 @@ use crate::data_contract::JsonValue; -use crate::validation::JsonSchemaValidator; +use crate::validation::{JsonSchemaValidator, SimpleConsensusValidationResult}; use crate::ProtocolError; use platform_version::version::PlatformVersion; @@ -26,6 +26,27 @@ impl JsonSchemaValidator { } } + pub fn compile_and_validate( + &self, + json_schema: &JsonValue, + json_value: &JsonValue, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .dpp + .validation + .json_schema_validator + .compile_and_validate + { + 0 => self.compile_and_validate_v0(json_schema, json_value), + version => Err(ProtocolError::UnknownVersionMismatch { + method: "JsonSchemaLazyValidator.compile_and_validate".to_string(), + known_versions: vec![0], + received: version, + }), + } + } + pub fn is_compiled(&self, platform_version: &PlatformVersion) -> Result { match platform_version .dpp diff --git a/packages/rs-dpp/src/validation/json_schema_validator/methods/compile/v0/mod.rs b/packages/rs-dpp/src/validation/json_schema_validator/methods/compile/v0/mod.rs index 9e01fb64e8c..c9031d3e587 100644 --- a/packages/rs-dpp/src/validation/json_schema_validator/methods/compile/v0/mod.rs +++ b/packages/rs-dpp/src/validation/json_schema_validator/methods/compile/v0/mod.rs @@ -1,11 +1,12 @@ use crate::consensus::ConsensusError; use crate::data_contract::JsonValue; -use crate::validation::JsonSchemaValidator; +use crate::validation::{JsonSchemaValidator, SimpleConsensusValidationResult}; use crate::ProtocolError; use jsonschema::{JSONSchema, KeywordDefinition}; use serde_json::json; impl JsonSchemaValidator { + #[inline(always)] pub(super) fn compile_v0(&self, json_schema: &JsonValue) -> Result { if self.is_compiled_v0() { return Ok(false); @@ -44,6 +45,64 @@ impl JsonSchemaValidator { Ok(true) } + #[inline(always)] + pub(super) fn compile_and_validate_v0( + &self, + json_schema: &JsonValue, + json_value: &JsonValue, + ) -> Result { + let mut validator_guard = self.validator.write().unwrap(); + + // Check again to ensure no other thread has modified it after dropping the read lock + if let Some(validator) = validator_guard.as_ref() { + match validator.validate(json_value) { + Ok(_) => Ok(SimpleConsensusValidationResult::new()), + Err(validation_errors) => { + let errors: Vec = + validation_errors.map(ConsensusError::from).collect(); + + Ok(SimpleConsensusValidationResult::new_with_errors(errors)) + } + } + } else { + let validator = JSONSchema::options() + .with_meta_schemas() + .should_ignore_unknown_formats(false) + .should_validate_formats(true) + .with_draft(jsonschema::Draft::Draft202012) + .clone() // doesn't work otherwise + .add_keyword( + "byteArray", + KeywordDefinition::Schema(json!({ + "items": { + "type": "integer", + "minimum": 0, + "maximum": 255, + }, + })), + ) + .compile(json_schema) + .map_err(|error| { + // Todo: not sure this is a consensus error + ProtocolError::ConsensusError(Box::new(ConsensusError::from(error))) + })?; + + let validation_result = if let Err(validation_errors) = validator.validate(json_value) { + let errors: Vec = + validation_errors.map(ConsensusError::from).collect(); + + Ok(SimpleConsensusValidationResult::new_with_errors(errors)) + } else { + Ok(SimpleConsensusValidationResult::new()) + }; + + *validator_guard = Some(validator); + + validation_result + } + } + + #[inline(always)] pub(super) fn is_compiled_v0(&self) -> bool { let validator_guard = self.validator.read().unwrap(); diff --git a/packages/rs-dpp/src/validation/json_schema_validator/methods/new/v0/mod.rs b/packages/rs-dpp/src/validation/json_schema_validator/methods/new/v0/mod.rs index 88dc187a2ad..644351baeb3 100644 --- a/packages/rs-dpp/src/validation/json_schema_validator/methods/new/v0/mod.rs +++ b/packages/rs-dpp/src/validation/json_schema_validator/methods/new/v0/mod.rs @@ -4,6 +4,7 @@ use crate::ProtocolError; use platform_version::version::PlatformVersion; impl JsonSchemaValidator { + #[inline(always)] pub(super) fn new_compiled_v0( json_schema: &JsonValue, platform_version: &PlatformVersion, diff --git a/packages/rs-dpp/src/validation/json_schema_validator/methods/validate/v0/mod.rs b/packages/rs-dpp/src/validation/json_schema_validator/methods/validate/v0/mod.rs index 31fcddeb157..a8650e98d88 100644 --- a/packages/rs-dpp/src/validation/json_schema_validator/methods/validate/v0/mod.rs +++ b/packages/rs-dpp/src/validation/json_schema_validator/methods/validate/v0/mod.rs @@ -5,6 +5,7 @@ use crate::ProtocolError; use serde_json::Value as JsonValue; impl JsonSchemaValidator { + #[inline(always)] pub(super) fn validate_v0( &self, instance: &JsonValue, diff --git a/packages/rs-dpp/src/validation/mod.rs b/packages/rs-dpp/src/validation/mod.rs index d8f6579fbda..ceaa8bc69e3 100644 --- a/packages/rs-dpp/src/validation/mod.rs +++ b/packages/rs-dpp/src/validation/mod.rs @@ -6,18 +6,17 @@ pub use validation_result::{ ValidationResult, }; +#[cfg(feature = "validation")] use crate::version::PlatformVersion; #[cfg(feature = "validation")] use crate::ProtocolError; - -#[cfg(feature = "validation")] -pub mod block_time_window; #[cfg(feature = "validation")] pub(crate) mod byte_array_meta; #[cfg(feature = "validation")] -mod json_schema_validator; +pub mod json_schema_validator; #[cfg(feature = "validation")] pub(crate) mod meta_validators; +pub mod operations; mod validation_result; #[cfg(feature = "validation")] diff --git a/packages/rs-dpp/src/validation/operations.rs b/packages/rs-dpp/src/validation/operations.rs new file mode 100644 index 00000000000..477f1eb06a1 --- /dev/null +++ b/packages/rs-dpp/src/validation/operations.rs @@ -0,0 +1,60 @@ +use crate::fee::Credits; +use platform_version::version::PlatformVersion; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum ProtocolValidationOperation { + DocumentTypeSchemaValidationForSize(u64), + DocumentTypeSchemaPropertyValidation(u64), + DocumentTypeSchemaIndexValidation(u64, bool), +} + +impl ProtocolValidationOperation { + pub fn processing_cost(&self, platform_version: &PlatformVersion) -> Credits { + match self { + ProtocolValidationOperation::DocumentTypeSchemaValidationForSize(size) => { + platform_version + .fee_version + .data_contract + .document_type_base_fee + + *size + * platform_version + .fee_version + .data_contract + .document_type_size_fee + } + ProtocolValidationOperation::DocumentTypeSchemaPropertyValidation(properties_count) => { + *properties_count + * platform_version + .fee_version + .data_contract + .document_type_per_property_fee + } + ProtocolValidationOperation::DocumentTypeSchemaIndexValidation( + index_properties_count, + is_unique, + ) => { + if *is_unique { + *index_properties_count + * platform_version + .fee_version + .data_contract + .document_type_unique_index_per_property_fee + + platform_version + .fee_version + .data_contract + .document_type_base_unique_index_fee + } else { + *index_properties_count + * platform_version + .fee_version + .data_contract + .document_type_non_unique_index_per_property_fee + + platform_version + .fee_version + .data_contract + .document_type_base_non_unique_index_fee + } + } + } + } +} diff --git a/packages/rs-dpp/src/validation/validation_result.rs b/packages/rs-dpp/src/validation/validation_result.rs index 11023608967..a711e5c62f5 100644 --- a/packages/rs-dpp/src/validation/validation_result.rs +++ b/packages/rs-dpp/src/validation/validation_result.rs @@ -237,6 +237,17 @@ impl ValidationResult { ))) } + pub fn into_data_and_errors(self) -> Result<(TData, Vec), ProtocolError> { + Ok(( + self.data + .ok_or(ProtocolError::CorruptedCodeExecution(format!( + "trying to push validation result into data (errors are {:?})", + self.errors + )))?, + self.errors, + )) + } + pub fn data_as_borrowed(&self) -> Result<&TData, ProtocolError> { self.data .as_ref() diff --git a/packages/rs-dpp/src/version/mod.rs b/packages/rs-dpp/src/version/mod.rs index 71e2b84d9b8..71347643217 100644 --- a/packages/rs-dpp/src/version/mod.rs +++ b/packages/rs-dpp/src/version/mod.rs @@ -10,6 +10,9 @@ lazy_static! { RwLock::new(None); } +/// Number of votes for a protocol version upgrade. +pub type ProtocolVersionVoteCount = u64; + pub trait PlatformVersionCurrentVersion { fn set_current(platform_version: &'static PlatformVersion); fn get_current<'a>() -> Result<&'a Self, ProtocolError>; diff --git a/packages/rs-drive-abci/.env.example b/packages/rs-drive-abci/.env.example deleted file mode 100644 index 6bde9c76a6b..00000000000 --- a/packages/rs-drive-abci/.env.example +++ /dev/null @@ -1,74 +0,0 @@ -# ABCI host and port to listen -ABCI_BIND_ADDRESS="tcp://0.0.0.0:26658" -ABCI_PROMETHEUS_BIND_ADDRESS="http://0.0.0.0:29090" - -# stderr logging for humans -ABCI_LOG_STDOUT_DESTINATION=stdout -ABCI_LOG_STDOUT_LEVEL=info -ABCI_LOG_STDOUT_FORMAT=pretty -ABCI_LOG_STDOUT_COLOR=true - -DB_PATH=/tmp/db - -# GroveDB database file -GROVEDB_LATEST_FILE=${DB_PATH}/latest_state - -# Cache size for Data Contracts -DATA_CONTRACTS_GLOBAL_CACHE_SIZE=500 -DATA_CONTRACTS_BLOCK_CACHE_SIZE=200 - -# DashCore JSON-RPC host, port and credentials -# Read more: https://dashcore.readme.io/docs/core-api-ref-remote-procedure-calls -CORE_JSON_RPC_HOST=127.0.0.1 -CORE_JSON_RPC_PORT=9998 -CORE_JSON_RPC_USERNAME=dashrpc -CORE_JSON_RPC_PASSWORD=password - -# DashCore ZMQ host and port -CORE_ZMQ_HOST=127.0.0.1 -CORE_ZMQ_PORT=29998 -CORE_ZMQ_CONNECTION_RETRIES=16 - -NETWORK=testnet - -INITIAL_CORE_CHAINLOCKED_HEIGHT=1243 - -# https://github.com/dashevo/dashcore-lib/blob/286c33a9d29d33f05d874c47a9b33764a0be0cf1/lib/constants/index.js#L42-L57 -VALIDATOR_SET_LLMQ_TYPE=100 -VALIDATOR_SET_QUORUM_ROTATION_BLOCK_COUNT=64 - -DKG_INTERVAL=24 -MIN_QUORUM_VALID_MEMBERS=3 - -# DPNS Contract - -DPNS_MASTER_PUBLIC_KEY=02649a81b760e8635dd3a4fad8911388ed09d7c1680558a890180d4edc8bcece7e -DPNS_SECOND_PUBLIC_KEY=03f5ea3ab4bf594c28997eb8f83873532275ac2edd36e586b137ed42d15d510948 - -# Dashpay Contract - -DASHPAY_MASTER_PUBLIC_KEY=022d6d70c9d24d03904713db17fb74c9201801ba0e3aed0f5d91e89df388e94aa6 -DASHPAY_SECOND_PUBLIC_KEY=028c0a26c87b2e7f1aebbbeace9e687d774e037f5b50a6905b5f6fa24495b502cd - -# Feature flags contract - -FEATURE_FLAGS_MASTER_PUBLIC_KEY=034ee04c509083ecd09e76fa53e0b5331b39120c19607cd04c4f167707dbb42302 -FEATURE_FLAGS_SECOND_PUBLIC_KEY=03c755ae1b79dbcc79020aad3ccdfcb142fc6e74f1afc220fca1e275a87aa12cf8 - -# Masternode reward shares contract - -MASTERNODE_REWARD_SHARES_MASTER_PUBLIC_KEY=02099cc210c7b6c7f566099046ddc92615342db326184940bf3811026ea328c85e -MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY=02bf55f97f189895da29824781053140ee66b2bf47760246504fbe502985096af5 - -# Withdrawals contract - -WITHDRAWALS_MASTER_PUBLIC_KEY=027057cdf58628635ef7b75e6b6c90dd996a16929cd68130e16b9328d429e5e03a -WITHDRAWALS_SECOND_PUBLIC_KEY=022084d827fea4823a69aa7c8d3e02fe780eaa0ef1e5e9841af395ba7e40465ab6 - -TENDERDASH_P2P_PORT=26656 - -EPOCH_TIME_LENGTH_S=788400 -QUORUM_SIZE=5 -QUORUM_TYPE=llmq_25_67 -CHAIN_ID=devnet -BLOCK_SPACING_MS=3000 diff --git a/packages/rs-drive-abci/.env.local b/packages/rs-drive-abci/.env.local new file mode 100644 index 00000000000..942707ab200 --- /dev/null +++ b/packages/rs-drive-abci/.env.local @@ -0,0 +1,71 @@ +# ABCI host and port to listen +ABCI_CONSENSUS_BIND_ADDRESS="tcp://0.0.0.0:26658" +GRPC_BIND_ADDRESS="0.0.0.0:26670" + +# Metrics are disabled when empty. Must be http://0.0.0.0:29090 for example to enable +PROMETHEUS_BIND_ADDRESS= + +# stderr logging for humans +ABCI_LOG_STDOUT_DESTINATION=stdout +ABCI_LOG_STDOUT_LEVEL=info +ABCI_LOG_STDOUT_FORMAT=pretty +ABCI_LOG_STDOUT_COLOR=true + +DB_PATH=/tmp/db +REJECTIONS_PATH=/tmp/rejected + +# Cache size for Data Contracts +DATA_CONTRACTS_GLOBAL_CACHE_SIZE=500 +DATA_CONTRACTS_BLOCK_CACHE_SIZE=200 + +# DashCore JSON-RPC host, port and credentials +# Read more: https://dashcore.readme.io/docs/core-api-ref-remote-procedure-calls +CORE_JSON_RPC_HOST=127.0.0.1 +CORE_JSON_RPC_PORT=9998 +CORE_JSON_RPC_USERNAME=dashrpc +CORE_JSON_RPC_PASSWORD=password + +INITIAL_CORE_CHAINLOCKED_HEIGHT=1243 + +# https://github.com/dashevo/dashcore-lib/blob/286c33a9d29d33f05d874c47a9b33764a0be0cf1/lib/constants/index.js#L42-L57 +VALIDATOR_SET_QUORUM_TYPE=llmq_test +VALIDATOR_SET_QUORUM_SIZE=3 +VALIDATOR_SET_ROTATION_BLOCK_COUNT=64 + +CHAIN_LOCK_QUORUM_TYPE=llmq_test +CHAIN_LOCK_QUORUM_WINDOW=24 +CHAIN_LOCK_QUORUM_SIZE=3 + +# DPNS Contract + +DPNS_MASTER_PUBLIC_KEY=02649a81b760e8635dd3a4fad8911388ed09d7c1680558a890180d4edc8bcece7e +DPNS_SECOND_PUBLIC_KEY=03f5ea3ab4bf594c28997eb8f83873532275ac2edd36e586b137ed42d15d510948 + +# Dashpay Contract + +DASHPAY_MASTER_PUBLIC_KEY=022d6d70c9d24d03904713db17fb74c9201801ba0e3aed0f5d91e89df388e94aa6 +DASHPAY_SECOND_PUBLIC_KEY=028c0a26c87b2e7f1aebbbeace9e687d774e037f5b50a6905b5f6fa24495b502cd + +# Feature flags contract + +FEATURE_FLAGS_MASTER_PUBLIC_KEY=034ee04c509083ecd09e76fa53e0b5331b39120c19607cd04c4f167707dbb42302 +FEATURE_FLAGS_SECOND_PUBLIC_KEY=03c755ae1b79dbcc79020aad3ccdfcb142fc6e74f1afc220fca1e275a87aa12cf8 + +# Masternode reward shares contract + +MASTERNODE_REWARD_SHARES_MASTER_PUBLIC_KEY=02099cc210c7b6c7f566099046ddc92615342db326184940bf3811026ea328c85e +MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY=02bf55f97f189895da29824781053140ee66b2bf47760246504fbe502985096af5 + +# Withdrawals contract + +WITHDRAWALS_MASTER_PUBLIC_KEY=027057cdf58628635ef7b75e6b6c90dd996a16929cd68130e16b9328d429e5e03a +WITHDRAWALS_SECOND_PUBLIC_KEY=022084d827fea4823a69aa7c8d3e02fe780eaa0ef1e5e9841af395ba7e40465ab6 + +EPOCH_TIME_LENGTH_S=788400 + +CHAIN_ID=devnet +BLOCK_SPACING_MS=5000 + +TOKIO_CONSOLE_ENABLED=false +TOKIO_CONSOLE_ADDRESS=127.0.0.1:6669 +TOKIO_CONSOLE_RETENTION_SECS=180 diff --git a/packages/rs-drive-abci/.env.mainnet b/packages/rs-drive-abci/.env.mainnet new file mode 100644 index 00000000000..a15602a413f --- /dev/null +++ b/packages/rs-drive-abci/.env.mainnet @@ -0,0 +1,70 @@ +# ABCI host and port to listen +ABCI_CONSENSUS_BIND_ADDRESS="tcp://0.0.0.0:26658" +GRPC_BIND_ADDRESS="0.0.0.0:26670" + +# Metrics are disabled when empty. Must be http://0.0.0.0:29090 for example to enable +PROMETHEUS_BIND_ADDRESS= + +# stderr logging for humans +ABCI_LOG_STDOUT_DESTINATION=stdout +ABCI_LOG_STDOUT_LEVEL=info +ABCI_LOG_STDOUT_FORMAT=pretty +ABCI_LOG_STDOUT_COLOR=true + +DB_PATH=/tmp/db +REJECTIONS_PATH=/tmp/rejected + +# Cache size for Data Contracts +DATA_CONTRACTS_GLOBAL_CACHE_SIZE=500 +DATA_CONTRACTS_BLOCK_CACHE_SIZE=200 + +# DashCore JSON-RPC host, port and credentials +# Read more: https://dashcore.readme.io/docs/core-api-ref-remote-procedure-calls +CORE_JSON_RPC_HOST=127.0.0.1 +CORE_JSON_RPC_PORT=9998 +CORE_JSON_RPC_USERNAME=dashrpc +CORE_JSON_RPC_PASSWORD=password + +INITIAL_CORE_CHAINLOCKED_HEIGHT=1243 + +# https://github.com/dashevo/dashcore-lib/blob/286c33a9d29d33f05d874c47a9b33764a0be0cf1/lib/constants/index.js#L42-L57 +VALIDATOR_SET_QUORUM_TYPE=llmq_100_67 +VALIDATOR_SET_QUORUM_SIZE=100 +VALIDATOR_SET_ROTATION_BLOCK_COUNT=64 + +CHAIN_LOCK_QUORUM_TYPE=llmq_400_60 +CHAIN_LOCK_QUORUM_WINDOW=288 + +# DPNS Contract + +DPNS_MASTER_PUBLIC_KEY=02649a81b760e8635dd3a4fad8911388ed09d7c1680558a890180d4edc8bcece7e +DPNS_SECOND_PUBLIC_KEY=03f5ea3ab4bf594c28997eb8f83873532275ac2edd36e586b137ed42d15d510948 + +# Dashpay Contract + +DASHPAY_MASTER_PUBLIC_KEY=022d6d70c9d24d03904713db17fb74c9201801ba0e3aed0f5d91e89df388e94aa6 +DASHPAY_SECOND_PUBLIC_KEY=028c0a26c87b2e7f1aebbbeace9e687d774e037f5b50a6905b5f6fa24495b502cd + +# Feature flags contract + +FEATURE_FLAGS_MASTER_PUBLIC_KEY=034ee04c509083ecd09e76fa53e0b5331b39120c19607cd04c4f167707dbb42302 +FEATURE_FLAGS_SECOND_PUBLIC_KEY=03c755ae1b79dbcc79020aad3ccdfcb142fc6e74f1afc220fca1e275a87aa12cf8 + +# Masternode reward shares contract + +MASTERNODE_REWARD_SHARES_MASTER_PUBLIC_KEY=02099cc210c7b6c7f566099046ddc92615342db326184940bf3811026ea328c85e +MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY=02bf55f97f189895da29824781053140ee66b2bf47760246504fbe502985096af5 + +# Withdrawals contract + +WITHDRAWALS_MASTER_PUBLIC_KEY=027057cdf58628635ef7b75e6b6c90dd996a16929cd68130e16b9328d429e5e03a +WITHDRAWALS_SECOND_PUBLIC_KEY=022084d827fea4823a69aa7c8d3e02fe780eaa0ef1e5e9841af395ba7e40465ab6 + +EPOCH_TIME_LENGTH_S=788400 + +CHAIN_ID=devnet +BLOCK_SPACING_MS=5000 + +TOKIO_CONSOLE_ENABLED=false +TOKIO_CONSOLE_ADDRESS=127.0.0.1:6669 +TOKIO_CONSOLE_RETENTION_SECS=180 diff --git a/packages/rs-drive-abci/.env.testnet b/packages/rs-drive-abci/.env.testnet new file mode 100644 index 00000000000..e40ea7efc00 --- /dev/null +++ b/packages/rs-drive-abci/.env.testnet @@ -0,0 +1,70 @@ +# ABCI host and port to listen +ABCI_CONSENSUS_BIND_ADDRESS="tcp://0.0.0.0:26658" +GRPC_BIND_ADDRESS="0.0.0.0:26670" + +# Metrics are disabled when empty. Must be http://0.0.0.0:29090 for example to enable +PROMETHEUS_BIND_ADDRESS= + +# stderr logging for humans +ABCI_LOG_STDOUT_DESTINATION=stdout +ABCI_LOG_STDOUT_LEVEL=info +ABCI_LOG_STDOUT_FORMAT=pretty +ABCI_LOG_STDOUT_COLOR=true + +DB_PATH=/tmp/db +REJECTIONS_PATH=/tmp/rejected + +# Cache size for Data Contracts +DATA_CONTRACTS_GLOBAL_CACHE_SIZE=500 +DATA_CONTRACTS_BLOCK_CACHE_SIZE=200 + +# DashCore JSON-RPC host, port and credentials +# Read more: https://dashcore.readme.io/docs/core-api-ref-remote-procedure-calls +CORE_JSON_RPC_HOST=127.0.0.1 +CORE_JSON_RPC_PORT=9998 +CORE_JSON_RPC_USERNAME=dashrpc +CORE_JSON_RPC_PASSWORD=password + +INITIAL_CORE_CHAINLOCKED_HEIGHT=1243 + +# https://github.com/dashevo/dashcore-lib/blob/286c33a9d29d33f05d874c47a9b33764a0be0cf1/lib/constants/index.js#L42-L57 +VALIDATOR_SET_QUORUM_TYPE=llmq_25_67 +VALIDATOR_SET_QUORUM_SIZE=25 +VALIDATOR_SET_ROTATION_BLOCK_COUNT=64 + +CHAIN_LOCK_QUORUM_TYPE=llmq_50_60 +CHAIN_LOCK_QUORUM_WINDOW=24 + +# DPNS Contract + +DPNS_MASTER_PUBLIC_KEY=02649a81b760e8635dd3a4fad8911388ed09d7c1680558a890180d4edc8bcece7e +DPNS_SECOND_PUBLIC_KEY=03f5ea3ab4bf594c28997eb8f83873532275ac2edd36e586b137ed42d15d510948 + +# Dashpay Contract + +DASHPAY_MASTER_PUBLIC_KEY=022d6d70c9d24d03904713db17fb74c9201801ba0e3aed0f5d91e89df388e94aa6 +DASHPAY_SECOND_PUBLIC_KEY=028c0a26c87b2e7f1aebbbeace9e687d774e037f5b50a6905b5f6fa24495b502cd + +# Feature flags contract + +FEATURE_FLAGS_MASTER_PUBLIC_KEY=034ee04c509083ecd09e76fa53e0b5331b39120c19607cd04c4f167707dbb42302 +FEATURE_FLAGS_SECOND_PUBLIC_KEY=03c755ae1b79dbcc79020aad3ccdfcb142fc6e74f1afc220fca1e275a87aa12cf8 + +# Masternode reward shares contract + +MASTERNODE_REWARD_SHARES_MASTER_PUBLIC_KEY=02099cc210c7b6c7f566099046ddc92615342db326184940bf3811026ea328c85e +MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY=02bf55f97f189895da29824781053140ee66b2bf47760246504fbe502985096af5 + +# Withdrawals contract + +WITHDRAWALS_MASTER_PUBLIC_KEY=027057cdf58628635ef7b75e6b6c90dd996a16929cd68130e16b9328d429e5e03a +WITHDRAWALS_SECOND_PUBLIC_KEY=022084d827fea4823a69aa7c8d3e02fe780eaa0ef1e5e9841af395ba7e40465ab6 + +EPOCH_TIME_LENGTH_S=788400 + +CHAIN_ID=devnet +BLOCK_SPACING_MS=5000 + +TOKIO_CONSOLE_ENABLED=false +TOKIO_CONSOLE_ADDRESS=127.0.0.1:6669 +TOKIO_CONSOLE_RETENTION_SECS=180 diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index af6227b8831..8b1281b271e 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -1,114 +1,117 @@ [package] name = "drive-abci" -version = "0.25.21" +version = "1.0.0-dev.15" authors = [ - "Samuel Westrich ", - "Ivan Shumkov ", - "Djavid Gabibiyan ", - "Lukasz Klimek ", - "Igor Markin ", + "Samuel Westrich ", + "Ivan Shumkov ", + "Djavid Gabibiyan ", + "Lukasz Klimek ", + "Igor Markin ", ] edition = "2021" -rust-version = "1.73" +rust-version = "1.76" license = "MIT" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] +arc-swap = "1.7.0" bincode = { version = "2.0.0-rc.3", features = ["serde"] } ciborium = { git = "https://github.com/qrayven/ciborium", branch = "feat-ser-null-as-undefined" } -chrono = "0.4.20" -serde = { version = "1.0.152", features = ["derive"] } +chrono = "0.4.35" +serde = { version = "1.0.197", features = ["derive"] } serde_json = { version = "1.0", features = ["preserve_order"] } serde_with = { version = "3.1.0", features = [ - "hex", - "macros", + "hex", + "macros", ], default-features = false } -drive = { path = "../rs-drive", features = [ - "full", - "grovedb_operations_logging", +drive = { path = "../rs-drive", default-features = false, features = [ + "server", + "grovedb_operations_logging", ] } -thiserror = "1.0.30" +thiserror = "1.0.58" rand = "0.8.5" tempfile = "3.3.0" -bs58 = "0.4.0" hex = "0.4.3" -indexmap = { version = "1.9.3", features = ["serde"] } +indexmap = { version = "2.2.6", features = ["serde"] } sha2 = "0.10.6" -dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", branch = "master" } +dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", tag = "v0.15.2" } dpp = { path = "../rs-dpp", features = ["abci"] } simple-signer = { path = "../simple-signer" } rust_decimal = "1.2.5" rust_decimal_macros = "1.25.0" mockall = { version = "0.11", optional = true } -bytes = { version = "1.4.0", default-features = false } -prost = { version = "0.11.6", default-features = false } +prost = { version = "0.12", default-features = false } tracing = { version = "0.1.37", default-features = false, features = [] } -clap = { version = "4.1.8", optional = true, features = ["derive"] } +clap = { version = "4.4.10", features = ["derive"] } envy = { version = "0.4.2" } -dotenvy = { version = "0.15.7", optional = true } -dapi-grpc = { path = "../dapi-grpc" } +dotenvy = { version = "0.15.7" } +dapi-grpc = { path = "../dapi-grpc", features = ["server"] } tracing-subscriber = { version = "0.3.16", default-features = false, features = [ - "env-filter", - "ansi", - "json", - "fmt", - "std", - "registry", - "tracing-log", + "env-filter", + "ansi", + "json", + "fmt", + "std", + "registry", + "tracing-log", ], optional = false } atty = { version = "0.2.14", optional = false } -tenderdash-abci = { git = "https://github.com/dashpay/rs-tenderdash-abci", tag = "v0.14.0-dev.2" } +tenderdash-abci = { git = "https://github.com/dashpay/rs-tenderdash-abci", version = "0.14.0-dev.12", features = [ + "grpc", +] } lazy_static = "1.4.0" itertools = { version = "0.10.5" } file-rotate = { version = "0.7.3" } reopen = { version = "1.0.3" } delegate = { version = "0.9.0" } regex = { version = "1.8.1" } -metrics = { version = "0.21" } -metrics-exporter-prometheus = { version = "0.12" } +metrics = { version = "0.22.3" } +metrics-exporter-prometheus = { version = "0.14.0" } url = { version = "2.3.1" } ureq = { "version" = "2.6.2" } -tokio = { version = "1", features = [ - "macros", - "signal", - "rt-multi-thread", - "time", +tokio = { version = "1.36", features = [ + "macros", + "signal", + "rt-multi-thread", + "time", ] } tokio-util = { version = "0.7.8" } derive_more = "0.99.17" +async-trait = "0.1.77" +console-subscriber = { version = "0.2.0", optional = true } [dev-dependencies] base64 = "0.20.0" platform-version = { path = "../rs-platform-version", features = [ - "mock-versions", + "mock-versions", ] } dpp = { path = "../rs-dpp", features = [ - "abci", - "random-documents", - "state-transition-signing", - "random-identities", - "random-public-keys", - "random-document-types", - "fixtures-and-mocks", - "identity-value-conversion", - "data-contract-json-conversion", - "data-contract-cbor-conversion", + "abci", + "random-documents", + "state-transition-signing", + "random-identities", + "random-public-keys", + "random-document-types", + "fixtures-and-mocks", + "identity-value-conversion", + "data-contract-json-conversion", + "data-contract-cbor-conversion", ] } drive = { path = "../rs-drive" } strategy-tests = { path = "../strategy-tests" } +assert_matches = "1.5.0" # For tests of grovedb verify -rocksdb = { version = "0.21.0" } +rocksdb = { version = "0.22.0" } integer-encoding = { version = "4.0.0" } [features] -default = ["server", "mocks"] -server = ["clap", "dotenvy"] +# TODO: Remove console for production +default = ["mocks", "console"] mocks = ["mockall", "drive/fixtures-and-mocks"] +console = ["console-subscriber", "tokio/tracing"] [[bin]] name = "drive-abci" path = "src/main.rs" -required-features = ["server"] +required-features = ["console"] diff --git a/packages/rs-drive-abci/src/abci/app/check_tx.rs b/packages/rs-drive-abci/src/abci/app/check_tx.rs new file mode 100644 index 00000000000..8e0c4ee4fa2 --- /dev/null +++ b/packages/rs-drive-abci/src/abci/app/check_tx.rs @@ -0,0 +1,97 @@ +use crate::abci::app::PlatformApplication; +use crate::abci::handler; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use crate::utils::spawn_blocking_task_with_name_if_supported; +use async_trait::async_trait; +use std::fmt::Debug; +use std::sync::Arc; +use tenderdash_abci::proto::abci as proto; +use tenderdash_abci::proto::abci::abci_application_server as grpc_abci_server; +use tenderdash_abci::proto::tonic; + +/// AbciApp is an implementation of gRPC ABCI Application, as defined by Tenderdash. +/// +/// AbciApp implements logic that should be triggered when Tenderdash performs various operations, like +/// creating new proposal or finalizing new block. +pub struct CheckTxAbciApplication +where + C: CoreRPCLike + Send + Sync + 'static, +{ + /// Platform + platform: Arc>, +} + +impl PlatformApplication for CheckTxAbciApplication +where + C: CoreRPCLike + Send + Sync + 'static, +{ + fn platform(&self) -> &Platform { + self.platform.as_ref() + } +} + +impl CheckTxAbciApplication +where + C: CoreRPCLike + Send + Sync + 'static, +{ + /// Create new ABCI app + pub fn new(platform: Arc>) -> Self { + Self { platform } + } +} + +impl Debug for CheckTxAbciApplication +where + C: CoreRPCLike + Send + Sync + 'static, +{ + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "") + } +} + +#[async_trait] +impl grpc_abci_server::AbciApplication for CheckTxAbciApplication +where + C: CoreRPCLike + Send + Sync + 'static, +{ + async fn echo( + &self, + request: tonic::Request, + ) -> Result, tonic::Status> { + let response = handler::echo(self, request.into_inner()).map_err(error_into_status)?; + + Ok(tonic::Response::new(response)) + } + + async fn check_tx( + &self, + request: tonic::Request, + ) -> Result, tonic::Status> { + let platform = Arc::clone(&self.platform); + + let proto_request = request.into_inner(); + + let check_tx_type = proto::CheckTxType::try_from(proto_request.r#type) + .map_err(|_| tonic::Status::invalid_argument("invalid check tx type"))?; + + let thread_name = match check_tx_type { + proto::CheckTxType::New => "check_tx", + proto::CheckTxType::Recheck => "re_check_tx", + }; + + spawn_blocking_task_with_name_if_supported(thread_name, move || { + let response = + handler::check_tx(&platform, proto_request).map_err(error_into_status)?; + + Ok(tonic::Response::new(response)) + })? + .await + .map_err(|error| tonic::Status::internal(format!("check tx panics: {}", error)))? + } +} + +pub fn error_into_status(error: Error) -> tonic::Status { + tonic::Status::internal(error.to_string()) +} diff --git a/packages/rs-drive-abci/src/abci/app/consensus.rs b/packages/rs-drive-abci/src/abci/app/consensus.rs new file mode 100644 index 00000000000..a1f08429847 --- /dev/null +++ b/packages/rs-drive-abci/src/abci/app/consensus.rs @@ -0,0 +1,152 @@ +use crate::abci::app::{BlockExecutionApplication, PlatformApplication, TransactionalApplication}; +use crate::abci::handler; +use crate::abci::handler::error::error_into_exception; +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::block_execution_context::BlockExecutionContext; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::version::PlatformVersion; +use drive::grovedb::Transaction; +use std::fmt::Debug; +use std::sync::RwLock; +use tenderdash_abci::proto::abci as proto; + +/// AbciApp is an implementation of ABCI Application, as defined by Tenderdash. +/// +/// AbciApp implements logic that should be triggered when Tenderdash performs various operations, like +/// creating new proposal or finalizing new block. +pub struct ConsensusAbciApplication<'a, C> { + /// Platform + platform: &'a Platform, + /// The current GroveDb transaction + transaction: RwLock>>, + /// The current block execution context + block_execution_context: RwLock>, +} + +impl<'a, C> ConsensusAbciApplication<'a, C> { + /// Create new ABCI app + pub fn new(platform: &'a Platform) -> Self { + Self { + platform, + transaction: Default::default(), + block_execution_context: Default::default(), + } + } +} + +impl<'a, C> PlatformApplication for ConsensusAbciApplication<'a, C> { + fn platform(&self) -> &Platform { + self.platform + } +} + +impl<'a, C> BlockExecutionApplication for ConsensusAbciApplication<'a, C> { + fn block_execution_context(&self) -> &RwLock> { + &self.block_execution_context + } +} + +impl<'a, C> TransactionalApplication<'a> for ConsensusAbciApplication<'a, C> { + /// create and store a new transaction + fn start_transaction(&self) { + let transaction = self.platform.drive.grove.start_transaction(); + self.transaction.write().unwrap().replace(transaction); + } + + fn transaction(&self) -> &RwLock>> { + &self.transaction + } + + /// Commit a transaction + fn commit_transaction(&self, platform_version: &PlatformVersion) -> Result<(), Error> { + let transaction = self + .transaction + .write() + .unwrap() + .take() + .ok_or(Error::Execution(ExecutionError::NotInTransaction( + "trying to commit a transaction, but we are not in one", + )))?; + + self.platform + .drive + .commit_transaction(transaction, &platform_version.drive) + .map_err(Error::Drive) + } +} + +impl<'a, C> Debug for ConsensusAbciApplication<'a, C> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "") + } +} + +impl<'a, C> tenderdash_abci::Application for ConsensusAbciApplication<'a, C> +where + C: CoreRPCLike, +{ + fn info( + &self, + request: proto::RequestInfo, + ) -> Result { + handler::info(self, request).map_err(error_into_exception) + } + + fn init_chain( + &self, + request: proto::RequestInitChain, + ) -> Result { + handler::init_chain(self, request).map_err(error_into_exception) + } + + fn query( + &self, + _request: proto::RequestQuery, + ) -> Result { + unreachable!("query is not implemented for consensus ABCI application") + } + + fn check_tx( + &self, + _request: proto::RequestCheckTx, + ) -> Result { + unreachable!("check_tx is not implemented for consensus ABCI application") + } + + fn extend_vote( + &self, + request: proto::RequestExtendVote, + ) -> Result { + handler::extend_vote(self, request).map_err(error_into_exception) + } + + fn finalize_block( + &self, + request: proto::RequestFinalizeBlock, + ) -> Result { + handler::finalize_block(self, request).map_err(error_into_exception) + } + + fn prepare_proposal( + &self, + request: proto::RequestPrepareProposal, + ) -> Result { + handler::prepare_proposal(self, request).map_err(error_into_exception) + } + + fn process_proposal( + &self, + request: proto::RequestProcessProposal, + ) -> Result { + handler::process_proposal(self, request).map_err(error_into_exception) + } + + fn verify_vote_extension( + &self, + request: proto::RequestVerifyVoteExtension, + ) -> Result { + handler::verify_vote_extension(self, request).map_err(error_into_exception) + } +} diff --git a/packages/rs-drive-abci/src/abci/app/execution_result.rs b/packages/rs-drive-abci/src/abci/app/execution_result.rs new file mode 100644 index 00000000000..a6b9cfbaceb --- /dev/null +++ b/packages/rs-drive-abci/src/abci/app/execution_result.rs @@ -0,0 +1,47 @@ +use crate::abci::handler::error::consensus::AbciResponseInfoGetter; +use crate::abci::handler::error::HandlerError; +use crate::error::Error; +use crate::platform_types::state_transitions_processing_result::StateTransitionExecutionResult; +use dpp::fee::SignedCredits; +use dpp::version::PlatformVersion; +use dpp::version::TryIntoPlatformVersioned; +use tenderdash_abci::proto::abci::ExecTxResult; + +impl TryIntoPlatformVersioned for StateTransitionExecutionResult { + type Error = Error; + + fn try_into_platform_versioned( + self, + platform_version: &PlatformVersion, + ) -> Result { + let response = match self { + StateTransitionExecutionResult::SuccessfulExecution(_, actual_fees) => ExecTxResult { + code: 0, + gas_used: actual_fees.total_base_fee() as SignedCredits, + ..Default::default() + }, + StateTransitionExecutionResult::UnpaidConsensusError(error) => ExecTxResult { + code: HandlerError::from(&error).code(), + info: error.response_info_for_version(platform_version)?, + gas_used: 0, + ..Default::default() + }, + StateTransitionExecutionResult::PaidConsensusError(error, actual_fees) => { + ExecTxResult { + code: HandlerError::from(&error).code(), + info: error.response_info_for_version(platform_version)?, + gas_used: actual_fees.total_base_fee() as SignedCredits, + ..Default::default() + } + } + StateTransitionExecutionResult::InternalError(message) => ExecTxResult { + code: HandlerError::Internal(message).code(), + // TODO: That would be nice to provide more information about the error for debugging + info: String::default(), + ..Default::default() + }, + }; + + Ok(response) + } +} diff --git a/packages/rs-drive-abci/src/abci/app/full.rs b/packages/rs-drive-abci/src/abci/app/full.rs new file mode 100644 index 00000000000..e760301deba --- /dev/null +++ b/packages/rs-drive-abci/src/abci/app/full.rs @@ -0,0 +1,152 @@ +use crate::abci::app::{BlockExecutionApplication, PlatformApplication, TransactionalApplication}; +use crate::abci::handler; +use crate::abci::handler::error::error_into_exception; +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::block_execution_context::BlockExecutionContext; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::version::PlatformVersion; +use drive::grovedb::Transaction; +use std::fmt::Debug; +use std::sync::RwLock; +use tenderdash_abci::proto::abci as proto; + +/// AbciApp is an implementation of ABCI Application, as defined by Tenderdash. +/// +/// AbciApp implements logic that should be triggered when Tenderdash performs various operations, like +/// creating new proposal or finalizing new block. +pub struct FullAbciApplication<'a, C> { + /// Platform + pub platform: &'a Platform, + /// The current GroveDB transaction + pub transaction: RwLock>>, + /// The current block execution context + pub block_execution_context: RwLock>, +} + +impl<'a, C> FullAbciApplication<'a, C> { + /// Create new ABCI app + pub fn new(platform: &'a Platform) -> Self { + Self { + platform, + transaction: Default::default(), + block_execution_context: Default::default(), + } + } +} + +impl<'a, C> PlatformApplication for FullAbciApplication<'a, C> { + fn platform(&self) -> &Platform { + self.platform + } +} + +impl<'a, C> BlockExecutionApplication for FullAbciApplication<'a, C> { + fn block_execution_context(&self) -> &RwLock> { + &self.block_execution_context + } +} + +impl<'a, C> TransactionalApplication<'a> for FullAbciApplication<'a, C> { + /// create and store a new transaction + fn start_transaction(&self) { + let transaction = self.platform.drive.grove.start_transaction(); + self.transaction.write().unwrap().replace(transaction); + } + + fn transaction(&self) -> &RwLock>> { + &self.transaction + } + + /// Commit a transaction + fn commit_transaction(&self, platform_version: &PlatformVersion) -> Result<(), Error> { + let transaction = self + .transaction + .write() + .unwrap() + .take() + .ok_or(Error::Execution(ExecutionError::NotInTransaction( + "trying to commit a transaction, but we are not in one", + )))?; + + self.platform + .drive + .commit_transaction(transaction, &platform_version.drive) + .map_err(Error::Drive) + } +} + +impl<'a, C> Debug for FullAbciApplication<'a, C> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "") + } +} + +impl<'a, C> tenderdash_abci::Application for FullAbciApplication<'a, C> +where + C: CoreRPCLike, +{ + fn info( + &self, + request: proto::RequestInfo, + ) -> Result { + handler::info(self, request).map_err(error_into_exception) + } + + fn init_chain( + &self, + request: proto::RequestInitChain, + ) -> Result { + handler::init_chain(self, request).map_err(error_into_exception) + } + + fn query( + &self, + _request: proto::RequestQuery, + ) -> Result { + unreachable!("query is not supported in full ABCI application") + } + + fn check_tx( + &self, + request: proto::RequestCheckTx, + ) -> Result { + handler::check_tx(self.platform, request).map_err(error_into_exception) + } + + fn extend_vote( + &self, + request: proto::RequestExtendVote, + ) -> Result { + handler::extend_vote(self, request).map_err(error_into_exception) + } + + fn finalize_block( + &self, + request: proto::RequestFinalizeBlock, + ) -> Result { + handler::finalize_block(self, request).map_err(error_into_exception) + } + + fn prepare_proposal( + &self, + request: proto::RequestPrepareProposal, + ) -> Result { + handler::prepare_proposal(self, request).map_err(error_into_exception) + } + + fn process_proposal( + &self, + request: proto::RequestProcessProposal, + ) -> Result { + handler::process_proposal(self, request).map_err(error_into_exception) + } + + fn verify_vote_extension( + &self, + request: proto::RequestVerifyVoteExtension, + ) -> Result { + handler::verify_vote_extension(self, request).map_err(error_into_exception) + } +} diff --git a/packages/rs-drive-abci/src/abci/app/mod.rs b/packages/rs-drive-abci/src/abci/app/mod.rs new file mode 100644 index 00000000000..d86290b566b --- /dev/null +++ b/packages/rs-drive-abci/src/abci/app/mod.rs @@ -0,0 +1,41 @@ +use crate::error::Error; +use crate::platform_types::platform::Platform; +use drive::grovedb::Transaction; +use std::sync::RwLock; + +mod check_tx; +mod consensus; +/// Convert state transition execution result into ABCI response +pub mod execution_result; +mod full; + +use crate::execution::types::block_execution_context::BlockExecutionContext; +use crate::rpc::core::DefaultCoreRPC; +pub use check_tx::CheckTxAbciApplication; +pub use consensus::ConsensusAbciApplication; +use dpp::version::PlatformVersion; +pub use full::FullAbciApplication; + +/// Platform-based ABCI application +pub trait PlatformApplication { + /// Returns Platform + fn platform(&self) -> &Platform; +} + +/// Transactional ABCI application +pub trait TransactionalApplication<'a> { + /// Creates and keeps a new transaction + fn start_transaction(&self); + + /// Returns the current transaction + fn transaction(&self) -> &RwLock>>; + + /// Commits created transaction + fn commit_transaction(&self, platform_version: &PlatformVersion) -> Result<(), Error>; +} + +/// Application that executes blocks and need to keep context between handlers +pub trait BlockExecutionApplication { + /// Returns the current block execution context + fn block_execution_context(&self) -> &RwLock>; +} diff --git a/packages/rs-drive-abci/src/abci/config.rs b/packages/rs-drive-abci/src/abci/config.rs index ca28bee1227..18f3af7b4cc 100644 --- a/packages/rs-drive-abci/src/abci/config.rs +++ b/packages/rs-drive-abci/src/abci/config.rs @@ -20,21 +20,8 @@ pub struct AbciConfig { /// Address should be an URL with scheme `tcp://` or `unix://`, for example: /// - `tcp://127.0.0.1:1234` /// - `unix:///var/run/abci.sock` - #[serde(rename = "abci_bind_address")] - pub bind_address: String, - - /// Address to listen for Prometheus connection. - /// - /// Optional. - /// - /// /// Address should be an URL with scheme `http://`, for example: - /// - `http://127.0.0.1:29090` - /// - /// Port number defaults to [DEFAULT_PROMETHEUS_PORT]. - /// - /// [DEFAULT_PROMETHEUS_PORT]: crate::metrics::DEFAULT_PROMETHEUS_PORT - #[serde(default, rename = "abci_prometheus_bind_address")] - pub prometheus_bind_address: Option, + #[serde(rename = "abci_consensus_bind_address")] + pub consensus_bind_address: String, /// Public keys used for system identity #[serde(flatten)] @@ -71,8 +58,7 @@ impl AbciConfig { impl Default for AbciConfig { fn default() -> Self { Self { - bind_address: "tcp://127.0.0.1:1234".to_string(), - prometheus_bind_address: None, + consensus_bind_address: "tcp://127.0.0.1:1234".to_string(), keys: Keys::new_random_keys_with_seed(18012014, PlatformVersion::first()) .expect("random keys for first version can not error"), //Dash genesis day genesis_height: AbciConfig::default_genesis_height(), diff --git a/packages/rs-drive-abci/src/abci/error.rs b/packages/rs-drive-abci/src/abci/error.rs index ce2016900ca..2b19bd97fb7 100644 --- a/packages/rs-drive-abci/src/abci/error.rs +++ b/packages/rs-drive-abci/src/abci/error.rs @@ -1,4 +1,7 @@ use dpp::bls_signatures::BlsError; +use dpp::consensus::ConsensusError; +use tenderdash_abci::proto::abci::ExtendVoteExtension; +use tenderdash_abci::proto::types::VoteExtension; // @append_only /// Error returned within ABCI server @@ -10,13 +13,19 @@ pub enum AbciError { /// Request does not match currently processed block #[error("request does not match current block: {0}")] RequestForWrongBlockReceived(String), - /// Withdrawal transactions mismatch + /// Withdrawal vote extensions mismatch #[error("vote extensions mismatch: got {got:?}, expected {expected:?}")] #[allow(missing_docs)] - VoteExtensionMismatchReceived { got: String, expected: String }, + VoteExtensionMismatchReceived { + got: Vec, + expected: Vec, + }, /// Vote extensions signature is invalid #[error("one of vote extension signatures is invalid")] VoteExtensionsSignatureInvalid, + /// Invalid vote extensions verification + #[error("invalid vote extensions verification")] + InvalidVoteExtensionsVerification, /// Cannot load withdrawal transactions #[error("cannot load withdrawal transactions: {0}")] WithdrawalTransactionsDBLoadError(String), @@ -45,6 +54,14 @@ pub enum AbciError { #[error("bad commit signature: {0}")] BadCommitSignature(String), + /// The chain lock received was invalid + #[error("invalid chain lock: {0}")] + InvalidChainLock(String), + + /// The chain lock received was invalid + #[error("chain lock is for a block not known by core: {0}")] + ChainLockedBlockNotKnownByCore(String), + /// Error returned by Tenderdash-abci library #[error("tenderdash: {0}")] Tenderdash(#[from] tenderdash_abci::Error), @@ -61,14 +78,16 @@ pub enum AbciError { #[error("bls error from Tenderdash for threshold mechanisms: {1}: {0}")] BlsErrorOfTenderdashThresholdMechanism(BlsError, String), - /// Generic with code should only be used in tests - #[error("generic with code: {0}")] - GenericWithCode(u32), -} + /// Incompatibility version Error on info handshake between Drive ABCI and Tenderdash + #[error("ABCI version mismatch. Tenderdash requires ABCI protobuf definitions version {tenderdash}, our version is {drive}")] + AbciVersionMismatch { + /// ABCI version in Tenderdash + tenderdash: String, + /// ABCI version in Drive ABCI + drive: String, + }, -// used by `?` operator -impl From for String { - fn from(value: AbciError) -> Self { - value.to_string() - } + /// Generic with code should only be used in tests + #[error("invalid state transition error: {0}")] + InvalidStateTransition(#[from] ConsensusError), } diff --git a/packages/rs-drive-abci/src/abci/handler/check_tx.rs b/packages/rs-drive-abci/src/abci/handler/check_tx.rs new file mode 100644 index 00000000000..65fd9838b7c --- /dev/null +++ b/packages/rs-drive-abci/src/abci/handler/check_tx.rs @@ -0,0 +1,166 @@ +use crate::abci::handler::error::consensus::AbciResponseInfoGetter; +use crate::abci::handler::error::HandlerError; +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::metrics::{LABEL_ABCI_RESPONSE_CODE, LABEL_CHECK_TX_MODE, LABEL_STATE_TRANSITION_NAME}; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::consensus::codes::ErrorWithCode; +use dpp::fee::SignedCredits; +use dpp::util::hash::hash_single; +use metrics::Label; +use tenderdash_abci::proto::abci as proto; + +pub fn check_tx( + platform: &Platform, + request: proto::RequestCheckTx, +) -> Result +where + C: CoreRPCLike, +{ + let mut timer = crate::metrics::abci_request_duration("check_tx"); + + let platform_state = platform.state.load(); + let platform_version = platform_state.current_platform_version()?; + + let proto::RequestCheckTx { tx, r#type } = request; + + let validation_result = platform.check_tx( + tx.as_slice(), + r#type.try_into()?, + &platform_state, + platform_version, + ); + + validation_result + .and_then(|validation_result| { + let (check_tx_result, errors) = + validation_result.into_data_and_errors().map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "validation result should contain check tx result", + )) + })?; + + let first_consensus_error = errors.first(); + + let (code, info) = if let Some(consensus_error) = first_consensus_error { + ( + consensus_error.code(), + consensus_error.response_info_for_version(platform_version)?, + ) + } else { + // If there are no execution errors the code will be 0 + (0, "".to_string()) + }; + + let gas_wanted = check_tx_result + .fee_result + .as_ref() + .map(|fee_result| fee_result.total_base_fee()) + .unwrap_or_default(); + + // Todo: IMPORTANT We need tenderdash to support multiple senders + let first_unique_identifier = check_tx_result + .unique_identifiers + .first() + .cloned() + .unwrap_or_default(); + + let state_transition_name = check_tx_result + .state_transition_name + .clone() + .unwrap_or_else(|| "Unknown".to_string()); + + let priority = check_tx_result.priority as i64; + + if tracing::enabled!(tracing::Level::TRACE) { + let message = match (r#type, code) { + (0, 0) => "added to mempool".to_string(), + (1, 0) => "kept in mempool after re-check".to_string(), + (0, _) => format!( + "rejected with code {code} due to error: {}", + first_consensus_error.ok_or_else(|| Error::Execution( + ExecutionError::CorruptedCodeExecution( + "consensus error must be present with non-zero error code" + ) + ))? + ), + (1, _) => format!( + "removed from mempool with code {code} after re-check due to error: {}", + first_consensus_error.ok_or_else(|| Error::Execution( + ExecutionError::CorruptedCodeExecution( + "consensus error must be present with non-zero error code" + ) + ))? + ), + _ => { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "we have only 2 modes of check tx", + ))) + } + }; + + let state_transition_hash = + check_tx_result.state_transition_hash.ok_or_else(|| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "state transition hash must be present if trace level is enabled", + )) + })?; + + let st_hash = hex::encode(state_transition_hash); + + tracing::trace!( + ?check_tx_result, + error = ?first_consensus_error, + st_hash, + "{} state transition ({}) {}", + state_transition_name, + st_hash, + message + ); + } + + timer.add_label(Label::new( + LABEL_STATE_TRANSITION_NAME, + state_transition_name, + )); + timer.add_label(Label::new(LABEL_CHECK_TX_MODE, r#type.to_string())); + timer.add_label(Label::new(LABEL_ABCI_RESPONSE_CODE, code.to_string())); + + Ok(proto::ResponseCheckTx { + code, + data: vec![], + info, + gas_wanted: gas_wanted as SignedCredits, + codespace: "".to_string(), + sender: first_unique_identifier, + priority, + }) + }) + .or_else(|error| { + let handler_error = HandlerError::Internal(error.to_string()); + + if tracing::enabled!(tracing::Level::ERROR) { + let st_hash = hex::encode(hash_single(tx)); + + tracing::error!( + ?error, + st_hash, + check_tx_mode = r#type, + "Failed to check state transition ({}): {}", + st_hash, + error + ); + } + + Ok(proto::ResponseCheckTx { + code: handler_error.code(), + data: vec![], + info: handler_error.response_info()?, + gas_wanted: 0 as SignedCredits, + codespace: "".to_string(), + sender: "".to_string(), + priority: 0, + }) + }) +} diff --git a/packages/rs-drive-abci/src/abci/handler/echo.rs b/packages/rs-drive-abci/src/abci/handler/echo.rs new file mode 100644 index 00000000000..7e8f60db3ac --- /dev/null +++ b/packages/rs-drive-abci/src/abci/handler/echo.rs @@ -0,0 +1,14 @@ +use crate::abci::app::PlatformApplication; +use crate::error::Error; +use crate::rpc::core::CoreRPCLike; +use tenderdash_abci::proto::abci as proto; + +pub fn echo(_app: &A, request: proto::RequestEcho) -> Result +where + A: PlatformApplication, + C: CoreRPCLike, +{ + Ok(proto::ResponseEcho { + message: request.message, + }) +} diff --git a/packages/rs-drive-abci/src/abci/handler/error/mod.rs b/packages/rs-drive-abci/src/abci/handler/error/mod.rs index 2d7f3a13e77..19735ff6d44 100644 --- a/packages/rs-drive-abci/src/abci/handler/error/mod.rs +++ b/packages/rs-drive-abci/src/abci/handler/error/mod.rs @@ -2,12 +2,16 @@ pub mod consensus; use crate::error::query::QueryError; use crate::error::Error; +use dpp::consensus::codes::ErrorWithCode; +use dpp::consensus::ConsensusError; use dpp::platform_value::platform_value; use dpp::platform_value::string_encoding::{encode, Encoding}; -use tenderdash_abci::proto::abci::ResponseException; +use tenderdash_abci::proto::abci as proto; /// ABCI handlers errors #[derive(Debug, thiserror::Error)] +// Allow dead code, as the majority of these errors are reserved for future use +#[allow(dead_code)] pub enum HandlerError { /// ABCI Handler error (Cancelled) #[error("{0}")] @@ -57,6 +61,9 @@ pub enum HandlerError { /// ABCI Handler error (Unauthenticated) #[error("{0}")] Unauthenticated(String), + /// State Transition processing consensus error + #[error(transparent)] + StateTransitionConsensusError(ConsensusError), } /// Error codes for ABCI handlers @@ -99,60 +106,59 @@ pub enum HandlerErrorCode { impl HandlerError { /// Returns ABCI handler error code pub fn code(&self) -> u32 { - let code = match self { - HandlerError::Cancelled(_) => HandlerErrorCode::Cancelled, - HandlerError::Unknown(_) => HandlerErrorCode::Unknown, - HandlerError::InvalidArgument(_) => HandlerErrorCode::InvalidArgument, - HandlerError::DeadlineExceeded(_) => HandlerErrorCode::DeadlineExceeded, - HandlerError::NotFound(_) => HandlerErrorCode::NotFound, - HandlerError::AlreadyExists(_) => HandlerErrorCode::AlreadyExists, - HandlerError::PermissionDenied(_) => HandlerErrorCode::PermissionDenied, - HandlerError::ResourceExhausted(_) => HandlerErrorCode::ResourceExhausted, - HandlerError::FailedPrecondition(_) => HandlerErrorCode::FailedPrecondition, - HandlerError::Aborted(_) => HandlerErrorCode::Aborted, - HandlerError::OutOfRange(_) => HandlerErrorCode::OutOfRange, - HandlerError::Unimplemented(_) => HandlerErrorCode::Unimplemented, - HandlerError::Internal(_) => HandlerErrorCode::Internal, - HandlerError::Unavailable(_) => HandlerErrorCode::Unavailable, - HandlerError::DataLoss(_) => HandlerErrorCode::DataLoss, - HandlerError::Unauthenticated(_) => HandlerErrorCode::Unauthenticated, - }; - - code as u32 + match self { + HandlerError::Cancelled(_) => HandlerErrorCode::Cancelled as u32, + HandlerError::Unknown(_) => HandlerErrorCode::Unknown as u32, + HandlerError::InvalidArgument(_) => HandlerErrorCode::InvalidArgument as u32, + HandlerError::DeadlineExceeded(_) => HandlerErrorCode::DeadlineExceeded as u32, + HandlerError::NotFound(_) => HandlerErrorCode::NotFound as u32, + HandlerError::AlreadyExists(_) => HandlerErrorCode::AlreadyExists as u32, + HandlerError::PermissionDenied(_) => HandlerErrorCode::PermissionDenied as u32, + HandlerError::ResourceExhausted(_) => HandlerErrorCode::ResourceExhausted as u32, + HandlerError::FailedPrecondition(_) => HandlerErrorCode::FailedPrecondition as u32, + HandlerError::Aborted(_) => HandlerErrorCode::Aborted as u32, + HandlerError::OutOfRange(_) => HandlerErrorCode::OutOfRange as u32, + HandlerError::Unimplemented(_) => HandlerErrorCode::Unimplemented as u32, + HandlerError::Internal(_) => HandlerErrorCode::Internal as u32, + HandlerError::Unavailable(_) => HandlerErrorCode::Unavailable as u32, + HandlerError::DataLoss(_) => HandlerErrorCode::DataLoss as u32, + HandlerError::Unauthenticated(_) => HandlerErrorCode::Unauthenticated as u32, + HandlerError::StateTransitionConsensusError(error) => error.code(), + } } /// Returns error message - pub fn message(&self) -> &str { + pub fn message(&self) -> String { match self { - HandlerError::Cancelled(message) => message, - HandlerError::Unknown(message) => message, - HandlerError::InvalidArgument(message) => message, - HandlerError::DeadlineExceeded(message) => message, - HandlerError::NotFound(message) => message, - HandlerError::AlreadyExists(message) => message, - HandlerError::PermissionDenied(message) => message, - HandlerError::ResourceExhausted(message) => message, - HandlerError::FailedPrecondition(message) => message, - HandlerError::Aborted(message) => message, - HandlerError::OutOfRange(message) => message, - HandlerError::Unimplemented(message) => message, - HandlerError::Internal(message) => message, - HandlerError::Unavailable(message) => message, - HandlerError::DataLoss(message) => message, - HandlerError::Unauthenticated(message) => message, + HandlerError::Cancelled(message) => message.to_owned(), + HandlerError::Unknown(message) => message.to_owned(), + HandlerError::InvalidArgument(message) => message.to_owned(), + HandlerError::DeadlineExceeded(message) => message.to_owned(), + HandlerError::NotFound(message) => message.to_owned(), + HandlerError::AlreadyExists(message) => message.to_owned(), + HandlerError::PermissionDenied(message) => message.to_owned(), + HandlerError::ResourceExhausted(message) => message.to_owned(), + HandlerError::FailedPrecondition(message) => message.to_owned(), + HandlerError::Aborted(message) => message.to_owned(), + HandlerError::OutOfRange(message) => message.to_owned(), + HandlerError::Unimplemented(message) => message.to_owned(), + HandlerError::Internal(message) => message.to_owned(), + HandlerError::Unavailable(message) => message.to_owned(), + HandlerError::DataLoss(message) => message.to_owned(), + HandlerError::Unauthenticated(message) => message.to_owned(), + HandlerError::StateTransitionConsensusError(error) => error.to_string(), } } /// Returns base64-encoded message for info field of ABCI handler responses - pub fn response_info(&self) -> Result { + pub fn response_info(&self) -> Result { let error_data_buffer = platform_value!({ - "message": self.message().to_string(), + "message": self.message(), // TODO: consider capturing stack with one of the libs // and send it to the client //"stack": "..." }) - .to_cbor_buffer() - .map_err(|e| ResponseException::from(Error::Protocol(e.into())))?; + .to_cbor_buffer()?; let error_data_base64 = encode(&error_data_buffer, Encoding::Base64); @@ -172,3 +178,21 @@ impl From<&QueryError> for HandlerError { } } } + +impl From<&ConsensusError> for HandlerError { + fn from(value: &ConsensusError) -> Self { + Self::StateTransitionConsensusError(value.to_owned()) + } +} + +impl From<&Error> for HandlerError { + fn from(value: &Error) -> Self { + Self::Internal(value.to_string()) + } +} + +pub fn error_into_exception(error: Error) -> proto::ResponseException { + proto::ResponseException { + error: error.to_string(), + } +} diff --git a/packages/rs-drive-abci/src/abci/handler/execution_result.rs b/packages/rs-drive-abci/src/abci/handler/execution_result.rs deleted file mode 100644 index f2ec040a386..00000000000 --- a/packages/rs-drive-abci/src/abci/handler/execution_result.rs +++ /dev/null @@ -1,61 +0,0 @@ -use crate::abci::handler::error::consensus::AbciResponseInfoGetter; -use crate::error::Error; -use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult; -use dpp::consensus::codes::ErrorWithCode; -use dpp::fee::SignedCredits; -use dpp::version::PlatformVersion; -use dpp::version::TryIntoPlatformVersioned; -use tenderdash_abci::proto::abci::ExecTxResult; - -// State transitions are never free, so we should filter out SuccessfulFreeExecution -// So we use an option -impl TryIntoPlatformVersioned for StateTransitionExecutionResult { - type Error = Error; - - fn try_into_platform_versioned( - self, - platform_version: &PlatformVersion, - ) -> Result { - let response = match self { - Self::SuccessfulPaidExecution(dry_run_fee_result, fee_result) => ExecTxResult { - code: 0, - data: vec![], - log: "".to_string(), - info: "".to_string(), - gas_wanted: dry_run_fee_result.total_base_fee() as SignedCredits, - gas_used: fee_result.total_base_fee() as SignedCredits, - events: vec![], - codespace: "".to_string(), - }, - Self::SuccessfulFreeExecution => ExecTxResult { - code: 0, - data: vec![], - log: "".to_string(), - info: "".to_string(), - gas_wanted: 0, - gas_used: 0, - events: vec![], - codespace: "".to_string(), - }, - Self::ConsensusExecutionError(validation_result) => { - let error = validation_result - .errors - .first() - .expect("invalid execution result should have a consensus error"); - - ExecTxResult { - code: error.code(), - data: vec![], - log: "".to_string(), - info: error.response_info_for_version(platform_version)?, - gas_wanted: 0, - gas_used: 0, - events: vec![], - codespace: "".to_string(), - } - } - }; - - Ok(response) - } -} diff --git a/packages/rs-drive-abci/src/abci/handler/extend_vote.rs b/packages/rs-drive-abci/src/abci/handler/extend_vote.rs new file mode 100644 index 00000000000..b000deea6bb --- /dev/null +++ b/packages/rs-drive-abci/src/abci/handler/extend_vote.rs @@ -0,0 +1,53 @@ +use crate::abci::app::{BlockExecutionApplication, PlatformApplication, TransactionalApplication}; +use crate::abci::AbciError; +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; +use crate::execution::types::block_state_info::v0::{ + BlockStateInfoV0Getters, BlockStateInfoV0Methods, +}; +use crate::rpc::core::CoreRPCLike; +use tenderdash_abci::proto::abci as proto; + +pub fn extend_vote<'a, A, C>( + app: &A, + request: proto::RequestExtendVote, +) -> Result +where + A: PlatformApplication + TransactionalApplication<'a> + BlockExecutionApplication, + C: CoreRPCLike, +{ + let _timer = crate::metrics::abci_request_duration("extend_vote"); + + let proto::RequestExtendVote { + hash: block_hash, + height, + round, + } = request; + let block_execution_context_guard = app.block_execution_context().read().unwrap(); + let block_execution_context = + block_execution_context_guard + .as_ref() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "block execution context must be set in block begin handler for extend vote", + )))?; + + // Verify Tenderdash that it called this handler correctly + let block_state_info = &block_execution_context.block_state_info(); + + if !block_state_info.matches_current_block(height as u64, round as u32, block_hash.clone())? { + return Err(AbciError::RequestForWrongBlockReceived(format!( + "received extend vote request for height: {} round: {}, block: {}; expected height: {} round: {}, block: {}", + height, round, hex::encode(block_hash), + block_state_info.height(), block_state_info.round(), block_state_info.block_hash().map(hex::encode).unwrap_or("None".to_string()) + )).into()); + } + + // Extend vote with unsigned withdrawal transactions + // we only want to sign the hash of the transaction + let vote_extensions = block_execution_context + .unsigned_withdrawal_transactions() + .into(); + + Ok(proto::ResponseExtendVote { vote_extensions }) +} diff --git a/packages/rs-drive-abci/src/abci/handler/finalize_block.rs b/packages/rs-drive-abci/src/abci/handler/finalize_block.rs new file mode 100644 index 00000000000..177a97f0c0c --- /dev/null +++ b/packages/rs-drive-abci/src/abci/handler/finalize_block.rs @@ -0,0 +1,75 @@ +use crate::abci::app::{BlockExecutionApplication, PlatformApplication, TransactionalApplication}; +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; +use crate::platform_types::cleaned_abci_messages::finalized_block_cleaned_request::v0::FinalizeBlockCleanedRequest; +use crate::rpc::core::CoreRPCLike; +use std::sync::atomic::Ordering; +use tenderdash_abci::proto::abci as proto; + +pub fn finalize_block<'a, A, C>( + app: &A, + request: proto::RequestFinalizeBlock, +) -> Result +where + A: PlatformApplication + TransactionalApplication<'a> + BlockExecutionApplication, + C: CoreRPCLike, +{ + let _timer = crate::metrics::abci_request_duration("finalize_block"); + + let transaction_guard = app.transaction().read().unwrap(); + let transaction = + transaction_guard + .as_ref() + .ok_or(Error::Execution(ExecutionError::NotInTransaction( + "trying to finalize block without a current transaction", + )))?; + + // Get current block platform version + let block_execution_context = app + .block_execution_context() + .write() + .unwrap() + .take() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "block execution context must be set in block begin handler for finalize block", + )))?; + + let platform_version = block_execution_context + .block_platform_state() + .current_platform_version()?; + + let request_finalize_block: FinalizeBlockCleanedRequest = request.try_into()?; + + let block_height = request_finalize_block.height; + + let block_finalization_outcome = app.platform().finalize_block_proposal( + request_finalize_block, + block_execution_context, + transaction, + platform_version, + )?; + + drop(transaction_guard); + + //FIXME: tell tenderdash about the problem instead + // This can not go to production! + if !block_finalization_outcome.validation_result.is_valid() { + return Err(Error::Abci( + block_finalization_outcome + .validation_result + .errors + .into_iter() + .next() + .unwrap(), + )); + } + + app.commit_transaction(platform_version)?; + + app.platform() + .committed_block_height_guard + .store(block_height, Ordering::Relaxed); + + Ok(proto::ResponseFinalizeBlock { retain_height: 0 }) +} diff --git a/packages/rs-drive-abci/src/abci/handler/info.rs b/packages/rs-drive-abci/src/abci/handler/info.rs new file mode 100644 index 00000000000..af8145ae5ca --- /dev/null +++ b/packages/rs-drive-abci/src/abci/handler/info.rs @@ -0,0 +1,57 @@ +use crate::abci::app::PlatformApplication; +use crate::abci::AbciError; +use crate::error::Error; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::rpc::core::CoreRPCLike; +use dpp::version::PlatformVersion; +use tenderdash_abci::proto::abci as proto; + +pub fn info(app: &A, request: proto::RequestInfo) -> Result +where + A: PlatformApplication, + C: CoreRPCLike, +{ + if !tenderdash_abci::check_version(&request.abci_version) { + return Err(AbciError::AbciVersionMismatch { + tenderdash: request.abci_version, + drive: tenderdash_abci::proto::ABCI_VERSION.to_string(), + } + .into()); + } + + let platform_state = app.platform().state.load(); + + let state_app_hash = platform_state + .last_committed_block_app_hash() + .map(|app_hash| app_hash.to_vec()) + .unwrap_or_default(); + + let latest_supported_protocol_version = PlatformVersion::latest().protocol_version; + + let response = proto::ResponseInfo { + data: "".to_string(), + app_version: latest_supported_protocol_version as u64, + last_block_height: platform_state.last_committed_block_height() as i64, + version: env!("CARGO_PKG_VERSION").to_string(), + last_block_app_hash: state_app_hash.clone(), + }; + + tracing::debug!( + latest_supported_protocol_version, + software_version = env!("CARGO_PKG_VERSION"), + block_version = request.block_version, + p2p_version = request.p2p_version, + app_hash = hex::encode(state_app_hash), + height = platform_state.last_committed_block_height(), + "Handshake with consensus engine", + ); + + if tracing::enabled!(tracing::Level::TRACE) { + tracing::trace!( + platform_state_fingerprint = hex::encode(platform_state.fingerprint()), + "platform runtime state", + ); + } + + Ok(response) +} diff --git a/packages/rs-drive-abci/src/abci/handler/init_chain.rs b/packages/rs-drive-abci/src/abci/handler/init_chain.rs new file mode 100644 index 00000000000..a62a26021cb --- /dev/null +++ b/packages/rs-drive-abci/src/abci/handler/init_chain.rs @@ -0,0 +1,42 @@ +use crate::abci::app::{BlockExecutionApplication, PlatformApplication, TransactionalApplication}; +use crate::error::Error; +use crate::rpc::core::CoreRPCLike; +use tenderdash_abci::proto::abci as proto; + +pub fn init_chain<'a, A, C>( + app: &A, + request: proto::RequestInitChain, +) -> Result +where + A: PlatformApplication + TransactionalApplication<'a> + BlockExecutionApplication, + C: CoreRPCLike, +{ + app.start_transaction(); + + let transaction_guard = app.transaction().read().unwrap(); + let transaction = transaction_guard + .as_ref() + .expect("transaction must be started"); + + // We need to drop the block execution context just in case init chain had already been called + let block_context = app.block_execution_context().write().unwrap().take(); //drop the block execution context + if block_context.is_some() { + tracing::warn!("block context was present during init chain, dropping it"); + } + + let chain_id = request.chain_id.to_string(); + + let response = app.platform().init_chain(request, transaction)?; + + transaction.set_savepoint(); + + let app_hash = hex::encode(&response.app_hash); + + tracing::info!( + app_hash, + chain_id, + "Platform chain initialized, initial state is created" + ); + + Ok(response) +} diff --git a/packages/rs-drive-abci/src/abci/handler/mod.rs b/packages/rs-drive-abci/src/abci/handler/mod.rs index 3235b7d59cd..8acd0737ebe 100644 --- a/packages/rs-drive-abci/src/abci/handler/mod.rs +++ b/packages/rs-drive-abci/src/abci/handler/mod.rs @@ -35,1349 +35,23 @@ //! can only make changes that are backwards compatible. Otherwise new calls must be made instead. //! -mod error; -mod execution_result; - -use crate::abci::server::AbciApplication; -use crate::error::execution::ExecutionError; - -use crate::error::Error; -use crate::rpc::core::CoreRPCLike; -use dpp::errors::consensus::codes::ErrorWithCode; -use tenderdash_abci::proto::abci as proto; -use tenderdash_abci::proto::abci::response_verify_vote_extension::VerifyStatus; -use tenderdash_abci::proto::abci::tx_record::TxAction; -use tenderdash_abci::proto::abci::{ - ExecTxResult, RequestCheckTx, RequestFinalizeBlock, RequestInitChain, RequestPrepareProposal, - RequestProcessProposal, RequestQuery, ResponseCheckTx, ResponseFinalizeBlock, - ResponseInitChain, ResponsePrepareProposal, ResponseProcessProposal, ResponseQuery, TxRecord, -}; -use tenderdash_abci::proto::types::VoteExtensionType; - -use super::AbciError; - -use crate::execution::types::block_execution_context::v0::{ - BlockExecutionContextV0Getters, BlockExecutionContextV0MutableGetters, - BlockExecutionContextV0Setters, -}; -use crate::execution::types::block_state_info::v0::{ - BlockStateInfoV0Getters, BlockStateInfoV0Methods, BlockStateInfoV0Setters, -}; -use crate::platform_types::block_execution_outcome; -use crate::platform_types::block_proposal::v0::BlockProposal; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; -use crate::platform_types::platform_state::PlatformState; -use crate::platform_types::withdrawal::withdrawal_txs; -use dpp::dashcore::hashes::Hash; -use dpp::fee::SignedCredits; -use dpp::version::TryIntoPlatformVersioned; -use dpp::version::{PlatformVersion, PlatformVersionCurrentVersion}; -use error::consensus::AbciResponseInfoGetter; -use error::HandlerError; - -impl<'a, C> tenderdash_abci::Application for AbciApplication<'a, C> -where - C: CoreRPCLike, -{ - fn info( - &self, - request: proto::RequestInfo, - ) -> Result { - let state_guard = self.platform.state.read().unwrap(); - - if !tenderdash_abci::check_version(&request.abci_version) { - return Err(proto::ResponseException::from(format!( - "tenderdash requires ABCI version {}, our version is {}", - request.abci_version, - tenderdash_abci::proto::ABCI_VERSION - ))); - } - - let state_app_hash = state_guard - .last_block_app_hash() - .map(|app_hash| app_hash.to_vec()) - .unwrap_or_default(); - - let latest_platform_version = PlatformVersion::latest(); - - let response = proto::ResponseInfo { - data: "".to_string(), - app_version: latest_platform_version.protocol_version as u64, - last_block_height: state_guard.last_block_height() as i64, - version: env!("CARGO_PKG_VERSION").to_string(), - last_block_app_hash: state_app_hash.clone(), - }; - - tracing::info!( - protocol_version = latest_platform_version.protocol_version, - software_version = env!("CARGO_PKG_VERSION"), - block_version = request.block_version, - p2p_version = request.p2p_version, - app_hash = hex::encode(state_app_hash), - height = state_guard.last_block_height(), - "Consensus engine is started from block {}", - state_guard.last_block_height(), - ); - - if tracing::enabled!(tracing::Level::TRACE) { - tracing::trace!( - platform_state_fingerprint = hex::encode(state_guard.fingerprint()), - "platform runtime state", - ); - } - - Ok(response) - } - - fn init_chain( - &self, - request: RequestInitChain, - ) -> Result { - self.start_transaction(); - let chain_id = request.chain_id.to_string(); - - // We need to drop the block execution context just in case init chain had already been called - let mut block_execution_context = self.platform.block_execution_context.write().unwrap(); - let block_context = block_execution_context.take(); //drop the block execution context - if block_context.is_some() { - tracing::warn!("block context was present during init chain, restarting"); - let protocol_version_in_consensus = self.platform.config.initial_protocol_version; - let mut platform_state_write_guard = self.platform.state.write().unwrap(); - *platform_state_write_guard = PlatformState::default_with_protocol_versions( - protocol_version_in_consensus, - protocol_version_in_consensus, - ); - drop(platform_state_write_guard); - } - drop(block_execution_context); - - let transaction_guard = self.transaction.read().unwrap(); - let transaction = transaction_guard.as_ref().unwrap(); - let response = self.platform.init_chain(request, transaction)?; - - transaction.set_savepoint(); - - let app_hash = hex::encode(&response.app_hash); - - tracing::info!( - app_hash, - chain_id, - "platform chain initialized, initial state is created" - ); - - Ok(response) - } - - fn prepare_proposal( - &self, - mut request: RequestPrepareProposal, - ) -> Result { - let _timer = crate::metrics::abci_request_duration("prepare_proposal"); - - // We should get the latest CoreChainLock from core - // It is possible that we will not get a chain lock from core, in this case, just don't - // propose one - // This is done before all else - - let core_chain_lock_update = match self.platform.core_rpc.get_best_chain_lock() { - Ok(latest_chain_lock) => { - if request.core_chain_locked_height < latest_chain_lock.core_block_height { - Some(latest_chain_lock) - } else { - None - } - } - Err(_) => None, - }; - - // Filter out transactions exceeding max_block_size - let mut transactions_exceeding_max_block_size = Vec::new(); - { - let mut total_transactions_size = 0; - let mut index_to_remove_at = None; - for (i, raw_transaction) in request.txs.iter().enumerate() { - total_transactions_size += raw_transaction.len(); - - if total_transactions_size as i64 > request.max_tx_bytes { - index_to_remove_at = Some(i); - break; - } - } - - if let Some(index_to_remove_at) = index_to_remove_at { - transactions_exceeding_max_block_size - .extend(request.txs.drain(index_to_remove_at..)); - } - } - - let mut block_proposal: BlockProposal = (&request).try_into()?; - - if let Some(core_chain_lock_update) = core_chain_lock_update.as_ref() { - // We can't add this, as it slows down CI way too much - // todo: find a way to re-enable this without destroying CI - tracing::debug!( - "propose chain lock update to height {} at block {}", - core_chain_lock_update.core_block_height, - request.height - ); - block_proposal.core_chain_locked_height = core_chain_lock_update.core_block_height; - } - - // Prepare transaction - let transaction_guard = if request.height == self.platform.config.abci.genesis_height as i64 - { - // special logic on init chain - let transaction = self.transaction.read().unwrap(); - if transaction.is_none() { - return Err(Error::Abci(AbciError::BadRequest("received a prepare proposal request for the genesis height before an init chain request".to_string())))?; - } - if request.round > 0 { - transaction.as_ref().map(|tx| tx.rollback_to_savepoint()); - } - transaction - } else { - self.start_transaction(); - self.transaction.read().unwrap() - }; - - let transaction = transaction_guard.as_ref().unwrap(); - - // Running the proposal executes all the state transitions for the block - let run_result = self - .platform - .run_block_proposal(block_proposal, transaction)?; - - if !run_result.is_valid() { - // This is a system error, because we are proposing - return Err(run_result.errors.first().unwrap().to_string().into()); - } - - let block_execution_outcome::v0::BlockExecutionOutcome { - app_hash, - state_transition_results, - validator_set_update, - protocol_version, - } = run_result.into_data().map_err(Error::Protocol)?; - - let platform_version = PlatformVersion::get(protocol_version) - .expect("must be set in run block proposal from existing protocol version"); - - // We need to let Tenderdash know about the transactions we should remove from execution - let mut tx_results = Vec::new(); - let mut tx_records = Vec::new(); - let mut valid_txs_count = 0; - let mut invalid_tx_count = 0; - - for (tx, state_transition_execution_result) in state_transition_results { - let tx_result: ExecTxResult = - state_transition_execution_result.try_into_platform_versioned(platform_version)?; - - let action = if tx_result.code > 0 { - invalid_tx_count += 1; - TxAction::Removed - } else { - valid_txs_count += 1; - TxAction::Unmodified - } as i32; - - if action != TxAction::Removed as i32 { - tx_results.push(tx_result); - } - tx_records.push(TxRecord { action, tx }); - } - - let delayed_tx_count = transactions_exceeding_max_block_size.len(); - - // Add up exceeding transactions to the response - tx_records.extend( - transactions_exceeding_max_block_size - .into_iter() - .map(|tx| TxRecord { - action: TxAction::Delayed as i32, - tx, - }), - ); - - // TODO: implement all fields, including tx processing; for now, just leaving bare minimum - let response = ResponsePrepareProposal { - tx_results, - app_hash: app_hash.to_vec(), - tx_records, - core_chain_lock_update, - validator_set_update, - ..Default::default() - }; - - let mut block_execution_context_guard = - self.platform.block_execution_context.write().unwrap(); - - let block_execution_context = block_execution_context_guard - .as_mut() - .expect("expected that a block execution context was set"); - block_execution_context.set_proposer_results(Some(response.clone())); - - tracing::info!( - invalid_tx_count, - valid_txs_count, - delayed_tx_count, - "Prepared proposal with {} transitions for height: {}, round: {}", - valid_txs_count, - request.height, - request.round, - ); - - Ok(response) - } - - fn process_proposal( - &self, - mut request: RequestProcessProposal, - ) -> Result { - let _timer = crate::metrics::abci_request_duration("process_proposal"); - - let mut block_execution_context_guard = - self.platform.block_execution_context.write().unwrap(); - - let mut drop_block_execution_context = false; - if let Some(block_execution_context) = block_execution_context_guard.as_mut() { - // We are already in a block - // This only makes sense if we were the proposer unless we are at a future round - if block_execution_context.block_state_info().round() != (request.round as u32) { - // We were not the proposer, and we should process something new - drop_block_execution_context = true; - } else if let Some(current_block_hash) = - block_execution_context.block_state_info().block_hash() - { - // There is also the possibility that this block already came in, but tenderdash crashed - // Now tenderdash is sending it again - if let Some(proposal_info) = block_execution_context.proposer_results() { - tracing::debug!( - method = "process_proposal", - ?proposal_info, // TODO: It might be too big for debug - "we knew block hash, block execution context already had a proposer result", - ); - // We were the proposer as well, so we have the result in cache - return Ok(ResponseProcessProposal { - status: proto::response_process_proposal::ProposalStatus::Accept.into(), - app_hash: proposal_info.app_hash.clone(), - tx_results: proposal_info.tx_results.clone(), - consensus_param_updates: proposal_info.consensus_param_updates.clone(), - validator_set_update: proposal_info.validator_set_update.clone(), - }); - } - - if current_block_hash.as_slice() == request.hash { - // We were not the proposer, just drop the execution context - tracing::warn!( - method = "process_proposal", - ?request, // Shumkov, lklimek: this structure might be very big and we already logged it such as all other ABCI requests and responses - "block execution context already existed, but we are running it again for same height {}/round {}", - request.height, - request.round, - ); - drop_block_execution_context = true; - } else { - // We are getting a different block hash for a block of the same round - // This is a terrible issue - return Err(Error::Abci(AbciError::BadRequest( - "received a process proposal request twice with different hash".to_string(), - )))?; - } - } else { - let Some(proposal_info) = block_execution_context.proposer_results() else { - return Err(Error::Abci(AbciError::BadRequest( - "received a process proposal request twice".to_string(), - )))?; - }; - - let expected_transactions = proposal_info - .tx_records - .iter() - .filter_map(|record| { - if record.action == TxAction::Removed as i32 - || record.action == TxAction::Delayed as i32 - { - None - } else { - Some(&record.tx) - } - }) - .collect::>(); - - // While it is true that the length could be same, seeing how this is such a rare situation - // It does not seem worth to deal with situations where the length is the same but the transactions have changed - if expected_transactions.len() == request.txs.len() - && proposal_info.core_chain_lock_update == request.core_chain_lock_update - { - let (app_hash, tx_results, consensus_param_updates, validator_set_update) = { - tracing::debug!( - method = "process_proposal", - "we didn't know block hash (we were most likely proposer), block execution context already had a proposer result {:?}", - proposal_info, - ); - - // Cloning all required properties from proposal_info and then dropping it - let app_hash = proposal_info.app_hash.clone(); - let tx_results = proposal_info.tx_results.clone(); - let consensus_param_updates = proposal_info.consensus_param_updates.clone(); - let validator_set_update = proposal_info.validator_set_update.clone(); - ( - app_hash, - tx_results, - consensus_param_updates, - validator_set_update, - ) - }; - - // We need to set the block hash - block_execution_context - .block_state_info_mut() - .set_block_hash(Some(request.hash.clone().try_into().map_err(|_| { - Error::Abci(AbciError::BadRequestDataSize( - "block hash is not 32 bytes in process proposal".to_string(), - )) - })?)); - return Ok(ResponseProcessProposal { - status: proto::response_process_proposal::ProposalStatus::Accept.into(), - app_hash, - tx_results, - consensus_param_updates, - validator_set_update, - }); - } else { - tracing::warn!( - method = "process_proposal", - "we didn't know block hash (we were most likely proposer), block execution context already had a proposer result {:?}, but we are requesting a different amount of transactions, dropping the cache", - proposal_info, - ); - - drop_block_execution_context = true; - }; - } - } - - if drop_block_execution_context { - *block_execution_context_guard = None; - } - drop(block_execution_context_guard); - - // Get transaction - let transaction_guard = if request.height == self.platform.config.abci.genesis_height as i64 - { - // special logic on init chain - let transaction = self.transaction.read().unwrap(); - if transaction.is_none() { - return Err(Error::Abci(AbciError::BadRequest("received a process proposal request for the genesis height before an init chain request".to_string())))?; - } - if request.round > 0 { - transaction.as_ref().map(|tx| tx.rollback_to_savepoint()); - } - transaction - } else { - self.start_transaction(); - self.transaction.read().unwrap() - }; - let transaction = transaction_guard.as_ref().unwrap(); - - // We can take the core chain lock update here because it won't be used anywhere else - if let Some(_c) = request.core_chain_lock_update.take() { - //todo: if there is a core chain lock update we need to validate it - } - - // Running the proposal executes all the state transitions for the block - let run_result = self - .platform - .run_block_proposal((&request).try_into()?, transaction)?; - - if !run_result.is_valid() { - // This was an error running this proposal, tell tenderdash that the block isn't valid - let response = ResponseProcessProposal { - status: proto::response_process_proposal::ProposalStatus::Reject.into(), - ..Default::default() - }; - - tracing::warn!( - errors = ?run_result.errors, - "Rejected invalid proposal for height: {}, round: {}", - request.height, - request.round, - ); - - Ok(response) - } else { - let block_execution_outcome::v0::BlockExecutionOutcome { - app_hash, - state_transition_results, - validator_set_update, - protocol_version, - } = run_result.into_data().map_err(Error::Protocol)?; - - let platform_version = PlatformVersion::get(protocol_version) - .expect("must be set in run block proposer from existing platform version"); - - let mut invalid_tx_count = 0; - let mut valid_tx_count = 0; - - let tx_results = state_transition_results - .into_iter() - .map(|(_, execution_result)| { - let tx_result: ExecTxResult = - execution_result.try_into_platform_versioned(platform_version)?; - - if tx_result.code == 0 { - valid_tx_count += 1; - } else { - invalid_tx_count += 1; - } - - Ok(tx_result) - }) - .collect::, Error>>()?; - - // TODO: implement all fields, including tx processing; for now, just leaving bare minimum - let response = ResponseProcessProposal { - app_hash: app_hash.to_vec(), - tx_results, - status: proto::response_process_proposal::ProposalStatus::Accept.into(), - validator_set_update, - ..Default::default() - }; - - tracing::info!( - invalid_tx_count, - valid_tx_count, - "Processed proposal with {} transactions for height: {}, round: {}", - valid_tx_count, - request.height, - request.round, - ); - - Ok(response) - } - } - - fn extend_vote( - &self, - request: proto::RequestExtendVote, - ) -> Result { - let _timer = crate::metrics::abci_request_duration("extend_vote"); - - let proto::RequestExtendVote { - hash: block_hash, - height, - round, - } = request; - let guarded_block_execution_context = self.platform.block_execution_context.read().unwrap(); - let block_execution_context = - guarded_block_execution_context - .as_ref() - .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( - "block execution context must be set in block begin handler for extend vote", - )))?; - - // Verify Tenderdash that it called this handler correctly - let block_state_info = &block_execution_context.block_state_info(); - - if !block_state_info.matches_current_block( - height as u64, - round as u32, - block_hash.clone(), - )? { - Err(Error::from(AbciError::RequestForWrongBlockReceived(format!( - "received extend vote request for height: {} round: {}, block: {}; expected height: {} round: {}, block: {}", - height, round, hex::encode(block_hash), - block_state_info.height(), block_state_info.round(), block_state_info.block_hash().map(hex::encode).unwrap_or("None".to_string()) - ))) - .into()) - } else { - // we only want to sign the hash of the transaction - let extensions = block_execution_context - .withdrawal_transactions() - .keys() - .map(|tx_id| proto::ExtendVoteExtension { - r#type: VoteExtensionType::ThresholdRecover as i32, - extension: tx_id.to_byte_array().to_vec(), - }) - .collect(); - Ok(proto::ResponseExtendVote { - vote_extensions: extensions, - }) - } - } - - /// Todo: Verify vote extension not really needed because extend vote is deterministic - fn verify_vote_extension( - &self, - request: proto::RequestVerifyVoteExtension, - ) -> Result { - let _timer = crate::metrics::abci_request_duration("verify_vote_extension"); - - let proto::RequestVerifyVoteExtension { - height, - round, - vote_extensions, - .. - } = request; - - let guarded_block_execution_context = self.platform.block_execution_context.read().unwrap(); - let block_execution_context = - guarded_block_execution_context - .as_ref() - .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( - "block execution context must be set in block begin handler for verify vote extension", - )))?; - - let platform_version = block_execution_context - .block_platform_state() - .current_platform_version()?; - - let got: withdrawal_txs::v0::WithdrawalTxs = vote_extensions.into(); - let expected = block_execution_context - .withdrawal_transactions() - .keys() - .map(|tx_id| proto::ExtendVoteExtension { - r#type: VoteExtensionType::ThresholdRecover as i32, - extension: tx_id.to_byte_array().to_vec(), - }) - .collect::>() - .into(); - - // let state = self.platform.state.read().unwrap(); - // - // let quorum = state.current_validator_set()?; - - // let validator_pro_tx_hash = ProTxHash::from_slice(validator_pro_tx_hash.as_slice()) - // .map_err(|_| { - // Error::Abci(AbciError::BadRequestDataSize(format!( - // "invalid vote extension protxhash: {}", - // hex::encode(validator_pro_tx_hash.as_slice()) - // ))) - // })?; - // - // let Some(validator) = quorum.validator_set.get(&validator_pro_tx_hash) else { - // return Ok(proto::ResponseVerifyVoteExtension { - // status: VerifyStatus::Unknown.into(), - // }); - // }; - - let validation_result = self.platform.check_withdrawals( - &got, - &expected, - height as u64, - round as u32, - None, - None, - platform_version, - )?; - - if validation_result.is_valid() { - Ok(proto::ResponseVerifyVoteExtension { - status: VerifyStatus::Accept.into(), - }) - } else { - tracing::error!( - ?got, - ?expected, - ?validation_result.errors, - "vote extension mismatch" - ); - Ok(proto::ResponseVerifyVoteExtension { - status: VerifyStatus::Reject.into(), - }) - } - } - - fn finalize_block( - &self, - request: RequestFinalizeBlock, - ) -> Result { - let _timer = crate::metrics::abci_request_duration("finalize_block"); - - let transaction_guard = self.transaction.read().unwrap(); - - let transaction = transaction_guard.as_ref().ok_or(Error::Execution( - ExecutionError::NotInTransaction( - "trying to finalize block without a current transaction", - ), - ))?; - - let block_finalization_outcome = self - .platform - .finalize_block_proposal(request.try_into()?, transaction)?; - - //FIXME: tell tenderdash about the problem instead - // This can not go to production! - if !block_finalization_outcome.validation_result.is_valid() { - return Err(Error::Abci( - block_finalization_outcome - .validation_result - .errors - .into_iter() - .next() - .unwrap(), - ) - .into()); - } - - drop(transaction_guard); - - self.commit_transaction()?; - - Ok(ResponseFinalizeBlock { - events: vec![], - retain_height: 0, - }) - } - - fn check_tx( - &self, - request: RequestCheckTx, - ) -> Result { - let _timer = crate::metrics::abci_request_duration("check_tx"); - - let RequestCheckTx { tx, .. } = request; - match self.platform.check_tx(tx.as_slice()) { - Ok(validation_result) => { - let platform_state = self.platform.state.read().unwrap(); - let platform_version = platform_state.current_platform_version()?; - let first_consensus_error = validation_result.errors.first(); - - let (code, info) = if let Some(consensus_error) = first_consensus_error { - ( - consensus_error.code(), - consensus_error - .response_info_for_version(platform_version) - .map_err(proto::ResponseException::from)?, - ) - } else { - // If there are no execution errors the code will be 0 - (0, "".to_string()) - }; - - let gas_wanted = validation_result - .data - .map(|fee_result| fee_result.total_base_fee()) - .unwrap_or_default(); - - Ok(ResponseCheckTx { - code, - data: vec![], - info, - gas_wanted: gas_wanted as SignedCredits, - codespace: "".to_string(), - sender: "".to_string(), - priority: 0, - }) - } - Err(error) => { - let handler_error = HandlerError::Internal(error.to_string()); - - tracing::error!(?error, "check_tx failed"); - - Ok(ResponseCheckTx { - code: handler_error.code(), - data: vec![], - info: handler_error.response_info()?, - gas_wanted: 0 as SignedCredits, - codespace: "".to_string(), - sender: "".to_string(), - priority: 0, - }) - } - } - } - - fn query(&self, request: RequestQuery) -> Result { - let _timer = crate::metrics::abci_request_duration("query"); - - let RequestQuery { data, path, .. } = &request; - - // TODO: It must be proto::ResponseException - let Some(platform_version) = PlatformVersion::get_maybe_current() else { - let handler_error = - HandlerError::Unavailable("platform is not initialized".to_string()); - - let response = ResponseQuery { - code: handler_error.code(), - log: "".to_string(), - info: handler_error.response_info()?, - index: 0, - key: vec![], - value: vec![], - proof_ops: None, - height: self.platform.state.read().unwrap().height() as i64, - codespace: "".to_string(), - }; - - tracing::error!(?response, "platform version not initialized"); - - return Ok(response); - }; - - let result = self - .platform - .query(path.as_str(), data.as_slice(), platform_version)?; - - let (code, data, info) = if result.is_valid() { - (0, result.data.unwrap_or_default(), "success".to_string()) - } else { - let error = result - .errors - .first() - .expect("validation result should have at least one error"); - - let handler_error = HandlerError::from(error); - - (handler_error.code(), vec![], handler_error.response_info()?) - }; - - let response = ResponseQuery { - //todo: right now just put GRPC error codes, - // later we will use own error codes - code, - log: "".to_string(), - info, - index: 0, - key: vec![], - value: data, - proof_ops: None, - height: self.platform.state.read().unwrap().height() as i64, - codespace: "".to_string(), - }; - - Ok(response) - } -} -// -// #[cfg(test)] -// mod tests { -// mod handlers { -// use crate::config::PlatformConfig; -// use crate::rpc::core::MockCoreRPCLike; -// use chrono::{Duration, Utc}; -// use dashcore_rpc::dashcore::hashes::hex::FromHex; -// use dashcore_rpc::dashcore::BlockHash; -// use dpp::contracts::withdrawals_contract; -// -// use dpp::identity::core_script::CoreScript; -// use dpp::identity::state_transition::identity_credit_withdrawal_transition::Pooling; -// use dpp::platform_value::{platform_value, BinaryData}; -// use dpp::prelude::Identifier; -// use dpp::system_data_contracts::{load_system_data_contract, SystemDataContract}; -// use dpp::tests::fixtures::get_withdrawal_document_fixture; -// use dpp::util::hash; -// use drive::common::helpers::identities::create_test_masternode_identities; -// use dpp::block::block_info::BlockInfo; -// use drive::drive::identity::withdrawals::WithdrawalTransactionIdAndBytes; -// use drive::fee::epoch::CreditsPerEpoch; -// use drive::fee_pools::epochs::Epoch; -// use drive::tests::helpers::setup::setup_document; -// use rust_decimal::prelude::ToPrimitive; -// use serde_json::json; -// use std::cmp::Ordering; -// use std::ops::Div; -// use tenderdash_abci::Application; -// use tenderdash_abci::proto::abci::{RequestPrepareProposal, RequestProcessProposal}; -// use tenderdash_abci::proto::google::protobuf::Timestamp; -// -// use crate::abci::messages::{ -// AfterFinalizeBlockRequest, BlockBeginRequest, BlockEndRequest, BlockFees, -// }; -// use crate::platform::Platform; -// use crate::test::fixture::abci::static_init_chain_request; -// use crate::test::helpers::fee_pools::create_test_masternode_share_identities_and_documents; -// use crate::test::helpers::setup::{TempPlatform, TestPlatformBuilder}; -// -// -// fn prepare_withdrawal_test(platform: &TempPlatform) { -// let transaction = platform.drive.grove.start_transaction(); -// //this should happen after -// let data_contract = load_system_data_contract(SystemDataContract::Withdrawals) -// .expect("to load system data contract"); -// -// // Init withdrawal requests -// let withdrawals: Vec = (0..16) -// .map(|index: u64| (index.to_be_bytes().to_vec(), vec![index as u8; 32])) -// .collect(); -// -// let owner_id = Identifier::new([1u8; 32]); -// -// for (_, tx_bytes) in withdrawals.iter() { -// let tx_id = hash::hash(tx_bytes); -// -// let document = get_withdrawal_document_fixture( -// &data_contract, -// owner_id, -// platform_value!({ -// "amount": 1000u64, -// "coreFeePerByte": 1u32, -// "pooling": Pooling::Never as u8, -// "outputScript": CoreScript::from_bytes((0..23).collect::>()), -// "status": withdrawals_contract::WithdrawalStatus::POOLED as u8, -// "transactionIndex": 1u64, -// "transactionSignHeight": 93u64, -// "transactionId": BinaryData::new(tx_id), -// }), -// None, -// ) -// .expect("expected withdrawal document"); -// -// let document_type = data_contract -// .document_type(withdrawals_contract::document_types::WITHDRAWAL) -// .expect("expected to get document type"); -// -// setup_document( -// &platform.drive, -// &document, -// &data_contract, -// document_type, -// Some(&transaction), -// ); -// } -// -// let block_info = BlockInfo { -// time_ms: 1, -// height: 1, -// epoch: Epoch::new(1).unwrap(), -// }; -// -// let mut drive_operations = vec![]; -// -// platform -// .drive -// .add_enqueue_withdrawal_transaction_operations(&withdrawals, &mut drive_operations); -// -// platform -// .drive -// .apply_drive_operations(drive_operations, true, &block_info, Some(&transaction)) -// .expect("to apply drive operations"); -// -// platform.drive.grove.commit_transaction(transaction).unwrap().expect("expected to commit transaction") -// } -// -// #[test] -// fn test_abci_flow_with_withdrawals() { -// let mut platform = TestPlatformBuilder::new() -// .with_config(PlatformConfig { -// verify_sum_trees: false, -// ..Default::default() -// }) -// .build_with_mock_rpc(); -// -// let mut core_rpc_mock = MockCoreRPCLike::new(); -// -// core_rpc_mock -// .expect_get_block_hash() -// // .times(total_days) -// .returning(|_| { -// Ok(BlockHash::from_hex( -// "0000000000000000000000000000000000000000000000000000000000000000", -// ) -// .unwrap()) -// }); -// -// core_rpc_mock -// .expect_get_block_json() -// // .times(total_days) -// .returning(|_| Ok(json!({}))); -// -// platform.core_rpc = core_rpc_mock; -// -// // init chain -// let init_chain_request = static_init_chain_request(); -// -// platform -// .init_chain(init_chain_request) -// .expect("should init chain"); -// -// prepare_withdrawal_test(&platform); -// -// let transaction = platform.drive.grove.start_transaction(); -// -// // setup the contract -// let contract = platform.create_mn_shares_contract(Some(&transaction)); -// -// let genesis_time = Utc::now(); -// -// let total_days = 29; -// -// let epoch_1_start_day = 18; -// -// let blocks_per_day = 50i64; -// -// let epoch_1_start_block = 13; -// -// let proposers_count = 50u16; -// -// let storage_fees_per_block = 42000; -// -// // and create masternode identities -// let proposers = create_test_masternode_identities( -// &platform.drive, -// proposers_count, -// Some(51), -// Some(&transaction), -// ); -// -// create_test_masternode_share_identities_and_documents( -// &platform.drive, -// &contract, -// &proposers, -// Some(53), -// Some(&transaction), -// ); -// -// platform.drive.grove.commit_transaction(transaction).unwrap().expect("expected to commit transaction"); -// -// let block_interval = 86400i64.div(blocks_per_day); -// -// let mut previous_block_time_ms: Option = None; -// -// // process blocks -// for day in 0..total_days { -// for block_num in 0..blocks_per_day { -// let block_time = if day == 0 && block_num == 0 { -// genesis_time -// } else { -// genesis_time -// + Duration::days(day as i64) -// + Duration::seconds(block_interval * block_num) -// }; -// -// let block_height = 1 + (blocks_per_day as u64 * day as u64) + block_num as u64; -// -// let block_time_ms = block_time -// .timestamp_millis() -// .to_u64() -// .expect("block time can not be before 1970"); -// -// //todo: before we had total_hpmns, where should we put it -// let request_process_proposal = RequestPrepareProposal { -// max_tx_bytes: 0, -// txs: vec![], -// local_last_commit: None, -// misbehavior: vec![], -// height: block_height as i64, -// round: 0, -// time: Some(Timestamp { -// seconds: (block_time_ms / 1000) as i64, -// nanos: ((block_time_ms % 1000) * 1000) as i32, -// }), -// next_validators_hash: [0u8;32].to_vec(), -// core_chain_locked_height: 1, -// proposer_pro_tx_hash: proposers -// .get(block_height as usize % (proposers_count as usize)) -// .unwrap().to_vec(), -// proposed_app_version: 1, -// version: None, -// quorum_hash: [0u8;32].to_vec(), -// }; -// -// // We are going to process the proposal, during processing we expect internal -// // subroutines to take place, these subroutines will create the transactions -// let process_proposal_response = platform -// .process_proposal(block_begin_request) -// .unwrap_or_else(|e| { -// panic!( -// "should begin process block #{} for day #{} : {:?}", -// block_height, day, e -// ) -// }); -// -// // Set previous block time -// previous_block_time_ms = Some(block_time_ms); -// -// // Should calculate correct current epochs -// let (epoch_index, epoch_change) = if day > epoch_1_start_day { -// (1, false) -// } else if day == epoch_1_start_day { -// match block_num.cmp(&epoch_1_start_block) { -// Ordering::Less => (0, false), -// Ordering::Equal => (1, true), -// Ordering::Greater => (1, false), -// } -// } else if day == 0 && block_num == 0 { -// (0, true) -// } else { -// (0, false) -// }; -// -// assert_eq!( -// block_begin_response.epoch_info.current_epoch_index, -// epoch_index -// ); -// -// assert_eq!( -// block_begin_response.epoch_info.is_epoch_change, -// epoch_change -// ); -// -// if day == 0 && block_num == 0 { -// let unsigned_withdrawal_hexes = block_begin_response -// .unsigned_withdrawal_transactions -// .iter() -// .map(hex::encode) -// .collect::>(); -// -// assert_eq!(unsigned_withdrawal_hexes, vec![ -// "200000000000000000000000000000000000000000000000000000000000000000010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200101010101010101010101010101010101010101010101010101010101010101010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200202020202020202020202020202020202020202020202020202020202020202010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200303030303030303030303030303030303030303030303030303030303030303010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200404040404040404040404040404040404040404040404040404040404040404010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200505050505050505050505050505050505050505050505050505050505050505010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200606060606060606060606060606060606060606060606060606060606060606010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200707070707070707070707070707070707070707070707070707070707070707010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200808080808080808080808080808080808080808080808080808080808080808010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200909090909090909090909090909090909090909090909090909090909090909010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// "200f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f010000002b32db6c2c0a6235fb1397e8225ea85e0f0e6e8c7b126d0016ccbde0e667151e", -// ]); -// } else { -// assert_eq!( -// block_begin_response.unsigned_withdrawal_transactions.len(), -// 0 -// ); -// } -// -// let block_end_request = BlockEndRequest { -// fees: BlockFees { -// storage_fee: storage_fees_per_block, -// processing_fee: 1600, -// refunds_per_epoch: CreditsPerEpoch::from_iter([(0, 100)]), -// }, -// }; -// -// let block_end_response = platform -// .block_end(block_end_request, Some(&transaction)) -// .unwrap_or_else(|_| { -// panic!( -// "should end process block #{} for day #{}", -// block_height, day -// ) -// }); -// -// let after_finalize_block_request = AfterFinalizeBlockRequest { -// updated_data_contract_ids: Vec::new(), -// }; -// -// platform -// .after_finalize_block(after_finalize_block_request) -// .unwrap_or_else(|_| { -// panic!( -// "should begin process block #{} for day #{}", -// block_height, day -// ) -// }); -// -// // Should pay to all proposers for epoch 0, when epochs 1 started -// if epoch_index != 0 && epoch_change { -// assert!(block_end_response.proposers_paid_count.is_some()); -// assert!(block_end_response.paid_epoch_index.is_some()); -// -// assert_eq!( -// block_end_response.proposers_paid_count.unwrap(), -// proposers_count -// ); -// assert_eq!(block_end_response.paid_epoch_index.unwrap(), 0); -// } else { -// assert!(block_end_response.proposers_paid_count.is_none()); -// assert!(block_end_response.paid_epoch_index.is_none()); -// }; -// } -// } -// } -// -// #[test] -// fn test_chain_halt_for_36_days() { -// // TODO refactor to remove code duplication -// -// let mut platform = TestPlatformBuilder::new() -// .with_config(PlatformConfig { -// verify_sum_trees: false, -// ..Default::default() -// }) -// .build_with_mock_rpc(); -// -// let mut core_rpc_mock = MockCoreRPCLike::new(); -// -// core_rpc_mock -// .expect_get_block_hash() -// // .times(1) // TODO: investigate why it always n + 1 -// .returning(|_| { -// Ok(BlockHash::from_hex( -// "0000000000000000000000000000000000000000000000000000000000000000", -// ) -// .unwrap()) -// }); -// -// core_rpc_mock -// .expect_get_block_json() -// // .times(1) // TODO: investigate why it always n + 1 -// .returning(|_| Ok(json!({}))); -// -// platform.core_rpc = core_rpc_mock; -// -// let transaction = platform.drive.grove.start_transaction(); -// -// // init chain -// let init_chain_request = static_init_chain_request(); -// -// platform -// .init_chain(init_chain_request, Some(&transaction)) -// .expect("should init chain"); -// -// // setup the contract -// let contract = platform.create_mn_shares_contract(Some(&transaction)); -// -// let genesis_time = Utc::now(); -// -// let epoch_2_start_day = 37; -// -// let blocks_per_day = 50i64; -// -// let proposers_count = 50u16; -// -// let storage_fees_per_block = 42000; -// -// // and create masternode identities -// let proposers = create_test_masternode_identities( -// &platform.drive, -// proposers_count, -// Some(52), -// Some(&transaction), -// ); -// -// create_test_masternode_share_identities_and_documents( -// &platform.drive, -// &contract, -// &proposers, -// Some(54), -// Some(&transaction), -// ); -// -// let block_interval = 86400i64.div(blocks_per_day); -// -// let mut previous_block_time_ms: Option = None; -// -// // process blocks -// for day in [0, 1, 2, 3, 37] { -// for block_num in 0..blocks_per_day { -// let block_time = if day == 0 && block_num == 0 { -// genesis_time -// } else { -// genesis_time -// + Duration::days(day as i64) -// + Duration::seconds(block_interval * block_num) -// }; -// -// let block_height = 1 + (blocks_per_day as u64 * day as u64) + block_num as u64; -// -// let block_time_ms = block_time -// .timestamp_millis() -// .to_u64() -// .expect("block time can not be before 1970"); -// -// // Processing block -// let block_begin_request = BlockBeginRequest { -// block_height, -// block_time_ms, -// previous_block_time_ms, -// proposer_pro_tx_hash: *proposers -// .get(block_height as usize % (proposers_count as usize)) -// .unwrap(), -// proposed_app_version: 1, -// validator_set_quorum_hash: Default::default(), -// last_synced_core_height: 1, -// core_chain_locked_height: 1, -// total_hpmns: proposers_count as u32, -// }; -// -// let block_begin_response = platform -// .block_begin(block_begin_request, Some(&transaction)) -// .unwrap_or_else(|_| { -// panic!( -// "should begin process block #{} for day #{}", -// block_height, day -// ) -// }); -// -// // Set previous block time -// previous_block_time_ms = Some(block_time_ms); -// -// // Should calculate correct current epochs -// let (epoch_index, epoch_change) = if day == epoch_2_start_day { -// if block_num == 0 { -// (2, true) -// } else { -// (2, false) -// } -// } else if day == 0 && block_num == 0 { -// (0, true) -// } else { -// (0, false) -// }; -// -// assert_eq!( -// block_begin_response.epoch_info.current_epoch_index, -// epoch_index -// ); -// -// assert_eq!( -// block_begin_response.epoch_info.is_epoch_change, -// epoch_change -// ); -// -// let block_end_request = BlockEndRequest { -// fees: BlockFees { -// storage_fee: storage_fees_per_block, -// processing_fee: 1600, -// refunds_per_epoch: CreditsPerEpoch::from_iter([(0, 100)]), -// }, -// }; -// -// let block_end_response = platform -// .block_end(block_end_request, Some(&transaction)) -// .unwrap_or_else(|_| { -// panic!( -// "should end process block #{} for day #{}", -// block_height, day -// ) -// }); -// -// let after_finalize_block_request = AfterFinalizeBlockRequest { -// updated_data_contract_ids: Vec::new(), -// }; -// -// platform -// .after_finalize_block(after_finalize_block_request) -// .unwrap_or_else(|_| { -// panic!( -// "should begin process block #{} for day #{}", -// block_height, day -// ) -// }); -// -// // Should pay to all proposers for epoch 0, when epochs 1 started -// if epoch_index != 0 && epoch_change { -// assert!(block_end_response.proposers_paid_count.is_some()); -// assert!(block_end_response.paid_epoch_index.is_some()); -// -// assert_eq!( -// block_end_response.proposers_paid_count.unwrap(), -// blocks_per_day as u16, -// ); -// assert_eq!(block_end_response.paid_epoch_index.unwrap(), 0); -// } else { -// assert!(block_end_response.proposers_paid_count.is_none()); -// assert!(block_end_response.paid_epoch_index.is_none()); -// }; -// } -// } -// } -// } -// } +mod check_tx; +mod echo; +pub mod error; +mod extend_vote; +mod finalize_block; +mod info; +mod init_chain; +mod prepare_proposal; +mod process_proposal; +mod verify_vote_extension; + +pub use check_tx::check_tx; +pub use echo::echo; +pub use extend_vote::extend_vote; +pub use finalize_block::finalize_block; +pub use info::info; +pub use init_chain::init_chain; +pub use prepare_proposal::prepare_proposal; +pub use process_proposal::process_proposal; +pub use verify_vote_extension::verify_vote_extension; diff --git a/packages/rs-drive-abci/src/abci/handler/prepare_proposal.rs b/packages/rs-drive-abci/src/abci/handler/prepare_proposal.rs new file mode 100644 index 00000000000..ce4c6b8e10c --- /dev/null +++ b/packages/rs-drive-abci/src/abci/handler/prepare_proposal.rs @@ -0,0 +1,223 @@ +use crate::abci::app::{BlockExecutionApplication, PlatformApplication, TransactionalApplication}; +use crate::abci::AbciError; +use crate::error::Error; +use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Setters; +use crate::platform_types::block_execution_outcome; +use crate::platform_types::block_proposal::v0::BlockProposal; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::state_transitions_processing_result::StateTransitionExecutionResult; +use crate::rpc::core::CoreRPCLike; +use dpp::dashcore::hashes::Hash; +use dpp::version::PlatformVersion; +use dpp::version::TryIntoPlatformVersioned; +use tenderdash_abci::proto::abci as proto; +use tenderdash_abci::proto::abci::tx_record::TxAction; +use tenderdash_abci::proto::abci::{ExecTxResult, TxRecord}; +use tenderdash_abci::proto::types::CoreChainLock; + +pub fn prepare_proposal<'a, A, C>( + app: &A, + mut request: proto::RequestPrepareProposal, +) -> Result +where + A: PlatformApplication + TransactionalApplication<'a> + BlockExecutionApplication, + C: CoreRPCLike, +{ + let timer = crate::metrics::abci_request_duration("prepare_proposal"); + + // We should get the latest CoreChainLock from core + // It is possible that we will not get a chain lock from core, in this case, just don't + // propose one + // This is done before all else + + let platform_state = app.platform().state.load(); + + let last_committed_core_height = platform_state.last_committed_core_height(); + + let core_chain_lock_update = match app.platform().core_rpc.get_best_chain_lock() { + Ok(latest_chain_lock) => { + if platform_state.last_committed_block_info().is_none() + || latest_chain_lock.block_height > last_committed_core_height + { + Some(latest_chain_lock) + } else { + None + } + } + Err(_) => None, + }; + + // Filter out transactions exceeding max_block_size + let mut transactions_exceeding_max_block_size = Vec::new(); + { + let mut total_transactions_size = 0; + let mut index_to_remove_at = None; + for (i, raw_transaction) in request.txs.iter().enumerate() { + total_transactions_size += raw_transaction.len(); + + if total_transactions_size as i64 > request.max_tx_bytes { + index_to_remove_at = Some(i); + break; + } + } + + if let Some(index_to_remove_at) = index_to_remove_at { + transactions_exceeding_max_block_size.extend(request.txs.drain(index_to_remove_at..)); + } + } + + let mut block_proposal: BlockProposal = (&request).try_into()?; + + if let Some(core_chain_lock_update) = core_chain_lock_update.as_ref() { + // We can't add this, as it slows down CI way too much + // todo: find a way to re-enable this without destroying CI + tracing::debug!( + "propose chain lock update to height {} at block {}", + core_chain_lock_update.block_height, + request.height + ); + block_proposal.core_chain_locked_height = core_chain_lock_update.block_height; + } else { + block_proposal.core_chain_locked_height = last_committed_core_height; + } + + // Prepare transaction + let transaction_guard = if request.height == app.platform().config.abci.genesis_height as i64 { + // special logic on init chain + let transaction_guard = app.transaction().read().unwrap(); + if transaction_guard.is_none() { + Err(Error::Abci(AbciError::BadRequest("received a prepare proposal request for the genesis height before an init chain request".to_string())))?; + }; + if request.round > 0 { + transaction_guard + .as_ref() + .map(|tx| tx.rollback_to_savepoint()); + }; + transaction_guard + } else { + app.start_transaction(); + app.transaction().read().unwrap() + }; + + let transaction = transaction_guard + .as_ref() + .expect("transaction must be started"); + + // Running the proposal executes all the state transitions for the block + let mut run_result = + app.platform() + .run_block_proposal(block_proposal, true, &platform_state, transaction)?; + + if !run_result.is_valid() { + // This is a system error, because we are proposing + return Err(run_result.errors.remove(0)); + } + + let block_execution_outcome::v0::BlockExecutionOutcome { + app_hash, + state_transitions_result, + validator_set_update, + protocol_version, + mut block_execution_context, + } = run_result.into_data().map_err(Error::Protocol)?; + + let platform_version = PlatformVersion::get(protocol_version) + .expect("must be set in run block proposal from existing protocol version"); + + // We need to let Tenderdash know about the transactions we should remove from execution + let valid_tx_count = state_transitions_result.valid_count(); + let failed_tx_count = state_transitions_result.failed_count(); + let delayed_tx_count = transactions_exceeding_max_block_size.len(); + let invalid_paid_tx_count = state_transitions_result.invalid_paid_count(); + let invalid_unpaid_tx_count = state_transitions_result.invalid_unpaid_count(); + + let mut tx_results = Vec::new(); + let mut tx_records = Vec::new(); + + for (state_transition_execution_result, raw_state_transition) in state_transitions_result + .into_execution_results() + .into_iter() + .zip(request.txs) + { + let tx_action = match &state_transition_execution_result { + StateTransitionExecutionResult::SuccessfulExecution(..) => TxAction::Unmodified, + // We have identity to pay for the state transition, so we keep it in the block + StateTransitionExecutionResult::PaidConsensusError(..) => TxAction::Unmodified, + // We don't have any associated identity to pay for the state transition, + // so we remove it from the block to prevent spam attacks. + // Such state transitions must be invalidated by check tx, but they might + // still be added to mempool due to inconsistency between check tx and tx processing + // (fees calculation) or malicious proposer. + StateTransitionExecutionResult::UnpaidConsensusError(..) => TxAction::Removed, + // We shouldn't include in the block any state transitions that produced an internal error + // during execution + StateTransitionExecutionResult::InternalError(..) => TxAction::Removed, + }; + + let tx_result: ExecTxResult = + state_transition_execution_result.try_into_platform_versioned(platform_version)?; + + if tx_action != TxAction::Removed { + tx_results.push(tx_result); + } + + tx_records.push(TxRecord { + action: tx_action.into(), + tx: raw_state_transition, + }); + } + + // Add up exceeding transactions to the response + tx_records.extend( + transactions_exceeding_max_block_size + .into_iter() + .map(|tx| TxRecord { + action: TxAction::Delayed as i32, + tx, + }), + ); + + let response = proto::ResponsePrepareProposal { + tx_results, + app_hash: app_hash.to_vec(), + tx_records, + core_chain_lock_update: core_chain_lock_update.map(|chain_lock| CoreChainLock { + core_block_hash: chain_lock.block_hash.to_byte_array().to_vec(), + core_block_height: chain_lock.block_height, + signature: chain_lock.signature.to_bytes().to_vec(), + }), + validator_set_update, + // TODO: implement consensus param updates + consensus_param_updates: None, + app_version: protocol_version as u64, + }; + + block_execution_context.set_proposer_results(Some(response.clone())); + + app.block_execution_context() + .write() + .unwrap() + .replace(block_execution_context); + + let elapsed_time_ms = timer.elapsed().as_millis(); + + tracing::info!( + invalid_paid_tx_count, + invalid_unpaid_tx_count, + valid_tx_count, + delayed_tx_count, + failed_tx_count, + "Prepared proposal with {} transition{} for height: {}, round: {} in {} ms", + valid_tx_count + invalid_paid_tx_count, + if valid_tx_count + invalid_paid_tx_count > 0 { + "s" + } else { + "" + }, + request.height, + request.round, + elapsed_time_ms, + ); + + Ok(response) +} diff --git a/packages/rs-drive-abci/src/abci/handler/process_proposal.rs b/packages/rs-drive-abci/src/abci/handler/process_proposal.rs new file mode 100644 index 00000000000..3f4daaca7b5 --- /dev/null +++ b/packages/rs-drive-abci/src/abci/handler/process_proposal.rs @@ -0,0 +1,286 @@ +use crate::abci::app::{BlockExecutionApplication, PlatformApplication, TransactionalApplication}; +use crate::abci::AbciError; +use crate::error::Error; +use crate::execution::types::block_execution_context::v0::{ + BlockExecutionContextV0Getters, BlockExecutionContextV0MutableGetters, +}; +use crate::execution::types::block_state_info::v0::{ + BlockStateInfoV0Getters, BlockStateInfoV0Setters, +}; +use crate::platform_types::block_execution_outcome; +use crate::platform_types::state_transitions_processing_result::StateTransitionExecutionResult; +use crate::rpc::core::CoreRPCLike; +use dpp::version::PlatformVersion; +use dpp::version::TryIntoPlatformVersioned; +use tenderdash_abci::proto::abci as proto; +use tenderdash_abci::proto::abci::tx_record::TxAction; + +pub fn process_proposal<'a, A, C>( + app: &A, + request: proto::RequestProcessProposal, +) -> Result +where + A: PlatformApplication + TransactionalApplication<'a> + BlockExecutionApplication, + C: CoreRPCLike, +{ + let timer = crate::metrics::abci_request_duration("process_proposal"); + + let mut drop_block_execution_context = false; + let mut block_execution_context_guard = app.block_execution_context().write().unwrap(); + if let Some(block_execution_context) = block_execution_context_guard.as_mut() { + // We are already in a block, or in init chain. + // This only makes sense if we were the proposer unless we are at a future round + if block_execution_context.block_state_info().round() != (request.round as u32) { + // We were not the proposer, and we should process something new + drop_block_execution_context = true; + } else if let Some(current_block_hash) = + block_execution_context.block_state_info().block_hash() + { + // There is also the possibility that this block already came in, but tenderdash crashed + // Now tenderdash is sending it again + if let Some(proposal_info) = block_execution_context.proposer_results() { + tracing::debug!( + method = "process_proposal", + "we knew block hash, block execution context already had a proposer result", + ); + // We were the proposer as well, so we have the result in cache + return Ok(proto::ResponseProcessProposal { + status: proto::response_process_proposal::ProposalStatus::Accept.into(), + app_hash: proposal_info.app_hash.clone(), + tx_results: proposal_info.tx_results.clone(), + consensus_param_updates: proposal_info.consensus_param_updates.clone(), + validator_set_update: proposal_info.validator_set_update.clone(), + events: Vec::new(), + }); + } + + if current_block_hash.as_slice() == request.hash { + // We were not the proposer, just drop the execution context + tracing::warn!( + method = "process_proposal", + "block execution context already existed, but we are running it again for same height {}/round {}", + request.height, + request.round, + ); + drop_block_execution_context = true; + } else { + // We are getting a different block hash for a block of the same round + // This is a terrible issue + Err(Error::Abci(AbciError::BadRequest( + "received a process proposal request twice with different hash".to_string(), + )))?; + } + } else { + let Some(proposal_info) = block_execution_context.proposer_results() else { + Err(Error::Abci(AbciError::BadRequest( + "received a process proposal request twice".to_string(), + )))? + }; + + let expected_transactions = proposal_info + .tx_records + .iter() + .filter_map(|record| { + if record.action == TxAction::Removed as i32 + || record.action == TxAction::Delayed as i32 + { + None + } else { + Some(&record.tx) + } + }) + .collect::>(); + + // While it is true that the length could be same, seeing how this is such a rare situation + // It does not seem worth to deal with situations where the length is the same but the transactions have changed + if expected_transactions.len() == request.txs.len() + && proposal_info.core_chain_lock_update == request.core_chain_lock_update + { + let (app_hash, tx_results, consensus_param_updates, validator_set_update) = { + tracing::debug!( + method = "process_proposal", + "we didn't know block hash (we were most likely proposer), block execution context already had a proposer result {:?}", + proposal_info, + ); + + // Cloning all required properties from proposal_info and then dropping it + let app_hash = proposal_info.app_hash.clone(); + let tx_results = proposal_info.tx_results.clone(); + let consensus_param_updates = proposal_info.consensus_param_updates.clone(); + let validator_set_update = proposal_info.validator_set_update.clone(); + ( + app_hash, + tx_results, + consensus_param_updates, + validator_set_update, + ) + }; + + // We need to set the block hash + block_execution_context + .block_state_info_mut() + .set_block_hash(Some(request.hash.clone().try_into().map_err(|_| { + Error::Abci(AbciError::BadRequestDataSize( + "block hash is not 32 bytes in process proposal".to_string(), + )) + })?)); + return Ok(proto::ResponseProcessProposal { + status: proto::response_process_proposal::ProposalStatus::Accept.into(), + app_hash, + tx_results, + consensus_param_updates, + validator_set_update, + events: Vec::new(), + }); + } else { + tracing::warn!( + method = "process_proposal", + "we didn't know block hash (we were most likely proposer), block execution context already had a proposer result, but we are requesting a different amount of transactions, dropping the cache", + ); + + drop_block_execution_context = true; + }; + } + } + + if drop_block_execution_context { + block_execution_context_guard.take(); + } + drop(block_execution_context_guard); + + // Get transaction + let transaction_guard = if request.height == app.platform().config.abci.genesis_height as i64 { + // special logic on init chain + let transaction_guard = app.transaction().read().unwrap(); + if transaction_guard.is_none() { + Err(Error::Abci(AbciError::BadRequest("received a process proposal request for the genesis height before an init chain request".to_string())))?; + } + if request.round > 0 { + transaction_guard + .as_ref() + .map(|tx| tx.rollback_to_savepoint()); + } + transaction_guard + } else { + app.start_transaction(); + app.transaction().read().unwrap() + }; + + let transaction = transaction_guard + .as_ref() + .expect("transaction must be started"); + + let platform_state = app.platform().state.load(); + + // Running the proposal executes all the state transitions for the block + let run_result = app.platform().run_block_proposal( + (&request).try_into()?, + false, + &platform_state, + transaction, + )?; + + if !run_result.is_valid() { + // This was an error running this proposal, tell tenderdash that the block isn't valid + let response = proto::ResponseProcessProposal { + status: proto::response_process_proposal::ProposalStatus::Reject.into(), + app_hash: [0; 32].to_vec(), // we must send 32 bytes + ..Default::default() + }; + + tracing::warn!( + errors = ?run_result.errors, + "Rejected invalid proposal for height: {}, round: {}", + request.height, + request.round, + ); + + return Ok(response); + } + + let block_execution_outcome::v0::BlockExecutionOutcome { + app_hash, + state_transitions_result: state_transition_results, + validator_set_update, + protocol_version, + block_execution_context, + } = run_result.into_data().map_err(Error::Protocol)?; + + let platform_version = PlatformVersion::get(protocol_version) + .expect("must be set in run block proposer from existing platform version"); + + app.block_execution_context() + .write() + .unwrap() + .replace(block_execution_context); + + let invalid_tx_count = state_transition_results.invalid_paid_count(); + let valid_tx_count = state_transition_results.valid_count(); + let failed_tx_count = state_transition_results.failed_count(); + let invalid_unpaid_tx_count = state_transition_results.invalid_unpaid_count(); + let unexpected_execution_results = failed_tx_count + invalid_unpaid_tx_count; + + // Reject block if proposal contains failed or unpaid state transitions + if unexpected_execution_results > 0 { + let response = proto::ResponseProcessProposal { + app_hash: app_hash.to_vec(), + status: proto::response_process_proposal::ProposalStatus::Reject.into(), + ..Default::default() + }; + + let elapsed_time_ms = timer.elapsed().as_millis(); + + tracing::warn!( + invalid_tx_count, + valid_tx_count, + failed_tx_count, + invalid_unpaid_tx_count, + elapsed_time_ms, + "Rejected invalid proposal for height: {}, round: {} due to {} unexpected state transition execution result(s)", + request.height, + request.round, + unexpected_execution_results + ); + + return Ok(response); + } + + let tx_results = state_transition_results + .into_execution_results() + .into_iter() + // To prevent spam attacks we add to the block state transitions covered with fees only + .filter(|execution_result| { + matches!( + execution_result, + StateTransitionExecutionResult::SuccessfulExecution(..) + | StateTransitionExecutionResult::PaidConsensusError(..) + ) + }) + .map(|execution_result| execution_result.try_into_platform_versioned(platform_version)) + .collect::>()?; + + let response = proto::ResponseProcessProposal { + app_hash: app_hash.to_vec(), + tx_results, + status: proto::response_process_proposal::ProposalStatus::Accept.into(), + validator_set_update, + // TODO: Implement consensus param updates + consensus_param_updates: None, + events: Vec::new(), + }; + + let elapsed_time_ms = timer.elapsed().as_millis(); + + tracing::info!( + invalid_tx_count, + valid_tx_count, + elapsed_time_ms, + "Processed proposal with {} transactions for height: {}, round: {} in {} ms", + valid_tx_count + invalid_tx_count, + request.height, + request.round, + elapsed_time_ms, + ); + + Ok(response) +} diff --git a/packages/rs-drive-abci/src/abci/handler/verify_vote_extension.rs b/packages/rs-drive-abci/src/abci/handler/verify_vote_extension.rs new file mode 100644 index 00000000000..47d7e27e3bf --- /dev/null +++ b/packages/rs-drive-abci/src/abci/handler/verify_vote_extension.rs @@ -0,0 +1,96 @@ +use crate::abci::app::{BlockExecutionApplication, PlatformApplication}; +use crate::error::Error; +use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; +use crate::execution::types::block_state_info::v0::BlockStateInfoV0Getters; +use crate::rpc::core::CoreRPCLike; +use tenderdash_abci::proto::abci as proto; +use tenderdash_abci::proto::abci::response_verify_vote_extension::VerifyStatus; +use tenderdash_abci::proto::abci::ExtendVoteExtension; + +/// Todo: Verify vote extension not really needed because extend vote is deterministic +pub fn verify_vote_extension( + app: &A, + request: proto::RequestVerifyVoteExtension, +) -> Result +where + A: PlatformApplication + BlockExecutionApplication, + C: CoreRPCLike, +{ + let _timer = crate::metrics::abci_request_duration("verify_vote_extension"); + + // Verify that this is a vote extension for our current executed block and our proposer + let proto::RequestVerifyVoteExtension { + height, + round, + vote_extensions, + .. + } = request; + + let height: u64 = height as u64; + let round: u32 = round as u32; + + // Make sure we are in a block execution phase + let block_execution_context_ref = app.block_execution_context().read().unwrap(); + let Some(block_execution_context) = block_execution_context_ref.as_ref() else { + tracing::warn!( + "vote extensions for height: {}, round: {} are rejected because we are not in a block execution phase", + height, + round, + ); + + return Ok(proto::ResponseVerifyVoteExtension { + status: VerifyStatus::Reject.into(), + }); + }; + + // Make sure vote extension is for our currently executing block + + let block_state_info = block_execution_context.block_state_info(); + + // We might get vote extension to verify for previous (in case if other node is behind) + // or future round (in case if the current node is behind), so we make sure that only height + // is matching. It's fine because withdrawal transactions to sign are the same for any round + // of the same height + if block_state_info.height() != height { + tracing::warn!( + "vote extensions for height: {}, round: {} are rejected because we are at height: {}", + height, + round, + block_state_info.height(), + ); + + return Ok(proto::ResponseVerifyVoteExtension { + status: VerifyStatus::Reject.into(), + }); + } + + // Verify that a validator is requesting a signatures + // for a correct set of withdrawal transactions + + let expected_withdrawals = block_execution_context.unsigned_withdrawal_transactions(); + + if expected_withdrawals != vote_extensions.as_slice() { + let expected_extensions: Vec = expected_withdrawals.into(); + + tracing::error!( + received_extensions = ?vote_extensions, + ?expected_extensions, + "vote extensions for height: {}, round: {} mismatch", + height, round + ); + + return Ok(proto::ResponseVerifyVoteExtension { + status: VerifyStatus::Reject.into(), + }); + } + + tracing::debug!( + "vote extensions for height: {}, round: {} are successfully verified", + height, + round, + ); + + Ok(proto::ResponseVerifyVoteExtension { + status: VerifyStatus::Accept.into(), + }) +} diff --git a/packages/rs-drive-abci/src/abci/mod.rs b/packages/rs-drive-abci/src/abci/mod.rs index f404881f811..e9b7681eaec 100644 --- a/packages/rs-drive-abci/src/abci/mod.rs +++ b/packages/rs-drive-abci/src/abci/mod.rs @@ -1,16 +1,11 @@ mod error; -/// The handlers of abci messages -#[cfg(any(feature = "server", test))] -pub mod handler; - // server configuration pub mod config; -#[cfg(any(feature = "server", test))] -pub(crate) mod server; + +/// ABCI applications +pub mod app; + +mod handler; pub use error::AbciError; -#[cfg(feature = "server")] -pub use server::start; -#[cfg(any(feature = "server", test))] -pub use server::AbciApplication; diff --git a/packages/rs-drive-abci/src/abci/server.rs b/packages/rs-drive-abci/src/abci/server.rs deleted file mode 100644 index c3d2247ddc4..00000000000 --- a/packages/rs-drive-abci/src/abci/server.rs +++ /dev/null @@ -1,95 +0,0 @@ -//! This module implements ABCI application server. -//! -use crate::error::execution::ExecutionError; -use crate::{ - config::PlatformConfig, error::Error, platform_types::platform::Platform, - rpc::core::CoreRPCLike, -}; -use drive::grovedb::Transaction; -use std::fmt::Debug; -use std::sync::RwLock; -use tokio_util::sync::CancellationToken; - -/// AbciApp is an implementation of ABCI Application, as defined by Tenderdash. -/// -/// AbciApp implements logic that should be triggered when Tenderdash performs various operations, like -/// creating new proposal or finalizing new block. -pub struct AbciApplication<'a, C> { - /// Platform - pub platform: &'a Platform, - /// The current transaction - pub transaction: RwLock>>, -} - -/// Start ABCI server and process incoming connections. -/// -/// Should never return. -pub fn start( - config: &PlatformConfig, - core_rpc: C, - cancel: CancellationToken, -) -> Result<(), Error> { - let bind_address = config.abci.bind_address.clone(); - - let platform: Platform = - Platform::open_with_client(&config.db_path, Some(config.clone()), core_rpc)?; - - let abci = AbciApplication::new(&platform)?; - - let server = tenderdash_abci::ServerBuilder::new(abci, &bind_address) - .with_cancel_token(cancel.clone()) - .build() - .map_err(super::AbciError::from)?; - - while !cancel.is_cancelled() { - tracing::info!("waiting for new ABCI connection"); - match server.next_client() { - Err(e) => tracing::error!("ABCI connection terminated: {:?}", e), - Ok(_) => tracing::info!("ABCI connection closed"), - } - } - - Ok(()) -} - -impl<'a, C> AbciApplication<'a, C> { - /// Create new ABCI app - pub fn new(platform: &'a Platform) -> Result, Error> { - let app = AbciApplication { - platform, - transaction: RwLock::new(None), - }; - - Ok(app) - } - - /// create and store a new transaction - pub fn start_transaction(&self) { - let transaction = self.platform.drive.grove.start_transaction(); - self.transaction.write().unwrap().replace(transaction); - } - - /// Commit a transaction - pub fn commit_transaction(&self) -> Result<(), Error> { - let transaction = self - .transaction - .write() - .unwrap() - .take() - .ok_or(Error::Execution(ExecutionError::NotInTransaction( - "trying to commit a transaction, but we are not in one", - )))?; - let platform_state = self.platform.state.read().unwrap(); - let platform_version = platform_state.current_platform_version()?; - self.platform - .drive - .commit_transaction(transaction, &platform_version.drive) - .map_err(Error::Drive) - } -} - -impl<'a, C> Debug for AbciApplication<'a, C> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "") - } -} diff --git a/packages/rs-drive-abci/src/config.rs b/packages/rs-drive-abci/src/config.rs index f325924e25f..e3d043d479e 100644 --- a/packages/rs-drive-abci/src/config.rs +++ b/packages/rs-drive-abci/src/config.rs @@ -31,6 +31,7 @@ use std::path::PathBuf; use dpp::util::deserializer::ProtocolVersion; use drive::drive::config::DriveConfig; +use drive::drive::defaults::INITIAL_PROTOCOL_VERSION; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use crate::logging::LogConfigs; @@ -76,41 +77,12 @@ impl Default for CoreRpcConfig { } /// Configuration for Dash Core related things -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize, Deserialize, Default)] #[serde(default)] pub struct CoreConfig { /// Core RPC config #[serde(flatten)] pub rpc: CoreRpcConfig, - - /// DKG interval - pub dkg_interval: String, // String due to https://github.com/softprops/envy/issues/26 - /// Minimum number of valid members to use the quorum - pub min_quorum_valid_members: String, // String due to https://github.com/softprops/envy/issues/26 -} - -impl CoreConfig { - /// return dkg_interval - pub fn dkg_interval(&self) -> u32 { - self.dkg_interval - .parse::() - .expect("DKG_INTERVAL is not an int") - } - /// Returns minimal number of quorum members - pub fn min_quorum_valid_members(&self) -> u32 { - self.min_quorum_valid_members - .parse::() - .expect("MIN_QUORUM_VALID_MEMBERS is not an int") - } -} -impl Default for CoreConfig { - fn default() -> Self { - Self { - dkg_interval: String::from("24"), - min_quorum_valid_members: String::from("3"), - rpc: Default::default(), - } - } } /// Configuration of the execution part of Dash Platform. @@ -128,10 +100,10 @@ pub struct ExecutionConfig { /// How often should quorums change? #[serde( - default = "ExecutionConfig::default_validator_set_quorum_rotation_block_count", + default = "ExecutionConfig::default_validator_set_rotation_block_count", deserialize_with = "from_str_or_number" )] - pub validator_set_quorum_rotation_block_count: u32, + pub validator_set_rotation_block_count: u32, /// How long in seconds should an epoch last /// It might last a lot longer if the chain is halted @@ -185,17 +157,41 @@ pub struct PlatformConfig { #[serde(flatten)] pub abci: AbciConfig, + /// Address to listen for Prometheus connection. + /// + /// Optional. + /// + /// /// Address should be an URL with scheme `http://`, for example: + /// - `http://127.0.0.1:29090` + /// + /// Port number defaults to [crate::metrics::DEFAULT_PROMETHEUS_PORT]. + pub prometheus_bind_address: Option, + + /// Address to listen for gRPC connection. + pub grpc_bind_address: String, + /// Execution config #[serde(flatten)] pub execution: ExecutionConfig, /// The default quorum type - pub quorum_type: String, + pub validator_set_quorum_type: String, + + /// The quorum type used for verifying chain locks + pub chain_lock_quorum_type: String, + + /// The validator set quorum size + pub validator_set_quorum_size: u16, - /// The default quorum size - pub quorum_size: u16, + /// The chain lock quorum size + pub chain_lock_quorum_size: u16, - // todo: this should probably be coming from Tenderdash config + /// The window for chain locks + /// On Mainnet Chain Locks are signed using 400_60: One quorum in every 288 blocks and activeQuorumCount is 4. + /// On Testnet Chain Locks are signed using 50_60: One quorum in every 24 blocks and activeQuorumCount is 24. + pub chain_lock_quorum_window: u32, + + // todo: this should probably be coming from Tenderdash config. It's a test only param /// Approximately how often are blocks produced pub block_spacing_ms: u64, @@ -206,10 +202,28 @@ pub struct PlatformConfig { /// Path to data storage pub db_path: PathBuf, + /// Path to store rejected / invalid items (like transactions). + /// Used mainly for debuggig. + /// + /// If not set, rejected and invalid items will not be stored. + #[serde(default)] + pub rejections_path: Option, + // todo: put this in tests like #[cfg(test)] /// This should be None, except in the case of Testing platform #[serde(skip)] pub testing_configs: PlatformTestConfig, + + /// Enable tokio console (console feature must be enabled) + pub tokio_console_enabled: bool, + + /// Tokio console address to connect to + #[serde(default = "PlatformConfig::default_tokio_console_address")] + pub tokio_console_address: String, + + /// Number of seconds to store task information if there is no clients connected + #[serde(default = "PlatformConfig::default_tokio_console_retention_secs")] + pub tokio_console_retention_secs: u64, } impl ExecutionConfig { @@ -221,7 +235,7 @@ impl ExecutionConfig { true } - fn default_validator_set_quorum_rotation_block_count() -> u32 { + fn default_validator_set_rotation_block_count() -> u32 { 15 } @@ -232,20 +246,48 @@ impl ExecutionConfig { impl PlatformConfig { fn default_initial_protocol_version() -> ProtocolVersion { - //todo: versioning - 1 + INITIAL_PROTOCOL_VERSION + } + + fn default_tokio_console_address() -> String { + String::from("127.0.0.1:6669") + } + + fn default_tokio_console_retention_secs() -> u64 { + 60 * 3 } /// Return type of quorum - pub fn quorum_type(&self) -> QuorumType { - let found = if let Ok(t) = self.quorum_type.trim().parse::() { + pub fn validator_set_quorum_type(&self) -> QuorumType { + let found = if let Ok(t) = self.validator_set_quorum_type.trim().parse::() { + QuorumType::from(t) + } else { + QuorumType::from(self.validator_set_quorum_type.as_str()) + }; + + if found == QuorumType::UNKNOWN { + panic!( + "config: unsupported QUORUM_TYPE: {}", + self.validator_set_quorum_type + ); + } + + found + } + + /// Return type of quorum for validating chain locks + pub fn chain_lock_quorum_type(&self) -> QuorumType { + let found = if let Ok(t) = self.chain_lock_quorum_type.trim().parse::() { QuorumType::from(t) } else { - QuorumType::from(self.quorum_type.as_str()) + QuorumType::from(self.chain_lock_quorum_type.as_str()) }; if found == QuorumType::UNKNOWN { - panic!("config: unsupported QUORUM_TYPE: {}", self.quorum_type); + panic!( + "config: unsupported QUORUM_TYPE: {}", + self.chain_lock_quorum_type + ); } found @@ -279,8 +321,8 @@ impl Default for ExecutionConfig { Self { use_document_triggers: ExecutionConfig::default_use_document_triggers(), verify_sum_trees: ExecutionConfig::default_verify_sum_trees(), - validator_set_quorum_rotation_block_count: - ExecutionConfig::default_validator_set_quorum_rotation_block_count(), + validator_set_rotation_block_count: + ExecutionConfig::default_validator_set_rotation_block_count(), epoch_time_length_s: ExecutionConfig::default_epoch_time_length_s(), } } @@ -288,17 +330,81 @@ impl Default for ExecutionConfig { impl Default for PlatformConfig { fn default() -> Self { + Self::default_mainnet() + } +} + +#[allow(missing_docs)] +impl PlatformConfig { + pub fn default_local() -> Self { + Self { + validator_set_quorum_type: "llmq_test_platform".to_string(), + chain_lock_quorum_type: "llmq_test".to_string(), + validator_set_quorum_size: 3, + chain_lock_quorum_size: 3, + chain_lock_quorum_window: 24, + block_spacing_ms: 5000, + drive: Default::default(), + abci: Default::default(), + core: Default::default(), + execution: Default::default(), + db_path: PathBuf::from("/var/lib/dash-platform/data"), + rejections_path: Some(PathBuf::from("/var/log/dash/rejected")), + testing_configs: PlatformTestConfig::default(), + tokio_console_enabled: false, + tokio_console_address: PlatformConfig::default_tokio_console_address(), + tokio_console_retention_secs: PlatformConfig::default_tokio_console_retention_secs(), + initial_protocol_version: Self::default_initial_protocol_version(), + prometheus_bind_address: None, + grpc_bind_address: "0.0.0.0:26670".to_string(), + } + } + + pub fn default_testnet() -> Self { + Self { + validator_set_quorum_type: "llmq_25_67".to_string(), + chain_lock_quorum_type: "llmq_50_60".to_string(), + validator_set_quorum_size: 25, + chain_lock_quorum_size: 50, + chain_lock_quorum_window: 24, + block_spacing_ms: 5000, + drive: Default::default(), + abci: Default::default(), + core: Default::default(), + execution: Default::default(), + db_path: PathBuf::from("/var/lib/dash-platform/data"), + rejections_path: Some(PathBuf::from("/var/log/dash/rejected")), + testing_configs: PlatformTestConfig::default(), + initial_protocol_version: Self::default_initial_protocol_version(), + prometheus_bind_address: None, + grpc_bind_address: "0.0.0.0:26670".to_string(), + tokio_console_enabled: false, + tokio_console_address: PlatformConfig::default_tokio_console_address(), + tokio_console_retention_secs: PlatformConfig::default_tokio_console_retention_secs(), + } + } + + pub fn default_mainnet() -> Self { Self { - quorum_type: "llmq_100_67".to_string(), - quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_400_60".to_string(), + validator_set_quorum_size: 100, + chain_lock_quorum_size: 400, + chain_lock_quorum_window: 288, block_spacing_ms: 5000, drive: Default::default(), abci: Default::default(), core: Default::default(), execution: Default::default(), db_path: PathBuf::from("/var/lib/dash-platform/data"), + rejections_path: Some(PathBuf::from("/var/log/dash/rejected")), testing_configs: PlatformTestConfig::default(), - initial_protocol_version: 1, + initial_protocol_version: Self::default_initial_protocol_version(), + prometheus_bind_address: None, + grpc_bind_address: "0.0.0.0:26670".to_string(), + tokio_console_enabled: false, + tokio_console_address: PlatformConfig::default_tokio_console_address(), + tokio_console_retention_secs: PlatformConfig::default_tokio_console_retention_secs(), } } } @@ -341,7 +447,7 @@ mod tests { #[test] fn test_config_from_env() { // ABCI log configs are parsed manually, so they deserve separate handling - // Notat that STDOUT is also defined in .env.example, but env var should overwrite it. + // Note that STDOUT is also defined in .env.example, but env var should overwrite it. let vectors = &[ ("STDOUT", "pretty"), ("UPPERCASE", "json"), @@ -354,14 +460,15 @@ mod tests { env::set_var(format!("ABCI_LOG_{}_FORMAT", vector.0), vector.1); } - let envfile = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(".env.example"); + let envfile = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(".env.local"); dotenvy::from_path(envfile.as_path()).expect("cannot load .env file"); - assert_eq!("5", env::var("QUORUM_SIZE").unwrap()); + assert_eq!("/tmp/db", env::var("DB_PATH").unwrap()); + assert_eq!("/tmp/rejected", env::var("REJECTIONS_PATH").unwrap()); let config = super::PlatformConfig::from_env().expect("expected config from env"); assert!(config.execution.verify_sum_trees); - assert_ne!(config.quorum_type(), QuorumType::UNKNOWN); + assert_ne!(config.validator_set_quorum_type(), QuorumType::UNKNOWN); for id in vectors { matches!(config.abci.log[id.0].destination, LogDestination::Bytes); } diff --git a/packages/rs-drive-abci/src/core/wait_for_core_to_sync/v0/mod.rs b/packages/rs-drive-abci/src/core/wait_for_core_to_sync/v0/mod.rs index 47e8dbbc8dd..d1f79b1e55d 100644 --- a/packages/rs-drive-abci/src/core/wait_for_core_to_sync/v0/mod.rs +++ b/packages/rs-drive-abci/src/core/wait_for_core_to_sync/v0/mod.rs @@ -17,6 +17,14 @@ pub fn wait_for_core_to_sync_v0( tracing::info!(?core_rpc, "waiting for core rpc to start"); while !cancel.is_cancelled() { + let has_chain_locked = match core_rpc.get_best_chain_lock() { + Ok(_) => true, + Err(error) => { + tracing::warn!(?error, "cannot get best chain lock"); + false + } + }; + let mn_sync_status = match core_rpc.masternode_sync_status() { Ok(status) => status, Err(error) => { @@ -25,7 +33,7 @@ pub fn wait_for_core_to_sync_v0( } }; - if !mn_sync_status.is_synced || !mn_sync_status.is_blockchain_synced { + if !has_chain_locked || !mn_sync_status.is_synced || !mn_sync_status.is_blockchain_synced { std::thread::sleep(CORE_SYNC_STATUS_CHECK_TIMEOUT); tracing::info!("waiting for core to sync..."); diff --git a/packages/rs-drive-abci/src/error/execution.rs b/packages/rs-drive-abci/src/error/execution.rs index ce9a5886866..dfa77b882cf 100644 --- a/packages/rs-drive-abci/src/error/execution.rs +++ b/packages/rs-drive-abci/src/error/execution.rs @@ -53,7 +53,7 @@ pub enum ExecutionError { /// The platform encountered a corrupted cache state error. #[error("platform corrupted cached state error: {0}")] - CorruptedCachedState(&'static str), + CorruptedCachedState(String), /// The fork is not yet active for core. #[error("initialization fork not active: {0}")] @@ -121,4 +121,8 @@ pub enum ExecutionError { /// General Bls Error #[error("bls error: {0}")] BlsErrorGeneral(#[from] BlsError), + + /// General IO Error + #[error("io error: {0}")] + IOError(#[from] std::io::Error), } diff --git a/packages/rs-drive-abci/src/error/mod.rs b/packages/rs-drive-abci/src/error/mod.rs index 3658a8169dc..3bf2c4aa97f 100644 --- a/packages/rs-drive-abci/src/error/mod.rs +++ b/packages/rs-drive-abci/src/error/mod.rs @@ -3,6 +3,8 @@ use crate::error::execution::ExecutionError; use crate::error::serialization::SerializationError; use crate::logging; use dashcore_rpc::Error as CoreRpcError; +use dpp::bls_signatures::BlsError; +use dpp::data_contract::errors::DataContractError; use dpp::platform_value::Error as ValueError; use dpp::version::PlatformVersionError; use drive::dpp::ProtocolError; @@ -36,6 +38,9 @@ pub enum Error { /// Core RPC Error #[error("core rpc error: {0}")] CoreRpc(#[from] CoreRpcError), + /// BLS Error + #[error("BLS error: {0}")] + BLSError(#[from] BlsError), /// Serialization Error #[error("serialization: {0}")] Serialization(#[from] SerializationError), @@ -57,6 +62,12 @@ impl From for Error { } } +impl From for Error { + fn from(value: DataContractError) -> Self { + Self::Protocol(ProtocolError::DataContractError(value)) + } +} + impl From for Error { fn from(value: ValueError) -> Self { let platform_error: ProtocolError = value.into(); diff --git a/packages/rs-drive-abci/src/error/query.rs b/packages/rs-drive-abci/src/error/query.rs index 5cff82e1be4..0a6e9317031 100644 --- a/packages/rs-drive-abci/src/error/query.rs +++ b/packages/rs-drive-abci/src/error/query.rs @@ -44,6 +44,10 @@ pub enum QueryError { #[error("not found error: {0}")] NotFound(String), + /// Server issue + #[error("query not serviceable: {0}")] + NotServiceable(String), + /// Decoding Error #[error("decoding error: {0}")] DecodingError(String), diff --git a/packages/rs-drive-abci/src/execution/check_tx/mod.rs b/packages/rs-drive-abci/src/execution/check_tx/mod.rs index e6c5b7d3f35..d3c69cfc4ff 100644 --- a/packages/rs-drive-abci/src/execution/check_tx/mod.rs +++ b/packages/rs-drive-abci/src/execution/check_tx/mod.rs @@ -2,13 +2,75 @@ use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::platform::Platform; +use crate::abci::AbciError; +use crate::platform_types::platform_state::PlatformState; use crate::rpc::core::CoreRPCLike; use dpp::consensus::ConsensusError; use dpp::fee::fee_result::FeeResult; use dpp::validation::ValidationResult; +use dpp::version::PlatformVersion; mod v0; +// @append_only +#[repr(u8)] +#[derive(Copy, Clone, Debug)] +pub enum CheckTxLevel { + FirstTimeCheck = 0, + Recheck = 1, +} + +impl TryFrom for CheckTxLevel { + type Error = Error; + + fn try_from(value: u8) -> Result { + match value { + 0 => Ok(CheckTxLevel::FirstTimeCheck), + 1 => Ok(CheckTxLevel::Recheck), + value => Err(Error::Abci(AbciError::BadRequest(format!( + "Invalid value for CheckTxLevel {}", + value + )))), + } + } +} + +impl TryFrom for CheckTxLevel { + type Error = Error; + + fn try_from(value: i32) -> Result { + match value { + 0 => Ok(CheckTxLevel::FirstTimeCheck), + 1 => Ok(CheckTxLevel::Recheck), + value => Err(Error::Abci(AbciError::BadRequest(format!( + "Invalid value for CheckTxLevel {}", + value + )))), + } + } +} + +/// The result of a check tx +#[derive(Clone, Debug)] +pub struct CheckTxResult { + /// The level used when checking the transaction + pub level: CheckTxLevel, + /// The fee_result if there was one + /// There might not be one in the case of a very cheep recheck + pub fee_result: Option, + /// A set of unique identifiers, if any are found already in the mempool then tenderdash should + /// reject the transition. All transitions return only 1 unique identifier except the documents + /// batch transition that returns 1 for each document transition + pub unique_identifiers: Vec, + /// Priority to return to tenderdash. State Transitions with higher priority take precedence + /// over state transitions with lower priority + pub priority: u32, + /// State transition type name. Using for logging + pub state_transition_name: Option, + /// State transition ID. Using for logging + pub state_transition_hash: Option<[u8; 32]>, +} + impl Platform where C: CoreRPCLike, @@ -25,16 +87,17 @@ where /// /// # Returns /// - /// * `Result, Error>` - If the state transition passes all + /// * `Result, Error>` - If the state transition passes all /// checks, it returns a `ValidationResult` with fee information. If any check fails, it returns an `Error`. pub fn check_tx( &self, raw_tx: &[u8], - ) -> Result, Error> { - let state = self.state.read().expect("expected to get state"); - let platform_version = state.current_platform_version()?; + check_tx_level: CheckTxLevel, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { match platform_version.drive_abci.methods.engine.check_tx { - 0 => self.check_tx_v0(raw_tx), + 0 => self.check_tx_v0(raw_tx, check_tx_level, platform_state, platform_version), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "check_tx".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs b/packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs index 8368c3e21d0..e6fa1e13e84 100644 --- a/packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs @@ -1,28 +1,37 @@ use crate::error::Error; -use crate::execution::validation::state_transition::processor::process_state_transition; -use crate::platform_types::platform::{Platform, PlatformRef}; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::execution::check_tx::{CheckTxLevel, CheckTxResult}; +use crate::execution::validation::state_transition::check_tx_verification::state_transition_to_execution_event_for_check_tx; + #[cfg(test)] -use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult; +use crate::platform_types::event_execution_result::EventExecutionResult; #[cfg(test)] -use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult::ConsensusExecutionError; +use crate::platform_types::event_execution_result::EventExecutionResult::UnpaidConsensusExecutionError; +use crate::platform_types::platform::{Platform, PlatformRef}; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::rpc::core::CoreRPCLike; -use dpp::block::block_info::BlockInfo; -use dpp::block::epoch::Epoch; -use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0Getters; -use dpp::consensus::basic::decode::SerializedObjectParsingError; -use dpp::consensus::basic::BasicError; + use dpp::consensus::ConsensusError; -use dpp::fee::epoch::GENESIS_EPOCH_INDEX; -use dpp::fee::fee_result::FeeResult; + +use crate::error::execution::ExecutionError; +use crate::execution::types::state_transition_container::v0::{ + DecodedStateTransition, InvalidStateTransition, InvalidWithProtocolErrorStateTransition, + SuccessfullyDecodedStateTransition, +}; +#[cfg(test)] +use crate::execution::validation::state_transition::processor::process_state_transition; +use crate::platform_types::platform_state::PlatformState; +#[cfg(test)] use dpp::serialization::PlatformDeserializable; -use dpp::state_transition::StateTransition; #[cfg(test)] -use dpp::validation::SimpleConsensusValidationResult; +use dpp::state_transition::StateTransition; +use dpp::util::hash::hash_single; use dpp::validation::ValidationResult; +use dpp::version::PlatformVersion; #[cfg(test)] use drive::grovedb::Transaction; +const PRIORITY_USER_FEE_INCREASE_MULTIPLIER: u32 = 100; + impl Platform where C: CoreRPCLike, @@ -31,32 +40,40 @@ where pub(in crate::execution) fn execute_tx( &self, raw_tx: Vec, - block_info: &BlockInfo, transaction: &Transaction, - ) -> Result { + ) -> Result { let state_transition = StateTransition::deserialize_from_bytes(raw_tx.as_slice()).map_err(Error::Protocol)?; - let state_read_guard = self.state.read().unwrap(); + + let state_read_guard = self.state.load(); + let platform_ref = PlatformRef { drive: &self.drive, state: &state_read_guard, config: &self.config, core_rpc: &self.core_rpc, - block_info, }; - let state_transition_execution_event = - process_state_transition(&platform_ref, state_transition, Some(transaction))?; - - if state_transition_execution_event.is_valid() { - let platform_version = platform_ref.state.current_platform_version()?; - let execution_event = state_transition_execution_event.into_data()?; - self.execute_event(execution_event, block_info, transaction, platform_version) + let state_transition_execution_event = process_state_transition( + &platform_ref, + self.state.load().last_block_info(), + state_transition, + Some(transaction), + )?; + + if state_transition_execution_event.has_data() { + let (execution_event, errors) = + state_transition_execution_event.into_data_and_errors()?; + self.execute_event( + execution_event, + errors, + state_read_guard.last_block_info(), + transaction, + platform_ref.state.current_platform_version()?, + ) } else { - Ok(ConsensusExecutionError( - SimpleConsensusValidationResult::new_with_errors( - state_transition_execution_event.errors, - ), + Ok(UnpaidConsensusExecutionError( + state_transition_execution_event.errors, )) } } @@ -64,7 +81,8 @@ where /// Checks a state transition to determine if it should be added to the mempool. /// /// This function performs a few checks, including validating the state transition and ensuring that the - /// user can pay for it. It may be inaccurate in rare cases, so the proposer needs to re-check transactions + /// user can pay for it. From the time a state transition is added to the mempool to the time it is included in a proposed block, + /// a previously valid state transition may have become invalid, so the proposer needs to re-check transactions /// before proposing a block. /// /// # Arguments @@ -73,52 +91,125 @@ where /// /// # Returns /// - /// * `Result, Error>` - If the state transition passes all + /// * `Result, Error>` - If the state transition passes all /// checks, it returns a `ValidationResult` with fee information. If any check fails, it returns an `Error`. pub(super) fn check_tx_v0( &self, raw_tx: &[u8], - ) -> Result, Error> { - let state_transition = match StateTransition::deserialize_from_bytes(raw_tx) { - Ok(state_transition) => state_transition, - Err(err) => { - return Ok(ValidationResult::new_with_error( - ConsensusError::BasicError(BasicError::SerializedObjectParsingError( - SerializedObjectParsingError::new(err.to_string()), - )), - )) - } + check_tx_level: CheckTxLevel, + platform_state: &PlatformState, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut state_transition_hash = None; + if tracing::enabled!(tracing::Level::TRACE) { + state_transition_hash = Some(hash_single(raw_tx)); + } + + let mut check_tx_result = CheckTxResult { + level: check_tx_level, + fee_result: None, + unique_identifiers: vec![], + priority: 0, + state_transition_name: None, + state_transition_hash, }; - let state_read_guard = self.state.read().unwrap(); + let raw_state_transitions = vec![raw_tx]; + let mut decoded_state_transitions: Vec = self + .decode_raw_state_transitions(&raw_state_transitions, platform_version)? + .into(); + + if decoded_state_transitions.len() != 1 { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expected exactly one decoded state transition", + ))); + } - // Latest committed or genesis block info - let block_info = state_read_guard.any_block_info(); + let state_transition = match decoded_state_transitions.remove(0) { + DecodedStateTransition::SuccessfullyDecoded(SuccessfullyDecodedStateTransition { + decoded, + .. + }) => decoded, + DecodedStateTransition::InvalidEncoding(InvalidStateTransition { error, .. }) => { + return Ok(ValidationResult::new_with_data_and_errors( + check_tx_result, + vec![error], + )); + } + DecodedStateTransition::FailedToDecode(InvalidWithProtocolErrorStateTransition { + error, + .. + }) => { + return Err(error.into()); + } + }; let platform_ref = PlatformRef { drive: &self.drive, - state: &state_read_guard, + state: platform_state, config: &self.config, core_rpc: &self.core_rpc, - block_info, }; - let execution_event = process_state_transition(&platform_ref, state_transition, None)?; + let user_fee_increase = state_transition.user_fee_increase() as u32; + + check_tx_result.priority = + user_fee_increase.saturating_mul(PRIORITY_USER_FEE_INCREASE_MULTIPLIER); + + check_tx_result.state_transition_name = Some(state_transition.name().to_string()); + + check_tx_result.unique_identifiers = state_transition.unique_identifiers(); + + let validation_result = state_transition_to_execution_event_for_check_tx( + &platform_ref, + state_transition, + check_tx_level, + )?; + + // If there are any validation errors happen we return + // the validation result with errors and CheckTxResult data + if !validation_result.is_valid() { + return Ok(ValidationResult::new_with_data_and_errors( + check_tx_result, + validation_result.errors, + )); + } + + // If we are here then state transition pre-validation succeeded + + // We should run the execution event in dry run (estimated fees) + // to see if we would have enough fees for the transition + if let Some(execution_event) = validation_result.into_data()? { + let validation_result = self.validate_fees_of_event( + &execution_event, + platform_state.last_block_info(), + None, + platform_version, + )?; + + let (estimated_fee_result, errors) = validation_result.into_data_and_errors()?; - let platform_version = platform_ref.state.current_platform_version()?; + check_tx_result.fee_result = Some(estimated_fee_result); - // We should run the execution event in dry run to see if we would have enough fees for the transition - execution_event.and_then_borrowed_validation(|execution_event| { - self.validate_fees_of_event(execution_event, block_info, None, platform_version) - }) + Ok(ValidationResult::new_with_data_and_errors( + check_tx_result, + errors, + )) + } else { + // In case of asset lock based transitions, we don't have execution event + // because we already validated remaining balance + Ok(ValidationResult::new_with_data(check_tx_result)) + } } } #[cfg(test)] mod tests { use crate::config::PlatformConfig; + use crate::platform_types::event_execution_result::EventExecutionResult::{ + SuccessfulPaidExecution, UnpaidConsensusExecutionError, UnsuccessfulPaidExecution, + }; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; - use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult::SuccessfulPaidExecution; use crate::platform_types::system_identity_public_keys::v0::SystemIdentityPublicKeysV0; use crate::test::helpers::setup::TestPlatformBuilder; use dpp::block::block_info::BlockInfo; @@ -130,7 +221,7 @@ mod tests { use dpp::dashcore::secp256k1::Secp256k1; use dpp::dashcore::{key::KeyPair, signer, Network, PrivateKey}; - use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; use dpp::data_contract::document_type::random_document::{ CreateRandomDocument, DocumentFieldFillSize, DocumentFieldFillType, }; @@ -144,6 +235,7 @@ mod tests { use dpp::prelude::{Identifier, IdentityPublicKey}; use dpp::serialization::{PlatformSerializable, Signable}; + use dpp::native_bls::NativeBlsModule; use dpp::state_transition::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; use dpp::state_transition::identity_create_transition::methods::IdentityCreateTransitionMethodsV0; @@ -155,20 +247,32 @@ mod tests { use dpp::state_transition::public_key_in_creation::v0::IdentityPublicKeyInCreationV0; use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; use dpp::state_transition::{StateTransition, StateTransitionLike}; - use dpp::tests::fixtures::{get_dashpay_contract_fixture, instant_asset_lock_proof_fixture}; + use dpp::tests::fixtures::{ + get_dashpay_contract_fixture, get_dpns_data_contract_fixture, + instant_asset_lock_proof_fixture, + }; use dpp::version::PlatformVersion; - use dpp::NativeBlsModule; + use crate::execution::check_tx::CheckTxLevel::{FirstTimeCheck, Recheck}; + use dpp::consensus::state::state_error::StateError; + use dpp::data_contract::document_type::v0::random_document_type::{ + FieldMinMaxBounds, FieldTypeWeights, RandomDocumentTypeParameters, + }; + use dpp::data_contract::document_type::v0::DocumentTypeV0; + use dpp::data_contract::document_type::DocumentType; use dpp::identity::contract_bounds::ContractBounds::SingleContractDocumentType; use dpp::platform_value::Bytes32; + use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; + use dpp::state_transition::identity_create_transition::accessors::IdentityCreateTransitionAccessorsV0; + use dpp::state_transition::public_key_in_creation::accessors::IdentityPublicKeyInCreationV0Setters; use dpp::system_data_contracts::dashpay_contract; use dpp::system_data_contracts::SystemDataContract::Dashpay; - use platform_version::TryIntoPlatformVersioned; + use platform_version::{TryFromPlatformVersioned, TryIntoPlatformVersioned}; use rand::rngs::StdRng; use rand::SeedableRng; use std::collections::BTreeMap; - // This test needs to be finished, but is still useful for debugging + // This test needs to be redone with new contract bytes, but is still useful for debugging #[test] #[ignore] fn verify_check_tx_on_data_contract_create() { @@ -181,8 +285,8 @@ mod tests { .expect_verify_instant_lock() .returning(|_, _| Ok(true)); - let state = platform.state.read().unwrap(); - let protocol_version = state.current_protocol_version_in_consensus(); + let platform_state = platform.state.load(); + let protocol_version = platform_state.current_protocol_version_in_consensus(); let platform_version = PlatformVersion::get(protocol_version).unwrap(); let tx: Vec = vec![ @@ -201,8 +305,8 @@ mod tests { 217, 221, 43, 251, 104, 84, 78, 35, 20, 237, 188, 237, 240, 216, 62, 79, 208, 96, 149, 116, 62, 82, 187, 135, 219, ]; - let state_transitions = StateTransition::deserialize_many(&vec![tx.clone()]) - .expect("expected a state transition"); + let state_transitions = + StateTransition::deserialize_many(&[tx.clone()]).expect("expected a state transition"); let state_transition = state_transitions.first().unwrap(); let StateTransition::DataContractCreate(contract_create) = state_transition else { panic!("expecting a data contract create"); @@ -234,18 +338,34 @@ mod tests { let transaction = platform.drive.grove.start_transaction(); - let check_result = platform.check_tx(&tx).expect("expected to check tx"); + let check_result = platform + .check_tx(&tx, FirstTimeCheck, &platform_state, platform_version) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); + + let check_result = platform + .check_tx(&tx, Recheck, &platform_state, platform_version) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); - let result = platform + platform .platform .process_raw_state_transitions( - &vec![tx], - &state, + &vec![tx.clone()], + &platform_state, &BlockInfo::default(), &transaction, platform_version, ) .expect("expected to process state transition"); + + let check_result = platform + .check_tx(&tx, Recheck, &platform_state, platform_version) + .expect("expected to check tx"); + + assert!(!check_result.is_valid()); } #[test] @@ -259,8 +379,8 @@ mod tests { .expect_verify_instant_lock() .returning(|_, _| Ok(true)); - let state = platform.state.read().unwrap(); - let protocol_version = state.current_protocol_version_in_consensus(); + let platform_state = platform.state.load(); + let protocol_version = platform_state.current_protocol_version_in_consensus(); let platform_version = PlatformVersion::get(protocol_version).unwrap(); let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( @@ -285,7 +405,7 @@ mod tests { } .into(); - let dashpay = get_dashpay_contract_fixture(Some(identity.id()), protocol_version); + let dashpay = get_dashpay_contract_fixture(Some(identity.id()), 1, protocol_version); let mut create_contract_state_transition: StateTransition = dashpay .try_into_platform_versioned(platform_version) .expect("expected a state transition"); @@ -308,14 +428,79 @@ mod tests { .expect("expected to insert identity"); let validation_result = platform - .check_tx(serialized.as_slice()) + .check_tx( + serialized.as_slice(), + FirstTimeCheck, + &platform_state, + platform_version, + ) .expect("expected to check tx"); assert!(validation_result.errors.is_empty()); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![serialized.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 2985330); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); // it should still be valid, because we didn't commit the transaction + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(!check_result.is_valid()); // it should no longer be valid, because of the nonce check + + assert!(matches!( + check_result.errors.first().expect("expected an error"), + ConsensusError::StateError(StateError::InvalidIdentityNonceError(_)) + )); } #[test] - fn document_update_check_tx() { + fn data_contract_create_check_tx_for_invalid_contract() { let mut platform = TestPlatformBuilder::new() .with_config(PlatformConfig::default()) .build_with_mock_rpc(); @@ -325,184 +510,1383 @@ mod tests { .expect_verify_instant_lock() .returning(|_, _| Ok(true)); - let mut platform_state = platform.state.read().unwrap(); - let platform_version = platform_state.current_platform_version().unwrap(); - - let mut signer = SimpleSigner::default(); - - let mut rng = StdRng::seed_from_u64(567); + let platform_state = platform.state.load(); + let protocol_version = platform_state.current_protocol_version_in_consensus(); + let platform_version = PlatformVersion::get(protocol_version).unwrap(); let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( 1, - Some(19), + Some(1), platform_version, ) .expect("expected to get key pair"); - signer.add_key(key.clone(), private_key.clone()); - - let (_, pk) = ECDSA_SECP256K1 - .random_public_and_private_key_data(&mut rng, platform_version) - .unwrap(); - - let asset_lock_proof = instant_asset_lock_proof_fixture(Some( - PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap(), - )); - - let identifier = asset_lock_proof - .create_identifier() - .expect("expected an identifier"); - + platform + .drive + .create_initial_state_structure(None, platform_version) + .expect("expected to create state structure"); let identity: Identity = IdentityV0 { - id: identifier, + id: Identifier::new([ + 158, 113, 180, 126, 91, 83, 62, 44, 83, 54, 97, 88, 240, 215, 84, 139, 167, 156, + 166, 203, 222, 4, 64, 31, 215, 199, 149, 151, 190, 246, 251, 44, + ]), public_keys: BTreeMap::from([(1, key.clone())]), balance: 1000000000, revision: 0, } .into(); - let identity_create_transition: StateTransition = - IdentityCreateTransition::try_from_identity_with_signer( - identity.clone(), - asset_lock_proof, - pk.as_slice(), - &signer, - &NativeBlsModule, - platform_version, - ) - .expect("expected an identity create transition"); + let mut dashpay = get_dashpay_contract_fixture(Some(identity.id()), 1, protocol_version); + + let dashpay_id = dashpay.data_contract().id(); + // we need to alter dashpay to make it invalid + + let document_types = dashpay.data_contract_mut().document_types_mut(); + + let parameters = RandomDocumentTypeParameters { + new_fields_optional_count_range: 5..6, + new_fields_required_count_range: 3..4, + new_indexes_count_range: Default::default(), + field_weights: FieldTypeWeights { + string_weight: 5, + float_weight: 3, + integer_weight: 2, + date_weight: 0, + boolean_weight: 1, + byte_array_weight: 0, + }, + field_bounds: FieldMinMaxBounds { + string_min_len: Default::default(), + string_has_min_len_chance: 0.0, + string_max_len: Default::default(), + string_has_max_len_chance: 0.0, + integer_min: Default::default(), + integer_has_min_chance: 0.0, + integer_max: Default::default(), + integer_has_max_chance: 0.0, + float_min: Default::default(), + float_has_min_chance: 0.0, + float_max: Default::default(), + float_has_max_chance: 0.0, + date_min: 0, + date_max: 100, + byte_array_min_len: Default::default(), + byte_array_has_min_len_chance: 0.0, + byte_array_max_len: Default::default(), + byte_array_has_max_len_chance: 0.0, + }, + keep_history_chance: 0.0, + documents_mutable_chance: 0.0, + documents_can_be_deleted_chance: 0.0, + }; - let identity_create_serialized_transition = identity_create_transition - .serialize_to_bytes() - .expect("serialized state transition"); + let mut rng = StdRng::seed_from_u64(6); + + document_types.insert( + "invalid".to_string(), + DocumentType::V0( + DocumentTypeV0::invalid_random_document_type( + parameters, + dashpay_id, + &mut rng, + platform_version, + ) + .expect("expected an invalid document type"), + ), + ); - let dashpay = - get_dashpay_contract_fixture(Some(identity.id()), platform_version.protocol_version); - let dashpay_contract = dashpay.data_contract().clone(); let mut create_contract_state_transition: StateTransition = dashpay .try_into_platform_versioned(platform_version) .expect("expected a state transition"); create_contract_state_transition .sign(&key, private_key.as_slice(), &NativeBlsModule) .expect("expected to sign transition"); - let data_contract_create_serialized_transition = create_contract_state_transition + let serialized = create_contract_state_transition .serialize_to_bytes() - .expect("expected data contract create serialized state transition"); - - let profile = dashpay_contract - .document_type_for_name("profile") - .expect("expected a profile document type"); - - let entropy = Bytes32::random_with_rng(&mut rng); - - let mut document = profile - .random_document_with_identifier_and_entropy( - &mut rng, - identifier, - entropy, - DocumentFieldFillType::FillIfNotRequired, - DocumentFieldFillSize::AnyDocumentFillSize, + .expect("serialized state transition"); + platform + .drive + .add_new_identity( + identity, + false, + &BlockInfo::default(), + true, + None, platform_version, ) - .expect("expected a random document"); - - document.set("avatarUrl", "http://test.com/bob.jpg".into()); - - let mut altered_document = document.clone(); - - altered_document.increment_revision().unwrap(); - altered_document.set("displayName", "Samuel".into()); - altered_document.set("avatarUrl", "http://test.com/cat.jpg".into()); + .expect("expected to insert identity"); - let documents_batch_create_transition = - DocumentsBatchTransition::new_document_creation_transition_from_document( - document, - profile, - entropy.0, - &key, - &signer, + let validation_result = platform + .check_tx( + serialized.as_slice(), + FirstTimeCheck, + &platform_state, platform_version, - None, - None, - None, ) - .expect("expect to create documents batch transition"); + .expect("expected to check tx"); - let documents_batch_create_serialized_transition = documents_batch_create_transition - .serialize_to_bytes() - .expect("expected documents batch serialized state transition"); + assert!(validation_result.errors.is_empty()); - let documents_batch_update_transition = - DocumentsBatchTransition::new_document_replacement_transition_from_document( - altered_document, - profile, - &key, - &signer, + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_state, platform_version, - None, - None, - None, ) - .expect("expect to create documents batch transition"); - - let documents_batch_update_serialized_transition = documents_batch_update_transition - .serialize_to_bytes() - .expect("expected documents batch serialized state transition"); + .expect("expected to check tx"); - platform - .drive - .create_initial_state_structure(None, platform_version) - .expect("expected to create state structure"); + assert!(check_result.is_valid()); let transaction = platform.drive.grove.start_transaction(); - let validation_result = platform - .execute_tx( - identity_create_serialized_transition, + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![serialized.clone()], + &platform_state, &BlockInfo::default(), &transaction, + platform_version, ) - .expect("expected to execute identity_create tx"); + .expect("expected to process state transition"); - assert!( - matches!(validation_result, SuccessfulPaidExecution(..)), - "{:?}", - validation_result - ); + // We have one invalid paid for state transition + assert_eq!(processing_result.invalid_paid_count(), 1); - let validation_result = platform - .execute_tx( - data_contract_create_serialized_transition, - &BlockInfo::default(), - &transaction, - ) - .expect("expected to execute data_contract_create tx"); - assert!(matches!(validation_result, SuccessfulPaidExecution(..))); - let validation_result = platform - .execute_tx( - documents_batch_create_serialized_transition, - &BlockInfo::default(), - &transaction, + assert_eq!(processing_result.aggregated_fees().processing_fee, 905460); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_state, + platform_version, ) - .expect("expected to execute document_create tx"); - assert!(matches!(validation_result, SuccessfulPaidExecution(..))); + .expect("expected to check tx"); + + assert!(check_result.is_valid()); // it should still be valid, because we didn't commit the transaction platform .drive .grove .commit_transaction(transaction) .unwrap() - .expect("expected to commit transaction"); + .expect("expected to commit"); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(!check_result.is_valid()); // it should no longer be valid, because of the nonce check + + assert!(matches!( + check_result.errors.first().expect("expected an error"), + ConsensusError::StateError(StateError::InvalidIdentityNonceError(_)) + )); + } + + #[test] + fn data_contract_create_check_tx_priority() { + let mut platform = TestPlatformBuilder::new() + .with_config(PlatformConfig::default()) + .build_with_mock_rpc(); + + platform + .core_rpc + .expect_verify_instant_lock() + .returning(|_, _| Ok(true)); + + let platform_state = platform.state.load(); + let protocol_version = platform_state.current_protocol_version_in_consensus(); + let platform_version = PlatformVersion::get(protocol_version).unwrap(); + + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(1), + platform_version, + ) + .expect("expected to get key pair"); + + platform + .drive + .create_initial_state_structure(None, platform_version) + .expect("expected to create state structure"); + let identity: Identity = IdentityV0 { + id: Identifier::new([ + 158, 113, 180, 126, 91, 83, 62, 44, 83, 54, 97, 88, 240, 215, 84, 139, 167, 156, + 166, 203, 222, 4, 64, 31, 215, 199, 149, 151, 190, 246, 251, 44, + ]), + public_keys: BTreeMap::from([(1, key.clone())]), + balance: 1000000000, + revision: 0, + } + .into(); + + let dashpay = get_dashpay_contract_fixture(Some(identity.id()), 1, protocol_version); + let mut create_contract_state_transition: StateTransition = dashpay + .try_into_platform_versioned(platform_version) + .expect("expected a state transition"); + + create_contract_state_transition.set_user_fee_increase(100); // This means that things will be twice as expensive + + create_contract_state_transition + .sign(&key, private_key.as_slice(), &NativeBlsModule) + .expect("expected to sign transition"); + let serialized = create_contract_state_transition + .serialize_to_bytes() + .expect("serialized state transition"); + platform + .drive + .add_new_identity( + identity, + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to insert identity"); + + let validation_result = platform + .check_tx( + serialized.as_slice(), + FirstTimeCheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(validation_result.errors.is_empty()); + + assert_eq!(validation_result.data.unwrap().priority, 10000); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); + + assert_eq!(check_result.data.unwrap().priority, 10000); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![serialized.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + // The processing fees should be twice as much as a fee multiplier of 0, + // since a fee multiplier of 100 means 100% more of 1 (gives 2) + assert_eq!( + processing_result.aggregated_fees().processing_fee, + 2985330 * 2 + ); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); // it should still be valid, because we didn't commit the transaction + + assert_eq!(check_result.data.unwrap().priority, 10000); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(!check_result.is_valid()); // it should no longer be valid, because of the nonce check + + assert!(matches!( + check_result.errors.first().expect("expected an error"), + ConsensusError::StateError(StateError::InvalidIdentityNonceError(_)) + )); + } + + #[test] + fn data_contract_create_check_tx_after_identity_balance_used_up() { + let mut platform = TestPlatformBuilder::new() + .with_config(PlatformConfig::default()) + .build_with_mock_rpc(); + + platform + .core_rpc + .expect_verify_instant_lock() + .returning(|_, _| Ok(true)); + + let platform_state = platform.state.load(); + let protocol_version = platform_state.current_protocol_version_in_consensus(); + let platform_version = PlatformVersion::get(protocol_version).unwrap(); + + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(1), + platform_version, + ) + .expect("expected to get key pair"); + + platform + .drive + .create_initial_state_structure(None, platform_version) + .expect("expected to create state structure"); + let identity: Identity = IdentityV0 { + id: Identifier::new([ + 158, 113, 180, 126, 91, 83, 62, 44, 83, 54, 97, 88, 240, 215, 84, 139, 167, 156, + 166, 203, 222, 4, 64, 31, 215, 199, 149, 151, 190, 246, 251, 44, + ]), + public_keys: BTreeMap::from([(1, key.clone())]), + balance: 200000000, // we have enough balance only for 1 insertion (this is where this test is different) + revision: 0, + } + .into(); + + let dashpay = get_dashpay_contract_fixture(Some(identity.id()), 1, protocol_version); + let mut create_contract_state_transition: StateTransition = dashpay + .try_into_platform_versioned(platform_version) + .expect("expected a state transition"); + create_contract_state_transition + .sign(&key, private_key.as_slice(), &NativeBlsModule) + .expect("expected to sign transition"); + let serialized = create_contract_state_transition + .serialize_to_bytes() + .expect("serialized state transition"); + platform + .drive + .add_new_identity( + identity, + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to insert identity"); + + let validation_result = platform + .check_tx( + serialized.as_slice(), + FirstTimeCheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(validation_result.errors.is_empty()); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); + + let transaction = platform.drive.grove.start_transaction(); + + platform + .platform + .process_raw_state_transitions( + &vec![serialized.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); // it should still be valid, because we didn't commit the transaction + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let check_result = platform + .check_tx( + serialized.as_slice(), + Recheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(!check_result.is_valid()); // the identity shouldn't have enough balance anymore + } + + #[test] + fn data_contract_update_check_tx() { + let mut platform = TestPlatformBuilder::new() + .with_config(PlatformConfig::default()) + .build_with_mock_rpc(); + + platform + .core_rpc + .expect_verify_instant_lock() + .returning(|_, _| Ok(true)); + + let platform_state = platform.state.load(); + let protocol_version = platform_state.current_protocol_version_in_consensus(); + let platform_version = PlatformVersion::get(protocol_version).unwrap(); + + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(1), + platform_version, + ) + .expect("expected to get key pair"); + + platform + .drive + .create_initial_state_structure(None, platform_version) + .expect("expected to create state structure"); + let identity: Identity = IdentityV0 { + id: Identifier::new([ + 158, 113, 180, 126, 91, 83, 62, 44, 83, 54, 97, 88, 240, 215, 84, 139, 167, 156, + 166, 203, 222, 4, 64, 31, 215, 199, 149, 151, 190, 246, 251, 44, + ]), + public_keys: BTreeMap::from([(1, key.clone())]), + balance: 1000000000, + revision: 0, + } + .into(); + + let dashpay_created_contract = + get_dashpay_contract_fixture(Some(identity.id()), 1, protocol_version); + let mut modified_dashpay_contract = dashpay_created_contract.data_contract().clone(); + let mut create_contract_state_transition: StateTransition = dashpay_created_contract + .try_into_platform_versioned(platform_version) + .expect("expected a state transition"); + create_contract_state_transition + .sign(&key, private_key.as_slice(), &NativeBlsModule) + .expect("expected to sign transition"); + let serialized = create_contract_state_transition + .serialize_to_bytes() + .expect("serialized state transition"); + platform + .drive + .add_new_identity( + identity.clone(), + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to insert identity"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![serialized.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 2985330); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + // Now let's do the data contract update + let _dashpay_id = modified_dashpay_contract.id(); + // we need to alter dashpay to make it invalid + + modified_dashpay_contract.set_version(2); + + let document_types = modified_dashpay_contract.document_types_mut(); + + let dpns_contract = + get_dpns_data_contract_fixture(Some(identity.id()), 1, protocol_version) + .data_contract_owned(); + + document_types.insert( + "preorder".to_string(), + dpns_contract + .document_type_for_name("preorder") + .expect("expected document type") + .to_owned_document_type(), + ); + + let mut update_contract_state_transition: StateTransition = + DataContractUpdateTransition::try_from_platform_versioned( + (modified_dashpay_contract, 2), + platform_version, + ) + .expect("expected a state transition") + .into(); + + update_contract_state_transition + .sign(&key, private_key.as_slice(), &NativeBlsModule) + .expect("expected to sign transition"); + let serialized_update = update_contract_state_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let validation_result = platform + .check_tx( + serialized_update.as_slice(), + FirstTimeCheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(validation_result.errors.is_empty()); + + let check_result = platform + .check_tx( + serialized_update.as_slice(), + Recheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); + + let transaction = platform.drive.grove.start_transaction(); + + let update_processing_result = platform + .platform + .process_raw_state_transitions( + &vec![serialized_update.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + // We have one invalid paid for state transition + assert_eq!(update_processing_result.valid_count(), 1); + + assert_eq!( + update_processing_result.aggregated_fees().processing_fee, + 7125710 + ); + + let check_result = platform + .check_tx( + serialized_update.as_slice(), + Recheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); // it should still be valid, because we didn't commit the transaction + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let check_result = platform + .check_tx( + serialized_update.as_slice(), + Recheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(!check_result.is_valid()); // it should no longer be valid, because of the nonce check + + assert!(matches!( + check_result.errors.first().expect("expected an error"), + ConsensusError::StateError(StateError::InvalidIdentityNonceError(_)) + )); + } + + #[test] + fn data_contract_update_check_tx_for_invalid_update() { + let mut platform = TestPlatformBuilder::new() + .with_config(PlatformConfig::default()) + .build_with_mock_rpc(); + + platform + .core_rpc + .expect_verify_instant_lock() + .returning(|_, _| Ok(true)); + + let platform_state = platform.state.load(); + let protocol_version = platform_state.current_protocol_version_in_consensus(); + let platform_version = PlatformVersion::get(protocol_version).unwrap(); + + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(1), + platform_version, + ) + .expect("expected to get key pair"); + + platform + .drive + .create_initial_state_structure(None, platform_version) + .expect("expected to create state structure"); + let identity: Identity = IdentityV0 { + id: Identifier::new([ + 158, 113, 180, 126, 91, 83, 62, 44, 83, 54, 97, 88, 240, 215, 84, 139, 167, 156, + 166, 203, 222, 4, 64, 31, 215, 199, 149, 151, 190, 246, 251, 44, + ]), + public_keys: BTreeMap::from([(1, key.clone())]), + balance: 1000000000, + revision: 0, + } + .into(); + + let dashpay_created_contract = + get_dashpay_contract_fixture(Some(identity.id()), 1, protocol_version); + let mut modified_dashpay_contract = dashpay_created_contract.data_contract().clone(); + let mut create_contract_state_transition: StateTransition = dashpay_created_contract + .try_into_platform_versioned(platform_version) + .expect("expected a state transition"); + create_contract_state_transition + .sign(&key, private_key.as_slice(), &NativeBlsModule) + .expect("expected to sign transition"); + let serialized = create_contract_state_transition + .serialize_to_bytes() + .expect("serialized state transition"); + platform + .drive + .add_new_identity( + identity, + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to insert identity"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![serialized.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 2985330); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + // Now let's do the data contract update + let dashpay_id = modified_dashpay_contract.id(); + // we need to alter dashpay to make it invalid + + let document_types = modified_dashpay_contract.document_types_mut(); + + let parameters = RandomDocumentTypeParameters { + new_fields_optional_count_range: 5..6, + new_fields_required_count_range: 3..4, + new_indexes_count_range: Default::default(), + field_weights: FieldTypeWeights { + string_weight: 5, + float_weight: 3, + integer_weight: 2, + date_weight: 0, + boolean_weight: 1, + byte_array_weight: 0, + }, + field_bounds: FieldMinMaxBounds { + string_min_len: Default::default(), + string_has_min_len_chance: 0.0, + string_max_len: Default::default(), + string_has_max_len_chance: 0.0, + integer_min: Default::default(), + integer_has_min_chance: 0.0, + integer_max: Default::default(), + integer_has_max_chance: 0.0, + float_min: Default::default(), + float_has_min_chance: 0.0, + float_max: Default::default(), + float_has_max_chance: 0.0, + date_min: 0, + date_max: 100, + byte_array_min_len: Default::default(), + byte_array_has_min_len_chance: 0.0, + byte_array_max_len: Default::default(), + byte_array_has_max_len_chance: 0.0, + }, + keep_history_chance: 0.0, + documents_mutable_chance: 0.0, + documents_can_be_deleted_chance: 0.0, + }; + + let mut rng = StdRng::seed_from_u64(6); + + document_types.insert( + "invalid".to_string(), + DocumentType::V0( + DocumentTypeV0::invalid_random_document_type( + parameters, + dashpay_id, + &mut rng, + platform_version, + ) + .expect("expected an invalid document type"), + ), + ); + + let mut update_contract_state_transition: StateTransition = + DataContractUpdateTransition::try_from_platform_versioned( + (modified_dashpay_contract, 2), + platform_version, + ) + .expect("expected a state transition") + .into(); + + update_contract_state_transition + .sign(&key, private_key.as_slice(), &NativeBlsModule) + .expect("expected to sign transition"); + let serialized_update = update_contract_state_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let validation_result = platform + .check_tx( + serialized_update.as_slice(), + FirstTimeCheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(validation_result.errors.is_empty()); + + let check_result = platform + .check_tx( + serialized_update.as_slice(), + Recheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![serialized_update.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + // We have one invalid paid for state transition + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 1231130); + + let check_result = platform + .check_tx( + serialized_update.as_slice(), + Recheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(check_result.is_valid()); // it should still be valid, because we didn't commit the transaction + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let check_result = platform + .check_tx( + serialized_update.as_slice(), + Recheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(!check_result.is_valid()); // it should no longer be valid, because of the nonce check + + assert!(matches!( + check_result.errors.first().expect("expected an error"), + ConsensusError::StateError(StateError::InvalidIdentityNonceError(_)) + )); + } + + #[test] + fn document_update_check_tx() { + let mut platform = TestPlatformBuilder::new() + .with_config(PlatformConfig::default()) + .build_with_mock_rpc() + .set_genesis_state(); + + platform + .core_rpc + .expect_verify_instant_lock() + .returning(|_, _| Ok(true)); + + let platform_state = platform.state.load(); + let platform_version = platform_state.current_platform_version().unwrap(); + + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(567); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key(0, Some(3), platform_version) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(19), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(key.clone(), private_key.clone()); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identifier = asset_lock_proof + .create_identifier() + .expect("expected an identifier"); + + let identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([(0, master_key.clone()), (1, key.clone())]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof, + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let dashpay = + get_dashpay_contract_fixture(Some(identity.id()), 1, platform_version.protocol_version); + let dashpay_contract = dashpay.data_contract().clone(); + let mut create_contract_state_transition: StateTransition = dashpay + .try_into_platform_versioned(platform_version) + .expect("expected a state transition"); + create_contract_state_transition + .sign(&key, private_key.as_slice(), &NativeBlsModule) + .expect("expected to sign transition"); + let data_contract_create_serialized_transition = create_contract_state_transition + .serialize_to_bytes() + .expect("expected data contract create serialized state transition"); + + let profile = dashpay_contract + .document_type_for_name("profile") + .expect("expected a profile document type"); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + &mut rng, + identifier, + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("avatarUrl", "http://test.com/bob.jpg".into()); + + let mut altered_document = document.clone(); + + altered_document.increment_revision().unwrap(); + altered_document.set("displayName", "Samuel".into()); + altered_document.set("avatarUrl", "http://test.com/cat.jpg".into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + profile, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let documents_batch_update_transition = + DocumentsBatchTransition::new_document_replacement_transition_from_document( + altered_document, + profile, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_update_serialized_transition = documents_batch_update_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let validation_result = platform + .execute_tx(identity_create_serialized_transition, &transaction) + .expect("expected to execute identity_create tx"); + + assert!( + matches!(validation_result, SuccessfulPaidExecution(..)), + "{:?}", + validation_result + ); + + let validation_result = platform + .execute_tx(data_contract_create_serialized_transition, &transaction) + .expect("expected to execute data_contract_create tx"); + assert!(matches!(validation_result, SuccessfulPaidExecution(..))); + let validation_result = platform + .execute_tx(documents_batch_create_serialized_transition, &transaction) + .expect("expected to execute document_create tx"); + assert!(matches!(validation_result, SuccessfulPaidExecution(..))); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let validation_result = platform + .check_tx( + documents_batch_update_serialized_transition.as_slice(), + FirstTimeCheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(validation_result.errors.is_empty()); + } + + #[test] + fn identity_top_up_check_tx() { + let mut platform = TestPlatformBuilder::new() + .with_config(PlatformConfig::default()) + .build_with_mock_rpc(); + + platform + .core_rpc + .expect_verify_instant_lock() + .returning(|_, _| Ok(true)); + + let platform_state = platform.state.load(); + let platform_version = platform_state.current_platform_version().unwrap(); + + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(567); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key(0, Some(3), platform_version) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(19), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(key.clone(), private_key.clone()); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identifier = asset_lock_proof + .create_identifier() + .expect("expected an identifier"); + + let identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([(0, master_key.clone()), (1, key.clone())]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof, + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + platform + .drive + .create_initial_state_structure(None, platform_version) + .expect("expected to create state structure"); + + let transaction = platform.drive.grove.start_transaction(); + + let validation_result = platform + .execute_tx(identity_create_serialized_transition, &transaction) + .expect("expected to execute identity_create tx"); + assert!(matches!(validation_result, SuccessfulPaidExecution(..))); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof_top_up = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identity_top_up_transition: StateTransition = + IdentityTopUpTransition::try_from_identity( + &identity, + asset_lock_proof_top_up, + pk.as_slice(), + 0, + platform_version, + None, + ) + .expect("expected an identity create transition"); + + let identity_top_up_serialized_transition = identity_top_up_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let validation_result = platform + .check_tx( + identity_top_up_serialized_transition.as_slice(), + FirstTimeCheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(validation_result.errors.is_empty()); + + let transaction = platform.drive.grove.start_transaction(); + + let validation_result = platform + .execute_tx(identity_top_up_serialized_transition, &transaction) + .expect("expected to execute identity top up tx"); + assert!(matches!(validation_result, SuccessfulPaidExecution(..))); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + } + + #[test] + fn identity_cant_double_top_up() { + let mut platform = TestPlatformBuilder::new() + .with_config(PlatformConfig::default()) + .build_with_mock_rpc(); + + platform + .core_rpc + .expect_verify_instant_lock() + .returning(|_, _| Ok(true)); + + let platform_state = platform.state.load(); + let platform_version = platform_state.current_platform_version().unwrap(); + + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(567); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key(0, Some(3), platform_version) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(19), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(key.clone(), private_key.clone()); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identifier = asset_lock_proof + .create_identifier() + .expect("expected an identifier"); + + let identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([(0, master_key.clone()), (1, key.clone())]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof, + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + platform + .drive + .create_initial_state_structure(None, platform_version) + .expect("expected to create state structure"); + + let transaction = platform.drive.grove.start_transaction(); + + let validation_result = platform + .execute_tx(identity_create_serialized_transition, &transaction) + .expect("expected to execute identity_create tx"); + assert!(matches!(validation_result, SuccessfulPaidExecution(..))); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof_top_up = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identity_top_up_transition: StateTransition = + IdentityTopUpTransition::try_from_identity( + &identity, + asset_lock_proof_top_up, + pk.as_slice(), + 0, + platform_version, + None, + ) + .expect("expected an identity create transition"); + + let identity_top_up_serialized_transition = identity_top_up_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let validation_result = platform + .check_tx( + identity_top_up_serialized_transition.as_slice(), + FirstTimeCheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(validation_result.errors.is_empty()); + + let transaction = platform.drive.grove.start_transaction(); + + let validation_result = platform + .execute_tx(identity_top_up_serialized_transition.clone(), &transaction) + .expect("expected to execute identity top up tx"); + assert!(matches!(validation_result, SuccessfulPaidExecution(..))); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let validation_result = platform + .check_tx( + identity_top_up_serialized_transition.as_slice(), + FirstTimeCheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(matches!( + validation_result.errors.first().expect("expected an error"), + ConsensusError::BasicError( + BasicError::IdentityAssetLockTransactionOutPointAlreadyConsumedError(_) + ) + )); let validation_result = platform - .check_tx(documents_batch_update_serialized_transition.as_slice()) + .check_tx( + identity_top_up_serialized_transition.as_slice(), + Recheck, + &platform_state, + platform_version, + ) .expect("expected to check tx"); - assert!(validation_result.errors.is_empty()); + assert!(matches!( + validation_result.errors.first().expect("expected an error"), + ConsensusError::BasicError( + BasicError::IdentityAssetLockTransactionOutPointAlreadyConsumedError(_) + ) + )); } #[test] - fn identity_top_up_check_tx() { + fn identity_top_up_with_unknown_identity_doesnt_panic() { let mut platform = TestPlatformBuilder::new() .with_config(PlatformConfig::default()) .build_with_mock_rpc(); @@ -512,7 +1896,7 @@ mod tests { .expect_verify_instant_lock() .returning(|_, _| Ok(true)); - let platform_state = platform.state.read().unwrap(); + let platform_state = platform.state.load(); let platform_version = platform_state.current_platform_version().unwrap(); let mut signer = SimpleSigner::default(); @@ -532,9 +1916,10 @@ mod tests { .random_public_and_private_key_data(&mut rng, platform_version) .unwrap(); - let asset_lock_proof = instant_asset_lock_proof_fixture(Some( - PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap(), - )); + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); let identifier = asset_lock_proof .create_identifier() @@ -548,58 +1933,26 @@ mod tests { } .into(); - let identity_create_transition: StateTransition = - IdentityCreateTransition::try_from_identity_with_signer( - identity.clone(), - asset_lock_proof, - pk.as_slice(), - &signer, - &NativeBlsModule, - platform_version, - ) - .expect("expected an identity create transition"); - - let identity_create_serialized_transition = identity_create_transition - .serialize_to_bytes() - .expect("serialized state transition"); - platform .drive .create_initial_state_structure(None, platform_version) .expect("expected to create state structure"); - let transaction = platform.drive.grove.start_transaction(); - - let validation_result = platform - .execute_tx( - identity_create_serialized_transition, - &BlockInfo::default(), - &transaction, - ) - .expect("expected to execute identity_create tx"); - assert!(matches!(validation_result, SuccessfulPaidExecution(..))); - - platform - .drive - .grove - .commit_transaction(transaction) - .unwrap() - .expect("expected to commit transaction"); - let (_, pk) = ECDSA_SECP256K1 .random_public_and_private_key_data(&mut rng, platform_version) .unwrap(); - let asset_lock_proof_top_up = instant_asset_lock_proof_fixture(Some( - PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap(), - )); + let asset_lock_proof_top_up = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); let identity_top_up_transition: StateTransition = IdentityTopUpTransition::try_from_identity( - identity.clone(), + &identity, asset_lock_proof_top_up, pk.as_slice(), - &NativeBlsModule, + 0, platform_version, None, ) @@ -610,32 +1963,24 @@ mod tests { .expect("serialized state transition"); let validation_result = platform - .check_tx(identity_top_up_serialized_transition.as_slice()) + .check_tx( + identity_top_up_serialized_transition.as_slice(), + FirstTimeCheck, + &platform_state, + platform_version, + ) .expect("expected to check tx"); - assert!(validation_result.errors.is_empty()); - - let transaction = platform.drive.grove.start_transaction(); - - let validation_result = platform - .execute_tx( - identity_top_up_serialized_transition, - &BlockInfo::default(), - &transaction, - ) - .expect("expected to execute identity top up tx"); - assert!(matches!(validation_result, SuccessfulPaidExecution(..))); + // This errors because we never created the identity - platform - .drive - .grove - .commit_transaction(transaction) - .unwrap() - .expect("expected to commit transaction"); + assert!(matches!( + validation_result.errors.first().expect("expected an error"), + ConsensusError::SignatureError(SignatureError::IdentityNotFoundError(_)) + )); } #[test] - fn identity_cant_double_top_up() { + fn identity_cant_create_with_used_outpoint() { let mut platform = TestPlatformBuilder::new() .with_config(PlatformConfig::default()) .build_with_mock_rpc(); @@ -645,13 +1990,19 @@ mod tests { .expect_verify_instant_lock() .returning(|_, _| Ok(true)); - let platform_state = platform.state.read().unwrap(); + let platform_state = platform.state.load(); let platform_version = platform_state.current_platform_version().unwrap(); let mut signer = SimpleSigner::default(); let mut rng = StdRng::seed_from_u64(567); + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key(0, Some(3), platform_version) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( 1, Some(19), @@ -665,9 +2016,10 @@ mod tests { .random_public_and_private_key_data(&mut rng, platform_version) .unwrap(); - let asset_lock_proof = instant_asset_lock_proof_fixture(Some( - PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap(), - )); + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); let identifier = asset_lock_proof .create_identifier() @@ -675,7 +2027,7 @@ mod tests { let identity: Identity = IdentityV0 { id: identifier, - public_keys: BTreeMap::from([(1, key.clone())]), + public_keys: BTreeMap::from([(0, master_key.clone()), (1, key.clone())]), balance: 1000000000, revision: 0, } @@ -683,11 +2035,12 @@ mod tests { let identity_create_transition: StateTransition = IdentityCreateTransition::try_from_identity_with_signer( - identity.clone(), + &identity, asset_lock_proof, pk.as_slice(), &signer, &NativeBlsModule, + 0, platform_version, ) .expect("expected an identity create transition"); @@ -704,11 +2057,7 @@ mod tests { let transaction = platform.drive.grove.start_transaction(); let validation_result = platform - .execute_tx( - identity_create_serialized_transition, - &BlockInfo::default(), - &transaction, - ) + .execute_tx(identity_create_serialized_transition, &transaction) .expect("expected to execute identity_create tx"); assert!(matches!(validation_result, SuccessfulPaidExecution(..))); @@ -723,16 +2072,17 @@ mod tests { .random_public_and_private_key_data(&mut rng, platform_version) .unwrap(); - let asset_lock_proof_top_up = instant_asset_lock_proof_fixture(Some( - PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap(), - )); + let asset_lock_proof_top_up = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); let identity_top_up_transition: StateTransition = IdentityTopUpTransition::try_from_identity( - identity.clone(), - asset_lock_proof_top_up, + &identity, + asset_lock_proof_top_up.clone(), pk.as_slice(), - &NativeBlsModule, + 0, platform_version, None, ) @@ -743,7 +2093,12 @@ mod tests { .expect("serialized state transition"); let validation_result = platform - .check_tx(identity_top_up_serialized_transition.as_slice()) + .check_tx( + identity_top_up_serialized_transition.as_slice(), + FirstTimeCheck, + &platform_state, + platform_version, + ) .expect("expected to check tx"); assert!(validation_result.errors.is_empty()); @@ -751,11 +2106,7 @@ mod tests { let transaction = platform.drive.grove.start_transaction(); let validation_result = platform - .execute_tx( - identity_top_up_serialized_transition.clone(), - &BlockInfo::default(), - &transaction, - ) + .execute_tx(identity_top_up_serialized_transition.clone(), &transaction) .expect("expected to execute identity top up tx"); assert!(matches!(validation_result, SuccessfulPaidExecution(..))); @@ -766,107 +2117,88 @@ mod tests { .unwrap() .expect("expected to commit transaction"); - let validation_result = platform - .check_tx(identity_top_up_serialized_transition.as_slice()) - .expect("expected to check tx"); - - assert!(matches!( - validation_result.errors.first().expect("expected an error"), - ConsensusError::BasicError( - BasicError::IdentityAssetLockTransactionOutPointAlreadyExistsError(_) - ) - )); - } - - #[test] - fn identity_top_up_with_unknown_identity_doesnt_panic() { - let mut platform = TestPlatformBuilder::new() - .with_config(PlatformConfig::default()) - .build_with_mock_rpc(); - - platform - .core_rpc - .expect_verify_instant_lock() - .returning(|_, _| Ok(true)); - - let platform_state = platform.state.read().unwrap(); - let platform_version = platform_state.current_platform_version().unwrap(); + // At this point we try creating a new identity with a used asset lock let mut signer = SimpleSigner::default(); - let mut rng = StdRng::seed_from_u64(567); + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key(0, Some(4), platform_version) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( 1, - Some(19), + Some(50), platform_version, ) .expect("expected to get key pair"); signer.add_key(key.clone(), private_key.clone()); - let (_, pk) = ECDSA_SECP256K1 - .random_public_and_private_key_data(&mut rng, platform_version) - .unwrap(); - - let asset_lock_proof = instant_asset_lock_proof_fixture(Some( - PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap(), - )); - - let identifier = asset_lock_proof + let identifier = asset_lock_proof_top_up .create_identifier() .expect("expected an identifier"); let identity: Identity = IdentityV0 { id: identifier, - public_keys: BTreeMap::from([(1, key.clone())]), + public_keys: BTreeMap::from([(0, master_key.clone()), (1, key.clone())]), balance: 1000000000, revision: 0, } .into(); - platform - .drive - .create_initial_state_structure(None, platform_version) - .expect("expected to create state structure"); - - let (_, pk) = ECDSA_SECP256K1 - .random_public_and_private_key_data(&mut rng, platform_version) - .unwrap(); - - let asset_lock_proof_top_up = instant_asset_lock_proof_fixture(Some( - PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap(), - )); - - let identity_top_up_transition: StateTransition = - IdentityTopUpTransition::try_from_identity( - identity.clone(), + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, asset_lock_proof_top_up, pk.as_slice(), + &signer, &NativeBlsModule, + 0, platform_version, - None, ) .expect("expected an identity create transition"); - let identity_top_up_serialized_transition = identity_top_up_transition + let identity_create_serialized_transition = identity_create_transition .serialize_to_bytes() .expect("serialized state transition"); let validation_result = platform - .check_tx(identity_top_up_serialized_transition.as_slice()) + .check_tx( + identity_create_serialized_transition.as_slice(), + FirstTimeCheck, + &platform_state, + platform_version, + ) .expect("expected to check tx"); - // This errors because we never created the identity + assert!(matches!( + validation_result.errors.first().expect("expected an error"), + ConsensusError::BasicError( + BasicError::IdentityAssetLockTransactionOutPointAlreadyConsumedError(_) + ) + )); + + let validation_result = platform + .check_tx( + identity_create_serialized_transition.as_slice(), + Recheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); assert!(matches!( validation_result.errors.first().expect("expected an error"), - ConsensusError::SignatureError(SignatureError::IdentityNotFoundError(_)) + ConsensusError::BasicError( + BasicError::IdentityAssetLockTransactionOutPointAlreadyConsumedError(_) + ) )); } #[test] - fn identity_cant_create_with_used_outpoint() { + fn identity_can_create_with_semi_used_outpoint() { let mut platform = TestPlatformBuilder::new() .with_config(PlatformConfig::default()) .build_with_mock_rpc(); @@ -876,13 +2208,19 @@ mod tests { .expect_verify_instant_lock() .returning(|_, _| Ok(true)); - let platform_state = platform.state.read().unwrap(); + let platform_state = platform.state.load(); let platform_version = platform_state.current_platform_version().unwrap(); let mut signer = SimpleSigner::default(); let mut rng = StdRng::seed_from_u64(567); + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key(0, Some(3), platform_version) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( 1, Some(19), @@ -896,9 +2234,10 @@ mod tests { .random_public_and_private_key_data(&mut rng, platform_version) .unwrap(); - let asset_lock_proof = instant_asset_lock_proof_fixture(Some( - PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap(), - )); + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); let identifier = asset_lock_proof .create_identifier() @@ -906,23 +2245,39 @@ mod tests { let identity: Identity = IdentityV0 { id: identifier, - public_keys: BTreeMap::from([(1, key.clone())]), + public_keys: BTreeMap::from([(0, master_key.clone()), (1, key.clone())]), balance: 1000000000, revision: 0, } .into(); - let identity_create_transition: StateTransition = + let mut identity_create_transition: StateTransition = IdentityCreateTransition::try_from_identity_with_signer( - identity.clone(), - asset_lock_proof, + &identity, + asset_lock_proof.clone(), pk.as_slice(), &signer, &NativeBlsModule, + 0, platform_version, ) .expect("expected an identity create transition"); + let valid_identity_create_transition = identity_create_transition.clone(); + + // let's add an error so this fails on state validation + + if let StateTransition::IdentityCreate(identity_create_transition_inner) = + &mut identity_create_transition + { + // let's create a new key that isn't signed + let master_key = identity_create_transition_inner + .public_keys_mut() + .get_mut(0) + .expect("expected master key"); + master_key.set_signature(vec![].into()); + }; + let identity_create_serialized_transition = identity_create_transition .serialize_to_bytes() .expect("serialized state transition"); @@ -935,12 +2290,67 @@ mod tests { let transaction = platform.drive.grove.start_transaction(); let validation_result = platform - .execute_tx( - identity_create_serialized_transition, - &BlockInfo::default(), - &transaction, + .execute_tx(identity_create_serialized_transition, &transaction) + .expect("expected to execute identity_create tx"); + assert!(matches!(validation_result, UnsuccessfulPaidExecution(..))); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // now lets try to recreate the valid identity + + // This one will use the balance on the outpoint that was already saved + + let valid_identity_create_serialized_transition = valid_identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let validation_result = platform + .execute_tx(valid_identity_create_serialized_transition, &transaction) + .expect("expected to execute identity_create tx"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // this is unpaid because it will look like a replay attack + assert!(matches!( + validation_result, + UnpaidConsensusExecutionError(..) + )); + + let valid_identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof, + pk.as_slice(), + &signer, + &NativeBlsModule, + 1, + platform_version, ) + .expect("expected an identity create transition"); + + let valid_identity_create_serialized_transition = valid_identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let validation_result = platform + .execute_tx(valid_identity_create_serialized_transition, &transaction) .expect("expected to execute identity_create tx"); + + // the user fee increase changed, so this is now passing assert!(matches!(validation_result, SuccessfulPaidExecution(..))); platform @@ -954,16 +2364,17 @@ mod tests { .random_public_and_private_key_data(&mut rng, platform_version) .unwrap(); - let asset_lock_proof_top_up = instant_asset_lock_proof_fixture(Some( - PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap(), - )); + let asset_lock_proof_top_up = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); let identity_top_up_transition: StateTransition = IdentityTopUpTransition::try_from_identity( - identity.clone(), + &identity, asset_lock_proof_top_up.clone(), pk.as_slice(), - &NativeBlsModule, + 0, platform_version, None, ) @@ -974,7 +2385,12 @@ mod tests { .expect("serialized state transition"); let validation_result = platform - .check_tx(identity_top_up_serialized_transition.as_slice()) + .check_tx( + identity_top_up_serialized_transition.as_slice(), + FirstTimeCheck, + &platform_state, + platform_version, + ) .expect("expected to check tx"); assert!(validation_result.errors.is_empty()); @@ -982,11 +2398,7 @@ mod tests { let transaction = platform.drive.grove.start_transaction(); let validation_result = platform - .execute_tx( - identity_top_up_serialized_transition.clone(), - &BlockInfo::default(), - &transaction, - ) + .execute_tx(identity_top_up_serialized_transition.clone(), &transaction) .expect("expected to execute identity top up tx"); assert!(matches!(validation_result, SuccessfulPaidExecution(..))); @@ -1001,6 +2413,12 @@ mod tests { let mut signer = SimpleSigner::default(); + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key(0, Some(4), platform_version) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( 1, Some(50), @@ -1016,7 +2434,7 @@ mod tests { let identity: Identity = IdentityV0 { id: identifier, - public_keys: BTreeMap::from([(1, key.clone())]), + public_keys: BTreeMap::from([(0, master_key.clone()), (1, key.clone())]), balance: 1000000000, revision: 0, } @@ -1024,11 +2442,12 @@ mod tests { let identity_create_transition: StateTransition = IdentityCreateTransition::try_from_identity_with_signer( - identity, + &identity, asset_lock_proof_top_up, pk.as_slice(), &signer, &NativeBlsModule, + 0, platform_version, ) .expect("expected an identity create transition"); @@ -1038,13 +2457,34 @@ mod tests { .expect("serialized state transition"); let validation_result = platform - .check_tx(identity_create_serialized_transition.as_slice()) + .check_tx( + identity_create_serialized_transition.as_slice(), + FirstTimeCheck, + &platform_state, + platform_version, + ) + .expect("expected to check tx"); + + assert!(matches!( + validation_result.errors.first().expect("expected an error"), + ConsensusError::BasicError( + BasicError::IdentityAssetLockTransactionOutPointAlreadyConsumedError(_) + ) + )); + + let validation_result = platform + .check_tx( + identity_create_serialized_transition.as_slice(), + Recheck, + &platform_state, + platform_version, + ) .expect("expected to check tx"); assert!(matches!( validation_result.errors.first().expect("expected an error"), ConsensusError::BasicError( - BasicError::IdentityAssetLockTransactionOutPointAlreadyExistsError(_) + BasicError::IdentityAssetLockTransactionOutPointAlreadyConsumedError(_) ) )); } @@ -1082,7 +2522,7 @@ mod tests { .expect_verify_instant_lock() .returning(|_, _| Ok(true)); - let platform_state = platform.state.read().unwrap(); + let platform_state = platform.state.load(); let platform_version = platform_state.current_platform_version().unwrap(); let genesis_time = 0; @@ -1124,9 +2564,10 @@ mod tests { let update_transition: IdentityUpdateTransition = IdentityUpdateTransitionV0 { identity_id: dpns_contract::OWNER_ID_BYTES.into(), revision: 0, + nonce: 1, add_public_keys: vec![IdentityPublicKeyInCreation::V0(new_key)], disable_public_keys: vec![], - public_keys_disabled_at: None, + user_fee_increase: 0, signature_public_key_id: 1, signature: Default::default(), } @@ -1149,7 +2590,12 @@ mod tests { .expect("expected to serialize"); let validation_result = platform - .check_tx(update_transition_bytes.as_slice()) + .check_tx( + update_transition_bytes.as_slice(), + FirstTimeCheck, + &platform_state, + platform_version, + ) .expect("expected to execute identity top up tx"); // Only master keys can sign an update @@ -1175,7 +2621,7 @@ mod tests { let high_key_pair = KeyPair::new(&secp, &mut rng); - let high_secret_key = high_key_pair.secret_key(); + let _high_secret_key = high_key_pair.secret_key(); let high_public_key = high_key_pair.public_key(); @@ -1190,7 +2636,7 @@ mod tests { .expect_verify_instant_lock() .returning(|_, _| Ok(true)); - let platform_state = platform.state.read().unwrap(); + let platform_state = platform.state.load(); let platform_version = platform_state.current_platform_version().unwrap(); let genesis_time = 0; @@ -1223,22 +2669,23 @@ mod tests { }), }; - let signable_bytes = new_key + let _signable_bytes = new_key .signable_bytes() .expect("expected to get signable bytes"); let update_transition: IdentityUpdateTransition = IdentityUpdateTransitionV0 { identity_id: dashpay_contract::OWNER_ID_BYTES.into(), revision: 1, + nonce: 1, add_public_keys: vec![IdentityPublicKeyInCreation::V0(new_key.clone())], disable_public_keys: vec![], - public_keys_disabled_at: None, + user_fee_increase: 0, signature_public_key_id: 0, signature: Default::default(), } .into(); - let mut update_transition: StateTransition = update_transition.into(); + let update_transition: StateTransition = update_transition.into(); let signable_bytes = update_transition .signable_bytes() @@ -1253,9 +2700,10 @@ mod tests { let update_transition: IdentityUpdateTransition = IdentityUpdateTransitionV0 { identity_id: dashpay_contract::OWNER_ID_BYTES.into(), revision: 1, + nonce: 1, add_public_keys: vec![IdentityPublicKeyInCreation::V0(new_key)], disable_public_keys: vec![], - public_keys_disabled_at: None, + user_fee_increase: 0, signature_public_key_id: 0, signature: Default::default(), } @@ -1273,7 +2721,12 @@ mod tests { .expect("expected to serialize"); let validation_result = platform - .check_tx(update_transition_bytes.as_slice()) + .check_tx( + update_transition_bytes.as_slice(), + FirstTimeCheck, + &platform_state, + platform_version, + ) .expect("expected to execute identity top up tx"); // we won't have enough funds diff --git a/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/mod.rs b/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/mod.rs index 88998b490da..31a95672c64 100644 --- a/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/mod.rs @@ -1,9 +1,9 @@ use crate::error::execution::ExecutionError; use crate::error::Error; +use crate::execution::types::block_execution_context::BlockExecutionContext; use crate::platform_types::block_execution_outcome; use crate::platform_types::cleaned_abci_messages::finalized_block_cleaned_request::v0::FinalizeBlockCleanedRequest; use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::rpc::core::CoreRPCLike; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; @@ -34,12 +34,10 @@ where pub(crate) fn finalize_block_proposal( &self, request_finalize_block: FinalizeBlockCleanedRequest, + block_execution_context: BlockExecutionContext, transaction: &Transaction, + platform_version: &PlatformVersion, ) -> Result { - let state = self.state.read().expect("expected to get state"); - let current_protocol_version = state.current_protocol_version_in_consensus(); - drop(state); - let platform_version = PlatformVersion::get(current_protocol_version)?; match platform_version .drive_abci .methods @@ -48,6 +46,7 @@ where { 0 => self.finalize_block_proposal_v0( request_finalize_block, + block_execution_context, transaction, platform_version, ), diff --git a/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/v0/mod.rs index 0063cd57363..ae78f603616 100644 --- a/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/v0/mod.rs @@ -1,5 +1,3 @@ -use dashcore_rpc::dashcore::hashes::Hash; - use dpp::block::epoch::Epoch; use dpp::validation::SimpleValidationResult; @@ -10,16 +8,21 @@ use dpp::block::block_info::BlockInfo; use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0; use dpp::version::PlatformVersion; +use dpp::dashcore::bls_sig_utils::BLSSignature; + use tenderdash_abci::{ proto::{serializers::timestamp::ToMilis, types::BlockId as ProtoBlockId}, - signatures::SignBytes, + signatures::Hashable, }; use crate::abci::AbciError; -use crate::error::execution::ExecutionError; use crate::error::Error; -use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; +use crate::execution::types::block_execution_context::v0::{ + BlockExecutionContextV0Getters, BlockExecutionContextV0MutableGetters, + BlockExecutionContextV0OwnedGetters, +}; +use crate::execution::types::block_execution_context::BlockExecutionContext; use crate::execution::types::block_state_info::v0::{ BlockStateInfoV0Getters, BlockStateInfoV0Methods, }; @@ -59,31 +62,19 @@ where pub(super) fn finalize_block_proposal_v0( &self, request_finalize_block: FinalizeBlockCleanedRequest, + mut block_execution_context: BlockExecutionContext, transaction: &Transaction, - _platform_version: &PlatformVersion, + platform_version: &PlatformVersion, ) -> Result { let mut validation_result = SimpleValidationResult::::new_with_errors(vec![]); - // Retrieve block execution context before we do anything at all - let guarded_block_execution_context = self.block_execution_context.read().unwrap(); - let block_execution_context = - guarded_block_execution_context - .as_ref() - .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( - "block execution context must be set in block begin handler for finalize block proposal", - )))?; - let block_state_info = block_execution_context.block_state_info(); let epoch_info = block_execution_context.epoch_info(); let block_platform_state = block_execution_context.block_platform_state(); - let current_protocol_version = block_platform_state.current_protocol_version_in_consensus(); - - let platform_version = PlatformVersion::get(current_protocol_version)?; - // Let's decompose the request let FinalizeBlockCleanedRequest { - commit: commit_info, + commit: mut commit_info, misbehavior: _, hash, height, @@ -101,13 +92,13 @@ where } = block; let block_id_hash = Into::::into(block_id.clone()) - .sha256(&self.config.abci.chain_id, height as i64, round as i32) + .calculate_msg_hash(&self.config.abci.chain_id, height as i64, round as i32) .map_err(AbciError::from)? .try_into() .expect("invalid sha256 length"); //// Verification that commit is for our current executed block - // When receiving the finalized block, we need to make sure that info matches our current block + // When receiving the finalized block, we need to make sure info matches our current block // First let's check the basics, height, round and hash if !block_state_info.matches_expected_block_info( @@ -126,14 +117,17 @@ where block_header.core_chain_locked_height, block_state_info.height(), block_state_info.round(), - block_state_info.block_hash().map(|a| hex::encode(a)).unwrap_or("None".to_string()), + block_state_info.block_hash().map(hex::encode).unwrap_or("None".to_string()), block_state_info.core_chain_locked_height() ))); return Ok(validation_result.into()); } - let state_cache = self.state.read().unwrap(); - let current_quorum_hash = state_cache.current_validator_set_quorum_hash().into(); + let last_committed_state = self.state.load(); + let current_quorum_hash = last_committed_state + .current_validator_set_quorum_hash() + .into(); + if current_quorum_hash != commit_info.quorum_hash { validation_result.add_error(AbciError::WrongFinalizeBlockReceived(format!( "received a block for h: {} r: {} with validator set quorum hash {} expected current validator set quorum hash is {}", @@ -142,7 +136,23 @@ where return Ok(validation_result.into()); } - let quorum_public_key = &state_cache.current_validator_set()?.threshold_public_key(); + // Verify vote extensions + // We don't need to verify vote extension signatures once again after tenderdash + // here, because we will do it bellow broadcasting withdrawal transactions. + // The sendrawtransaction RPC method returns an error if quorum signature is invalid + let expected_withdrawal_transactions = + block_execution_context.unsigned_withdrawal_transactions(); + + if !expected_withdrawal_transactions + .are_matching_with_vote_extensions(&commit_info.threshold_vote_extensions) + { + validation_result.add_error(AbciError::VoteExtensionMismatchReceived { + got: commit_info.threshold_vote_extensions, + expected: expected_withdrawal_transactions.into(), + }); + + return Ok(validation_result.into()); + } // In production this will always be true if self @@ -152,7 +162,11 @@ where { // Verify commit - let quorum_type = self.config.quorum_type(); + let quorum_public_key = last_committed_state + .current_validator_set()? + .threshold_public_key(); + let quorum_type = self.config.validator_set_quorum_type(); + // TODO: We already had commit in the function above, why do we need to create it again with clone? let commit = Commit::new_from_cleaned( commit_info.clone(), block_id, @@ -168,24 +182,6 @@ where return Ok(validation_result.into()); } } - drop(state_cache); - - // Verify vote extensions - // let received_withdrawals = WithdrawalTxs::from(&commit.threshold_vote_extensions); - // let our_withdrawals = WithdrawalTxs::load(Some(transaction), &self.drive) - // .map_err(|e| AbciError::WithdrawalTransactionsDBLoadError(e.to_string()))?; - //todo: reenable check - // - // if let Err(e) = self.check_withdrawals( - // &received_withdrawals, - // &our_withdrawals, - // Some(quorum_public_key), - // ) { - // validation_result.add_error(e); - // return Ok(validation_result.into()); - // } - - // Next let's check that the hash received is the same as the hash we expect if height == self.config.abci.genesis_height { self.drive @@ -197,17 +193,43 @@ where .expect("current epoch info should be in range"), ); - // we need to add the block time to_commit_block_info.time_ms = block_header.time.to_milis(); to_commit_block_info.core_height = block_header.core_chain_locked_height; - // // Finalize withdrawal processing - // our_withdrawals.finalize(Some(transaction), &self.drive, &to_commit_block_info)?; - - // At the end we update the state cache + // Append signatures and broadcast asset unlock transactions to Core + + // Drain withdrawal transaction instead of cloning + let unsigned_withdrawal_transactions = block_execution_context + .unsigned_withdrawal_transactions_mut() + .drain(); + + if !unsigned_withdrawal_transactions.is_empty() { + // Drain signatures instead of cloning + let signatures = commit_info + .threshold_vote_extensions + .drain(..) + .map(|vote_extension| { + let signature_bytes: [u8; 96] = + vote_extension.signature.try_into().map_err(|e| { + AbciError::BadRequestDataSize(format!( + "invalid vote extension signature size: {}", + hex::encode(e) + )) + })?; + + Ok(BLSSignature::from(signature_bytes)) + }) + .collect::>()?; + + self.append_signatures_and_broadcast_withdrawal_transactions( + unsigned_withdrawal_transactions, + signatures, + platform_version, + )?; + } - drop(guarded_block_execution_context); + // Update platform (drive abci) state let extended_block_info = ExtendedBlockInfoV0 { basic_info: to_commit_block_info, @@ -219,9 +241,16 @@ where } .into(); - self.update_state_cache(extended_block_info, transaction, platform_version)?; + self.update_drive_cache(&block_execution_context, platform_version)?; + + let block_platform_state = block_execution_context.block_platform_state_owned(); - self.update_drive_cache(platform_version)?; + self.update_state_cache( + extended_block_info, + block_platform_state, + transaction, + platform_version, + )?; // Gather some metrics crate::metrics::abci_last_block_time(block_header.time.seconds as u64); diff --git a/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/mod.rs b/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/mod.rs index fe2df6ea990..57ec814c047 100644 --- a/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/mod.rs @@ -6,7 +6,6 @@ use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use crate::error::execution::ExecutionError; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; use tenderdash_abci::proto::abci::{RequestInitChain, ResponseInitChain}; @@ -21,10 +20,11 @@ where request: RequestInitChain, transaction: &Transaction, ) -> Result { - let state = self.state.read().expect("expected to get state"); - let current_protocol_version = state.current_protocol_version_in_consensus(); - drop(state); - let platform_version = PlatformVersion::get(current_protocol_version)?; + // We don't have platform state at this point, so we should + // use initial protocol version from genesis + let protocol_version = self.config.initial_protocol_version; + let platform_version = PlatformVersion::get(protocol_version)?; + match platform_version.drive_abci.methods.engine.init_chain { 0 => self.init_chain_v0(request, transaction, platform_version), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { diff --git a/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/v0/mod.rs index 7a585aa5622..29fba3c5148 100644 --- a/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/v0/mod.rs @@ -9,8 +9,10 @@ use drive::grovedb::Transaction; use crate::platform_types::cleaned_abci_messages::request_init_chain_cleaned_params; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; use crate::platform_types::system_identity_public_keys::v0::SystemIdentityPublicKeysV0; use dpp::version::PlatformVersion; +use std::sync::Arc; use tenderdash_abci::proto::abci::{RequestInitChain, ResponseInitChain, ValidatorSetUpdate}; impl Platform @@ -28,6 +30,7 @@ where request_init_chain_cleaned_params::v0::RequestInitChainCleanedParams::try_from( request, )?; + // We get core height early, as this also verifies v20 fork let core_height = self.initial_core_height(request.initial_core_height, platform_version)?; @@ -37,6 +40,7 @@ where let system_identity_public_keys_v0: SystemIdentityPublicKeysV0 = self.config.abci.keys.clone().into(); + // Create genesis drive state self.create_genesis_state( genesis_time, system_identity_public_keys_v0.into(), @@ -44,7 +48,11 @@ where platform_version, )?; - let mut state_guard = self.state.write().unwrap(); + // Create platform execution state + let mut initial_platform_state = PlatformState::default_with_protocol_versions( + request.initial_protocol_version, + request.initial_protocol_version, + ); let genesis_block_info = BlockInfo { height: request.initial_height, @@ -53,9 +61,20 @@ where ..Default::default() }; + // !!! Very important to understand !!! + // We update the core info at the initial core height. This means that we use the quorums + // at the initial core height for block 1. + // The initial core height is either the height of the fork at which platform activates + // or it is the request.initial_core_height. + // Block 1 is signed with the quorum chosen based on this info/height. + // It is also worth saying that the quorum chosen will be the most recently built quorum. + // On block 1 the proposer will most likely propose a new core chain locked height. + // That will cause the core info to update again, so very often block 2 will be signed by + // a different quorum. + self.update_core_info( None, - &mut state_guard, + &mut initial_platform_state, core_height, true, &genesis_block_info, @@ -63,29 +82,33 @@ where platform_version, )?; - let (quorum_hash, validator_set) = - { - let validator_set_inner = state_guard.validator_sets().first().ok_or( - ExecutionError::InitializationError("we should have at least one quorum"), - )?; + let (quorum_hash, validator_set) = { + let validator_set_inner = initial_platform_state.validator_sets().first().ok_or( + ExecutionError::InitializationError("we should have at least one quorum"), + )?; + + ( + *validator_set_inner.0, + ValidatorSetUpdate::from(validator_set_inner.1), + ) + }; - ( - *validator_set_inner.0, - ValidatorSetUpdate::from(validator_set_inner.1), - ) - }; + initial_platform_state.set_current_validator_set_quorum_hash(quorum_hash); - state_guard.set_current_validator_set_quorum_hash(quorum_hash); + initial_platform_state.set_genesis_block_info(Some(genesis_block_info)); - state_guard.set_genesis_block_info(Some(genesis_block_info)); + initial_platform_state + .set_current_protocol_version_in_consensus(request.initial_protocol_version); if tracing::enabled!(tracing::Level::TRACE) { tracing::trace!( - platform_state_fingerprint = hex::encode(state_guard.fingerprint()), + platform_state_fingerprint = hex::encode(initial_platform_state.fingerprint()), "platform runtime state", ); } + self.state.store(Arc::new(initial_platform_state)); + let app_hash = self .drive .grove diff --git a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs index 01b951d49e1..7a766b14f6c 100644 --- a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs @@ -1,7 +1,9 @@ use crate::error::execution::ExecutionError; use crate::error::Error; +use crate::platform_types::epoch_info::v0::EpochInfoV0Methods; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; use crate::platform_types::{block_execution_outcome, block_proposal}; use crate::rpc::core::CoreRPCLike; use dpp::validation::ValidationResult; @@ -23,6 +25,7 @@ where /// # Arguments /// /// * `block_proposal` - The block proposal to be processed. + /// * `known_from_us` - Do we know that we made this block proposal? /// * `transaction` - The transaction associated with the block proposal. /// /// # Returns @@ -40,14 +43,48 @@ where pub fn run_block_proposal( &self, block_proposal: block_proposal::v0::BlockProposal, + known_from_us: bool, + platform_state: &PlatformState, transaction: &Transaction, ) -> Result, Error> { - let state = self.state.read().expect("expected to get state"); - let current_protocol_version = state.current_protocol_version_in_consensus(); - drop(state); - let platform_version = PlatformVersion::get(current_protocol_version)?; - let epoch_info = self.gather_epoch_info(&block_proposal, transaction, platform_version)?; + // Epoch information is always calculated with the last committed platform version + // even if we are switching to a new version in this block. + let last_committed_platform_version = platform_state.current_platform_version()?; + + // !!!! This EpochInfo is based on the last committed platform version + // !!!! and will be used for the first block of the epoch. + let epoch_info = self.gather_epoch_info( + &block_proposal, + transaction, + platform_state, + last_committed_platform_version, + )?; + + // Determine a protocol version for this block + let platform_version = if epoch_info.is_epoch_change_but_not_genesis() { + // Switch to next proposed platform version if we are on the first block of the new epoch + // This version must be set to the state as current one during block processing + let next_protocol_version = platform_state.next_epoch_protocol_version(); + + // We should panic if this node is not supported a new protocol version + let Ok(next_platform_version) = PlatformVersion::get(next_protocol_version) else { + panic!( + r#"Failed to upgrade the network protocol version {next_protocol_version}. + +Please update your software to the latest version: https://docs.dash.org/platform-protocol-upgrade + +Your software version: {}, latest supported protocol version: {}."#, + env!("CARGO_PKG_VERSION"), + PlatformVersion::latest().protocol_version + ); + }; + + next_platform_version + } else { + // Stay on the last committed platform version + last_committed_platform_version + }; match platform_version .drive_abci @@ -57,8 +94,10 @@ where { 0 => self.run_block_proposal_v0( block_proposal, - epoch_info.into(), + known_from_us, + epoch_info, transaction, + platform_state, platform_version, ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { diff --git a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs index 25156a27993..38939ca2a75 100644 --- a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs @@ -1,6 +1,3 @@ -use dashcore_rpc::dashcore::hashes::Hash; -use dashcore_rpc::dashcore::Txid; - use dpp::block::epoch::Epoch; use dpp::validation::ValidationResult; @@ -8,7 +5,6 @@ use drive::error::Error::GroveDB; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; -use std::collections::BTreeMap; use crate::abci::AbciError; use crate::error::execution::ExecutionError; @@ -16,7 +12,6 @@ use crate::error::execution::ExecutionError; use crate::error::Error; use crate::execution::types::block_execution_context::v0::{ BlockExecutionContextV0Getters, BlockExecutionContextV0MutableGetters, - BlockExecutionContextV0Setters, }; use crate::execution::types::block_execution_context::BlockExecutionContext; use crate::execution::types::block_fees::v0::BlockFeesV0; @@ -31,6 +26,8 @@ use crate::platform_types::epoch_info::v0::{EpochInfoV0Getters, EpochInfoV0Metho use crate::platform_types::epoch_info::EpochInfo; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; +use crate::platform_types::verify_chain_lock_result::v0::VerifyChainLockResult; use crate::rpc::core::CoreRPCLike; impl Platform @@ -46,6 +43,7 @@ where /// # Arguments /// /// * `block_proposal` - The block proposal to be processed. + /// * `known_from_us` - Do we know that we made this block proposal?. /// * `transaction` - The transaction associated with the block proposal. /// /// # Returns @@ -63,14 +61,13 @@ where pub(super) fn run_block_proposal_v0( &self, block_proposal: block_proposal::v0::BlockProposal, + known_from_us: bool, epoch_info: EpochInfo, transaction: &Transaction, + last_committed_platform_state: &PlatformState, platform_version: &PlatformVersion, ) -> Result, Error> { - // Start by getting information from the state - let state = self.state.read().unwrap(); - tracing::trace!( method = "run_block_proposal_v0", ?block_proposal, @@ -80,14 +77,33 @@ where block_proposal.round, ); - let last_block_time_ms = state.last_block_time_ms(); - let last_block_height = - state.known_height_or(self.config.abci.genesis_height.saturating_sub(1)); - let last_block_core_height = - state.known_core_height_or(self.config.abci.genesis_core_height); - let hpmn_list_len = state.hpmn_list_len(); + // Run block proposal determines version by itself based on the previous + // state and block time. + // It should provide correct version on prepare proposal to block header + // and validate it on process proposal. + // If version set to 0 (default number value) it means we are on prepare proposal, + // so there is no need for validation. + if !known_from_us + && block_proposal.consensus_versions.app != platform_version.protocol_version as u64 + { + return Ok(ValidationResult::new_with_error( + AbciError::BadRequest(format!( + "received a block proposal with protocol version {}, expected: {}", + block_proposal.consensus_versions.app, platform_version.protocol_version + )) + .into(), + )); + } + + let last_block_time_ms = last_committed_platform_state.last_committed_block_time_ms(); + let last_block_height = last_committed_platform_state.last_committed_known_block_height_or( + self.config.abci.genesis_height.saturating_sub(1), + ); + let last_block_core_height = last_committed_platform_state + .last_committed_known_core_height_or(self.config.abci.genesis_core_height); - let mut block_platform_state = state.clone(); + // Create a bock state from previous committed state + let mut block_platform_state = last_committed_platform_state.clone(); // Init block execution context let block_state_info = block_state_info::v0::BlockStateInfoV0::from_block_proposal( @@ -110,6 +126,7 @@ where // destructure the block proposal let block_proposal::v0::BlockProposal { core_chain_locked_height, + core_chain_lock_update, proposed_app_version, proposer_pro_tx_hash, validator_set_quorum_hash, @@ -122,9 +139,116 @@ where .expect("current epoch index should be in range"), ); + if epoch_info.is_epoch_change_but_not_genesis() { + tracing::info!( + epoch_index = epoch_info.current_epoch_index(), + "epoch change occurring from epoch {} to epoch {}", + epoch_info + .previous_epoch_index() + .expect("must be set since we aren't on genesis"), + epoch_info.current_epoch_index(), + ); + } + + // Update block platform state with current and next epoch protocol versions + // if it was proposed + // This is happening only on epoch change + self.upgrade_protocol_version_on_epoch_change( + &block_info, + &epoch_info, + last_committed_platform_state, + &mut block_platform_state, + transaction, + platform_version, + )?; + + // If there is a core chain lock update, we should start by verifying it + if let Some(core_chain_lock_update) = core_chain_lock_update.as_ref() { + if !known_from_us { + let verification_result = self.verify_chain_lock( + block_state_info.round, // the round is to allow us to bypass local verification in case of chain stall + &block_platform_state, + core_chain_lock_update, + true, // if it's not known from us, then we should try submitting it + platform_version, + ); + + let VerifyChainLockResult { + chain_lock_signature_is_deserializable, + found_valid_locally, + found_valid_by_core, + core_is_synced, + } = match verification_result { + Ok(verification_result) => verification_result, + Err(Error::Execution(e)) => { + // This will happen only if an internal version error + return Err(Error::Execution(e)); + } + Err(e) => { + // This will happen only if a core rpc error + return Ok(ValidationResult::new_with_error( + AbciError::InvalidChainLock(e.to_string()).into(), + )); + } + }; + + if !chain_lock_signature_is_deserializable { + return Ok(ValidationResult::new_with_error( + AbciError::InvalidChainLock(format!( + "received a chain lock for height {} that has a signature that can not be deserialized {:?}", + block_info.height, core_chain_lock_update, + )) + .into(), + )); + } + + if let Some(found_valid_locally) = found_valid_locally { + // This means we are able to check if the chain lock is valid + if !found_valid_locally { + // The signature was not valid + return Ok(ValidationResult::new_with_error( + AbciError::InvalidChainLock(format!( + "received a chain lock for height {} that we figured out was invalid based on platform state {:?}", + block_info.height, core_chain_lock_update, + )) + .into(), + )); + } + } + + if let Some(found_valid_by_core) = found_valid_by_core { + // This means we asked core if the chain lock was valid + if !found_valid_by_core { + // Core said it wasn't valid + return Ok(ValidationResult::new_with_error( + AbciError::InvalidChainLock(format!( + "received a chain lock for height {} that is invalid based on a core request {:?}", + block_info.height, core_chain_lock_update, + )) + .into(), + )); + } + } + + if let Some(core_is_synced) = core_is_synced { + // Core is just not synced + if !core_is_synced { + // The submission was not accepted by core + return Ok(ValidationResult::new_with_error( + AbciError::ChainLockedBlockNotKnownByCore(format!( + "received a chain lock for height {} that we could not accept because core is not synced {:?}", + block_info.height, core_chain_lock_update, + )) + .into(), + )); + } + } + } + } + // Update the masternode list and create masternode identities and also update the active quorums self.update_core_info( - Some(&state), + Some(last_committed_platform_state), &mut block_platform_state, core_chain_locked_height, false, @@ -132,9 +256,9 @@ where transaction, platform_version, )?; - drop(state); // Update the validator proposed app version + // It should be called after protocol version upgrade self.drive .update_validator_proposed_app_version( proposer_pro_tx_hash, @@ -146,154 +270,70 @@ where Error::Execution(ExecutionError::UpdateValidatorProposedAppVersionError(e)) })?; // This is a system error - let mut block_execution_context = block_execution_context::v0::BlockExecutionContextV0 { - block_state_info: block_state_info.into(), - epoch_info: epoch_info.clone(), - hpmn_count: hpmn_list_len as u32, - withdrawal_transactions: BTreeMap::new(), - block_platform_state, - proposer_results: None, - }; - - // Determine a new protocol version if enough proposers voted - if block_execution_context - .epoch_info - .is_epoch_change_but_not_genesis() - { - tracing::info!( - epoch_index = block_execution_context.epoch_info.current_epoch_index(), - "epoch change occurring from epoch {} to epoch {}", - block_execution_context - .epoch_info - .previous_epoch_index() - .expect("must be set since we aren't on genesis"), - block_execution_context.epoch_info.current_epoch_index(), - ); - - if block_execution_context - .block_platform_state - .current_protocol_version_in_consensus() - == block_execution_context - .block_platform_state - .next_epoch_protocol_version() - { - tracing::trace!( - epoch_index = block_execution_context.epoch_info.current_epoch_index(), - "protocol version remains the same {}", - block_execution_context - .block_platform_state - .current_protocol_version_in_consensus(), - ); - } else { - tracing::info!( - epoch_index = block_execution_context.epoch_info.current_epoch_index(), - "protocol version changed from {} to {}", - block_execution_context - .block_platform_state - .current_protocol_version_in_consensus(), - block_execution_context - .block_platform_state - .next_epoch_protocol_version(), - ); - } - - // Set current protocol version to the version from upcoming epoch - block_execution_context - .block_platform_state - .set_current_protocol_version_in_consensus( - block_execution_context - .block_platform_state - .next_epoch_protocol_version(), - ); - - // Determine new protocol version based on votes for the next epoch - let maybe_new_protocol_version = self.check_for_desired_protocol_upgrade( - block_execution_context.hpmn_count, - block_execution_context - .block_platform_state - .current_protocol_version_in_consensus(), - transaction, - )?; - - if let Some(new_protocol_version) = maybe_new_protocol_version { - block_execution_context - .block_platform_state - .set_next_epoch_protocol_version(new_protocol_version); - } else { - block_execution_context - .block_platform_state - .set_next_epoch_protocol_version( - block_execution_context - .block_platform_state - .current_protocol_version_in_consensus(), - ); - } - } - - let mut block_execution_context: BlockExecutionContext = block_execution_context.into(); - - // >>>>>> Withdrawal Status Update <<<<<<< - // Only update the broadcasted withdrawal statuses if the core chain lock height has - // changed. If it hasn't changed there should be no way a status could update - - if block_execution_context - .block_state_info() - .core_chain_locked_height() - != last_block_core_height - { - self.update_broadcasted_withdrawal_transaction_statuses( - &block_execution_context, + // Mark all previously broadcasted and chainlocked withdrawals as complete + // only when we are on a new core height + if block_state_info.core_chain_locked_height() != last_block_core_height { + self.update_broadcasted_withdrawal_statuses( + &block_info, transaction, platform_version, )?; } - // This takes withdrawals from the transaction queue + // Preparing withdrawal transactions for signing and broadcasting + // To process withdrawals we need to dequeue untiled transactions from the withdrawal transactions queue + // Untiled transactions then converted to unsigned transactions, appending current block information + // required for signature verification (core height and quorum hash) + // Then we save unsigned transaction bytes to block execution context + // to be signed (on extend_vote), verified (on verify_vote) and broadcasted (on finalize_block) let unsigned_withdrawal_transaction_bytes = self - .fetch_and_prepare_unsigned_withdrawal_transactions( + .dequeue_and_build_unsigned_withdrawal_transactions( validator_set_quorum_hash, - &block_execution_context, - transaction, + &block_info, + Some(transaction), platform_version, )?; - // Set the withdrawal transactions that were done in the previous block - block_execution_context.set_withdrawal_transactions( - unsigned_withdrawal_transaction_bytes - .into_iter() - .map(|withdrawal_transaction| { - ( - Txid::hash(withdrawal_transaction.as_slice()), - withdrawal_transaction, - ) - }) - .collect(), - ); - - let (block_fees, state_transition_results) = self.process_raw_state_transitions( + // Process transactions + let state_transitions_result = self.process_raw_state_transitions( raw_state_transitions, - block_execution_context.block_platform_state(), + &block_platform_state, &block_info, transaction, platform_version, )?; - let mut block_execution_context: BlockExecutionContext = block_execution_context; + // Pool withdrawals into transactions queue + // Takes queued withdrawals, creates untiled withdrawal transaction payload, saves them to queue + // Corresponding withdrawal documents are changed from queued to pooled self.pool_withdrawals_into_transactions_queue( - &block_execution_context, - transaction, + &block_info, + Some(transaction), platform_version, )?; - // while we have the state transitions executed, we now need to process the block fees + // Create a new block execution context + + let mut block_execution_context: BlockExecutionContext = + block_execution_context::v0::BlockExecutionContextV0 { + block_state_info: block_state_info.into(), + epoch_info: epoch_info.clone(), + // TODO: It doesn't seem correct to use previous block count of hpmns. + // We currently not using this field in the codebase. We probably should just remove it. + hpmn_count: last_committed_platform_state.hpmn_list_len() as u32, + unsigned_withdrawal_transactions: unsigned_withdrawal_transaction_bytes, + block_platform_state, + proposer_results: None, + } + .into(); - let block_fees_v0: BlockFeesV0 = block_fees.into(); + // while we have the state transitions executed, we now need to process the block fees + let block_fees_v0: BlockFeesV0 = state_transitions_result.aggregated_fees().clone().into(); // Process fees let processed_block_fees = self.process_block_fees( - block_execution_context.block_state_info(), - &epoch_info, + &block_execution_context, block_fees_v0.into(), transaction, platform_version, @@ -312,9 +352,11 @@ where .block_state_info_mut() .set_app_hash(Some(root_hash)); - let state = self.state.read().unwrap(); - let validator_set_update = - self.validator_set_update(&state, &mut block_execution_context, platform_version)?; + let validator_set_update = self.validator_set_update( + last_committed_platform_state, + &mut block_execution_context, + platform_version, + )?; if tracing::enabled!(tracing::Level::TRACE) { tracing::trace!( @@ -326,17 +368,13 @@ where ); } - self.block_execution_context - .write() - .unwrap() - .replace(block_execution_context); - Ok(ValidationResult::new_with_data( block_execution_outcome::v0::BlockExecutionOutcome { app_hash: root_hash, - state_transition_results, + state_transitions_result, validator_set_update, protocol_version: platform_version.protocol_version, + block_execution_context, }, )) } diff --git a/packages/rs-drive-abci/src/execution/mod.rs b/packages/rs-drive-abci/src/execution/mod.rs index 4352caa5718..0e4b73c3f00 100644 --- a/packages/rs-drive-abci/src/execution/mod.rs +++ b/packages/rs-drive-abci/src/execution/mod.rs @@ -4,6 +4,8 @@ mod check_tx; pub mod engine; /// platform execution events pub(in crate::execution) mod platform_events; +/// Storage implementation for the execution state +pub mod storage; /// Types needed in execution pub mod types; /// Validation module diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_end/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_end/mod.rs index ee3ad883d94..f881cea1dd8 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_end/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_end/mod.rs @@ -1,5 +1,3 @@ -/// Storage of the ephemeral state -pub(in crate::execution) mod store_ephemeral_state; /// Updating the state cache happens as the final part of block finalization pub(in crate::execution) mod update_state_cache; /// Validator set update diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_end/store_ephemeral_state/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_end/store_ephemeral_state/mod.rs deleted file mode 100644 index bef276301da..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/block_end/store_ephemeral_state/mod.rs +++ /dev/null @@ -1,53 +0,0 @@ -mod v0; - -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::PlatformState; -use crate::rpc::core::CoreRPCLike; - -use dpp::version::PlatformVersion; - -use drive::grovedb::Transaction; - -impl Platform -where - C: CoreRPCLike, -{ - /// Stores ephemeral state data, including the block information and quorum hash in GroveDB. - /// - /// This function is a version handler that directs to specific version implementations - /// of the store_ephemeral_state function. - /// - /// # Arguments - /// - /// * `platform_state` - A `PlatformState` reference. - /// * `transaction` - A `Transaction` reference. - /// * `platform_version` - A `PlatformVersion` reference that dictates which version of - /// the method to call. - /// - /// # Returns - /// - /// * `Result<(), Error>` - Returns an empty `Result` if the data is successfully stored, otherwise returns an `Error`. - /// - pub fn store_ephemeral_state( - &self, - platform_state: &PlatformState, - transaction: &Transaction, - platform_version: &PlatformVersion, - ) -> Result<(), Error> { - match platform_version - .drive_abci - .methods - .block_end - .store_ephemeral_state - { - 0 => self.store_ephemeral_state_v0(platform_state, transaction), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "store_ephemeral_state".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_end/store_ephemeral_state/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_end/store_ephemeral_state/v0/mod.rs deleted file mode 100644 index 016b67d2072..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/block_end/store_ephemeral_state/v0/mod.rs +++ /dev/null @@ -1,51 +0,0 @@ -use crate::error::Error; -use crate::platform_types::platform::Platform; -use crate::rpc::core::CoreRPCLike; - -use crate::platform_types::platform_state::PlatformState; -use dpp::serialization::PlatformSerializable; - -use drive::error::Error::GroveDB; -use drive::grovedb::Transaction; - -impl Platform -where - C: CoreRPCLike, -{ - /// Stores ephemeral state data, including the block information and quorum hash in GroveDB. - /// - /// This function should be removed from the current location. - /// - /// # Arguments - /// - /// * `platform_state` - A `PlatformState` reference. - /// * `transaction` - A `Transaction` reference. - /// - /// # Returns - /// - /// * `Result<(), Error>` - Returns an empty `Result` if the data is successfully stored, otherwise returns an `Error`. - /// - pub(super) fn store_ephemeral_state_v0( - &self, - platform_state: &PlatformState, - transaction: &Transaction, - ) -> Result<(), Error> { - // we need to serialize the platform state - let serialized_platform_state = platform_state.serialize_to_bytes()?; - - // next we need to store this data in grovedb - //todo:: maybe this should be in actual state - self.drive - .grove - .put_aux( - b"saved_state", - &serialized_platform_state, - None, - Some(transaction), - ) - .unwrap() - .map_err(|e| Error::Drive(GroveDB(e)))?; - - Ok(()) - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_end/update_drive_cache/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_end/update_drive_cache/mod.rs index a3bb44c9779..0342fe45594 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_end/update_drive_cache/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_end/update_drive_cache/mod.rs @@ -6,9 +6,9 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; -use dpp::block::extended_block_info::ExtendedBlockInfo; + +use crate::execution::types::block_execution_context::BlockExecutionContext; use dpp::version::PlatformVersion; -use drive::grovedb::Transaction; impl Platform where @@ -30,7 +30,11 @@ where /// * `Result<(), Error>` - If the state cache and quorums are successfully updated, it returns `Ok(())`. /// If there is a problem with the update, it returns an `Error`. /// - pub fn update_drive_cache(&self, platform_version: &PlatformVersion) -> Result<(), Error> { + pub fn update_drive_cache( + &self, + block_execution_context: &BlockExecutionContext, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { match platform_version .drive_abci .methods @@ -38,7 +42,7 @@ where .update_drive_cache { 0 => { - self.update_drive_cache_v0(); + self.update_drive_cache_v0(block_execution_context); Ok(()) } version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_end/update_drive_cache/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_end/update_drive_cache/v0/mod.rs index bed5932843e..35852a05d92 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_end/update_drive_cache/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_end/update_drive_cache/v0/mod.rs @@ -1,3 +1,6 @@ +use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; +use crate::execution::types::block_execution_context::BlockExecutionContext; +use crate::platform_types::epoch_info::v0::EpochInfoV0Methods; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; @@ -8,14 +11,27 @@ where /// Updates the drive cache at the end of finalize block. This does a few things like merging /// the data contract cache and the platform versions cache. /// - pub(super) fn update_drive_cache_v0(&self) { - let mut drive_cache = self.drive.cache.write().unwrap(); - + #[inline(always)] + pub(super) fn update_drive_cache_v0(&self, block_execution_context: &BlockExecutionContext) { // Update global cache with updated contracts - drive_cache.cached_contracts.merge_block_cache(); - // This is unnecessary since we clear block cache before every proposal execution - drive_cache.cached_contracts.clear_block_cache(); + self.drive + .cache + .data_contracts + .merge_and_clear_block_cache(); + + let mut protocol_versions_counter = self.drive.cache.protocol_versions_counter.write(); + + // Clear previously proposed versions since we started a new epoch + // For more information read comments in `upgrade_protocol_version_v0` function + if block_execution_context + .epoch_info() + .is_epoch_change_but_not_genesis() + { + protocol_versions_counter.clear_global_cache(); + protocol_versions_counter.unblock_global_cache(); + } - drive_cache.protocol_versions_counter.merge_block_cache() + // Update proposed versions with new proposal from the current block + protocol_versions_counter.merge_block_cache() } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_end/update_state_cache/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_end/update_state_cache/mod.rs index a055056edc9..2027e434de1 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_end/update_state_cache/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_end/update_state_cache/mod.rs @@ -5,6 +5,7 @@ use crate::error::Error; use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; use crate::rpc::core::CoreRPCLike; use dpp::block::extended_block_info::ExtendedBlockInfo; use dpp::version::PlatformVersion; @@ -35,6 +36,7 @@ where pub fn update_state_cache( &self, extended_block_info: ExtendedBlockInfo, + block_platform_state: PlatformState, transaction: &Transaction, platform_version: &PlatformVersion, ) -> Result<(), Error> { @@ -44,7 +46,12 @@ where .block_end .update_state_cache { - 0 => self.update_state_cache_v0(extended_block_info, transaction, platform_version), + 0 => self.update_state_cache_v0( + extended_block_info, + block_platform_state, + transaction, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "update_state_cache".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_end/update_state_cache/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_end/update_state_cache/v0/mod.rs index 5803180c654..e9c15fe0e0a 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_end/update_state_cache/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_end/update_state_cache/v0/mod.rs @@ -1,12 +1,12 @@ -use crate::error::execution::ExecutionError; use crate::error::Error; -use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0OwnedGetters; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; use crate::rpc::core::CoreRPCLike; use dpp::block::extended_block_info::ExtendedBlockInfo; -use dpp::version::{PlatformVersion, PlatformVersionCurrentVersion}; +use dpp::version::PlatformVersion; use drive::grovedb::Transaction; +use std::sync::Arc; impl Platform where @@ -34,37 +34,32 @@ where /// This function may return an `Error` variant if there is a problem with updating the state cache /// and quorums or storing the ephemeral data. /// + #[inline(always)] pub(super) fn update_state_cache_v0( &self, extended_block_info: ExtendedBlockInfo, + mut block_platform_state: PlatformState, transaction: &Transaction, platform_version: &PlatformVersion, ) -> Result<(), Error> { - let mut block_execution_context = self.block_execution_context.write().unwrap(); - - let block_execution_context = block_execution_context.take().ok_or(Error::Execution( - ExecutionError::CorruptedCodeExecution("there should be a block execution context"), - ))?; - - let mut state_cache = self.state.write().unwrap(); - - *state_cache = block_execution_context.block_platform_state_owned(); + // Update block state and store it in shared lock if let Some(next_validator_set_quorum_hash) = - state_cache.take_next_validator_set_quorum_hash() + block_platform_state.take_next_validator_set_quorum_hash() { - state_cache.set_current_validator_set_quorum_hash(next_validator_set_quorum_hash); + block_platform_state + .set_current_validator_set_quorum_hash(next_validator_set_quorum_hash); } - state_cache.set_last_committed_block_info(Some(extended_block_info)); + block_platform_state.set_last_committed_block_info(Some(extended_block_info)); + + block_platform_state.set_genesis_block_info(None); - state_cache.set_genesis_block_info(None); + // Persist block state - //todo: verify this with an update - PlatformVersion::set_current(PlatformVersion::get(platform_version.protocol_version)?); + self.store_platform_state(&block_platform_state, Some(transaction), platform_version)?; - // Persist ephemeral data - self.store_ephemeral_state(&state_cache, transaction, platform_version)?; + self.state.store(Arc::new(block_platform_state)); Ok(()) } diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_end/validator_set_update/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_end/validator_set_update/v0/mod.rs index 3a1ead24fb3..634d22b367f 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_end/validator_set_update/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_end/validator_set_update/v0/mod.rs @@ -10,6 +10,7 @@ use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; use crate::platform_types::validator_set::v0::ValidatorSetV0Getters; use crate::rpc::core::CoreRPCLike; +use itertools::Itertools; use tenderdash_abci::proto::abci::ValidatorSetUpdate; @@ -19,6 +20,7 @@ where { /// We need to validate against the platform state for rotation and not the block execution /// context state + #[inline(always)] pub(super) fn validator_set_update_v0( &self, platform_state: &PlatformState, @@ -27,10 +29,7 @@ where let mut perform_rotation = false; if block_execution_context.block_state_info().height() - % self - .config - .execution - .validator_set_quorum_rotation_block_count as u64 + % self.config.execution.validator_set_rotation_block_count as u64 == 0 { tracing::debug!( @@ -67,13 +66,15 @@ where .validator_sets() .get_index_of(&platform_state.current_validator_set_quorum_hash()) .ok_or(Error::Execution(ExecutionError::CorruptedCachedState( - "current quorums do not contain current validator set", - )))?; + format!("perform_rotation: current validator set quorum hash {} not in current known validator sets [{}] processing block {}", platform_state.current_validator_set_quorum_hash(), platform_state + .validator_sets().keys().map(|quorum_hash| quorum_hash.to_string()).join(" | "), + platform_state.last_committed_block_height() + 1, + ))))?; // we should rotate the quorum let quorum_count = platform_state.validator_sets().len(); match quorum_count { 0 => Err(Error::Execution(ExecutionError::CorruptedCachedState( - "no current quorums", + "no current quorums".to_string(), ))), 1 => Ok(None), count => { diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/add_process_epoch_change_operations/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/add_process_epoch_change_operations/mod.rs index 1d281cb1d1d..ba127365878 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/add_process_epoch_change_operations/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/add_process_epoch_change_operations/mod.rs @@ -8,12 +8,11 @@ use crate::error::Error; use crate::execution::types::block_fees::BlockFees; -use crate::execution::types::block_state_info::BlockStateInfo; use crate::execution::types::storage_fee_distribution_outcome; use crate::error::execution::ExecutionError; +use crate::execution::types::block_execution_context::BlockExecutionContext; -use crate::platform_types::epoch_info::EpochInfo; use crate::platform_types::platform::Platform; impl Platform { @@ -41,8 +40,7 @@ impl Platform { /// pub fn add_process_epoch_change_operations( &self, - block_info: &BlockStateInfo, - epoch_info: &EpochInfo, + block_execution_context: &BlockExecutionContext, block_fees: &BlockFees, transaction: &Transaction, batch: &mut Vec, @@ -56,8 +54,7 @@ impl Platform { .add_process_epoch_change_operations { 0 => self.add_process_epoch_change_operations_v0( - block_info, - epoch_info, + block_execution_context, block_fees, transaction, batch, diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/add_process_epoch_change_operations/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/add_process_epoch_change_operations/v0/mod.rs index 24d58502f45..e705b047ba0 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/add_process_epoch_change_operations/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/add_process_epoch_change_operations/v0/mod.rs @@ -36,7 +36,7 @@ use std::option::Option::None; use dpp::block::epoch::Epoch; -use dpp::fee::epoch::{perpetual_storage_epochs, GENESIS_EPOCH_INDEX, PERPETUAL_STORAGE_ERAS}; +use dpp::fee::epoch::{perpetual_storage_epochs, GENESIS_EPOCH_INDEX}; use dpp::fee::DEFAULT_ORIGINAL_FEE_MULTIPLIER; use dpp::version::PlatformVersion; use drive::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; @@ -47,12 +47,13 @@ use crate::error::Error; use crate::execution::types::block_fees::v0::BlockFeesV0Getters; use crate::execution::types::block_fees::BlockFees; use crate::execution::types::block_state_info::v0::BlockStateInfoV0Getters; -use crate::execution::types::block_state_info::BlockStateInfo; use crate::execution::types::storage_fee_distribution_outcome; +use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; +use crate::execution::types::block_execution_context::BlockExecutionContext; use crate::platform_types::epoch_info::v0::EpochInfoV0Getters; -use crate::platform_types::epoch_info::EpochInfo; use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use drive::fee_pools::epochs::operations_factory::EpochOperations; /// From the Dash Improvement Proposal: @@ -74,10 +75,10 @@ impl Platform { /// accumulated during the previous epoch. /// /// `DistributionLeftoverCredits` will be returned, except if we are at Genesis Epoch. + #[inline(always)] pub(super) fn add_process_epoch_change_operations_v0( &self, - block_info: &BlockStateInfo, - epoch_info: &EpochInfo, + block_execution_context: &BlockExecutionContext, block_fees: &BlockFees, transaction: &Transaction, batch: &mut Vec, @@ -86,6 +87,9 @@ impl Platform { { let mut inner_batch = GroveDbOpBatch::new(); + let epoch_info = block_execution_context.epoch_info(); + let block_info = block_execution_context.block_state_info(); + // init next thousandth empty epochs since last initiated let last_initiated_epoch_index = epoch_info .previous_epoch_index() @@ -110,6 +114,16 @@ impl Platform { &mut inner_batch, ); + // Update next epoch protocol version + let next_epoch = Epoch::new(epoch_info.current_epoch_index() + 1)?; + inner_batch.push( + next_epoch.update_protocol_version_operation( + block_execution_context + .block_platform_state() + .next_epoch_protocol_version(), + ), + ); + // Nothing to distribute on genesis epoch start if current_epoch.index == GENESIS_EPOCH_INDEX { batch.push(DriveOperation::GroveDBOpBatch(inner_batch)); @@ -150,11 +164,14 @@ mod tests { mod helpers { use super::*; + use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0; use crate::execution::types::block_fees::v0::{BlockFeesV0, BlockFeesV0Methods}; use crate::execution::types::block_state_info::v0::BlockStateInfoV0; use crate::platform_types::epoch_info::v0::EpochInfoV0; + use crate::platform_types::platform_state::PlatformState; use dpp::block::block_info::BlockInfo; use dpp::fee::epoch::CreditsPerEpoch; + use drive::drive::defaults::INITIAL_PROTOCOL_VERSION; /// Process and validate an epoch change pub fn process_and_validate_epoch_change( @@ -232,12 +249,25 @@ mod tests { } .into(); + let block_platform_state = PlatformState::default_with_protocol_versions( + INITIAL_PROTOCOL_VERSION, + INITIAL_PROTOCOL_VERSION, + ); + + let block_execution_context = BlockExecutionContextV0 { + block_state_info: block_info.clone().into(), + epoch_info, + hpmn_count: 0, + unsigned_withdrawal_transactions: Default::default(), + block_platform_state, + proposer_results: None, + }; + let mut batch = vec![]; let storage_fee_distribution_outcome = platform .add_process_epoch_change_operations_v0( - &block_info.clone().into(), - &epoch_info, + &block_execution_context.into(), &block_fees, transaction, &mut batch, diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/mod.rs index b82ac36f129..7ab4cbe08d8 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/mod.rs @@ -6,13 +6,12 @@ use drive::grovedb::Transaction; use crate::error::execution::ExecutionError; use crate::error::Error; +use crate::execution::types::block_execution_context::BlockExecutionContext; use crate::execution::types::block_fees::BlockFees; -use crate::execution::types::block_state_info::BlockStateInfo; use crate::execution::types::processed_block_fees_outcome; -use crate::platform_types::epoch_info::EpochInfo; use crate::platform_types::platform::Platform; impl Platform { @@ -37,8 +36,7 @@ impl Platform { /// pub fn process_block_fees( &self, - block_info: &BlockStateInfo, - epoch_info: &EpochInfo, + block_execution_context: &BlockExecutionContext, block_fees: BlockFees, transaction: &Transaction, platform_version: &PlatformVersion, @@ -50,8 +48,7 @@ impl Platform { .process_block_fees { 0 => self.process_block_fees_v0( - block_info, - epoch_info, + block_execution_context, block_fees, transaction, platform_version, diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/v0/mod.rs index 5659c7affe0..0b92b87f241 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/v0/mod.rs @@ -43,15 +43,15 @@ use drive::grovedb::Transaction; use crate::error::execution::ExecutionError; use crate::error::Error; +use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; +use crate::execution::types::block_execution_context::BlockExecutionContext; use crate::execution::types::block_fees::v0::BlockFeesV0Getters; use crate::execution::types::block_fees::BlockFees; use crate::execution::types::block_state_info::v0::{ BlockStateInfoV0Getters, BlockStateInfoV0Methods, }; -use crate::execution::types::block_state_info::BlockStateInfo; use crate::execution::types::processed_block_fees_outcome; use crate::platform_types::epoch_info::v0::EpochInfoV0Getters; -use crate::platform_types::epoch_info::EpochInfo; use crate::platform_types::platform::Platform; use drive::fee_pools::epochs::operations_factory::EpochOperations; @@ -73,22 +73,24 @@ impl Platform { /// and distributing the block fees from the previous block and applies the batch. /// /// Returns `ProcessedBlockFeesOutcome`. + #[inline(always)] pub(super) fn process_block_fees_v0( &self, - block_info: &BlockStateInfo, - epoch_info: &EpochInfo, + block_execution_context: &BlockExecutionContext, block_fees: BlockFees, transaction: &Transaction, platform_version: &PlatformVersion, ) -> Result { + let epoch_info = block_execution_context.epoch_info(); + let block_info = block_execution_context.block_state_info(); + let current_epoch = Epoch::new(epoch_info.current_epoch_index())?; let mut batch = vec![]; let storage_fee_distribution_outcome = if epoch_info.is_epoch_change() { self.add_process_epoch_change_operations( - block_info, - epoch_info, + block_execution_context, &block_fees, transaction, &mut batch, @@ -222,14 +224,18 @@ mod tests { use crate::config::ExecutionConfig; use crate::{config::PlatformConfig, test::helpers::setup::TestPlatformBuilder}; - use drive::common::identities::create_test_masternode_identities; + use drive::common::test_utils::identities::create_test_masternode_identities; mod helpers { use super::*; + use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0; use crate::execution::types::block_fees::v0::BlockFeesV0; use crate::execution::types::block_state_info::v0::BlockStateInfoV0; use crate::platform_types::epoch_info::v0::EpochInfoV0; + use crate::platform_types::epoch_info::EpochInfo; + use crate::platform_types::platform_state::PlatformState; use dpp::fee::epoch::{perpetual_storage_epochs, CreditsPerEpoch, GENESIS_EPOCH_INDEX}; + use drive::drive::defaults::INITIAL_PROTOCOL_VERSION; /// Process and validate block fees pub fn process_and_validate_block_fees( @@ -259,7 +265,7 @@ mod tests { app_hash: None, }; - let epoch_info = EpochInfoV0::from_genesis_time_and_block_info( + let epoch_info: EpochInfo = EpochInfoV0::from_genesis_time_and_block_info( genesis_time_ms, &block_info, platform.config.execution.epoch_time_length_s, @@ -274,10 +280,23 @@ mod tests { } .into(); + let block_platform_state = PlatformState::default_with_protocol_versions( + INITIAL_PROTOCOL_VERSION, + INITIAL_PROTOCOL_VERSION, + ); + + let block_execution_context = BlockExecutionContextV0 { + block_state_info: block_info.clone().into(), + epoch_info: epoch_info.clone(), + hpmn_count: 0, + unsigned_withdrawal_transactions: Default::default(), + block_platform_state, + proposer_results: None, + }; + let storage_fee_distribution_outcome = platform .process_block_fees_v0( - &block_info.clone().into(), - &epoch_info, + &block_execution_context.into(), block_fees.clone(), transaction, platform_version, diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_start/clear_drive_block_cache/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_start/clear_drive_block_cache/mod.rs index ab753ba88b6..f8f25668636 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_start/clear_drive_block_cache/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_start/clear_drive_block_cache/mod.rs @@ -6,9 +6,8 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; -use dpp::block::extended_block_info::ExtendedBlockInfo; + use dpp::version::PlatformVersion; -use drive::grovedb::Transaction; impl Platform where diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_start/clear_drive_block_cache/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_start/clear_drive_block_cache/v0/mod.rs index 1529688bf4c..ecf723fa2ad 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_start/clear_drive_block_cache/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_start/clear_drive_block_cache/v0/mod.rs @@ -8,10 +8,15 @@ where /// Clears the drive cache at the start of block processing. This does a few things like clearing /// the block data contract cache and the block platform versions cache. /// + #[inline(always)] pub(super) fn clear_drive_block_cache_v0(&self) { - let mut drive_cache = self.drive.cache.write().unwrap(); + self.drive.cache.data_contracts.clear_block_cache(); - drive_cache.cached_contracts.clear_block_cache(); - drive_cache.protocol_versions_counter.clear_block_cache() + let mut protocol_versions_counter = self.drive.cache.protocol_versions_counter.write(); + + protocol_versions_counter.clear_block_cache(); + // Getter is disabled in case of epoch change so we need to enable it back + // For more information read comments in `upgrade_protocol_version_v0` function + protocol_versions_counter.unblock_global_cache(); } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/v0/mod.rs index 467af1138b2..f0d40e393d5 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/v0/mod.rs @@ -1,5 +1,6 @@ use crate::error::Error; use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; @@ -30,6 +31,7 @@ where /// /// * Result<(), Error> - Returns Ok(()) if the update is successful. Returns an error if /// there is a problem updating the masternode list, quorum information, or the state. + #[inline(always)] pub(super) fn update_core_info_v0( &self, platform_state: Option<&PlatformState>, @@ -40,6 +42,12 @@ where transaction: &Transaction, platform_version: &PlatformVersion, ) -> Result<(), Error> { + // the core height of the block platform state is the last committed + if !is_init_chain && block_platform_state.last_committed_core_height() == core_block_height + { + // if we get the same height that we know we do not need to update core info + return Ok(()); + } self.update_masternode_list( platform_state, block_platform_state, @@ -51,6 +59,7 @@ where )?; self.update_quorum_info( + platform_state, block_platform_state, core_block_height, false, diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_operator_identity/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_operator_identity/v0/mod.rs index a4a607b9ba3..5b3d815efb0 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_operator_identity/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_operator_identity/v0/mod.rs @@ -10,6 +10,7 @@ impl Platform where C: CoreRPCLike, { + #[inline(always)] pub(super) fn create_operator_identity_v0( masternode: &MasternodeListItem, platform_version: &PlatformVersion, diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v0/mod.rs index 616ef40b5d6..79c1c9d1268 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v0/mod.rs @@ -2,7 +2,6 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dashcore_rpc::dashcore_rpc_json::MasternodeListItem; -use dpp::dashcore::hashes::Hash; use dpp::identity::accessors::IdentityGettersV0; use dpp::identity::Identity; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/disable_identity_keys/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/disable_identity_keys/v0/mod.rs index 6efc66d8447..88b2ccbdf99 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/disable_identity_keys/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/disable_identity_keys/v0/mod.rs @@ -4,7 +4,7 @@ use crate::rpc::core::CoreRPCLike; use dashcore_rpc::dashcore_rpc_json::MasternodeListItem; use dpp::block::block_info::BlockInfo; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; -use dpp::identity::Purpose::WITHDRAW; +use dpp::identity::Purpose::TRANSFER; use dpp::version::PlatformVersion; use drive::drive::batch::DriveOperation; use drive::drive::batch::DriveOperation::IdentityOperation; @@ -62,7 +62,7 @@ where )? .into_iter() .filter_map(|(key_id, key)| { - if key.is_disabled() || key.purpose() == WITHDRAW { + if key.is_disabled() || key.purpose() == TRANSFER { None // Don't disable withdrawal keys } else { Some(key_id) @@ -97,7 +97,6 @@ where drive_operations.push(IdentityOperation(DisableIdentityKeys { identity_id: operator_identifier, keys_ids: operator_identity_keys, - disable_at: block_info.time_ms, })); tracing::trace!( @@ -111,7 +110,6 @@ where drive_operations.push(IdentityOperation(DisableIdentityKeys { identity_id: voter_identifier, keys_ids: voter_identity_keys, - disable_at: block_info.time_ms, })); Ok(()) diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identifier/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identifier/v0/mod.rs index a3aee5b8604..150172ff41d 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identifier/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identifier/v0/mod.rs @@ -2,7 +2,6 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dashcore_rpc::dashcore_rpc_json::MasternodeListItem; -use dpp::dashcore::hashes::Hash; use dpp::version::PlatformVersion; impl Platform diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identity_keys/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identity_keys/v0/mod.rs index 6df7c15c6e7..ff3a8899500 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identity_keys/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_operator_identity_keys/v0/mod.rs @@ -30,7 +30,7 @@ where IdentityPublicKeyV0 { id: 1, key_type: KeyType::ECDSA_HASH160, - purpose: Purpose::WITHDRAW, + purpose: Purpose::TRANSFER, security_level: SecurityLevel::CRITICAL, read_only: true, data: BinaryData::new(operator_payout_address.to_vec()), diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_owner_identity_key/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_owner_identity_key/v0/mod.rs index 03865a481cb..eb478c5acca 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_owner_identity_key/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_owner_identity_key/v0/mod.rs @@ -16,7 +16,7 @@ where Ok(IdentityPublicKeyV0 { id: key_id, key_type: KeyType::ECDSA_HASH160, - purpose: Purpose::WITHDRAW, + purpose: Purpose::TRANSFER, security_level: SecurityLevel::CRITICAL, read_only: true, data: BinaryData::new(payout_address.to_vec()), diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_voter_identifier/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_voter_identifier/v0/mod.rs index d3e4a39d5aa..e7db6dc4a54 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_voter_identifier/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/get_voter_identifier/v0/mod.rs @@ -2,7 +2,6 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dashcore_rpc::dashcore_rpc_json::MasternodeListItem; -use dpp::dashcore::hashes::Hash; use dpp::version::PlatformVersion; impl Platform diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/hash_protxhash_with_key_data/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/hash_protxhash_with_key_data/v0/mod.rs index 8e696e032b6..3758afe7c5b 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/hash_protxhash_with_key_data/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/hash_protxhash_with_key_data/v0/mod.rs @@ -15,9 +15,6 @@ where let mut hasher = Sha256::new(); hasher.update(pro_tx_hash); hasher.update(key_data); - Ok(hasher - .finalize() - .try_into() - .expect("expected a 32 byte hash")) + Ok(hasher.finalize().into()) } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_operator_identity/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_operator_identity/v0/mod.rs index 98c1b95edbc..82e98c34774 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_operator_identity/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_operator_identity/v0/mod.rs @@ -14,7 +14,7 @@ use dpp::identity::accessors::IdentityGettersV0; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use dpp::identity::identity_public_key::v0::IdentityPublicKeyV0; -use dpp::identity::Purpose::WITHDRAW; +use dpp::identity::Purpose::TRANSFER; use dpp::identity::{Identity, IdentityPublicKey, KeyID, KeyType, Purpose, SecurityLevel}; use dpp::platform_value::BinaryData; use dpp::version::PlatformVersion; @@ -35,7 +35,7 @@ where pub(super) fn update_operator_identity_v0( &self, masternode: &(ProTxHash, DMNStateDiff), - block_info: &BlockInfo, + _block_info: &BlockInfo, platform_state: &PlatformState, transaction: &Transaction, drive_operations: &mut Vec, @@ -57,9 +57,10 @@ where .full_masternode_list() .get(pro_tx_hash) .ok_or_else(|| { - Error::Execution(ExecutionError::CorruptedCachedState( - "expected masternode to be in state", - )) + Error::Execution(ExecutionError::CorruptedCachedState(format!( + "expected masternode {} to be in state", + pro_tx_hash + ))) })?; let old_operator_identifier = Self::get_operator_identifier_from_masternode_list_item( @@ -144,7 +145,6 @@ where drive_operations.push(IdentityOperation(DisableIdentityKeys { identity_id: new_operator_identifier, keys_ids: old_operator_identity_key_ids_to_disable, - disable_at: block_info.time_ms, })); } @@ -191,7 +191,7 @@ where let key = IdentityPublicKeyV0 { id: new_key_id, key_type: KeyType::ECDSA_HASH160, - purpose: WITHDRAW, + purpose: TRANSFER, security_level: SecurityLevel::CRITICAL, read_only: true, data: BinaryData::new(new_operator_payout_address.to_vec()), @@ -232,7 +232,6 @@ where drive_operations.push(IdentityOperation(DisableIdentityKeys { identity_id: old_operator_identifier, keys_ids: old_operator_identity_key_ids_to_disable, - disable_at: block_info.time_ms, })); } let new_payout_address = diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_owner_withdrawal_address/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_owner_withdrawal_address/v0/mod.rs index fc45189d7bd..86de80f1d32 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_owner_withdrawal_address/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_owner_withdrawal_address/v0/mod.rs @@ -85,7 +85,6 @@ where drive_operations.push(IdentityOperation(DisableIdentityKeys { identity_id: owner_identifier, keys_ids: key_ids_to_disable, - disable_at: block_info.time_ms, })); } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_voter_identity/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_voter_identity/v0/mod.rs index 87ee96806d1..7a142ef5d0e 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_voter_identity/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_voter_identity/v0/mod.rs @@ -47,9 +47,10 @@ where .full_masternode_list() .get(pro_tx_hash) .ok_or_else(|| { - Error::Execution(ExecutionError::CorruptedCachedState( - "expected masternode to be in state", - )) + Error::Execution(ExecutionError::CorruptedCachedState(format!( + "expected masternode {} to be in state", + pro_tx_hash + ))) })?; let old_voter_identifier = @@ -85,7 +86,6 @@ where drive_operations.push(IdentityOperation(DisableIdentityKeys { identity_id: old_voter_identifier, keys_ids: old_voter_identity_key_ids, - disable_at: block_info.time_ms, })); // Part 2 : Create or Update Voting identity based on new key diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs index fc0f4c3ea94..b6c447fa75b 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs @@ -90,7 +90,7 @@ where // baseBlock must be a chain height and not 0 None } else { - let state_core_height = state.core_height(); + let state_core_height = state.last_committed_core_height(); if core_block_height == state_core_height { return Ok(update_state_masternode_list_outcome::v0::UpdateStateMasternodeListOutcome::default()); // no need to do anything diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/v0/mod.rs index e9372043b18..f60a9159944 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/v0/mod.rs @@ -40,10 +40,10 @@ where transaction: &Transaction, platform_version: &PlatformVersion, ) -> Result<(), Error> { - if let Some(last_commited_block_info) = + if let Some(last_committed_block_info) = block_platform_state.last_committed_block_info().as_ref() { - if core_block_height == last_commited_block_info.basic_info().core_height { + if core_block_height == last_committed_block_info.basic_info().core_height { tracing::debug!( method = "update_masternode_list_v0", "no update mnl at height {}", @@ -56,7 +56,7 @@ where method = "update_masternode_list_v0", "update mnl to height {} at block {}", core_block_height, - block_platform_state.core_height() + block_platform_state.last_committed_core_height() ); //todo: there's a weird condition that can happen if we are not on init chain, but we are // in the genesis and we are not on round 0, and the core height changed diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/mod.rs index 535f5e5ff0c..87510c71171 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/mod.rs @@ -26,6 +26,7 @@ where /// on success, or an `Error` on failure. pub(in crate::execution::platform_events::core_based_updates) fn update_quorum_info( &self, + platform_state: Option<&PlatformState>, block_platform_state: &mut PlatformState, core_block_height: u32, start_from_scratch: bool, @@ -38,6 +39,7 @@ where .update_quorum_info { 0 => self.update_quorum_info_v0( + platform_state, block_platform_state, core_block_height, start_from_scratch, diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs index 24130b279d4..50ad933c426 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs @@ -3,12 +3,14 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; +use crate::platform_types::signature_verification_quorums::SignatureVerificationQuorumsV0Methods; use std::collections::BTreeMap; use crate::platform_types::validator_set::v0::{ValidatorSetV0, ValidatorSetV0Getters}; use crate::platform_types::validator_set::ValidatorSet; use crate::rpc::core::CoreRPCLike; +use dpp::bls_signatures::PublicKey as BlsPublicKey; use dpp::dashcore::QuorumHash; use tracing::Level; @@ -29,19 +31,22 @@ where /// on success, or an `Error` on failure. pub(super) fn update_quorum_info_v0( &self, + platform_state: Option<&PlatformState>, block_platform_state: &mut PlatformState, core_block_height: u32, start_from_scratch: bool, ) -> Result<(), Error> { let _span = tracing::span!(Level::TRACE, "update_quorum_info", core_block_height).entered(); + let last_committed_core_height = block_platform_state.last_committed_core_height(); + if start_from_scratch { tracing::debug!("update quorum info from scratch up to {core_block_height}"); - } else if core_block_height != block_platform_state.core_height() { + } else if core_block_height != last_committed_core_height { tracing::debug!( - previous_core_block_height = block_platform_state.core_height(), + previous_core_block_height = last_committed_core_height, "update quorum info from {} to {}", - block_platform_state.core_height(), + last_committed_core_height, core_block_height ); } else { @@ -50,39 +55,49 @@ where return Ok(()); // no need to do anything } + // We request the quorum list from the current core block height, this is because we also keep + // the previous chain lock validating quorum. Core will sign from 8 blocks before the current + // core block height, so often we will use the previous chain lock validating quorums instead. + let mut extended_quorum_list = self .core_rpc .get_quorum_listextended(Some(core_block_height))?; + let validator_set_quorum_type = self.config.validator_set_quorum_type(); + let chain_lock_quorum_type = self.config.chain_lock_quorum_type(); + let validator_quorums_list: BTreeMap<_, _> = extended_quorum_list .quorums_by_type - .remove(&self.config.quorum_type()) + .remove(&validator_set_quorum_type) .ok_or(Error::Execution(ExecutionError::DashCoreBadResponseError( format!( "expected quorums of type {}, but did not receive any from Dash Core", - self.config.quorum_type + self.config.validator_set_quorum_type ), )))? .into_iter() .collect(); + let mut removed_a_validator_set = false; + // Remove validator_sets entries that are no longer valid for the core block height block_platform_state .validator_sets_mut() .retain(|quorum_hash, _| { - let has_quorum = validator_quorums_list.contains_key::(quorum_hash); + let retain = validator_quorums_list.contains_key::(quorum_hash); + removed_a_validator_set |= !retain; - if has_quorum { + if !retain { tracing::trace!( ?quorum_hash, - quorum_type = ?self.config.quorum_type(), - "remove validator set {} with quorum type {}", + quorum_type = ?self.config.validator_set_quorum_type(), + "removed validator set {} with quorum type {}", quorum_hash, - self.config.quorum_type() + self.config.validator_set_quorum_type() ) } - has_quorum + retain }); // Fetch quorum info and their keys from the RPC for new quorums @@ -94,9 +109,11 @@ where .contains_key::(key) }) .map(|(key, _)| { - let quorum_info_result = - self.core_rpc - .get_quorum_info(self.config.quorum_type(), key, None)?; + let quorum_info_result = self.core_rpc.get_quorum_info( + self.config.validator_set_quorum_type(), + key, + None, + )?; Ok((*key, quorum_info_result)) }) @@ -124,16 +141,18 @@ where tracing::trace!( ?validator_set, ?quorum_hash, - quorum_type = ?self.config.quorum_type(), + quorum_type = ?self.config.validator_set_quorum_type(), "add new validator set {} with quorum type {}", quorum_hash, - self.config.quorum_type() + self.config.validator_set_quorum_type() ); Ok((quorum_hash, validator_set)) }) .collect::, Error>>()?; + let added_a_validator_set = !new_validator_sets.is_empty(); + // Add new validator_sets entries block_platform_state .validator_sets_mut() @@ -154,6 +173,139 @@ where } }); + if validator_set_quorum_type == chain_lock_quorum_type { + // Remove validator_sets entries that are no longer valid for the core block height + if removed_a_validator_set || added_a_validator_set { + let quorums = block_platform_state + .validator_sets() + .iter() + .map(|(quorum_hash, validator_set)| { + (*quorum_hash, validator_set.threshold_public_key().clone()) + }) + .collect(); + + tracing::trace!("updated chain lock validating quorums to current validator set"); + + if platform_state.is_some() { + // we already have state, so we update last and previous quorums + block_platform_state + .chain_lock_validating_quorums_mut() + .rotate_quorums(quorums, last_committed_core_height, core_block_height); + } else { + // the only case where there will be no platform_state is init chain, + // so there is no previous quorums to update + block_platform_state + .chain_lock_validating_quorums_mut() + .set_current_quorums(quorums) + } + } + } else { + let chain_lock_quorums_list: BTreeMap<_, _> = extended_quorum_list + .quorums_by_type + .remove(&chain_lock_quorum_type) + .ok_or(Error::Execution(ExecutionError::DashCoreBadResponseError( + format!( + "expected quorums of type {}, but did not receive any from Dash Core", + self.config.chain_lock_quorum_type + ), + )))? + .into_iter() + .map(|(quorum_hash, extended_quorum_details)| { + (quorum_hash, extended_quorum_details.quorum_index) + }) + .collect(); + + let mut removed_a_chain_lock_validating_quorum = false; + + // Remove chain_lock_validating_quorums entries that are no longer valid for the core block height + block_platform_state + .chain_lock_validating_quorums_mut() + .current_quorums_mut() + .retain(|quorum_hash, _| { + let retain = chain_lock_quorums_list.contains_key::(quorum_hash); + if !retain { + tracing::trace!( + ?quorum_hash, + quorum_type = ?chain_lock_quorum_type, + "removed old chain lock quorum {} with quorum type {}", + quorum_hash, + chain_lock_quorum_type + ); + } + removed_a_chain_lock_validating_quorum |= !retain; + retain + }); + + // Fetch quorum info and their keys from the RPC for new quorums + let quorum_infos = chain_lock_quorums_list + .iter() + .filter(|(key, _)| { + !block_platform_state + .chain_lock_validating_quorums() + .current_quorums() + .contains_key::(key) + }) + .map(|(key, _)| { + let quorum_info_result = + self.core_rpc + .get_quorum_info(chain_lock_quorum_type, key, None)?; + + Ok((*key, quorum_info_result)) + }) + .collect::, Error>>()?; + + let added_a_chain_lock_validating_quorum = !quorum_infos.is_empty(); + + if added_a_chain_lock_validating_quorum { + // Map to chain lock validating quorums + let new_chain_lock_quorums = quorum_infos + .into_iter() + .map(|(quorum_hash, info_result)| { + let public_key = match BlsPublicKey::from_bytes( + info_result.quorum_public_key.as_slice(), + ) + .map_err(ExecutionError::BlsErrorFromDashCoreResponse) + { + Ok(public_key) => public_key, + Err(e) => return Err(e.into()), + }; + + tracing::trace!( + ?public_key, + ?quorum_hash, + quorum_type = ?chain_lock_quorum_type, + "add new chain lock quorum {} with quorum type {}", + quorum_hash, + chain_lock_quorum_type + ); + + Ok((quorum_hash, public_key)) + }) + .collect::, Error>>()?; + + // Add new validator_sets entries + block_platform_state + .chain_lock_validating_quorums_mut() + .current_quorums_mut() + .extend(new_chain_lock_quorums); + } + + if added_a_chain_lock_validating_quorum || removed_a_chain_lock_validating_quorum { + if let Some(old_state) = platform_state { + let previous_chain_lock_validating_quorums = + old_state.chain_lock_validating_quorums().current_quorums(); + + block_platform_state + .chain_lock_validating_quorums_mut() + .set_previous_past_quorums( + previous_chain_lock_validating_quorums.clone(), + last_committed_core_height, + core_block_height, + ); + } + } + } + Ok(()) } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs new file mode 100644 index 00000000000..11d1b02f782 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs @@ -0,0 +1,76 @@ +mod v0; + +use crate::error::execution::ExecutionError; +use crate::error::Error; +use dashcore_rpc::dashcore_rpc_json::QuorumType; +use dpp::bls_signatures::PublicKey as BlsPublicKey; +use dpp::dashcore::QuorumHash; + +use std::collections::BTreeMap; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +use dpp::version::PlatformVersion; + +pub type ReversedQuorumHashBytes = Vec; + +impl Platform +where + C: CoreRPCLike, +{ + /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums + /// + pub fn choose_quorum<'a>( + llmq_quorum_type: QuorumType, + quorums: &'a BTreeMap, + request_id: &[u8; 32], + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .methods + .core_chain_lock + .choose_quorum + { + 0 => Ok(Self::choose_quorum_v0( + llmq_quorum_type, + quorums, + request_id, + )), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "choose_quorum".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums + /// + pub fn choose_quorum_thread_safe<'a, const T: usize>( + llmq_quorum_type: QuorumType, + quorums: &'a BTreeMap, + request_id: &[u8; 32], + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .methods + .core_chain_lock + .choose_quorum + { + 0 => Ok(Self::choose_quorum_thread_safe_v0( + llmq_quorum_type, + quorums, + request_id, + )), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "choose_quorum_thread_safe".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs new file mode 100644 index 00000000000..0d8ac563e34 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs @@ -0,0 +1,357 @@ +use dashcore_rpc::dashcore_rpc_json::QuorumType; +use dpp::bls_signatures::PublicKey as BlsPublicKey; +use dpp::dashcore::hashes::{sha256d, Hash, HashEngine}; +use dpp::dashcore::QuorumHash; +use std::collections::BTreeMap; + +use crate::platform_types::platform::Platform; + +use crate::execution::platform_events::core_chain_lock::choose_quorum::ReversedQuorumHashBytes; + +impl Platform { + /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums + pub(super) fn choose_quorum_v0<'a>( + llmq_quorum_type: QuorumType, + quorums: &'a BTreeMap, + request_id: &[u8; 32], + ) -> Option<(ReversedQuorumHashBytes, &'a BlsPublicKey)> { + // Scoring system logic + let mut scores: Vec<(ReversedQuorumHashBytes, &BlsPublicKey, [u8; 32])> = Vec::new(); + + for (quorum_hash, public_key) in quorums { + let mut quorum_hash_bytes = quorum_hash.to_byte_array().to_vec(); + + // Only the quorum hash needs reversal. + quorum_hash_bytes.reverse(); + + let mut hasher = sha256d::Hash::engine(); + + // Serialize and hash the LLMQ type + hasher.input(&[llmq_quorum_type as u8]); + + // Serialize and add the quorum hash + hasher.input(quorum_hash_bytes.as_slice()); + + // Serialize and add the selection hash from the chain lock + hasher.input(request_id.as_slice()); + + // Finalize the hash + let hash_result = sha256d::Hash::from_engine(hasher); + scores.push((quorum_hash_bytes, public_key, hash_result.into())); + } + + if scores.is_empty() { + None + } else { + scores.sort_by_key(|k| k.2); + + let (quorum_hash, key, _) = scores.remove(0); + + Some((quorum_hash, key)) + } + } + + /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums + pub(super) fn choose_quorum_thread_safe_v0<'a, const T: usize>( + llmq_quorum_type: QuorumType, + quorums: &'a BTreeMap, + request_id: &[u8; 32], + ) -> Option<(ReversedQuorumHashBytes, &'a [u8; T])> { + // Scoring system logic + let mut scores: Vec<(ReversedQuorumHashBytes, &[u8; T], [u8; 32])> = Vec::new(); + + for (quorum_hash, key) in quorums { + let mut quorum_hash_bytes = quorum_hash.to_byte_array().to_vec(); + + // Only the quorum hash needs reversal. + quorum_hash_bytes.reverse(); + + let mut hasher = sha256d::Hash::engine(); + + // Serialize and hash the LLMQ type + hasher.input(&[llmq_quorum_type as u8]); + + // Serialize and add the quorum hash + hasher.input(quorum_hash_bytes.as_slice()); + + // Serialize and add the selection hash from the chain lock + hasher.input(request_id.as_slice()); + + // Finalize the hash + let hash_result = sha256d::Hash::from_engine(hasher); + scores.push((quorum_hash_bytes, key, hash_result.into())); + } + + scores.sort_by_key(|k| k.2); + scores.pop().map(|(hash, key, _)| (hash, key)) + } +} + +#[cfg(test)] +mod tests { + use crate::platform_types::platform::Platform; + use crate::rpc::core::MockCoreRPCLike; + use dashcore_rpc::dashcore_rpc_json::QuorumType; + use dpp::bls_signatures::PublicKey as BlsPublicKey; + use dpp::dashcore::hashes::Hash; + use dpp::dashcore::QuorumHash; + use std::collections::BTreeMap; + + #[test] + fn test_choose_quorum() { + // Active quorums: + let quorum_hash1 = QuorumHash::from_slice( + hex::decode("000000dc07d722238a994116c3395c334211d9864ff5b37c3be51d5fdda66223") + .unwrap() + .as_slice(), + ) + .unwrap(); + let quorum_hash2 = QuorumHash::from_slice( + hex::decode("000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071") + .unwrap() + .as_slice(), + ) + .unwrap(); + let quorum_hash3 = QuorumHash::from_slice( + hex::decode("0000006faac9003919a6d5456a0a46ae10db517f572221279f0540b79fd9cf1b") + .unwrap() + .as_slice(), + ) + .unwrap(); + let quorum_hash4 = QuorumHash::from_slice( + hex::decode("0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e") + .unwrap() + .as_slice(), + ) + .unwrap(); + let quorums = BTreeMap::from([ + (quorum_hash1, BlsPublicKey::generate()), + (quorum_hash2, BlsPublicKey::generate()), + (quorum_hash3, BlsPublicKey::generate()), + (quorum_hash4, BlsPublicKey::generate()), + ]); + + // + // ############### + // llmqType[1] requestID[bdcf9fb3ef01209a09db19170a1950775afb5f824c5f0662b9cdae2bf3bb36d5] -> 0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e + // llmqType[4] requestID[bdcf9fb3ef01209a09db19170a1950775afb5f824c5f0662b9cdae2bf3bb36d5] -> 000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071 + // llmqType[5] requestID[bdcf9fb3ef01209a09db19170a1950775afb5f824c5f0662b9cdae2bf3bb36d5] -> 000000dc07d722238a994116c3395c334211d9864ff5b37c3be51d5fdda66223 + // llmqType[100] requestID[bdcf9fb3ef01209a09db19170a1950775afb5f824c5f0662b9cdae2bf3bb36d5] -> 0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e + + let mut request_id: [u8; 32] = + hex::decode("bdcf9fb3ef01209a09db19170a1950775afb5f824c5f0662b9cdae2bf3bb36d5") + .unwrap() + .try_into() + .unwrap(); + + request_id.reverse(); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq50_60, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq100_67, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq60_75, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000dc07d722238a994116c3395c334211d9864ff5b37c3be51d5fdda66223" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::LlmqTest, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e" + ); + + // ############### + // llmqType[1] requestID[b06aa45eb35423f988e36c022967b4c02bb719b037717df13fa57c0f503d8a20] -> 0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e + // llmqType[4] requestID[b06aa45eb35423f988e36c022967b4c02bb719b037717df13fa57c0f503d8a20] -> 000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071 + // llmqType[5] requestID[b06aa45eb35423f988e36c022967b4c02bb719b037717df13fa57c0f503d8a20] -> 000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071 + // llmqType[100] requestID[b06aa45eb35423f988e36c022967b4c02bb719b037717df13fa57c0f503d8a20] -> 0000006faac9003919a6d5456a0a46ae10db517f572221279f0540b79fd9cf1b + + let mut request_id: [u8; 32] = + hex::decode("b06aa45eb35423f988e36c022967b4c02bb719b037717df13fa57c0f503d8a20") + .unwrap() + .try_into() + .unwrap(); + + request_id.reverse(); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq50_60, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq100_67, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq60_75, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::LlmqTest, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "0000006faac9003919a6d5456a0a46ae10db517f572221279f0540b79fd9cf1b" + ); + + // ############### + // llmqType[1] requestID[2fc41ef02a3216e4311805a9a11405a41a8d7a9f179526b4f6f2866bff009a10] -> 000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071 + // llmqType[4] requestID[2fc41ef02a3216e4311805a9a11405a41a8d7a9f179526b4f6f2866bff009a10] -> 0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e + // llmqType[5] requestID[2fc41ef02a3216e4311805a9a11405a41a8d7a9f179526b4f6f2866bff009a10] -> 000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071 + // llmqType[100] requestID[2fc41ef02a3216e4311805a9a11405a41a8d7a9f179526b4f6f2866bff009a10] -> 000000dc07d722238a994116c3395c334211d9864ff5b37c3be51d5fdda66223 + + let mut request_id: [u8; 32] = + hex::decode("2fc41ef02a3216e4311805a9a11405a41a8d7a9f179526b4f6f2866bff009a10") + .unwrap() + .try_into() + .unwrap(); + + request_id.reverse(); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq50_60, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq100_67, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq60_75, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::LlmqTest, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000dc07d722238a994116c3395c334211d9864ff5b37c3be51d5fdda66223" + ); + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs new file mode 100644 index 00000000000..52eb63c4e44 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs @@ -0,0 +1,54 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dashcore_rpc::dashcore::ChainLock; +use dpp::version::PlatformVersion; + +/// Version 0 +pub mod v0; + +/// As we ask to make sure that core is synced to the chain lock, we get back one of 3 +pub enum CoreSyncStatus { + /// Core is synced + Done, + /// Core is 1 or 2 blocks off, we should retry shortly + Almost, + /// Core is more than 2 blocks off + Not, +} + +impl Platform +where + C: CoreRPCLike, +{ + /// The point of this call is to make sure core is synced. + /// Before this call we had previously validated that the chain lock is valid. + /// Right now the core height should be the same as the chain lock height. + /// + /// Todo: In the future: The core height passed here is the core height that we need to be able to validate all + /// asset lock proofs. + /// It should be chosen by taking the highest height of all state transitions that require core. + /// State transitions that require core are: + /// *Identity Create State transition + /// *Identity Top up State transition + pub fn make_sure_core_is_synced_to_chain_lock( + &self, + chain_lock: &ChainLock, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .methods + .core_chain_lock + .make_sure_core_is_synced_to_chain_lock + { + 0 => self.make_sure_core_is_synced_to_chain_lock_v0(chain_lock, platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "make_sure_core_is_synced_to_chain_lock".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs new file mode 100644 index 00000000000..4ca9f9705cb --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs @@ -0,0 +1,36 @@ +use crate::error::Error; +use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dashcore_rpc::dashcore::ChainLock; +use dpp::version::PlatformVersion; + +impl Platform +where + C: CoreRPCLike, +{ + /// The point of this call is to make sure core is synced. + /// Before this call we had previously validated that the chain lock is valid. + pub(super) fn make_sure_core_is_synced_to_chain_lock_v0( + &self, + chain_lock: &ChainLock, + platform_version: &PlatformVersion, + ) -> Result { + let given_chain_lock_height = chain_lock.block_height; + // We need to make sure core is synced to the core height we see as valid for the state transitions + let best_chain_locked_height = self.core_rpc.submit_chain_lock(chain_lock)?; + Ok(if best_chain_locked_height >= given_chain_lock_height { + CoreSyncStatus::Done + } else if best_chain_locked_height - given_chain_lock_height + <= platform_version + .drive_abci + .methods + .core_chain_lock + .recent_block_count_amount + { + CoreSyncStatus::Almost + } else { + CoreSyncStatus::Not + }) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs new file mode 100644 index 00000000000..a44b48464e8 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs @@ -0,0 +1,5 @@ +mod choose_quorum; +mod make_sure_core_is_synced_to_chain_lock; +mod verify_chain_lock; +mod verify_chain_lock_locally; +mod verify_chain_lock_through_core; diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs new file mode 100644 index 00000000000..038a7365ac8 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs @@ -0,0 +1,50 @@ +mod v0; + +use crate::error::execution::ExecutionError; +use crate::error::Error; +use dpp::dashcore::ChainLock; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +use crate::platform_types::platform_state::PlatformState; +use crate::platform_types::verify_chain_lock_result::v0::VerifyChainLockResult; +use dpp::version::PlatformVersion; + +impl Platform +where + C: CoreRPCLike, +{ + /// Verify the chain lock + /// If submit is true, we try to submit the chain lock if it is considered valid or we can not check to see if it is + /// valid on platform. + pub fn verify_chain_lock( + &self, + round: u32, + platform_state: &PlatformState, + chain_lock: &ChainLock, + make_sure_core_is_synced: bool, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .methods + .core_chain_lock + .verify_chain_lock + { + 0 => self.verify_chain_lock_v0( + round, + platform_state, + chain_lock, + make_sure_core_is_synced, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "verify_chain_lock".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs new file mode 100644 index 00000000000..012e4cacd16 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs @@ -0,0 +1,157 @@ +use crate::error::Error; +use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus; +use crate::execution::platform_events::core_chain_lock::verify_chain_lock::VerifyChainLockResult; +use dpp::dashcore::ChainLock; +use dpp::version::PlatformVersion; +use std::thread::sleep; +use std::time::Duration; + +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; + +use crate::rpc::core::CoreRPCLike; + +const CORE_ALMOST_SYNCED_RETRIES: u32 = 5; +const CORE_ALMOST_SYNCED_SLEEP_TIME: u64 = 200; + +impl Platform +where + C: CoreRPCLike, +{ + pub(super) fn verify_chain_lock_v0( + &self, + round: u32, + platform_state: &PlatformState, + chain_lock: &ChainLock, + make_sure_core_is_synced: bool, + platform_version: &PlatformVersion, + ) -> Result { + // first we try to verify the chain lock locally + match self.verify_chain_lock_locally(round, platform_state, chain_lock, platform_version) { + Ok(Some(valid)) => { + if valid && make_sure_core_is_synced { + match self.make_sure_core_is_synced_to_chain_lock(chain_lock, platform_version) + { + Ok(sync_status) => { + match sync_status { + CoreSyncStatus::Done => Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(true), + found_valid_by_core: None, + core_is_synced: Some(true), + }), + CoreSyncStatus::Almost => { + for _i in 0..CORE_ALMOST_SYNCED_RETRIES { + // The chain lock is valid we just need to sleep a bit and retry + sleep(Duration::from_millis(CORE_ALMOST_SYNCED_SLEEP_TIME)); + let best_chain_locked = + self.core_rpc.get_best_chain_lock()?; + if best_chain_locked.block_height >= chain_lock.block_height + { + return Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(valid), + found_valid_by_core: Some(true), + core_is_synced: Some(true), + }); + } + } + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(true), + found_valid_by_core: Some(true), + core_is_synced: Some(false), + }) + } + CoreSyncStatus::Not => Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(valid), + found_valid_by_core: Some(true), + core_is_synced: Some(false), + }), + } + } + Err(Error::CoreRpc(..)) => { + //ToDO (important), separate errors from core, connection Errors -> Err, others should be part of the result + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(valid), + found_valid_by_core: Some(false), + core_is_synced: None, //we do not know + }) + } + Err(e) => Err(e), + } + } else { + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(valid), + found_valid_by_core: None, + core_is_synced: None, + }) + } + } + Ok(None) => { + // we were not able to verify locally + let (verified, status) = self.verify_chain_lock_through_core( + chain_lock, + make_sure_core_is_synced, + platform_version, + )?; + + if let Some(sync_status) = status { + // if we had make_sure_core_is_synced set to true + match sync_status { + CoreSyncStatus::Done => Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: None, + core_is_synced: Some(true), + }), + CoreSyncStatus::Almost => { + for _i in 0..CORE_ALMOST_SYNCED_RETRIES { + // The chain lock is valid we just need to sleep a bit and retry + sleep(Duration::from_millis(CORE_ALMOST_SYNCED_SLEEP_TIME)); + let best_chain_locked = self.core_rpc.get_best_chain_lock()?; + if best_chain_locked.block_height >= chain_lock.block_height { + return Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: Some(true), + core_is_synced: Some(true), + }); + } + } + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: Some(true), + core_is_synced: Some(false), + }) + } + CoreSyncStatus::Not => Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: Some(true), + core_is_synced: Some(false), + }), + } + } else { + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: Some(verified), + core_is_synced: None, + }) + } + } + Err(Error::BLSError(_)) => Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: false, + found_valid_locally: None, + found_valid_by_core: None, + core_is_synced: None, + }), + Err(e) => Err(e), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs new file mode 100644 index 00000000000..2e022adf5dd --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs @@ -0,0 +1,46 @@ +mod v0; + +use crate::error::execution::ExecutionError; +use crate::error::Error; +use dpp::dashcore::ChainLock; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +use crate::platform_types::platform_state::PlatformState; +use dpp::version::PlatformVersion; + +impl Platform +where + C: CoreRPCLike, +{ + /// Returning None here means we were unable to verify the chain lock because of an absence of + /// the quorum + pub fn verify_chain_lock_locally( + &self, + round: u32, + platform_state: &PlatformState, + chain_lock: &ChainLock, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .methods + .core_chain_lock + .verify_chain_lock_locally + { + 0 => self.verify_chain_lock_locally_v0( + round, + platform_state, + chain_lock, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "verify_chain_lock_locally".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs new file mode 100644 index 00000000000..d0f7b60af84 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -0,0 +1,276 @@ +use dpp::bls_signatures::G2Element; + +use dpp::dashcore::hashes::{sha256d, Hash, HashEngine}; +use dpp::dashcore::{ChainLock, QuorumSigningRequestId}; + +use crate::error::Error; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +use crate::error::execution::ExecutionError; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; +use crate::platform_types::signature_verification_quorums::SignatureVerificationQuorumsV0Methods; +use dpp::version::PlatformVersion; + +const CHAIN_LOCK_REQUEST_ID_PREFIX: &str = "clsig"; + +const SIGN_OFFSET: u32 = 8; + +impl Platform +where + C: CoreRPCLike, +{ + /// Returning None here means we were unable to verify the chain lock because of an absence of + /// the quorum + #[inline(always)] + pub(super) fn verify_chain_lock_locally_v0( + &self, + round: u32, + platform_state: &PlatformState, + chain_lock: &ChainLock, + platform_version: &PlatformVersion, + ) -> Result, Error> { + // First verify that the signature conforms to a signature + let signature = G2Element::from_bytes(chain_lock.signature.as_bytes())?; + + // we attempt to verify the chain lock locally + let chain_lock_height = chain_lock.block_height; + + let window_width = self.config.chain_lock_quorum_window; + + // The last block in the window where the quorums would be the same + let last_block_in_window = platform_state.last_committed_core_height() + - platform_state.last_committed_core_height() % window_width + + window_width + - 1; + + let verification_height = chain_lock_height.saturating_sub(SIGN_OFFSET); + + if verification_height > last_block_in_window { + tracing::debug!( + ?chain_lock, + "h:{} r:{} skipped message_digest for chain lock at core height {} is {}, verification height {}, last block in window {}", + platform_state.last_committed_block_height() + 1, + round, + chain_lock.block_height, + platform_state.last_committed_core_height(), + verification_height, + last_block_in_window, + ); + return Ok(None); // the chain lock is too far in the future or the past to verify locally + } + + let mut selected_quorum_sets = platform_state + .chain_lock_validating_quorums() + .select_quorums(chain_lock_height, verification_height); + + // From DIP 8: https://github.com/dashpay/dips/blob/master/dip-0008.md#finalization-of-signed-blocks + // The request id is SHA256("clsig", blockHeight) and the message hash is the block hash of the previously successful attempt. + + let mut engine = QuorumSigningRequestId::engine(); + + engine.input(&[CHAIN_LOCK_REQUEST_ID_PREFIX.len() as u8]); + engine.input(CHAIN_LOCK_REQUEST_ID_PREFIX.as_bytes()); + engine.input(chain_lock.block_height.to_le_bytes().as_slice()); + + let request_id = QuorumSigningRequestId::from_engine(engine); + + tracing::trace!( + ?chain_lock, + "request id for chain lock at height {} is {}", + chain_lock.block_height, + hex::encode(request_id.as_byte_array()) + ); + + // Based on the deterministic masternode list at the given height, a quorum must be selected that was active at the time this block was mined + let probable_quorums = selected_quorum_sets.next().ok_or_else(|| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "at lest one set of quorums must be selected", + )) + })?; + + let quorum = Platform::::choose_quorum( + self.config.chain_lock_quorum_type(), + probable_quorums, + request_id.as_ref(), + platform_version, + )?; + + let Some((quorum_hash, public_key)) = quorum else { + return Ok(None); + }; + + // The signature must verify against the quorum public key and SHA256(llmqType, quorumHash, SHA256(height), blockHash). llmqType and quorumHash must be taken from the quorum selected in 1. + + let mut engine = sha256d::Hash::engine(); + + engine.input(&[self.config.chain_lock_quorum_type() as u8]); + engine.input(quorum_hash.as_slice()); + engine.input(request_id.as_byte_array()); + engine.input(chain_lock.block_hash.as_byte_array()); + + let message_digest = sha256d::Hash::from_engine(engine); + + let mut chain_lock_verified = public_key.verify(&signature, message_digest.as_ref()); + + tracing::debug!( + ?chain_lock, + "h:{} r:{} message_digest for chain lock at core height {} is {}, quorum hash is {}, block hash is {}, chain lock was {}, last committed core height {}, verification height {}, last block in window {}", + platform_state.last_committed_block_height() + 1, + round, + chain_lock.block_height, + hex::encode(message_digest.as_byte_array()), + hex::encode(quorum_hash.as_slice()), + hex::encode(chain_lock.block_hash.as_byte_array()), + if chain_lock_verified { "verified"} else {"not verified"}, + platform_state.last_committed_core_height(), + verification_height, + last_block_in_window, + ); + + if !chain_lock_verified { + // We should also check the other quorum, as there could be the situation where the core height wasn't updated every block. + if let Some(second_to_check_quorums) = selected_quorum_sets.next() { + let quorum = Platform::::choose_quorum( + self.config.chain_lock_quorum_type(), + second_to_check_quorums, + request_id.as_ref(), + platform_version, + )?; + + let Some((quorum_hash, public_key)) = quorum else { + // we return that we are not able to verify + return Ok(None); + }; + + // The signature must verify against the quorum public key and SHA256(llmqType, quorumHash, SHA256(height), blockHash). llmqType and quorumHash must be taken from the quorum selected in 1. + + let mut engine = sha256d::Hash::engine(); + + engine.input(&[self.config.chain_lock_quorum_type() as u8]); + engine.input(quorum_hash.as_slice()); + engine.input(request_id.as_byte_array()); + engine.input(chain_lock.block_hash.as_byte_array()); + + let message_digest = sha256d::Hash::from_engine(engine); + + chain_lock_verified = public_key.verify(&signature, message_digest.as_ref()); + + tracing::debug!( + ?chain_lock, + "h:{} r:{} tried second quorums message_digest for chain lock at height {} is {}, quorum hash is {}, block hash is {}, chain lock was {}", + platform_state.last_committed_block_height() + 1, + round, + chain_lock.block_height, + hex::encode(message_digest.as_byte_array()), + hex::encode(quorum_hash.as_slice()), + hex::encode(chain_lock.block_hash.as_byte_array()), + if chain_lock_verified { "verified"} else {"not verified"} + ); + if !chain_lock_verified { + tracing::debug!( + "chain lock was invalid for both recent and old chain lock quorums" + ); + } + } else if platform_state + .chain_lock_validating_quorums() + .previous_past_quorums() + .is_none() + { + // we don't have old quorums, this means our node is very new. + tracing::debug!( + "we had no previous quorums locally, we should validate through core", + ); + return Ok(None); + } else if !selected_quorum_sets.should_be_verifiable { + tracing::debug!( + "we were in a situation where it would be possible we didn't have all quorums and we couldn't verify locally, we should validate through core", + ); + return Ok(None); + } else if round >= 10 { + tracing::debug!("high round when chain lock was invalid, asking core to verify"); + } else { + tracing::debug!("chain lock was invalid, and we deemed there was no reason to check old quorums"); + } + } + + Ok(Some(chain_lock_verified)) + } +} + +#[cfg(test)] +mod tests { + use crate::execution::platform_events::core_chain_lock::verify_chain_lock_locally::v0::CHAIN_LOCK_REQUEST_ID_PREFIX; + use dpp::dashcore::hashes::{sha256d, Hash, HashEngine}; + use dpp::dashcore::QuorumSigningRequestId; + + #[test] + fn verify_request_id() { + assert_eq!( + hex::encode(CHAIN_LOCK_REQUEST_ID_PREFIX.as_bytes()), + "636c736967" + ); + assert_eq!(hex::encode(122u32.to_le_bytes()), "7a000000"); + + let mut engine = QuorumSigningRequestId::engine(); + + engine.input(&[CHAIN_LOCK_REQUEST_ID_PREFIX.len() as u8]); + engine.input(CHAIN_LOCK_REQUEST_ID_PREFIX.as_bytes()); + engine.input(122u32.to_le_bytes().as_slice()); + + let request_id = QuorumSigningRequestId::from_engine(engine); + + assert_eq!( + hex::encode(request_id.as_byte_array()), + "e1a9d40e5145fdc168819125b5ae1b8f12d5115471624eb363a6c7a3693be2e6" + ); + + // + // let mut chain_lock_verified = public_key.verify(&signature, message_digest.as_ref()); + } + + #[test] + fn verify_message_digest() { + let mut engine = QuorumSigningRequestId::engine(); + + engine.input(&[CHAIN_LOCK_REQUEST_ID_PREFIX.len() as u8]); + engine.input(CHAIN_LOCK_REQUEST_ID_PREFIX.as_bytes()); + engine.input(956087u32.to_le_bytes().as_slice()); + + let request_id = QuorumSigningRequestId::from_engine(engine); + + assert_eq!( + hex::encode(request_id.as_byte_array()), + "ea04b27adfaa698487aee46b922fb8f1c77a562787b6afe65eecf7e685888928" + ); + + let mut block_hash = + hex::decode("000000d94ea7ac4f86c5f583e7da0feb90b9f8d038f25e55cc305524c5327266") + .unwrap(); + let mut quorum_hash = + hex::decode("0000009d376e73a22aa997bb6542bd1fc3018f61c2301a817126a737ffdcdc80") + .unwrap(); + + block_hash.reverse(); + quorum_hash.reverse(); + + let mut engine = sha256d::Hash::engine(); + + engine.input(&[1u8]); + engine.input(quorum_hash.as_slice()); + engine.input(request_id.to_byte_array().as_slice()); + engine.input(block_hash.as_slice()); + + let mut message_digest = sha256d::Hash::from_engine(engine).as_byte_array().to_vec(); + + message_digest.reverse(); + + assert_eq!( + hex::encode(message_digest.as_slice()), + "5ec53e83b8ff390b970e28db21da5b8e45fbe3b69d9f11a2c39062769b1f5e47" + ); + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs new file mode 100644 index 00000000000..e7c585498d7 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs @@ -0,0 +1,39 @@ +mod v0; + +use crate::error::execution::ExecutionError; +use crate::error::Error; +use dpp::dashcore::ChainLock; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus; +use dpp::version::PlatformVersion; + +impl Platform +where + C: CoreRPCLike, +{ + /// Verify the chain lock through core + pub fn verify_chain_lock_through_core( + &self, + chain_lock: &ChainLock, + submit: bool, + platform_version: &PlatformVersion, + ) -> Result<(bool, Option), Error> { + match platform_version + .drive_abci + .methods + .core_chain_lock + .verify_chain_lock_through_core + { + 0 => self.verify_chain_lock_through_core_v0(chain_lock, submit, platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "verify_chain_lock_through_core".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs new file mode 100644 index 00000000000..1aa5d4db57b --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs @@ -0,0 +1,43 @@ +use crate::error::Error; +use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus; +use dpp::dashcore::ChainLock; +use dpp::version::PlatformVersion; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +impl Platform +where + C: CoreRPCLike, +{ + /// Verify the chain lock through core v0 + #[inline(always)] + pub(super) fn verify_chain_lock_through_core_v0( + &self, + chain_lock: &ChainLock, + submit: bool, + platform_version: &PlatformVersion, + ) -> Result<(bool, Option), Error> { + if submit { + let given_chain_lock_height = chain_lock.block_height; + + let best_chain_locked_height = self.core_rpc.submit_chain_lock(chain_lock)?; + Ok(if best_chain_locked_height >= given_chain_lock_height { + (true, Some(CoreSyncStatus::Done)) + } else if best_chain_locked_height - given_chain_lock_height + <= platform_version + .drive_abci + .methods + .core_chain_lock + .recent_block_count_amount + { + (true, Some(CoreSyncStatus::Almost)) + } else { + (true, Some(CoreSyncStatus::Not)) + }) + } else { + Ok((self.core_rpc.verify_chain_lock(chain_lock)?, None)) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/mod.rs index b319ac4fb34..57aff29475a 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/mod.rs @@ -4,8 +4,9 @@ use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::block_proposal; -use crate::platform_types::epoch_info::v0::EpochInfoV0; +use crate::platform_types::epoch_info::EpochInfo; use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; @@ -28,10 +29,27 @@ impl Platform { &self, block_proposal: &block_proposal::v0::BlockProposal, transaction: &Transaction, + platform_state: &PlatformState, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result { + // !! BE AWARE BEFORE YOU MODIFY THIS CODE !!! + // Please be aware epoch information is gathered with previous platform version + // on epoch change (1st block of the epoch), despite we are switching to a new version + // in this block. Thus, the previous version of EpochInfo might also be used for the first block. + // A new version of this method will be called for the rest of epoch blocks + // and first block of the next epoch. + // This means that if we ever want to update EpochInfo, we will need to do so on a release + // where the new fields of epoch info are not being used. Then make another version once + // that one is activated. match platform_version.drive_abci.methods.epoch.gather_epoch_info { - 0 => self.gather_epoch_info_v0(block_proposal, transaction, platform_version), + 0 => self + .gather_epoch_info_v0( + block_proposal, + transaction, + platform_state, + platform_version, + ) + .map(|v0| v0.into()), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "gather_epoch_info".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/v0/mod.rs index a64fb5ac28f..81d3ff3d127 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/v0/mod.rs @@ -6,6 +6,7 @@ use crate::platform_types::block_proposal; use crate::platform_types::epoch_info::v0::EpochInfoV0; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; use drive::grovedb::Transaction; impl Platform { @@ -14,12 +15,11 @@ impl Platform { &self, block_proposal: &block_proposal::v0::BlockProposal, transaction: &Transaction, + platform_state: &PlatformState, platform_version: &PlatformVersion, ) -> Result { // Start by getting information from the state - let state = self.state.read().unwrap(); - - let last_block_time_ms = state.last_block_time_ms(); + let last_block_time_ms = platform_state.last_committed_block_time_ms(); // Init block execution context let block_state_info = block_state_info::v0::BlockStateInfoV0::from_block_proposal( @@ -33,6 +33,7 @@ impl Platform { block_time_ms, .. } = &block_proposal; + let genesis_time_ms = self.get_genesis_time(*height, *block_time_ms, transaction, platform_version)?; diff --git a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_distribute_fees_from_oldest_unpaid_epoch_pool_to_proposers_operations/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_distribute_fees_from_oldest_unpaid_epoch_pool_to_proposers_operations/v0/mod.rs index fec5da6a840..d56373613f3 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_distribute_fees_from_oldest_unpaid_epoch_pool_to_proposers_operations/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_distribute_fees_from_oldest_unpaid_epoch_pool_to_proposers_operations/v0/mod.rs @@ -92,7 +92,7 @@ mod tests { use super::*; use dpp::block::block_info::BlockInfo; - use drive::common::identities::create_test_masternode_identities_and_add_them_as_epoch_block_proposers; + use drive::common::test_utils::identities::create_test_masternode_identities_and_add_them_as_epoch_block_proposers; use crate::test::helpers::setup::TestPlatformBuilder; @@ -216,7 +216,7 @@ mod tests { let next_unpaid_epoch_index = platform .drive - .get_unpaid_epoch_index_v0(Some(&transaction)) + .get_unpaid_epoch_index(Some(&transaction), platform_version) .expect("should get unpaid epoch index"); assert_eq!(next_unpaid_epoch_index, current_epoch.index); diff --git a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_epoch_pool_to_proposers_payout_operations/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_epoch_pool_to_proposers_payout_operations/v0/mod.rs index 0c7a65f0a74..670f7dc1fe9 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_epoch_pool_to_proposers_payout_operations/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_epoch_pool_to_proposers_payout_operations/v0/mod.rs @@ -174,7 +174,7 @@ mod tests { use dpp::block::block_info::BlockInfo; use dpp::identity::accessors::IdentityGettersV0; use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; - use drive::common::identities::create_test_masternode_identities_and_add_them_as_epoch_block_proposers; + use drive::common::test_utils::identities::create_test_masternode_identities_and_add_them_as_epoch_block_proposers; use drive::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; use drive::drive::batch::GroveDbOpBatch; use drive::fee_pools::epochs::operations_factory::EpochOperations; @@ -187,7 +187,7 @@ mod tests { .build_with_mock_rpc() .set_initial_state_structure(); - let platform_read_guard = platform.state.read().unwrap(); + let platform_read_guard = platform.state.load(); let platform_version = platform_read_guard .current_platform_version() .expect("platform_version"); diff --git a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/create_mn_shares_contract/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/create_mn_shares_contract/mod.rs index 6dd0da06831..e0a2e2306f8 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/create_mn_shares_contract/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/create_mn_shares_contract/mod.rs @@ -20,11 +20,9 @@ impl Platform { transaction: TransactionArg, platform_version: &PlatformVersion, ) -> DataContract { - let contract = load_system_data_contract( - SystemDataContract::MasternodeRewards, - platform_version.protocol_version, - ) - .expect("should load masternode reward contract"); + let contract = + load_system_data_contract(SystemDataContract::MasternodeRewards, platform_version) + .expect("should load masternode reward contract"); let storage_flags = Some(Cow::Owned(StorageFlags::SingleEpoch(0))); diff --git a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/fetch_reward_shares_list_for_masternode/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/fetch_reward_shares_list_for_masternode/v0/mod.rs index 6f84e0799f6..3c2a9900c16 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/fetch_reward_shares_list_for_masternode/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/fetch_reward_shares_list_for_masternode/v0/mod.rs @@ -17,10 +17,11 @@ use drive::dpp::document::Document; use drive::grovedb::TransactionArg; use drive::query::{DriveQuery, InternalClauses, WhereClause, WhereOperator}; +use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::version::PlatformVersion; -use drive::drive::document::query::{QueryDocumentsOutcomeV0Methods}; +use drive::drive::document::query::QueryDocumentsOutcomeV0Methods; use std::collections::BTreeMap; -use dpp::data_contract::accessors::v0::DataContractV0Getters; + use crate::execution::platform_events::fee_pool_outwards_distribution::fetch_reward_shares_list_for_masternode::MN_REWARD_SHARES_DOCUMENT_TYPE; impl Platform { @@ -31,14 +32,17 @@ impl Platform { transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error> { - let document_type = self + let masternode_rewards_contract = self .drive - .system_contracts - .masternode_rewards - .document_type_for_name(MN_REWARD_SHARES_DOCUMENT_TYPE)?; + .cache + .system_data_contracts + .load_masternode_reward_shares(); + + let document_type = + masternode_rewards_contract.document_type_for_name(MN_REWARD_SHARES_DOCUMENT_TYPE)?; let drive_query = DriveQuery { - contract: &self.drive.system_contracts.masternode_rewards, + contract: &masternode_rewards_contract, document_type, internal_clauses: InternalClauses { primary_key_in_clause: None, diff --git a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/find_oldest_epoch_needing_payment/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/find_oldest_epoch_needing_payment/v0/mod.rs index 3027934ef5c..f61025593b7 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/find_oldest_epoch_needing_payment/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/find_oldest_epoch_needing_payment/v0/mod.rs @@ -25,7 +25,9 @@ impl Platform { return Ok(None); } - let unpaid_epoch_index = self.drive.get_unpaid_epoch_index_v0(transaction)?; + let unpaid_epoch_index = self + .drive + .get_unpaid_epoch_index(transaction, platform_version)?; // We pay for previous epochs only if unpaid_epoch_index == current_epoch_index { diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/build_withdrawal_transactions_from_documents/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/build_withdrawal_transactions_from_documents/mod.rs deleted file mode 100644 index 5ee1549005f..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/build_withdrawal_transactions_from_documents/mod.rs +++ /dev/null @@ -1,58 +0,0 @@ -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::platform_types::platform::Platform; -use crate::rpc::core::CoreRPCLike; -use dpp::document::Document; -use dpp::identifier::Identifier; -use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation; -use drive::drive::identity::withdrawals::WithdrawalTransactionIdAndBytes; -use drive::grovedb::TransactionArg; -use std::collections::HashMap; - -mod v0; - -impl Platform -where - C: CoreRPCLike, -{ - /// Builds a list of Core transactions from withdrawal documents. This function is a version handler that - /// directs to specific version implementations of the `build_withdrawal_transactions_from_documents` function. - /// - /// # Arguments - /// - /// * `documents` - A slice of `Document`. - /// * `drive_operation_types` - A mutable reference to `Vec`. - /// * `transaction` - A `TransactionArg` reference. - /// * `platform_version` - A `PlatformVersion` reference that dictates which version of - /// the method to call. - /// - /// # Returns - /// - /// * `Result, Error>` - Returns a HashMap containing withdrawal transactions if found, otherwise returns an `Error`. - pub(in crate::execution::platform_events::identity_credit_withdrawal) fn build_withdrawal_transactions_from_documents( - &self, - documents: &[Document], - drive_operation_types: &mut Vec, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result, Error> { - match platform_version - .drive_abci - .methods - .identity_credit_withdrawal - .build_withdrawal_transactions_from_documents - { - 0 => self.build_withdrawal_transactions_from_documents_v0( - documents, - drive_operation_types, - transaction, - ), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "build_withdrawal_transactions_from_documents".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/build_withdrawal_transactions_from_documents/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/build_withdrawal_transactions_from_documents/v0/mod.rs deleted file mode 100644 index 09b1c48c78f..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/build_withdrawal_transactions_from_documents/v0/mod.rs +++ /dev/null @@ -1,266 +0,0 @@ -use std::collections::HashMap; - -use dashcore_rpc::dashcore::{ - blockdata::transaction::special_transaction::asset_unlock::unqualified_asset_unlock::{ - AssetUnlockBasePayload, AssetUnlockBaseTransactionInfo, - }, - consensus::Encodable, - ScriptBuf, TxOut, -}; -use dpp::document::{Document, DocumentV0Getters}; -use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; -use dpp::system_data_contracts::withdrawals_contract::document_types::withdrawal; - -use drive::dpp::identifier::Identifier; -use drive::dpp::identity::convert_credits_to_duffs; -use drive::drive::identity::withdrawals::WithdrawalTransactionIdAndBytes; -use drive::{drive::batch::DriveOperation, query::TransactionArg}; - -use crate::{ - error::{execution::ExecutionError, Error}, - platform_types::platform::Platform, - rpc::core::CoreRPCLike, -}; - -impl Platform -where - C: CoreRPCLike, -{ - /// Build list of Core transactions from withdrawal documents - pub(super) fn build_withdrawal_transactions_from_documents_v0( - &self, - documents: &[Document], - drive_operation_types: &mut Vec, - transaction: TransactionArg, - ) -> Result, Error> { - let mut withdrawals: HashMap = HashMap::new(); - - let latest_withdrawal_index = self - .drive - .fetch_and_remove_latest_withdrawal_transaction_index_operations( - drive_operation_types, - transaction, - )?; - - for (i, document) in documents.iter().enumerate() { - let output_script_bytes = document - .properties() - .get_bytes(withdrawal::properties::OUTPUT_SCRIPT) - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Can't get outputScript from withdrawal document", - )) - })?; - - let amount = document - .properties() - .get_integer(withdrawal::properties::AMOUNT) - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Can't get amount from withdrawal document", - )) - })?; - - let core_fee_per_byte: u32 = document - .properties() - .get_integer(withdrawal::properties::CORE_FEE_PER_BYTE) - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Can't get coreFeePerByte from withdrawal document", - )) - })?; - - let state_transition_size = 190; - - let output_script = ScriptBuf::from_bytes(output_script_bytes); - - let tx_out = TxOut { - value: convert_credits_to_duffs(amount)?, - script_pubkey: output_script, - }; - - let transaction_index = latest_withdrawal_index + i as u64; - - let withdrawal_transaction = AssetUnlockBaseTransactionInfo { - version: 1, - lock_time: 0, - output: vec![tx_out], - base_payload: AssetUnlockBasePayload { - version: 1, - index: transaction_index, - fee: (state_transition_size * core_fee_per_byte * 1000), - }, - }; - - let mut transaction_buffer: Vec = vec![]; - - withdrawal_transaction - .consensus_encode(&mut transaction_buffer) - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Can't consensus encode a withdrawal transaction", - )) - })?; - - withdrawals.insert( - document.id(), - (transaction_index.to_be_bytes().to_vec(), transaction_buffer), - ); - } - - Ok(withdrawals) - } -} - -#[cfg(test)] -mod tests { - - use dpp::withdrawal::Pooling; - use dpp::{ - data_contracts::withdrawals_contract, tests::fixtures::get_withdrawal_document_fixture, - }; - use drive::tests::helpers::setup::setup_document; - - mod build_withdrawal_transactions_from_documents { - use dpp::block::block_info::BlockInfo; - - use dpp::data_contract::accessors::v0::DataContractV0Getters; - use dpp::data_contracts::withdrawals_contract::document_types::withdrawal; - use dpp::identity::core_script::CoreScript; - use dpp::platform_value::platform_value; - use dpp::prelude::Identifier; - use dpp::system_data_contracts::{load_system_data_contract, SystemDataContract}; - use dpp::version::PlatformVersion; - use drive::drive::identity::withdrawals::WithdrawalTransactionIdAndBytes; - use drive::tests::helpers::setup::setup_system_data_contract; - use itertools::Itertools; - - use crate::test::helpers::setup::TestPlatformBuilder; - - use super::*; - - #[test] - fn test_build() { - let platform_version = PlatformVersion::latest(); - let platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - - let transaction = platform.drive.grove.start_transaction(); - - let data_contract = load_system_data_contract( - SystemDataContract::Withdrawals, - platform_version.protocol_version, - ) - .expect("to load system data contract"); - - setup_system_data_contract(&platform.drive, &data_contract, Some(&transaction)); - - let owner_id = Identifier::new([1u8; 32]); - - let document_1 = get_withdrawal_document_fixture( - &data_contract, - owner_id, - platform_value!({ - "amount": 1000u64, - "coreFeePerByte": 1u32, - "pooling": Pooling::Never as u8, - "outputScript": CoreScript::from_bytes((0..23).collect::>()), - "status": withdrawals_contract::WithdrawalStatus::POOLED as u8, - "transactionIndex": 1u64, - }), - None, - platform_version.protocol_version, - ) - .expect("expected withdrawal document"); - - let document_type = data_contract - .document_type_for_name(withdrawal::NAME) - .expect("expected to get document type"); - - setup_document( - &platform.drive, - &document_1, - &data_contract, - document_type, - Some(&transaction), - ); - - let document_2 = get_withdrawal_document_fixture( - &data_contract, - owner_id, - platform_value!({ - "amount": 1000u64, - "coreFeePerByte": 1u32, - "pooling": Pooling::Never as u8, - "outputScript": CoreScript::from_bytes((0..23).collect::>()), - "status": withdrawals_contract::WithdrawalStatus::POOLED as u8, - "transactionIndex": 2u64, - }), - None, - platform_version.protocol_version, - ) - .expect("expected withdrawal document"); - - setup_document( - &platform.drive, - &document_2, - &data_contract, - document_type, - Some(&transaction), - ); - - let documents = vec![document_1, document_2]; - - let mut batch = vec![]; - - let transactions = platform - .build_withdrawal_transactions_from_documents_v0( - &documents, - &mut batch, - Some(&transaction), - ) - .expect("to build transactions from documents"); - - platform - .drive - .apply_drive_operations( - batch, - true, - &BlockInfo::default(), - Some(&transaction), - platform_version, - ) - .expect("to apply drive op batch"); - - assert_eq!( - transactions - .values() - .cloned() - .sorted() - .collect::>(), - vec![ - ( - vec![0, 0, 0, 0, 0, 0, 0, 0], - vec![ - 1, 0, 9, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 23, 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 48, 230, 2, 0 - ], - ), - ( - vec![0, 0, 0, 0, 0, 0, 0, 1], - vec![ - 1, 0, 9, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 23, 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 0, 0, 0, - 1, 1, 0, 0, 0, 0, 0, 0, 0, 48, 230, 2, 0 - ], - ), - ] - .into_iter() - .sorted() - .collect::>(), - ); - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_and_prepare_unsigned_withdrawal_transactions/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_and_prepare_unsigned_withdrawal_transactions/mod.rs deleted file mode 100644 index aa0430c75fe..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_and_prepare_unsigned_withdrawal_transactions/mod.rs +++ /dev/null @@ -1,55 +0,0 @@ -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::execution::types::block_execution_context::BlockExecutionContext; -use crate::platform_types::platform::Platform; -use crate::rpc::core::CoreRPCLike; -use dpp::version::PlatformVersion; -use drive::grovedb::Transaction; - -mod v0; - -impl Platform -where - C: CoreRPCLike, -{ - /// Prepares a list of an unsigned withdrawal transaction bytes. This function is a version handler that - /// directs to specific version implementations of the `fetch_and_prepare_unsigned_withdrawal_transactions` function. - /// - /// # Arguments - /// - /// * `validator_set_quorum_hash` - A byte array. - /// * `block_execution_context` - A `BlockExecutionContext` reference. - /// * `transaction` - A `Transaction` reference. - /// * `platform_version` - A `PlatformVersion` reference that dictates which version of - /// the method to call. - /// - /// # Returns - /// - /// * `Result>, Error>` - Returns a Vector of unsigned withdrawal transactions if found, otherwise returns an `Error`. - pub(in crate::execution) fn fetch_and_prepare_unsigned_withdrawal_transactions( - &self, - validator_set_quorum_hash: [u8; 32], - block_execution_context: &BlockExecutionContext, - transaction: &Transaction, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - match platform_version - .drive_abci - .methods - .identity_credit_withdrawal - .fetch_and_prepare_unsigned_withdrawal_transactions - { - 0 => self.fetch_and_prepare_unsigned_withdrawal_transactions_v0( - validator_set_quorum_hash, - block_execution_context, - transaction, - platform_version, - ), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "fetch_and_prepare_unsigned_withdrawal_transactions".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_and_prepare_unsigned_withdrawal_transactions/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_and_prepare_unsigned_withdrawal_transactions/v0/mod.rs deleted file mode 100644 index f388172b268..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_and_prepare_unsigned_withdrawal_transactions/v0/mod.rs +++ /dev/null @@ -1,168 +0,0 @@ -use dashcore_rpc::dashcore::{ - blockdata::transaction::special_transaction::asset_unlock::request_info::AssetUnlockRequestInfo, - hashes::Hash, QuorumHash, -}; -use dpp::block::block_info::BlockInfo; -use dpp::block::epoch::Epoch; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::document::document_methods::DocumentMethodsV0; -use dpp::document::{Document, DocumentV0Setters}; -use dpp::version::PlatformVersion; - -use drive::dpp::system_data_contracts::withdrawals_contract; -use drive::dpp::system_data_contracts::withdrawals_contract::document_types::withdrawal; - -use drive::dpp::util::hash; - -use drive::drive::batch::DriveOperation; -use drive::grovedb::Transaction; - -use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; -use crate::execution::types::block_execution_context::BlockExecutionContext; -use crate::execution::types::block_state_info::v0::BlockStateInfoV0Getters; -use crate::platform_types::epoch_info::v0::EpochInfoV0Getters; -use crate::{ - error::{execution::ExecutionError, Error}, - platform_types::platform::Platform, - rpc::core::CoreRPCLike, -}; - -const WITHDRAWAL_TRANSACTIONS_QUERY_LIMIT: u16 = 16; - -impl Platform -where - C: CoreRPCLike, -{ - /// Prepares a list of an unsigned withdrawal transaction bytes - pub(super) fn fetch_and_prepare_unsigned_withdrawal_transactions_v0( - &self, - validator_set_quorum_hash: [u8; 32], - block_execution_context: &BlockExecutionContext, - transaction: &Transaction, - platform_version: &PlatformVersion, - ) -> Result>, Error> { - let block_info = BlockInfo { - time_ms: block_execution_context.block_state_info().block_time_ms(), - height: block_execution_context.block_state_info().height(), - core_height: block_execution_context - .block_state_info() - .core_chain_locked_height(), - epoch: Epoch::new(block_execution_context.epoch_info().current_epoch_index())?, - }; - - let data_contract_id = withdrawals_contract::ID; - - let (_, Some(contract_fetch_info)) = self.drive.get_contract_with_fetch_info_and_fee( - data_contract_id.to_buffer(), - None, - true, - Some(transaction), - platform_version, - )? - else { - return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( - "can't fetch withdrawal data contract", - ))); - }; - - let mut drive_operations: Vec = vec![]; - - // Get 16 latest withdrawal transactions from the queue - let untied_withdrawal_transactions = self.drive.dequeue_withdrawal_transactions( - WITHDRAWAL_TRANSACTIONS_QUERY_LIMIT, - Some(transaction), - &mut drive_operations, - )?; - - if untied_withdrawal_transactions.is_empty() { - return Ok(Vec::new()); - } - - // Appending request_height and quorum_hash to withdrawal transaction - // and pass it to JS Drive for singing and broadcasting - let (unsigned_withdrawal_transactions, documents_to_update): (Vec<_>, Vec<_>) = - untied_withdrawal_transactions - .into_iter() - .map(|(_, untied_transaction_bytes)| { - let request_info = AssetUnlockRequestInfo { - request_height: block_execution_context - .block_state_info() - .core_chain_locked_height(), - quorum_hash: QuorumHash::hash(&validator_set_quorum_hash), - }; - - let mut unsigned_transaction_bytes = vec![]; - - request_info - .consensus_append_to_base_encode( - untied_transaction_bytes.clone(), - &mut unsigned_transaction_bytes, - ) - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "could not add additional request info to asset unlock transaction", - )) - })?; - - let original_transaction_id = hash::hash_to_vec(untied_transaction_bytes); - let update_transaction_id = - hash::hash_to_vec(unsigned_transaction_bytes.clone()); - - let mut document = self.drive.find_withdrawal_document_by_transaction_id( - &original_transaction_id, - Some(transaction), - platform_version, - )?; - - document.set_bytes( - withdrawal::properties::TRANSACTION_ID, - update_transaction_id, - ); - - document.set_i64( - withdrawal::properties::UPDATED_AT, - block_info.time_ms.try_into().map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Can't convert u64 block time to i64 updated_at", - )) - })?, - ); - - document.increment_revision().map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Could not increment document revision", - )) - })?; - - Ok((unsigned_transaction_bytes, document)) - }) - .collect::, Document)>, Error>>()? - .into_iter() - .unzip(); - - self.drive.add_update_multiple_documents_operations( - &documents_to_update, - &contract_fetch_info.contract, - contract_fetch_info - .contract - .document_type_for_name(withdrawal::NAME) - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "could not get document type", - )) - })?, - &mut drive_operations, - &platform_version.drive, - )?; - - self.drive.apply_drive_operations( - drive_operations, - true, - &block_info, - Some(transaction), - platform_version, - )?; - - Ok(unsigned_withdrawal_transactions) - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_transactions_block_inclusion_status/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_transactions_block_inclusion_status/mod.rs deleted file mode 100644 index a63d7ae4f5f..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_transactions_block_inclusion_status/mod.rs +++ /dev/null @@ -1,51 +0,0 @@ -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::platform_types::platform::Platform; -use crate::rpc::core::CoreRPCLike; -use dpp::identifier::Identifier; -use dpp::version::PlatformVersion; -use std::collections::BTreeMap; - -mod v0; - -impl Platform -where - C: CoreRPCLike, -{ - /// Fetch Core transactions by range of Core heights. This function is a version handler that - /// directs to specific version implementations of the `fetch_transactions_block_inclusion_status` function. - /// - /// # Arguments - /// - /// * `current_chain_locked_core_height` - The current chain locked core height - /// * `transactions` - A list of transactions to fetch. - /// * `platform_version` - A `PlatformVersion` reference that dictates which version of - /// the method to call. - /// - /// # Returns - /// - /// * `Result, Error>` - Returns a Vector of transaction hashes if found, otherwise returns an `Error`. - pub(in crate::execution::platform_events::identity_credit_withdrawal) fn fetch_transactions_block_inclusion_status( - &self, - current_chain_locked_core_height: u32, - transaction_identifiers: Vec<[u8; 32]>, - platform_version: &PlatformVersion, - ) -> Result, Error> { - match platform_version - .drive_abci - .methods - .identity_credit_withdrawal - .fetch_transactions_block_inclusion_status - { - 0 => self.fetch_transactions_block_inclusion_status_v0( - current_chain_locked_core_height, - transaction_identifiers, - ), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "fetch_transactions_block_inclusion_status".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_transactions_block_inclusion_status/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_transactions_block_inclusion_status/v0/mod.rs deleted file mode 100644 index 6363d8d3d6a..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/fetch_transactions_block_inclusion_status/v0/mod.rs +++ /dev/null @@ -1,38 +0,0 @@ -use dpp::dashcore::hashes::Hash; -use dpp::dashcore::Txid; -use dpp::prelude::Identifier; -use std::collections::BTreeMap; - -use crate::{error::Error, platform_types::platform::Platform, rpc::core::CoreRPCLike}; - -impl Platform -where - C: CoreRPCLike, -{ - /// Fetch Core transactions by range of Core heights - pub(super) fn fetch_transactions_block_inclusion_status_v0( - &self, - current_chain_locked_core_height: u32, - transaction_identifiers: Vec<[u8; 32]>, - ) -> Result, Error> { - let tx_ids: Vec = transaction_identifiers - .iter() - .map(|transaction_id| Txid::from_byte_array(*transaction_id)) - .collect(); - let transactions_are_chain_locked_result = - self.core_rpc.get_transactions_are_chain_locked(tx_ids)?; - - Ok(transactions_are_chain_locked_result - .into_iter() - .zip(transaction_identifiers) - .map(|(lock_result, identifier)| { - let Some(mined_height) = lock_result.height else { - return (identifier, false); - }; - let withdrawal_chain_locked = - lock_result.chain_lock && current_chain_locked_core_height >= mined_height; - (identifier, withdrawal_chain_locked) - }) - .collect()) - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/mod.rs deleted file mode 100644 index 60843ec380d..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub(in crate::execution) mod build_withdrawal_transactions_from_documents; -pub(in crate::execution) mod fetch_and_prepare_unsigned_withdrawal_transactions; -mod fetch_transactions_block_inclusion_status; -pub(in crate::execution) mod pool_withdrawals_into_transactions_queue; -pub(in crate::execution) mod update_broadcasted_withdrawal_transaction_statuses; diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/pool_withdrawals_into_transactions_queue/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/pool_withdrawals_into_transactions_queue/mod.rs deleted file mode 100644 index fded57be054..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/pool_withdrawals_into_transactions_queue/mod.rs +++ /dev/null @@ -1,52 +0,0 @@ -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::execution::types::block_execution_context::BlockExecutionContext; -use crate::platform_types::platform::Platform; -use crate::rpc::core::CoreRPCLike; -use dpp::version::PlatformVersion; -use drive::grovedb::Transaction; - -mod v0; - -impl Platform -where - C: CoreRPCLike, -{ - /// Pool withdrawal documents into transactions. This function is a version handler that - /// directs to specific version implementations of the `pool_withdrawals_into_transactions_queue` function. - /// - /// # Arguments - /// - /// * `block_execution_context` - A `BlockExecutionContext` reference that provides context for block execution. - /// * `transaction` - A `Transaction` reference representing the current transaction. - /// * `platform_version` - A `PlatformVersion` reference that dictates which version of - /// the method to call. - /// - /// # Returns - /// - /// * `Result<(), Error>` - Returns `Ok(())` if successful, otherwise returns an `Error`. - pub(in crate::execution) fn pool_withdrawals_into_transactions_queue( - &self, - block_execution_context: &BlockExecutionContext, - transaction: &Transaction, - platform_version: &PlatformVersion, - ) -> Result<(), Error> { - match platform_version - .drive_abci - .methods - .identity_credit_withdrawal - .pool_withdrawals_into_transactions_queue - { - 0 => self.pool_withdrawals_into_transactions_queue_v0( - block_execution_context, - transaction, - platform_version, - ), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "pool_withdrawals_into_transactions_queue".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/pool_withdrawals_into_transactions_queue/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/pool_withdrawals_into_transactions_queue/v0/mod.rs deleted file mode 100644 index 139820ec9ac..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/pool_withdrawals_into_transactions_queue/v0/mod.rs +++ /dev/null @@ -1,321 +0,0 @@ -use dpp::block::block_info::BlockInfo; -use dpp::block::epoch::Epoch; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::document::document_methods::DocumentMethodsV0; -use dpp::document::{DocumentV0Getters, DocumentV0Setters}; -use dpp::version::PlatformVersion; - -use drive::dpp::util::hash; -use drive::drive::identity::withdrawals::WithdrawalTransactionIdAndBytes; -use drive::grovedb::Transaction; - -use dpp::system_data_contracts::withdrawals_contract; -use dpp::system_data_contracts::withdrawals_contract::document_types::withdrawal; - -use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; -use crate::execution::types::block_execution_context::BlockExecutionContext; -use crate::execution::types::block_state_info::v0::BlockStateInfoV0Getters; -use crate::platform_types::epoch_info::v0::EpochInfoV0Getters; -use crate::{ - error::{execution::ExecutionError, Error}, - platform_types::platform::Platform, - rpc::core::CoreRPCLike, -}; - -impl Platform -where - C: CoreRPCLike, -{ - /// Pool withdrawal documents into transactions - pub(super) fn pool_withdrawals_into_transactions_queue_v0( - &self, - block_execution_context: &BlockExecutionContext, - transaction: &Transaction, - platform_version: &PlatformVersion, - ) -> Result<(), Error> { - let block_info = BlockInfo { - time_ms: block_execution_context.block_state_info().block_time_ms(), - height: block_execution_context.block_state_info().height(), - core_height: block_execution_context - .block_state_info() - .core_chain_locked_height(), - epoch: Epoch::new(block_execution_context.epoch_info().current_epoch_index())?, - }; - - let data_contract_id = withdrawals_contract::ID; - - let (_, Some(contract_fetch_info)) = self.drive.get_contract_with_fetch_info_and_fee( - data_contract_id.to_buffer(), - None, - true, - Some(transaction), - platform_version, - )? - else { - return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( - "can't fetch withdrawal data contract", - ))); - }; - - let mut documents = self.drive.fetch_withdrawal_documents_by_status( - withdrawals_contract::WithdrawalStatus::QUEUED.into(), - Some(transaction), - platform_version, - )?; - - if documents.is_empty() { - return Ok(()); - } - - let mut drive_operations = vec![]; - - let withdrawal_transactions = self.build_withdrawal_transactions_from_documents( - &documents, - &mut drive_operations, - Some(transaction), - platform_version, - )?; - - for document in documents.iter_mut() { - let Some((_, transaction_bytes)) = withdrawal_transactions.get(&document.id()) else { - return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( - "transactions must contain a transaction", - ))); - }; - - let transaction_id = hash::hash_to_vec(transaction_bytes); - - document.set_bytes( - withdrawal::properties::TRANSACTION_ID, - transaction_id.clone(), - ); - - document.set_u8( - withdrawal::properties::STATUS, - withdrawals_contract::WithdrawalStatus::POOLED as u8, - ); - - document.set_i64( - withdrawal::properties::UPDATED_AT, - block_info.time_ms.try_into().map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Can't convert u64 block time to i64 updated_at", - )) - })?, - ); - - document.increment_revision().map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Could not increment document revision", - )) - })?; - } - - self.drive.add_update_multiple_documents_operations( - &documents, - &contract_fetch_info.contract, - contract_fetch_info - .contract - .document_type_for_name(withdrawal::NAME) - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Can't fetch withdrawal data contract", - )) - })?, - &mut drive_operations, - &platform_version.drive, - )?; - - let withdrawal_transactions: Vec = - withdrawal_transactions.values().cloned().collect(); - - self.drive.add_enqueue_withdrawal_transaction_operations( - &withdrawal_transactions, - &mut drive_operations, - ); - - self.drive.apply_drive_operations( - drive_operations, - true, - &block_info, - Some(transaction), - platform_version, - )?; - - Ok(()) - } -} - -#[cfg(test)] -mod tests { - use super::*; - use dashcore_rpc::dashcore::QuorumHash; - use dpp::dashcore::hashes::Hash; - - use dpp::data_contracts::SystemDataContract; - use dpp::identifier::Identifier; - use dpp::identity::core_script::CoreScript; - use dpp::tests::fixtures::get_withdrawal_document_fixture; - use dpp::withdrawal::Pooling; - use drive::tests::helpers::setup::{setup_document, setup_system_data_contract}; - - use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0; - use crate::execution::types::block_state_info::v0::BlockStateInfoV0; - use crate::platform_types::epoch_info::v0::EpochInfoV0; - use crate::platform_types::platform_state::v0::PlatformStateV0; - use crate::test::helpers::setup::TestPlatformBuilder; - use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; - use dpp::platform_value::platform_value; - use dpp::system_data_contracts::load_system_data_contract; - use dpp::version::PlatformVersion; - - #[test] - fn test_pooling() { - let platform_version = PlatformVersion::latest(); - let platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - - let transaction = platform.drive.grove.start_transaction(); - - platform.block_execution_context.write().unwrap().replace( - BlockExecutionContextV0 { - block_state_info: BlockStateInfoV0 { - height: 1, - round: 0, - block_time_ms: 1, - previous_block_time_ms: Some(1), - proposer_pro_tx_hash: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, - ], - core_chain_locked_height: 96, - block_hash: None, - app_hash: None, - } - .into(), - epoch_info: EpochInfoV0 { - current_epoch_index: 1, - previous_epoch_index: None, - is_epoch_change: false, - } - .into(), - hpmn_count: 100, - withdrawal_transactions: Default::default(), - block_platform_state: PlatformStateV0 { - last_committed_block_info: None, - current_protocol_version_in_consensus: 0, - next_epoch_protocol_version: 0, - current_validator_set_quorum_hash: QuorumHash::all_zeros(), - next_validator_set_quorum_hash: None, - validator_sets: Default::default(), - full_masternode_list: Default::default(), - hpmn_masternode_list: Default::default(), - genesis_block_info: None, - } - .into(), - proposer_results: None, - } - .into(), - ); - - let data_contract = load_system_data_contract( - SystemDataContract::Withdrawals, - platform_version.protocol_version, - ) - .expect("to load system data contract"); - - setup_system_data_contract(&platform.drive, &data_contract, Some(&transaction)); - - let owner_id = Identifier::new([1u8; 32]); - - let document_1 = get_withdrawal_document_fixture( - &data_contract, - owner_id, - platform_value!({ - "amount": 1000u64, - "coreFeePerByte": 1u32, - "pooling": Pooling::Never as u8, - "outputScript": CoreScript::from_bytes((0..23).collect::>()), - "status": withdrawals_contract::WithdrawalStatus::QUEUED as u8, - "transactionIndex": 1u64, - }), - None, - platform_version.protocol_version, - ) - .expect("expected withdrawal document"); - - let document_type = data_contract - .document_type_for_name(withdrawal::NAME) - .expect("expected to get document type"); - - setup_document( - &platform.drive, - &document_1, - &data_contract, - document_type, - Some(&transaction), - ); - - let document_2 = get_withdrawal_document_fixture( - &data_contract, - owner_id, - platform_value!({ - "amount": 1000u64, - "coreFeePerByte": 1u32, - "pooling": Pooling::Never as u8, - "outputScript": CoreScript::from_bytes((0..23).collect::>()), - "status": withdrawals_contract::WithdrawalStatus::QUEUED as u8, - "transactionIndex": 2u64, - }), - None, - platform_version.protocol_version, - ) - .expect("expected withdrawal document"); - - setup_document( - &platform.drive, - &document_2, - &data_contract, - document_type, - Some(&transaction), - ); - - let guarded_block_execution_context = platform.block_execution_context.write().unwrap(); - let block_execution_context = guarded_block_execution_context.as_ref().unwrap(); - platform - .pool_withdrawals_into_transactions_queue_v0( - block_execution_context, - &transaction, - platform_version, - ) - .expect("to pool withdrawal documents into transactions"); - - let updated_documents = platform - .drive - .fetch_withdrawal_documents_by_status( - withdrawals_contract::WithdrawalStatus::POOLED.into(), - Some(&transaction), - platform_version, - ) - .expect("to fetch withdrawal documents"); - - let tx_ids = [ - "4b74f91644215904ff1aa4122b204ba674aea74d99a17c03fbda483692bf735b", - "897ec16cb13d802ee6acdaf55274c59f3509a4929d726bab919a962ed4a8703c", - ]; - - for document in updated_documents { - assert_eq!(document.revision(), Some(2)); - - let tx_id: Vec = document - .properties() - .get_bytes("transactionId") - .expect("to get transactionId"); - - let tx_id_hex = hex::encode(tx_id); - - assert!(tx_ids.contains(&tx_id_hex.as_str())); - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/update_broadcasted_withdrawal_transaction_statuses/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/update_broadcasted_withdrawal_transaction_statuses/mod.rs deleted file mode 100644 index d764c5a33ce..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/update_broadcasted_withdrawal_transaction_statuses/mod.rs +++ /dev/null @@ -1,62 +0,0 @@ -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::execution::types::block_execution_context::BlockExecutionContext; -use crate::platform_types::platform::Platform; -use crate::rpc::core::CoreRPCLike; -use dpp::version::PlatformVersion; -use drive::grovedb::Transaction; - -mod v0; - -impl Platform -where - C: CoreRPCLike, -{ - /// Update statuses for broadcasted withdrawals - /// - /// This method is responsible for updating the status of withdrawal transactions that have been broadcasted. - /// This is done based on the height of the last synced core block, which helps in determining whether the withdrawal - /// transaction has been completed or expired. - /// - /// # Arguments - /// - /// * `block_execution_context` - Contextual information about the current block execution. - /// * `transaction` - A transaction argument to interact with the underlying storage. - /// - /// # Returns - /// - /// * `Result<(), Error>` - Returns an Ok(()) if the statuses are successfully updated. - /// Otherwise, it returns an Error. - /// - /// # Errors - /// - /// This function may return an error if any of the following conditions are met: - /// - /// * There is an issue interacting with the underlying storage. - /// * There is an error fetching the withdrawal data contract. - /// * There is an error getting the transactionId or transactionSignHeight from the withdrawal document. - pub fn update_broadcasted_withdrawal_transaction_statuses( - &self, - block_execution_context: &BlockExecutionContext, - transaction: &Transaction, - platform_version: &PlatformVersion, - ) -> Result<(), Error> { - match platform_version - .drive_abci - .methods - .identity_credit_withdrawal - .update_broadcasted_withdrawal_transaction_statuses - { - 0 => self.update_broadcasted_withdrawal_transaction_statuses_v0( - block_execution_context, - transaction, - platform_version, - ), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "update_broadcasted_withdrawal_transaction_statuses".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/update_broadcasted_withdrawal_transaction_statuses/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/update_broadcasted_withdrawal_transaction_statuses/v0/mod.rs deleted file mode 100644 index b5ebb9f46fd..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/update_broadcasted_withdrawal_transaction_statuses/v0/mod.rs +++ /dev/null @@ -1,469 +0,0 @@ -use dpp::block::block_info::BlockInfo; -use dpp::block::epoch::Epoch; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::data_contracts::withdrawals_contract::WithdrawalStatus; -use dpp::document::document_methods::DocumentMethodsV0; -use dpp::document::{Document, DocumentV0Getters, DocumentV0Setters}; -use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; -use dpp::platform_value::Bytes32; -use dpp::prelude::Identifier; -use dpp::system_data_contracts::withdrawals_contract; -use dpp::system_data_contracts::withdrawals_contract::document_types::withdrawal; -use dpp::version::PlatformVersion; -use std::collections::BTreeMap; - -use drive::drive::batch::DriveOperation; -use drive::grovedb::Transaction; - -use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; -use crate::execution::types::block_execution_context::BlockExecutionContext; -use crate::execution::types::block_state_info::v0::BlockStateInfoV0Getters; -use crate::platform_types::epoch_info::v0::EpochInfoV0Getters; -use crate::{ - error::{execution::ExecutionError, Error}, - platform_types::platform::Platform, - rpc::core::CoreRPCLike, -}; - -const NUMBER_OF_BLOCKS_BEFORE_EXPIRED: u32 = 48; - -impl Platform -where - C: CoreRPCLike, -{ - /// Update statuses for broadcasted withdrawals - pub(super) fn update_broadcasted_withdrawal_transaction_statuses_v0( - &self, - block_execution_context: &BlockExecutionContext, - transaction: &Transaction, - platform_version: &PlatformVersion, - ) -> Result<(), Error> { - let block_info = BlockInfo { - time_ms: block_execution_context.block_state_info().block_time_ms(), - height: block_execution_context.block_state_info().height(), - core_height: block_execution_context - .block_state_info() - .core_chain_locked_height(), - epoch: Epoch::new(block_execution_context.epoch_info().current_epoch_index())?, - }; - - let data_contract_id = withdrawals_contract::ID; - - let (_, Some(contract_fetch_info)) = self.drive.get_contract_with_fetch_info_and_fee( - data_contract_id.to_buffer(), - None, - true, - Some(transaction), - platform_version, - )? - else { - return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( - "can't fetch withdrawal data contract", - ))); - }; - - let broadcasted_withdrawal_documents = self.drive.fetch_withdrawal_documents_by_status( - withdrawals_contract::WithdrawalStatus::BROADCASTED.into(), - Some(transaction), - platform_version, - )?; - - // Collecting only documents that have been updated - let transactions_to_check: Vec<[u8; 32]> = broadcasted_withdrawal_documents - .iter() - .map(|document| { - document - .properties() - .get_hash256_bytes(withdrawal::properties::TRANSACTION_ID) - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedDriveResponse( - "Can't get transactionId from withdrawal document".to_string(), - )) - }) - }) - .collect::, Error>>()?; - - let core_transactions_statuses = if transactions_to_check.is_empty() { - BTreeMap::new() - } else { - self.fetch_transactions_block_inclusion_status( - block_execution_context - .block_state_info() - .core_chain_locked_height(), - transactions_to_check, - platform_version, - )? - }; - - let mut drive_operations: Vec = vec![]; - - // Collecting only documents that have been updated - let documents_to_update: Vec = broadcasted_withdrawal_documents - .into_iter() - .map(|mut document| { - let transaction_sign_height: u32 = document - .properties() - .get_optional_integer(withdrawal::properties::TRANSACTION_SIGN_HEIGHT)? - .ok_or(Error::Execution(ExecutionError::CorruptedDriveResponse( - "Can't get transactionSignHeight from withdrawal document".to_string(), - )))?; - - let transaction_id = document - .properties() - .get_optional_hash256_bytes(withdrawal::properties::TRANSACTION_ID)? - .ok_or(Error::Execution(ExecutionError::CorruptedDriveResponse( - "Can't get transactionId from withdrawal document".to_string(), - )))?; - - let transaction_index = document - .properties() - .get_optional_integer(withdrawal::properties::TRANSACTION_INDEX)? - .ok_or(Error::Execution(ExecutionError::CorruptedDriveResponse( - "Can't get transaction index from withdrawal document".to_string(), - )))?; - - let current_status: WithdrawalStatus = document - .properties() - .get_optional_integer::(withdrawal::properties::STATUS)? - .ok_or(Error::Execution(ExecutionError::CorruptedDriveResponse( - "Can't get transaction index from withdrawal document".to_string(), - )))? - .try_into() - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedDriveResponse( - "Withdrawal status unknown".to_string(), - )) - })?; - - let block_height_difference = block_execution_context - .block_state_info() - .core_chain_locked_height() - - transaction_sign_height; - - let is_chain_locked = - *core_transactions_statuses - .get(&transaction_id) - .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( - "we should always have a withdrawal status", - )))?; - - let mut status = current_status; - - if is_chain_locked { - status = WithdrawalStatus::COMPLETE; - } else if block_height_difference > NUMBER_OF_BLOCKS_BEFORE_EXPIRED { - status = WithdrawalStatus::EXPIRED; - } else { - // todo: there could be a problem here where we always get the same withdrawals - // and don't cycle them most likely when we query withdrawals - return Ok(None); - } - - document.set_u8(withdrawal::properties::STATUS, status.into()); - - document.set_u64(withdrawal::properties::UPDATED_AT, block_info.time_ms); - - document.increment_revision().map_err(Error::Protocol)?; - - if status == WithdrawalStatus::EXPIRED { - self.drive.add_insert_expired_index_operation( - transaction_index, - &mut drive_operations, - ); - } - - Ok(Some(document)) - }) - .collect::>, Error>>()? - .into_iter() - .flatten() - .collect(); - - self.drive.add_update_multiple_documents_operations( - &documents_to_update, - &contract_fetch_info.contract, - contract_fetch_info - .contract - .document_type_for_name(withdrawal::NAME) - .map_err(|_| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "Can't fetch withdrawal data contract", - )) - })?, - &mut drive_operations, - &platform_version.drive, - )?; - - self.drive.apply_drive_operations( - drive_operations, - true, - &block_info, - Some(transaction), - platform_version, - )?; - - Ok(()) - } -} - -#[cfg(test)] -mod tests { - use dashcore_rpc::dashcore::{hashes::hex::FromHex, BlockHash, QuorumHash}; - use dashcore_rpc::dashcore_rpc_json::GetTransactionLockedResult; - use dpp::{ - data_contracts::withdrawals_contract, tests::fixtures::get_withdrawal_document_fixture, - }; - use drive::tests::helpers::setup::setup_document; - use serde_json::json; - use std::str::FromStr; - - use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0; - use crate::execution::types::block_state_info::v0::BlockStateInfoV0; - use crate::platform_types::epoch_info::v0::EpochInfoV0; - use crate::platform_types::platform_state::v0::PlatformStateV0; - use crate::rpc::core::MockCoreRPCLike; - use crate::test::helpers::setup::TestPlatformBuilder; - - use dpp::data_contract::accessors::v0::DataContractV0Getters; - - use dpp::document::DocumentV0Getters; - use dpp::identity::core_script::CoreScript; - use dpp::platform_value::platform_value; - - use crate::platform_types::platform::Platform; - use dpp::dashcore::hashes::Hash; - use dpp::dashcore::Txid; - use dpp::system_data_contracts::withdrawals_contract::document_types::withdrawal; - use dpp::version::PlatformVersion; - use dpp::withdrawal::Pooling; - use dpp::{ - prelude::Identifier, - system_data_contracts::{load_system_data_contract, SystemDataContract}, - }; - use drive::tests::helpers::setup::setup_system_data_contract; - - #[test] - fn test_statuses_are_updated() { - let platform_version = PlatformVersion::latest(); - let mut platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - - let mut mock_rpc_client = MockCoreRPCLike::new(); - - mock_rpc_client - .expect_get_transactions_are_chain_locked() - .returning(move |tx_ids: Vec| { - Ok(tx_ids - .into_iter() - .map(|tx_id| { - if tx_id.to_byte_array() - == [ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - ] - { - GetTransactionLockedResult { - height: Some(93), - chain_lock: true, - } - } else { - GetTransactionLockedResult { - height: None, - chain_lock: false, - } - } - }) - .collect()) - }); - - mock_rpc_client - .expect_get_block_hash() - .withf(|height| *height == 95) - .returning(|_| { - Ok(BlockHash::from_str( - "0000000000000000000000000000000000000000000000000000000000000000", - ) - .unwrap()) - }); - - mock_rpc_client - .expect_get_block_hash() - .withf(|height| *height == 96) - .returning(|_| { - Ok(BlockHash::from_str( - "1111111111111111111111111111111111111111111111111111111111111111", - ) - .unwrap()) - }); - - mock_rpc_client - .expect_get_block_json() - .withf(|bh| { - hex::encode(bh) - == "0000000000000000000000000000000000000000000000000000000000000000" - }) - .returning(|_| { - Ok(json!({ - "tx": ["0101010101010101010101010101010101010101010101010101010101010101"] - })) - }); - - mock_rpc_client - .expect_get_block_json() - .withf(|bh| { - hex::encode(bh) - == "1111111111111111111111111111111111111111111111111111111111111111" - }) - .returning(|_| { - Ok(json!({ - "tx": ["0202020202020202020202020202020202020202020202020202020202020202"] - })) - }); - - platform.core_rpc = mock_rpc_client; - - let transaction = platform.drive.grove.start_transaction(); - - let block_execution_context = BlockExecutionContextV0 { - block_state_info: BlockStateInfoV0 { - height: 1, - round: 0, - block_time_ms: 1, - previous_block_time_ms: Some(1), - proposer_pro_tx_hash: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - ], - core_chain_locked_height: 96, - block_hash: None, - app_hash: None, - } - .into(), - epoch_info: EpochInfoV0 { - current_epoch_index: 1, - previous_epoch_index: None, - is_epoch_change: false, - } - .into(), - hpmn_count: 100, - withdrawal_transactions: Default::default(), - block_platform_state: PlatformStateV0 { - last_committed_block_info: None, - current_protocol_version_in_consensus: 0, - next_epoch_protocol_version: 0, - current_validator_set_quorum_hash: QuorumHash::all_zeros(), - next_validator_set_quorum_hash: None, - validator_sets: Default::default(), - full_masternode_list: Default::default(), - hpmn_masternode_list: Default::default(), - genesis_block_info: None, - } - .into(), - proposer_results: None, - }; - - let data_contract = load_system_data_contract( - SystemDataContract::Withdrawals, - platform_version.protocol_version, - ) - .expect("to load system data contract"); - - setup_system_data_contract(&platform.drive, &data_contract, Some(&transaction)); - - let owner_id = Identifier::new([1u8; 32]); - - let document_1 = get_withdrawal_document_fixture( - &data_contract, - owner_id, - platform_value!({ - "amount": 1000u64, - "coreFeePerByte": 1u32, - "pooling": Pooling::Never, - "outputScript": CoreScript::from_bytes((0..23).collect::>()), - "status": withdrawals_contract::WithdrawalStatus::BROADCASTED as u8, - "transactionIndex": 1u64, - "transactionSignHeight": 93u64, - "transactionId": Identifier::new([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), - }), - None, - platform_version.protocol_version, - ).expect("expected withdrawal document"); - - let document_type = data_contract - .document_type_for_name(withdrawal::NAME) - .expect("expected to get document type"); - - setup_document( - &platform.drive, - &document_1, - &data_contract, - document_type, - Some(&transaction), - ); - - let document_2 = get_withdrawal_document_fixture( - &data_contract, - owner_id, - platform_value!({ - "amount": 1000u64, - "coreFeePerByte": 1u32, - "pooling": Pooling::Never as u8, - "outputScript": CoreScript::from_bytes((0..23).collect::>()), - "status": withdrawals_contract::WithdrawalStatus::BROADCASTED as u8, - "transactionIndex": 2u64, - "transactionSignHeight": 10u64, - "transactionId": Identifier::new([3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), - }), - None, - platform_version.protocol_version, - ) - .expect("expected withdrawal document"); - - setup_document( - &platform.drive, - &document_2, - &data_contract, - document_type, - Some(&transaction), - ); - - platform - .update_broadcasted_withdrawal_transaction_statuses_v0( - &block_execution_context.into(), - &transaction, - platform_version, - ) - .expect("to update withdrawal statuses"); - - let documents = platform - .drive - .fetch_withdrawal_documents_by_status( - withdrawals_contract::WithdrawalStatus::EXPIRED.into(), - Some(&transaction), - platform_version, - ) - .expect("to fetch documents by status"); - - assert_eq!(documents.len(), 1); - assert_eq!( - documents.get(0).unwrap().id().to_vec(), - document_2.id().to_vec() - ); - - let documents = platform - .drive - .fetch_withdrawal_documents_by_status( - withdrawals_contract::WithdrawalStatus::COMPLETE.into(), - Some(&transaction), - platform_version, - ) - .expect("to fetch documents by status"); - - assert_eq!(documents.len(), 1); - assert_eq!( - documents.get(0).unwrap().id().to_vec(), - document_1.id().to_vec() - ); - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/v0/mod.rs index ba2a1044d6b..73795a0aab2 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/v0/mod.rs @@ -44,12 +44,14 @@ use dpp::identity::identity_public_key::v0::IdentityPublicKeyV0; use dpp::identity::IdentityV0; use dpp::serialization::PlatformSerializableWithPlatformVersion; use dpp::version::PlatformVersion; -use drive::dpp::system_data_contracts::{load_system_data_contract, SystemDataContract}; +use drive::dpp::system_data_contracts::SystemDataContract; use drive::drive::batch::{ DataContractOperationType, DocumentOperationType, DriveOperation, IdentityOperationType, }; -use drive::drive::object_size_info::{DocumentAndContractInfo, DocumentInfo, OwnedDocumentInfo}; +use drive::drive::object_size_info::{ + DataContractInfo, DocumentInfo, DocumentTypeInfo, OwnedDocumentInfo, +}; use drive::query::TransactionArg; use std::borrow::Cow; use std::collections::BTreeMap; @@ -65,7 +67,8 @@ const DPNS_DASH_TLD_PREORDER_SALT: [u8; 32] = [ impl Platform { /// Creates trees and populates them with necessary identities, contracts and documents - pub fn create_genesis_state_v0( + #[inline(always)] + pub(super) fn create_genesis_state_v0( &self, genesis_time: TimestampMillis, system_identity_public_keys: SystemIdentityPublicKeys, @@ -81,24 +84,22 @@ impl Platform { // Create system identities and contracts - let dpns_contract = - load_system_data_contract(SystemDataContract::DPNS, platform_version.protocol_version)?; + let system_data_contracts = &self.drive.cache.system_data_contracts; + + let dpns_data_contract = system_data_contracts.load_dpns(); let system_data_contract_types = BTreeMap::from_iter([ ( SystemDataContract::DPNS, ( - dpns_contract.clone(), + system_data_contracts.load_dpns(), system_identity_public_keys.dpns_contract_owner(), ), ), ( SystemDataContract::Withdrawals, ( - load_system_data_contract( - SystemDataContract::Withdrawals, - platform_version.protocol_version, - )?, + system_data_contracts.load_withdrawals(), system_identity_public_keys.withdrawals_contract_owner(), ), ), @@ -116,26 +117,20 @@ impl Platform { ( SystemDataContract::Dashpay, ( - load_system_data_contract( - SystemDataContract::Dashpay, - platform_version.protocol_version, - )?, + system_data_contracts.load_dashpay(), system_identity_public_keys.dashpay_contract_owner(), ), ), ( SystemDataContract::MasternodeRewards, ( - load_system_data_contract( - SystemDataContract::MasternodeRewards, - platform_version.protocol_version, - )?, + system_data_contracts.load_masternode_reward_shares(), system_identity_public_keys.masternode_reward_shares_contract_owner(), ), ), ]); - for (_, (data_contract, identity_public_keys_set)) in system_data_contract_types { + for (data_contract, identity_public_keys_set) in system_data_contract_types.values() { let public_keys = [ ( 0, @@ -184,7 +179,7 @@ impl Platform { self.register_system_identity_operations(identity, &mut operations); } - self.register_dpns_top_level_domain_operations(&dpns_contract, &mut operations)?; + self.register_dpns_top_level_domain_operations(&dpns_data_contract, &mut operations)?; let block_info = BlockInfo::default_with_time(genesis_time); @@ -199,18 +194,17 @@ impl Platform { Ok(()) } - fn register_system_data_contract_operations( + fn register_system_data_contract_operations<'a>( &self, - data_contract: DataContract, - operations: &mut Vec, + data_contract: &'a DataContract, + operations: &mut Vec>, platform_version: &PlatformVersion, ) -> Result<(), Error> { let serialization = data_contract.serialize_to_bytes_with_platform_version(platform_version)?; operations.push(DriveOperation::DataContractOperation( - //todo: remove cbor DataContractOperationType::ApplyContractWithSerialization { - contract: Cow::Owned(data_contract), + contract: Cow::Borrowed(data_contract), serialized_contract: serialization, storage_flags: None, }, @@ -263,23 +257,27 @@ impl Platform { revision: None, created_at: None, updated_at: None, + transferred_at: None, + created_at_block_height: None, + updated_at_block_height: None, + transferred_at_block_height: None, + created_at_core_block_height: None, + updated_at_core_block_height: None, + transferred_at_core_block_height: None, } .into(); let document_type = contract.document_type_for_name("domain")?; - let operation = - DriveOperation::DocumentOperation(DocumentOperationType::AddDocumentForContract { - document_and_contract_info: DocumentAndContractInfo { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentInfo::DocumentOwnedInfo((document, None)), - owner_id: None, - }, - contract, - document_type, - }, - override_document: false, - }); + let operation = DriveOperation::DocumentOperation(DocumentOperationType::AddDocument { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentInfo::DocumentOwnedInfo((document, None)), + owner_id: None, + }, + contract_info: DataContractInfo::BorrowedDataContract(contract), + document_type_info: DocumentTypeInfo::DocumentTypeRef(document_type), + override_document: false, + }); operations.push(operation); @@ -317,8 +315,8 @@ mod tests { assert_eq!( root_hash, [ - 148, 196, 101, 163, 1, 56, 137, 50, 117, 196, 107, 103, 222, 55, 110, 59, 11, - 177, 172, 37, 17, 234, 56, 154, 232, 24, 208, 220, 27, 128, 201, 97 + 162, 81, 50, 217, 246, 11, 77, 233, 231, 192, 228, 176, 197, 102, 24, 18, 160, + 5, 182, 75, 119, 174, 75, 155, 86, 92, 88, 197, 201, 60, 60, 157 ] ) } diff --git a/packages/rs-drive-abci/src/execution/platform_events/initialization/initial_core_height/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/initialization/initial_core_height/v0/mod.rs index ae673a857c1..ab50a9e6de5 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/initialization/initial_core_height/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/initialization/initial_core_height/v0/mod.rs @@ -2,7 +2,6 @@ use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; -use dashcore_rpc::dashcore_rpc_json::Bip9SoftforkStatus; impl Platform where @@ -45,7 +44,7 @@ where let v20_fork = fork_info.height.unwrap(); if let Some(requested) = requested { - let best = self.core_rpc.get_best_chain_lock()?.core_block_height; + let best = self.core_rpc.get_best_chain_lock()?.block_height; tracing::trace!( requested, diff --git a/packages/rs-drive-abci/src/execution/platform_events/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/mod.rs index 51efcb08668..79821827bea 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/mod.rs @@ -12,16 +12,17 @@ pub(in crate::execution) mod epoch; pub(in crate::execution) mod fee_pool_inwards_distribution; /// Fee pool outwards distribution towards proposers pub(in crate::execution) mod fee_pool_outwards_distribution; -/// Functions related to IdentityCreditWithdrawalTransaction -pub(in crate::execution) mod identity_credit_withdrawal; /// Initialization pub(in crate::execution) mod initialization; /// Protocol upgrade events pub(in crate::execution) mod protocol_upgrade; /// State transition processing pub(in crate::execution) mod state_transition_processing; -/// Platform withdrawals +/// Withdrawal methods pub(in crate::execution) mod withdrawals; /// Events happening what starting to process a block pub(in crate::execution) mod block_start; + +/// Verify the chain lock +pub(in crate::execution) mod core_chain_lock; diff --git a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs index c2d15fa430c..33805f31251 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs @@ -3,20 +3,16 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use dpp::util::deserializer::ProtocolVersion; use dpp::version::PlatformVersion; -use drive::grovedb::Transaction; mod v0; impl Platform { /// Checks for a network upgrade and resets activation window. /// This method should only be called when a new epoch starts. - /// It alters the underlying state but does not change the drive cache. /// /// # Arguments /// /// * `total_hpmns` - The total number of high priority masternodes. - /// * `current_protocol_version_in_consensus` - The current protocol version in consensus. - /// * `transaction` - A transaction argument to interact with the underlying storage. /// /// # Returns /// @@ -34,21 +30,15 @@ impl Platform { pub fn check_for_desired_protocol_upgrade( &self, total_hpmns: u32, - current_protocol_version_in_consensus: ProtocolVersion, - transaction: &Transaction, + platform_version: &PlatformVersion, ) -> Result, Error> { - let current_platform_version = PlatformVersion::get(current_protocol_version_in_consensus)?; - match current_platform_version + match platform_version .drive_abci .methods .protocol_upgrade .check_for_desired_protocol_upgrade { - 0 => self.check_for_desired_protocol_upgrade_v0( - total_hpmns, - current_protocol_version_in_consensus, - transaction, - ), + 0 => self.check_for_desired_protocol_upgrade_v0(total_hpmns, platform_version), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "check_for_desired_protocol_upgrade".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/v0/mod.rs index dfd442eb4bc..107a55bb878 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/v0/mod.rs @@ -1,28 +1,27 @@ use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::platform::Platform; -use dpp::version::PlatformVersion; +use dpp::version::PlatformVersion; use drive::dpp::util::deserializer::ProtocolVersion; -use drive::grovedb::Transaction; - -/// The percentage needed of HPMNs to upgrade the protocol -/// It always needs to be higher than the rounded amount after applying the percentage -const PROTOCOL_VERSION_UPGRADE_PERCENTAGE_NEEDED: u64 = 75; impl Platform { /// checks for a network upgrade and resets activation window /// this should only be called on epoch change - /// this will change backing state, but does not change drive cache pub(super) fn check_for_desired_protocol_upgrade_v0( &self, total_hpmns: u32, - current_protocol_version_in_consensus: ProtocolVersion, - transaction: &Transaction, + platform_version: &PlatformVersion, ) -> Result, Error> { - let required_upgraded_hpns = 1 + let upgrade_percentage_needed = platform_version + .drive_abci + .methods + .protocol_upgrade + .protocol_version_upgrade_percentage_needed; + + let required_upgraded_hpmns = 1 + (total_hpmns as u64) - .checked_mul(PROTOCOL_VERSION_UPGRADE_PERCENTAGE_NEEDED) + .checked_mul(upgrade_percentage_needed) .and_then(|product| product.checked_div(100)) .ok_or(Error::Execution(ExecutionError::Overflow( "overflow for required block count", @@ -30,11 +29,10 @@ impl Platform { // if we are at an epoch change, check to see if over 75% of blocks of previous epoch // were on the future version - let mut cache = self.drive.cache.write().unwrap(); - let mut versions_passing_threshold = cache - .protocol_versions_counter - .versions_passing_threshold(required_upgraded_hpns); - drop(cache); + let protocol_versions_counter = self.drive.cache.protocol_versions_counter.read(); + let mut versions_passing_threshold = + protocol_versions_counter.versions_passing_threshold(required_upgraded_hpmns); + drop(protocol_versions_counter); if versions_passing_threshold.len() > 1 { return Err(Error::Execution( @@ -46,26 +44,13 @@ impl Platform { if !versions_passing_threshold.is_empty() { // same as equals 1 - let new_version = versions_passing_threshold.remove(0); - // Persist current and next epoch protocol versions - // we also drop all protocol version votes information - self.drive - .change_to_new_version_and_clear_version_information( - current_protocol_version_in_consensus, - new_version, - Some(transaction), - ) - .map_err(Error::Drive)?; + let next_version = versions_passing_threshold.remove(0); - Ok(Some(new_version)) - } else { - // we need to drop all version information - let current_platform_version = - PlatformVersion::get(current_protocol_version_in_consensus)?; - self.drive - .clear_version_information(Some(transaction), ¤t_platform_version.drive) - .map_err(Error::Drive)?; + // TODO: We stored next version here previously. + // It was never used so we can temporary remove it from here and move it to Epoch trees in upcoming PR + Ok(Some(next_version)) + } else { Ok(None) } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/mod.rs index a69fee99bb2..b2e1e826d4e 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/mod.rs @@ -1 +1,2 @@ mod check_for_desired_protocol_upgrade; +mod upgrade_protocol_version; diff --git a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/upgrade_protocol_version/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/upgrade_protocol_version/mod.rs new file mode 100644 index 00000000000..18fff0fb658 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/upgrade_protocol_version/mod.rs @@ -0,0 +1,58 @@ +mod v0; + +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::epoch_info::EpochInfo; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use dpp::block::block_info::BlockInfo; +use dpp::version::PlatformVersion; +use drive::grovedb::Transaction; + +impl Platform { + /// Sets current protocol version and next epoch protocol version to block platform state + /// + /// This function should be called on very top of bock production before we add new proposed version for the next epoch + /// + /// It takes five parameters: + /// * `block_info`: Information about the current block. + /// * `epoch_info`: Information about the current epoch. + /// * `last_committed_platform_state`: The last committed state of the platform. + /// * `block_platform_state`: The current state of the platform. + /// * `transaction`: The current transaction. + /// * `platform_version`: The current version of the platform. + /// + /// # Errors + /// + /// This function will return an error if the previous block protocol version does not match the current block protocol version not on epoch change + pub fn upgrade_protocol_version_on_epoch_change( + &self, + block_info: &BlockInfo, + epoch_info: &EpochInfo, + last_committed_platform_state: &PlatformState, + block_platform_state: &mut PlatformState, + transaction: &Transaction, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive_abci + .methods + .protocol_upgrade + .upgrade_protocol_version_on_epoch_change + { + 0 => self.upgrade_protocol_version_on_epoch_change_v0( + block_info, + epoch_info, + last_committed_platform_state, + block_platform_state, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "upgrade_protocol_version_on_epoch_change".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/upgrade_protocol_version/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/upgrade_protocol_version/v0/mod.rs new file mode 100644 index 00000000000..46b793e4fff --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/upgrade_protocol_version/v0/mod.rs @@ -0,0 +1,131 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::epoch_info::v0::{EpochInfoV0Getters, EpochInfoV0Methods}; +use crate::platform_types::epoch_info::EpochInfo; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; +use chrono::{TimeZone, Utc}; +use dpp::block::block_info::BlockInfo; +use dpp::version::PlatformVersion; +use drive::grovedb::Transaction; + +impl Platform { + /// Sets current protocol version and next epoch protocol version to block platform state + /// + /// It takes five parameters: + /// * `epoch_info`: Information about the current epoch. + /// * `last_committed_platform_state`: The last committed state of the platform. + /// * `block_platform_state`: The current state of the platform. + /// * `transaction`: The current transaction. + /// * `platform_version`: The current version of the platform. + /// + /// # Errors + /// + /// This function will return an error if the previous block protocol version does not match the current block protocol version not on epoch change + pub(super) fn upgrade_protocol_version_on_epoch_change_v0( + &self, + block_info: &BlockInfo, + epoch_info: &EpochInfo, + last_committed_platform_state: &PlatformState, + block_platform_state: &mut PlatformState, + transaction: &Transaction, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let previous_block_protocol_version = last_committed_platform_state + .current_platform_version()? + .protocol_version; + let current_block_protocol_version = platform_version.protocol_version; + + // Protocol version can be changed only on epoch change + if epoch_info.is_epoch_change_but_not_genesis() { + if current_block_protocol_version == previous_block_protocol_version { + tracing::info!( + epoch_index = epoch_info.current_epoch_index(), + "protocol version remains the same {}", + current_block_protocol_version, + ); + } else { + tracing::info!( + epoch_index = epoch_info.current_epoch_index(), + "protocol version changed from {} to {}", + previous_block_protocol_version, + current_block_protocol_version, + ); + + block_platform_state + .set_current_protocol_version_in_consensus(current_block_protocol_version); + }; + + // Determine a new protocol version for the next epoch if enough proposers voted + // otherwise keep the current one + + let hpmn_list_len = last_committed_platform_state.hpmn_list_len() as u32; + + let next_epoch_protocol_version = + self.check_for_desired_protocol_upgrade(hpmn_list_len, platform_version)?; + + if let Some(protocol_version) = next_epoch_protocol_version { + block_platform_state.set_next_epoch_protocol_version(protocol_version); + } + + // Since we are starting a new epoch we need to drop previously + // proposed versions + + // Remove previously proposed versions from Drive state + self.drive + .clear_version_information(Some(transaction), &platform_version.drive) + .map_err(Error::Drive)?; + + // We clean voting counter cache only on finalize block because: + // 1. The voting counter global cache uses for querying of voting information in Drive queries + // 2. There might be multiple rounds so on the next round we will lose all previous epoch votes + // + // Instead of clearing cache, the further block processing logic is using `get_if_enabled` + // to get a version counter from the global cache. We disable this getter here to prevent + // reading previous voting information for the new epoch. + // The getter must be enabled back on finalize block in [update_drive_cache] and at the very beginning + // of the block processing in [clear_drive_block_cache]. + + let mut protocol_versions_counter = self.drive.cache.protocol_versions_counter.write(); + protocol_versions_counter.block_global_cache(); + drop(protocol_versions_counter); + } else if current_block_protocol_version != previous_block_protocol_version { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "unexpected protocol upgrade: it should happen only on epoch change", + ))); + } + + // Warn user to update software if the next protocol version is not supported + let latest_supported_protocol_version = PlatformVersion::latest().protocol_version; + let next_epoch_protocol_version = block_platform_state.next_epoch_protocol_version(); + if block_platform_state.next_epoch_protocol_version() > latest_supported_protocol_version { + let genesis_time_ms = self.get_genesis_time( + block_info.height, + block_info.time_ms, + transaction, + platform_version, + )?; + + let next_epoch_activation_datetime_ms = genesis_time_ms + + (epoch_info.current_epoch_index() as u64 + * self.config.execution.epoch_time_length_s + * 1000); + + let next_epoch_activation_datetime = Utc + .timestamp_millis_opt(next_epoch_activation_datetime_ms as i64) + .single() + .expect("next_epoch_activation_date must always be in the range"); + + tracing::warn!( + next_epoch_protocol_version, + latest_supported_protocol_version, + "The node doesn't support new protocol version {} that will be activated starting from {}. Please update your software, otherwise the node won't be able to participate in the network. https://docs.dash.org/platform-protocol-upgrade", + next_epoch_protocol_version, + next_epoch_activation_datetime.to_rfc2822(), + ); + } + + Ok(()) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/decode_raw_state_transitions/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/decode_raw_state_transitions/mod.rs new file mode 100644 index 00000000000..92bf4fc44f2 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/decode_raw_state_transitions/mod.rs @@ -0,0 +1,53 @@ +mod v0; + +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::state_transition_container::StateTransitionContainer; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::version::PlatformVersion; + +impl Platform +where + C: CoreRPCLike, +{ + /// Processes the given raw state transitions based on the `block_info` and `transaction`. + /// + /// # Arguments + /// + /// * `raw_state_transitions` - A reference to a vector of raw state transitions. + /// * `platform_version` - A `PlatformVersion` reference that dictates which version of + /// the method to call. + /// + /// # Returns + /// + /// * `Result<(FeeResult, Vec), Error>` - If the processing is successful, it returns + /// a tuple consisting of a `FeeResult` and a vector of `ExecTxResult`. If the processing fails, + /// it returns an `Error`. + /// + /// # Errors + /// + /// This function may return an `Error` variant if there is a problem with deserializing the raw + /// state transitions, processing state transitions, or executing events. + pub(in crate::execution) fn decode_raw_state_transitions<'a>( + &self, + raw_state_transitions: &'a [impl AsRef<[u8]>], + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .methods + .state_transition_processing + .decode_raw_state_transitions + { + 0 => Ok(self + .decode_raw_state_transitions_v0(raw_state_transitions, platform_version) + .into()), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "decode_raw_state_transitions".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/decode_raw_state_transitions/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/decode_raw_state_transitions/v0/mod.rs new file mode 100644 index 00000000000..fd4b756f868 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/decode_raw_state_transitions/v0/mod.rs @@ -0,0 +1,127 @@ +use crate::execution::types::state_transition_container::v0::{ + DecodedStateTransition, InvalidStateTransition, InvalidWithProtocolErrorStateTransition, + StateTransitionContainerV0, SuccessfullyDecodedStateTransition, +}; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::consensus::basic::decode::SerializedObjectParsingError; +use dpp::consensus::basic::state_transition::StateTransitionMaxSizeExceededError; +use dpp::consensus::basic::BasicError; +use dpp::consensus::ConsensusError; +use dpp::serialization::PlatformDeserializable; +use dpp::state_transition::StateTransition; +use dpp::version::PlatformVersion; +use dpp::ProtocolError; +use std::time::{Duration, Instant}; + +impl Platform +where + C: CoreRPCLike, +{ + /// Decodes and processes raw state transitions for version 0. + /// + /// This method deserializes each raw state transition from the provided vector, attempting to process + /// and categorize them into valid or invalid state transitions based on the deserialization outcome + /// and specific validation rules. It encapsulates the results in a `StateTransitionContainerV0`, + /// which separately tracks valid and invalid state transitions along with any associated errors. + /// + /// ## Arguments + /// + /// - `raw_state_transitions`: A reference to a vector of raw state transitions, where each state transition + /// is represented as a vector of bytes. + /// + /// ## Returns + /// + /// - `StateTransitionContainerV0`: A container holding the processed state transitions, including + /// both successfully deserialized transitions and those that failed validation with their corresponding errors. + /// + /// ## Errors + /// + /// Errors can arise from issues in deserializing the raw state transitions or if the processing of state transitions + /// encounters a scenario that warrants halting further execution. Specific errors include deserialization failures, + /// exceeding the maximum encoded bytes limit for a state transition. Protocol level errors should never occur, but + /// are also included in the result container. + /// + pub(super) fn decode_raw_state_transitions_v0<'a>( + &self, + raw_state_transitions: &'a [impl AsRef<[u8]>], + platform_version: &PlatformVersion, + ) -> StateTransitionContainerV0<'a> { + // Todo: might be better to have StateTransitionContainerV0 be a decoder instead and have + // the method decode_raw_state_transitions + let decoded_state_transitions = raw_state_transitions + .iter() + .map(|raw_state_transition| { + if raw_state_transition.as_ref().len() as u64 + > platform_version + .dpp + .state_transitions + .max_state_transition_size + { + // The state transition is too big + let consensus_error = ConsensusError::BasicError( + BasicError::StateTransitionMaxSizeExceededError( + StateTransitionMaxSizeExceededError::new( + raw_state_transition.as_ref().len() as u64, + platform_version + .dpp + .state_transitions + .max_state_transition_size, + ), + ), + ); + + DecodedStateTransition::InvalidEncoding(InvalidStateTransition { + raw: raw_state_transition.as_ref(), + error: consensus_error, + elapsed_time: Duration::default(), + }) + } else { + let start_time = Instant::now(); + + match StateTransition::deserialize_from_bytes(raw_state_transition.as_ref()) { + Ok(state_transition) => DecodedStateTransition::SuccessfullyDecoded( + SuccessfullyDecodedStateTransition { + decoded: state_transition, + raw: raw_state_transition.as_ref(), + elapsed_time: start_time.elapsed(), + }, + ), + Err(error) => match error { + ProtocolError::PlatformDeserializationError(message) => { + let consensus_error = + SerializedObjectParsingError::new(message.clone()).into(); + + DecodedStateTransition::InvalidEncoding(InvalidStateTransition { + raw: raw_state_transition.as_ref(), + error: consensus_error, + elapsed_time: start_time.elapsed(), + }) + } + ProtocolError::MaxEncodedBytesReachedError { .. } => { + let message = error.to_string(); + let consensus_error = + SerializedObjectParsingError::new(message.clone()).into(); + + DecodedStateTransition::InvalidEncoding(InvalidStateTransition { + raw: raw_state_transition.as_ref(), + error: consensus_error, + elapsed_time: start_time.elapsed(), + }) + } + protocol_error => DecodedStateTransition::FailedToDecode( + InvalidWithProtocolErrorStateTransition { + raw: raw_state_transition.as_ref(), + error: protocol_error, + elapsed_time: start_time.elapsed(), + }, + ), + }, + } + } + }) + .collect(); + + StateTransitionContainerV0::new(decoded_state_transitions) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/mod.rs index 0b8d5e3f4cd..99952972dd2 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/mod.rs @@ -3,10 +3,11 @@ mod v0; use crate::error::execution::ExecutionError; use crate::error::Error; use crate::execution::types::execution_event::ExecutionEvent; +use crate::platform_types::event_execution_result::EventExecutionResult; use crate::platform_types::platform::Platform; -use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult; use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; +use dpp::consensus::ConsensusError; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; @@ -37,17 +38,24 @@ where pub(in crate::execution) fn execute_event( &self, event: ExecutionEvent, + consensus_errors: Vec, block_info: &BlockInfo, transaction: &Transaction, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result { match platform_version .drive_abci .methods .state_transition_processing .execute_event { - 0 => self.execute_event_v0(event, block_info, transaction, platform_version), + 0 => self.execute_event_v0( + event, + consensus_errors, + block_info, + transaction, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "execute_event".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/v0/mod.rs index d0f889d64ad..e7f03575d9e 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/v0/mod.rs @@ -1,13 +1,16 @@ use crate::error::Error; use crate::execution::types::execution_event::ExecutionEvent; -use crate::platform_types::platform::Platform; -use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult; -use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult::{ - ConsensusExecutionError, SuccessfulFreeExecution, SuccessfulPaidExecution, +use crate::execution::types::execution_operation::ValidationOperation; +use crate::platform_types::event_execution_result::EventExecutionResult; +use crate::platform_types::event_execution_result::EventExecutionResult::{ + SuccessfulFreeExecution, SuccessfulPaidExecution, UnpaidConsensusExecutionError, + UnsuccessfulPaidExecution, }; +use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; -use dpp::validation::SimpleConsensusValidationResult; +use dpp::consensus::ConsensusError; +use dpp::fee::fee_result::FeeResult; use dpp::version::PlatformVersion; use drive::drive::identity::update::apply_balance_change_outcome::ApplyBalanceChangeOutcomeV0Methods; use drive::grovedb::Transaction; @@ -41,28 +44,44 @@ where pub(super) fn execute_event_v0( &self, event: ExecutionEvent, + mut consensus_errors: Vec, block_info: &BlockInfo, transaction: &Transaction, platform_version: &PlatformVersion, - ) -> Result { - //todo: we need to split out errors - // between failed execution and internal errors - let validation_result = - self.validate_fees_of_event(&event, block_info, Some(transaction), platform_version)?; + ) -> Result { + let maybe_fee_validation_result = match event { + ExecutionEvent::PaidFromAssetLock { .. } | ExecutionEvent::Paid { .. } => { + Some(self.validate_fees_of_event( + &event, + block_info, + Some(transaction), + platform_version, + )?) + } + ExecutionEvent::PaidFromAssetLockWithoutIdentity { .. } + | ExecutionEvent::Free { .. } => None, + }; match event { - ExecutionEvent::PaidFromAssetLockDriveEvent { + ExecutionEvent::PaidFromAssetLock { identity, operations, + execution_operations, + user_fee_increase, .. } - | ExecutionEvent::PaidDriveEvent { + | ExecutionEvent::Paid { identity, operations, + execution_operations, + user_fee_increase, + .. } => { - if validation_result.is_valid_with_data() { + // We can unwrap here because we have the match right above + let mut fee_validation_result = maybe_fee_validation_result.unwrap(); + if fee_validation_result.is_valid_with_data() { //todo: make this into an atomic event with partial batches - let individual_fee_result = self + let mut individual_fee_result = self .drive .apply_drive_operations( operations, @@ -73,6 +92,14 @@ where ) .map_err(Error::Drive)?; + ValidationOperation::add_many_to_fee_result( + &execution_operations, + &mut individual_fee_result, + platform_version, + )?; + + individual_fee_result.apply_user_fee_increase(user_fee_increase); + let balance_change = individual_fee_result.into_balance_change(identity.id); let outcome = self.drive.apply_balance_change_from_fee_to_identity( @@ -81,17 +108,53 @@ where platform_version, )?; + if consensus_errors.is_empty() { + Ok(SuccessfulPaidExecution( + Some(fee_validation_result.into_data()?), + outcome.actual_fee_paid_owned(), + )) + } else { + Ok(UnsuccessfulPaidExecution( + Some(fee_validation_result.into_data()?), + outcome.actual_fee_paid_owned(), + consensus_errors, + )) + } + } else { + consensus_errors.append(&mut fee_validation_result.errors); + Ok(UnpaidConsensusExecutionError(consensus_errors)) + } + } + // This is for Partially used Asset Locks + // NOT used for identity create or identity top up + ExecutionEvent::PaidFromAssetLockWithoutIdentity { + processing_fees, + operations, + } => { + self.drive + .apply_drive_operations( + operations, + true, + block_info, + Some(transaction), + platform_version, + ) + .map_err(Error::Drive)?; + + if consensus_errors.is_empty() { Ok(SuccessfulPaidExecution( - validation_result.into_data()?, - outcome.actual_fee_paid_owned(), + None, + FeeResult::default_with_fees(0, processing_fees), )) } else { - Ok(ConsensusExecutionError( - SimpleConsensusValidationResult::new_with_errors(validation_result.errors), + Ok(UnsuccessfulPaidExecution( + None, + FeeResult::default_with_fees(0, processing_fees), + consensus_errors, )) } } - ExecutionEvent::FreeDriveEvent { operations } => { + ExecutionEvent::Free { operations } => { self.drive .apply_drive_operations( operations, diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/mod.rs index 56add58ac01..b8e08aad2ad 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/mod.rs @@ -1,3 +1,4 @@ +mod decode_raw_state_transitions; mod execute_event; mod process_raw_state_transitions; mod validate_fees_of_event; diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/mod.rs index 5f26cd86f79..288c571dbba 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/mod.rs @@ -4,13 +4,11 @@ use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::PlatformState; -use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult; +use crate::platform_types::state_transitions_processing_result::StateTransitionsProcessingResult; use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; -use dpp::fee::fee_result::FeeResult; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; -use tenderdash_abci::proto::abci::ExecTxResult; impl Platform where @@ -44,7 +42,7 @@ where block_info: &BlockInfo, transaction: &Transaction, platform_version: &PlatformVersion, - ) -> Result<(FeeResult, Vec<(Vec, StateTransitionExecutionResult)>), Error> { + ) -> Result { match platform_version .drive_abci .methods diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/v0/mod.rs index e6c04fb97e7..29827900d00 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/v0/mod.rs @@ -1,22 +1,34 @@ use crate::error::Error; -use crate::execution::validation::state_transition::processor::process_state_transition; use crate::platform_types::platform::{Platform, PlatformRef}; use crate::platform_types::platform_state::PlatformState; -use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult::{ - ConsensusExecutionError, SuccessfulPaidExecution, -}; use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; -use dpp::dashcore; -use dpp::dashcore::hashes::Hash; +use dpp::consensus::codes::ErrorWithCode; use dpp::fee::fee_result::FeeResult; -use dpp::state_transition::StateTransition; -use dpp::validation::SimpleConsensusValidationResult; +use dpp::util::hash::hash_single; +use dpp::validation::ConsensusValidationResult; +use std::time::Instant; -use crate::platform_types::state_transition_execution_result::StateTransitionExecutionResult; +use crate::execution::types::execution_event::ExecutionEvent; +use crate::execution::types::state_transition_container::v0::{ + DecodedStateTransition, InvalidStateTransition, InvalidWithProtocolErrorStateTransition, + SuccessfullyDecodedStateTransition, +}; +use crate::execution::validation::state_transition::processor::process_state_transition; +use crate::metrics::state_transition_execution_histogram; +use crate::platform_types::event_execution_result::EventExecutionResult; +use crate::platform_types::state_transitions_processing_result::{ + StateTransitionExecutionResult, StateTransitionsProcessingResult, +}; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; +struct StateTransitionAwareError<'t> { + error: Error, + raw_state_transition: &'t [u8], + state_transition_name: Option, +} + impl Platform where C: CoreRPCLike, @@ -35,9 +47,9 @@ where /// /// # Returns /// - /// * `Result<(FeeResult, Vec), Error>` - If the processing is successful, it returns - /// a tuple consisting of a `FeeResult` and a vector of `ExecTxResult`. If the processing fails, - /// it returns an `Error`. + /// * `Result` - If the processing is successful, it returns + /// a `StateTransitionsProcessingResult` with state transition execution results and aggregated information. + /// If the processing fails, it returns an `Error`. /// /// # Errors /// @@ -46,88 +58,390 @@ where /// pub(super) fn process_raw_state_transitions_v0( &self, - raw_state_transitions: &Vec>, + raw_state_transitions: &[Vec], block_platform_state: &PlatformState, block_info: &BlockInfo, transaction: &Transaction, platform_version: &PlatformVersion, - ) -> Result<(FeeResult, Vec<(Vec, StateTransitionExecutionResult)>), Error> { - let state_transitions = StateTransition::deserialize_many(raw_state_transitions)?; - let mut aggregate_fee_result = FeeResult::default(); + ) -> Result { let platform_ref = PlatformRef { drive: &self.drive, state: block_platform_state, config: &self.config, core_rpc: &self.core_rpc, - block_info, }; - let exec_tx_results = state_transitions - .into_iter() - .zip(raw_state_transitions.iter()) - .map(|(state_transition, raw_state_transition)| { - let state_transition_execution_event = process_state_transition( - &platform_ref, - state_transition.clone(), - Some(transaction), - )?; - - // Tenderdash hex-encoded ST hash - let mut st_hash = String::new(); - if tracing::enabled!(tracing::Level::TRACE) { - st_hash = hex::encode( - dashcore::hashes::sha256::Hash::hash(raw_state_transition).to_byte_array(), + + let state_transition_container = + self.decode_raw_state_transitions(raw_state_transitions, platform_version)?; + + let mut processing_result = StateTransitionsProcessingResult::default(); + + for decoded_state_transition in state_transition_container.into_iter() { + let execution_result = match decoded_state_transition { + DecodedStateTransition::SuccessfullyDecoded( + SuccessfullyDecodedStateTransition { + decoded: state_transition, + raw: raw_state_transition, + elapsed_time: decoding_elapsed_time, + }, + ) => { + let start_time = Instant::now(); + + let state_transition_name = state_transition.name(); + + if tracing::enabled!(tracing::Level::TRACE) { + let st_hash = hex::encode(hash_single(raw_state_transition)); + + tracing::trace!( + ?state_transition, + st_hash, + "Processing {} state transition", + state_transition_name + ); + } + + // Validate state transition and produce an execution event + let execution_result = process_state_transition( + &platform_ref, + block_info, + state_transition, + Some(transaction), + ) + .map(|validation_result| { + self.process_validation_result_v0( + raw_state_transition, + state_transition_name, + validation_result, + block_info, + transaction, + platform_version, + ) + .unwrap_or_else(error_to_internal_error_execution_result) + }) + .map_err(|error| StateTransitionAwareError { + error, + raw_state_transition, + state_transition_name: Some(state_transition_name.to_string()), + }) + .unwrap_or_else(error_to_internal_error_execution_result); + + // Store metrics + let elapsed_time = start_time.elapsed() + decoding_elapsed_time; + + let code = match &execution_result { + StateTransitionExecutionResult::SuccessfulExecution(_, _) => 0, + StateTransitionExecutionResult::PaidConsensusError(error, _) + | StateTransitionExecutionResult::UnpaidConsensusError(error) => { + error.code() + } + StateTransitionExecutionResult::InternalError(_) => 1, + }; + + state_transition_execution_histogram(elapsed_time, state_transition_name, code); + + execution_result + } + DecodedStateTransition::InvalidEncoding(InvalidStateTransition { + raw, + error, + elapsed_time: decoding_elapsed_time, + }) => { + if tracing::enabled!(tracing::Level::DEBUG) { + let st_hash = hex::encode(hash_single(raw)); + + tracing::debug!( + ?error, + st_hash, + "Invalid unknown state transition ({}): {}", + st_hash, + error + ); + } + + // Store metrics + state_transition_execution_histogram( + decoding_elapsed_time, + "Unknown", + error.code(), ); + + StateTransitionExecutionResult::UnpaidConsensusError(error) } + DecodedStateTransition::FailedToDecode( + InvalidWithProtocolErrorStateTransition { + raw, + error: protocol_error, + elapsed_time: decoding_elapsed_time, + }, + ) => { + // Store metrics + state_transition_execution_histogram(decoding_elapsed_time, "Unknown", 1); - let execution_result = if state_transition_execution_event.is_valid() { - let execution_event = state_transition_execution_event.into_data()?; + error_to_internal_error_execution_result(StateTransitionAwareError { + error: protocol_error.into(), + raw_state_transition: raw, + state_transition_name: None, + }) + } + }; - let result = self.execute_event( - execution_event, - block_info, - transaction, - platform_version, - )?; + processing_result.add(execution_result)?; + } + + Ok(processing_result) + } + + fn process_validation_result_v0<'a>( + &self, + raw_state_transition: &'a [u8], //used for errors + state_transition_name: &str, + mut validation_result: ConsensusValidationResult, + block_info: &BlockInfo, + transaction: &Transaction, + platform_version: &PlatformVersion, + ) -> Result> { + // State Transition is invalid + if !validation_result.is_valid() { + // To prevent spam we should deduct fees for invalid state transitions as well. + // There are three cases when the user can't pay fees: + // 1. The state transition is funded by an asset lock transactions. This transactions are + // placed on the payment blockchain and they can't be partially spent. + // 2. We can't prove that the state transition is associated with the identity + // 3. The revision given by the state transition isn't allowed based on the state + if validation_result.data.is_none() { + let first_consensus_error = validation_result + .errors + // the first error must be present for an invalid result + .remove(0); + + // We don't have execution event, so we can't pay for processing + return Ok(StateTransitionExecutionResult::UnpaidConsensusError( + first_consensus_error, + )); + }; + + let (execution_event, errors) = validation_result + .into_data_and_errors() + .expect("data must be present since we check it few lines above"); + + let first_consensus_error = errors + .first() + .expect("error must be present since we check it few lines above") + .clone(); + + // In this case the execution event will be to pay for the state transition processing + // This ONLY pays for what is needed to prevent attacks on the system + + let event_execution_result = self + .execute_event( + execution_event, + errors, + block_info, + transaction, + platform_version, + ) + .map_err(|error| StateTransitionAwareError { + error, + raw_state_transition, + state_transition_name: Some(state_transition_name.to_string()), + })?; + + let state_transition_execution_result = match event_execution_result { + EventExecutionResult::SuccessfulPaidExecution(estimated_fees, actual_fees) + | EventExecutionResult::UnsuccessfulPaidExecution(estimated_fees, actual_fees, _) => + { + if tracing::enabled!(tracing::Level::DEBUG) { + let st_hash = hex::encode(hash_single(raw_state_transition)); + + tracing::debug!( + error = ?first_consensus_error, + st_hash, + ?estimated_fees, + ?actual_fees, + "Invalid {} state transition ({}): {}", + state_transition_name, + st_hash, + &first_consensus_error + ); + } + + StateTransitionExecutionResult::PaidConsensusError( + first_consensus_error, + actual_fees, + ) + } + EventExecutionResult::SuccessfulFreeExecution => { + if tracing::enabled!(tracing::Level::DEBUG) { + let st_hash = hex::encode(hash_single(raw_state_transition)); + + tracing::debug!( + error = ?first_consensus_error, + st_hash, + "Free invalid {} state transition ({}): {}", + state_transition_name, + st_hash, + &first_consensus_error + ); + } + + StateTransitionExecutionResult::UnpaidConsensusError(first_consensus_error) + } + EventExecutionResult::UnpaidConsensusExecutionError(mut payment_errors) => { + let payment_consensus_error = payment_errors + // the first error must be present for an invalid result + .remove(0); + + if tracing::enabled!(tracing::Level::ERROR) { + let st_hash = hex::encode(hash_single(raw_state_transition)); + + tracing::error!( + main_error = ?first_consensus_error, + payment_error = ?payment_consensus_error, + st_hash, + "Not able to reduce balance for identity {} state transition ({}): {}", + state_transition_name, + st_hash, + payment_consensus_error + ); + } + + StateTransitionExecutionResult::InternalError(format!( + "{first_consensus_error} {payment_consensus_error}", + )) + } + }; + + return Ok(state_transition_execution_result); + } + + let (execution_event, errors) = + validation_result.into_data_and_errors().map_err(|error| { + StateTransitionAwareError { + error: error.into(), + raw_state_transition, + state_transition_name: Some(state_transition_name.to_string()), + } + })?; + + let event_execution_result = self + .execute_event( + execution_event, + errors, + block_info, + transaction, + platform_version, + ) + .map_err(|error| StateTransitionAwareError { + error, + raw_state_transition, + state_transition_name: Some(state_transition_name.to_string()), + })?; + + let state_transition_execution_result = match event_execution_result { + EventExecutionResult::SuccessfulPaidExecution(estimated_fees, actual_fees) => { + if tracing::enabled!(tracing::Level::DEBUG) { + let st_hash = hex::encode(hash_single(raw_state_transition)); tracing::debug!( - method = "process_raw_state_transitions_v0", + ?actual_fees, + ?estimated_fees, + st_hash, "{} state transition ({}) successfully processed", - state_transition.name(), + state_transition_name, st_hash, ); + } - tracing::trace!(?state_transition, "State transition"); + StateTransitionExecutionResult::SuccessfulExecution(estimated_fees, actual_fees) + } + EventExecutionResult::UnsuccessfulPaidExecution( + estimated_fees, + actual_fees, + mut errors, + ) => { + let payment_consensus_error = errors + // the first error must be present for an invalid result + .remove(0); - result - } else { - let first_consensus_error = state_transition_execution_event - .errors - .first() - .expect("first error must be present for invalid result"); + if tracing::enabled!(tracing::Level::DEBUG) { + let st_hash = hex::encode(hash_single(raw_state_transition)); tracing::debug!( - errors = ?state_transition_execution_event.errors, - method = "process_raw_state_transitions_v0", - "Invalid {} state transition ({}): {}", - state_transition.name(), + ?actual_fees, + ?estimated_fees, st_hash, - first_consensus_error + "{} state transition ({}) processed and mark as invalid: {}", + state_transition_name, + st_hash, + payment_consensus_error ); + } - tracing::trace!(?state_transition, "State transition"); + StateTransitionExecutionResult::PaidConsensusError( + payment_consensus_error, + actual_fees, + ) + } + EventExecutionResult::SuccessfulFreeExecution => { + if tracing::enabled!(tracing::Level::DEBUG) { + let st_hash = hex::encode(hash_single(raw_state_transition)); - ConsensusExecutionError(SimpleConsensusValidationResult::new_with_errors( - state_transition_execution_event.errors, - )) - }; - if let SuccessfulPaidExecution(_, fee_result) = &execution_result { - aggregate_fee_result.checked_add_assign(fee_result.clone())?; + tracing::debug!( + st_hash, + "Free {} state transition ({}) successfully processed", + state_transition_name, + st_hash, + ); } - Ok((raw_state_transition.clone(), execution_result)) - }) - .collect::, StateTransitionExecutionResult)>, Error>>()?; + StateTransitionExecutionResult::SuccessfulExecution(None, FeeResult::default()) + } + EventExecutionResult::UnpaidConsensusExecutionError(mut errors) => { + // TODO: In case of balance is not enough, we need to reduce balance only for processing fees + // and return paid consensus error. + // Unpaid consensus error should be only if balance not enough even + // to cover processing fees + let first_consensus_error = errors + // the first error must be present for an invalid result + .remove(0); + + if tracing::enabled!(tracing::Level::DEBUG) { + let st_hash = hex::encode(hash_single(raw_state_transition)); - Ok((aggregate_fee_result, exec_tx_results)) + tracing::debug!( + error = ?first_consensus_error, + st_hash, + "Insufficient identity balance to process {} state transition ({}): {}", + state_transition_name, + st_hash, + first_consensus_error + ); + } + + StateTransitionExecutionResult::UnpaidConsensusError(first_consensus_error) + } + }; + + Ok(state_transition_execution_result) } } + +fn error_to_internal_error_execution_result( + error_with_st: StateTransitionAwareError, +) -> StateTransitionExecutionResult { + if tracing::enabled!(tracing::Level::ERROR) { + let st_hash = hex::encode(hash_single(error_with_st.raw_state_transition)); + + tracing::error!( + error = ?error_with_st.error, + raw_state_transition = ?error_with_st.raw_state_transition, + st_hash, + "Failed to process {} state transition ({}) : {}", + error_with_st.state_transition_name.unwrap_or_else(|| "unknown".to_string()), + st_hash, + error_with_st.error, + ); + } + + StateTransitionExecutionResult::InternalError(error_with_st.error.to_string()) +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/v0/mod.rs index d2d35895c90..86b6dd890b8 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/v0/mod.rs @@ -1,14 +1,17 @@ use crate::error::execution::ExecutionError; use crate::error::Error; use crate::execution::types::execution_event::ExecutionEvent; +use crate::execution::types::execution_operation::ValidationOperation; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; use dpp::consensus::state::identity::IdentityInsufficientBalanceError; use dpp::consensus::state::state_error::StateError; use dpp::fee::fee_result::FeeResult; + use dpp::prelude::ConsensusValidationResult; use dpp::version::PlatformVersion; + use drive::grovedb::TransactionArg; impl Platform @@ -40,16 +43,18 @@ where platform_version: &PlatformVersion, ) -> Result, Error> { match event { - ExecutionEvent::PaidFromAssetLockDriveEvent { + ExecutionEvent::PaidFromAssetLock { identity, added_balance, operations, + execution_operations, + user_fee_increase, } => { let previous_balance = identity.balance.ok_or(Error::Execution( ExecutionError::CorruptedCodeExecution("partial identity info with no balance"), ))?; let previous_balance_with_top_up = previous_balance + added_balance; - let estimated_fee_result = self + let mut estimated_fee_result = self .drive .apply_drive_operations( operations.clone(), @@ -60,6 +65,14 @@ where ) .map_err(Error::Drive)?; + ValidationOperation::add_many_to_fee_result( + execution_operations, + &mut estimated_fee_result, + platform_version, + )?; + + estimated_fee_result.apply_user_fee_increase(*user_fee_increase); + // TODO: Should take into account refunds as well let total_fee = estimated_fee_result.total_base_fee(); if previous_balance_with_top_up >= total_fee { @@ -80,14 +93,19 @@ where )) } } - ExecutionEvent::PaidDriveEvent { + ExecutionEvent::Paid { identity, + removed_balance, operations, + execution_operations, + user_fee_increase, } => { let balance = identity.balance.ok_or(Error::Execution( ExecutionError::CorruptedCodeExecution("partial identity info with no balance"), ))?; - let estimated_fee_result = self + let balance_after_principal_operation = + balance.saturating_sub(removed_balance.unwrap_or_default()); + let mut estimated_fee_result = self .drive .apply_drive_operations( operations.clone(), @@ -98,9 +116,17 @@ where ) .map_err(Error::Drive)?; + ValidationOperation::add_many_to_fee_result( + execution_operations, + &mut estimated_fee_result, + platform_version, + )?; + + estimated_fee_result.apply_user_fee_increase(*user_fee_increase); + // TODO: Should take into account refunds as well let required_balance = estimated_fee_result.total_base_fee(); - if balance >= required_balance { + if balance_after_principal_operation >= required_balance { Ok(ConsensusValidationResult::new_with_data( estimated_fee_result, )) @@ -118,9 +144,10 @@ where )) } } - ExecutionEvent::FreeDriveEvent { .. } => Ok(ConsensusValidationResult::new_with_data( - FeeResult::default(), - )), + ExecutionEvent::Free { .. } + | ExecutionEvent::PaidFromAssetLockWithoutIdentity { .. } => Ok( + ConsensusValidationResult::new_with_data(FeeResult::default()), + ), } } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/append_signatures_and_broadcast_withdrawal_transactions/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/append_signatures_and_broadcast_withdrawal_transactions/mod.rs new file mode 100644 index 00000000000..de42c73bda7 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/append_signatures_and_broadcast_withdrawal_transactions/mod.rs @@ -0,0 +1,39 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::withdrawal::unsigned_withdrawal_txs::v0::UnsignedWithdrawalTxs; +use crate::rpc::core::CoreRPCLike; +use dpp::dashcore::bls_sig_utils::BLSSignature; +use dpp::version::PlatformVersion; + +mod v0; + +impl Platform +where + C: CoreRPCLike, +{ + /// Appends signatures to unsigned withdrawal transactions and broadcast them to Core + pub(in crate::execution) fn append_signatures_and_broadcast_withdrawal_transactions( + &self, + unsigned_withdrawal_transactions: UnsignedWithdrawalTxs, + signatures: Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive_abci + .methods + .withdrawals + .append_signatures_and_broadcast_withdrawal_transactions + { + 0 => self.append_signatures_and_broadcast_withdrawal_transactions_v0( + unsigned_withdrawal_transactions, + signatures, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "append_signatures_and_broadcast_withdrawal_transactions".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/append_signatures_and_broadcast_withdrawal_transactions/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/append_signatures_and_broadcast_withdrawal_transactions/v0/mod.rs new file mode 100644 index 00000000000..e0a14a88c70 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/append_signatures_and_broadcast_withdrawal_transactions/v0/mod.rs @@ -0,0 +1,151 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::withdrawal::unsigned_withdrawal_txs::v0::UnsignedWithdrawalTxs; +use crate::rpc::core::{ + CoreRPCLike, CORE_RPC_ERROR_ASSET_UNLOCK_EXPIRED, CORE_RPC_ERROR_ASSET_UNLOCK_NO_ACTIVE_QUORUM, + CORE_RPC_TX_ALREADY_IN_CHAIN, +}; +use dashcore_rpc::jsonrpc; +use dashcore_rpc::Error as CoreRPCError; +use dpp::dashcore::bls_sig_utils::BLSSignature; +use dpp::dashcore::transaction::special_transaction::TransactionPayload::AssetUnlockPayloadType; +use dpp::dashcore::{consensus, Txid}; + +use std::fs::{self, File}; +use std::io::Write; +use std::path::Path; +use std::time::{SystemTime, UNIX_EPOCH}; + +impl Platform +where + C: CoreRPCLike, +{ + pub(super) fn append_signatures_and_broadcast_withdrawal_transactions_v0( + &self, + unsigned_withdrawal_transactions: UnsignedWithdrawalTxs, + signatures: Vec, + ) -> Result<(), Error> { + if unsigned_withdrawal_transactions.is_empty() { + return Ok(()); + } + + if unsigned_withdrawal_transactions.len() != signatures.len() { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "number of signatures must match number of withdrawal transactions", + ))); + } + + tracing::debug!( + "Broadcasting {} withdrawal transactions", + unsigned_withdrawal_transactions.len(), + ); + + let mut transaction_submission_failures = vec![]; + + for (mut transaction, signature) in + unsigned_withdrawal_transactions.into_iter().zip(signatures) + { + let Some(AssetUnlockPayloadType(mut payload)) = transaction.special_transaction_payload + else { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "withdrawal transaction payload must be AssetUnlockPayloadType", + ))); + }; + + payload.quorum_sig = signature; + + let index = payload.base.index; + + transaction.special_transaction_payload = Some(AssetUnlockPayloadType(payload)); + + let tx_bytes = consensus::serialize(&transaction); + + // TODO: We need to broadcast all or none of the transactions (in case of error) + // will be fixed in upcoming PR + match self.core_rpc.send_raw_transaction(&tx_bytes) { + Ok(_) => { + tracing::debug!( + tx_id = transaction.txid().to_hex(), + index, + "Successfully broadcasted withdrawal transaction with index {}", + index + ); + } + // Ignore errors that can happen during blockchain synchronization. + // They will be logged with dashcore_rpc + Err(CoreRPCError::JsonRpc(jsonrpc::error::Error::Rpc(e))) + if e.code == CORE_RPC_TX_ALREADY_IN_CHAIN + || e.message == CORE_RPC_ERROR_ASSET_UNLOCK_NO_ACTIVE_QUORUM + || e.message == CORE_RPC_ERROR_ASSET_UNLOCK_EXPIRED => + { + // These will never work again + } + // Errors that can happen if we created invalid tx or Core isn't responding + Err(e) => { + tracing::error!( + tx_id = transaction.txid().to_string(), + index, + "Failed to broadcast asset unlock transaction {}: {}", + index, + e + ); + // These errors might allow the state transition to be broadcast in the future + transaction_submission_failures.push((transaction.txid(), tx_bytes)); + } + } + } + + if let Some(ref rejections_path) = self.config.rejections_path { + store_transaction_failures(transaction_submission_failures, rejections_path) + .map_err(|e| Error::Execution(e.into()))?; + } + + Ok(()) + } +} + +// Function to handle the storage of transaction submission failures +fn store_transaction_failures( + failures: Vec<(Txid, Vec)>, + dir_path: &Path, +) -> std::io::Result<()> { + if failures.is_empty() { + return Ok(()); + } + + // Ensure the directory exists + fs::create_dir_all(dir_path).map_err(|e| { + std::io::Error::new( + e.kind(), + format!("cannot create dir {}: {}", dir_path.display(), e), + ) + })?; + + // Get the current timestamp + let timestamp = SystemTime::now() + .duration_since(UNIX_EPOCH) + .expect("expected system time to be after unix epoch time") + .as_secs(); + + for (tx_id, transaction) in failures { + // Create the file name + let file_name = dir_path.join(format!("tx_{}_{}.dat", timestamp, tx_id)); + + // Write the bytes to the file + let mut file = File::create(&file_name).map_err(|e| { + std::io::Error::new( + e.kind(), + format!("cannot create file {}: {}", file_name.display(), e), + ) + })?; + file.write_all(&transaction).map_err(|e| { + std::io::Error::new( + e.kind(), + format!("cannot write to file {}: {}", file_name.display(), e), + ) + })?; + } + + Ok(()) +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/build_untied_withdrawal_transactions_from_documents/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/build_untied_withdrawal_transactions_from_documents/mod.rs new file mode 100644 index 00000000000..e4cd110298d --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/build_untied_withdrawal_transactions_from_documents/mod.rs @@ -0,0 +1,55 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::document::Document; +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use drive::drive::identity::withdrawals::{ + WithdrawalTransactionIndex, WithdrawalTransactionIndexAndBytes, +}; +use std::collections::HashMap; + +mod v0; + +impl Platform +where + C: CoreRPCLike, +{ + /// Builds a list of Core transactions from withdrawal documents. This function is a version handler that + /// directs to specific version implementations of the `build_withdrawal_transactions_from_documents` function. + /// + /// # Arguments + /// + /// * `documents` - A slice of `Document`. + /// * `drive_operation_types` - A mutable reference to `Vec`. + /// * `transaction` - A `TransactionArg` reference. + /// * `platform_version` - A `PlatformVersion` reference that dictates which version of + /// the method to call. + /// + /// # Returns + /// + /// * `Result, Error>` - Returns a HashMap containing withdrawal transactions if found, otherwise returns an `Error`. + pub(in crate::execution::platform_events::withdrawals) fn build_untied_withdrawal_transactions_from_documents( + &self, + documents: &[Document], + start_index: WithdrawalTransactionIndex, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .methods + .withdrawals + .build_untied_withdrawal_transactions_from_documents + { + 0 => { + self.build_untied_withdrawal_transactions_from_documents_v0(documents, start_index) + } + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "build_untied_withdrawal_transactions_from_documents".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/build_untied_withdrawal_transactions_from_documents/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/build_untied_withdrawal_transactions_from_documents/v0/mod.rs new file mode 100644 index 00000000000..e86aa33f61a --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/build_untied_withdrawal_transactions_from_documents/v0/mod.rs @@ -0,0 +1,235 @@ +use std::collections::HashMap; + +use dashcore_rpc::dashcore::{ + blockdata::transaction::special_transaction::asset_unlock::{ + qualified_asset_unlock::ASSET_UNLOCK_TX_SIZE, + unqualified_asset_unlock::{AssetUnlockBasePayload, AssetUnlockBaseTransactionInfo}, + }, + consensus::Encodable, + ScriptBuf, TxOut, +}; +use dpp::document::{Document, DocumentV0Getters}; +use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; +use dpp::system_data_contracts::withdrawals_contract::v1::document_types::withdrawal; + +use drive::dpp::identifier::Identifier; +use drive::dpp::identity::convert_credits_to_duffs; +use drive::drive::identity::withdrawals::{ + WithdrawalTransactionIndex, WithdrawalTransactionIndexAndBytes, +}; + +use crate::{ + error::{execution::ExecutionError, Error}, + platform_types::platform::Platform, + rpc::core::CoreRPCLike, +}; + +impl Platform +where + C: CoreRPCLike, +{ + /// Build list of Core transactions from withdrawal documents + pub(super) fn build_untied_withdrawal_transactions_from_documents_v0( + &self, + documents: &[Document], + start_index: WithdrawalTransactionIndex, + ) -> Result, Error> { + let mut withdrawals: HashMap = + HashMap::new(); + + for (i, document) in documents.iter().enumerate() { + let output_script_bytes = document + .properties() + .get_bytes(withdrawal::properties::OUTPUT_SCRIPT) + .map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "Can't get outputScript from withdrawal document", + )) + })?; + + let amount = document + .properties() + .get_integer(withdrawal::properties::AMOUNT) + .map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "Can't get amount from withdrawal document", + )) + })?; + + let core_fee_per_byte: u32 = document + .properties() + .get_integer(withdrawal::properties::CORE_FEE_PER_BYTE) + .map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "Can't get coreFeePerByte from withdrawal document", + )) + })?; + + let output_script = ScriptBuf::from_bytes(output_script_bytes); + + let tx_out = TxOut { + value: convert_credits_to_duffs(amount)?, + script_pubkey: output_script, + }; + + let transaction_index = start_index + i as WithdrawalTransactionIndex; + + let withdrawal_transaction = AssetUnlockBaseTransactionInfo { + version: 1, + lock_time: 0, + output: vec![tx_out], + base_payload: AssetUnlockBasePayload { + version: 1, + index: transaction_index, + fee: ASSET_UNLOCK_TX_SIZE as u32 * core_fee_per_byte, + }, + }; + + let mut transaction_buffer: Vec = vec![]; + + withdrawal_transaction + .consensus_encode(&mut transaction_buffer) + .map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "Can't consensus encode a withdrawal transaction", + )) + })?; + + withdrawals.insert(document.id(), (transaction_index, transaction_buffer)); + } + + Ok(withdrawals) + } +} + +#[cfg(test)] +mod tests { + + use dpp::withdrawal::Pooling; + use dpp::{ + data_contracts::withdrawals_contract, tests::fixtures::get_withdrawal_document_fixture, + }; + use drive::tests::helpers::setup::setup_document; + + mod build_withdrawal_transactions_from_documents { + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::data_contracts::withdrawals_contract::v1::document_types::withdrawal; + use dpp::identity::core_script::CoreScript; + use dpp::platform_value::platform_value; + use dpp::prelude::Identifier; + use dpp::system_data_contracts::{load_system_data_contract, SystemDataContract}; + use dpp::version::PlatformVersion; + use drive::drive::identity::withdrawals::WithdrawalTransactionIndexAndBytes; + use drive::tests::helpers::setup::setup_system_data_contract; + use itertools::Itertools; + + use crate::test::helpers::setup::TestPlatformBuilder; + + use super::*; + + #[test] + fn test_build() { + let platform_version = PlatformVersion::latest(); + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + let transaction = platform.drive.grove.start_transaction(); + + let data_contract = + load_system_data_contract(SystemDataContract::Withdrawals, platform_version) + .expect("to load system data contract"); + + setup_system_data_contract(&platform.drive, &data_contract, Some(&transaction)); + + let owner_id = Identifier::new([1u8; 32]); + + let document_1 = get_withdrawal_document_fixture( + &data_contract, + owner_id, + platform_value!({ + "amount": 1000u64, + "coreFeePerByte": 1u32, + "pooling": Pooling::Never as u8, + "outputScript": CoreScript::from_bytes((0..23).collect::>()), + "status": withdrawals_contract::WithdrawalStatus::POOLED as u8, + "transactionIndex": 1u64, + }), + None, + platform_version.protocol_version, + ) + .expect("expected withdrawal document"); + + let document_type = data_contract + .document_type_for_name(withdrawal::NAME) + .expect("expected to get document type"); + + setup_document( + &platform.drive, + &document_1, + &data_contract, + document_type, + Some(&transaction), + ); + + let document_2 = get_withdrawal_document_fixture( + &data_contract, + owner_id, + platform_value!({ + "amount": 1000u64, + "coreFeePerByte": 1u32, + "pooling": Pooling::Never as u8, + "outputScript": CoreScript::from_bytes((0..23).collect::>()), + "status": withdrawals_contract::WithdrawalStatus::POOLED as u8, + "transactionIndex": 2u64, + }), + None, + platform_version.protocol_version, + ) + .expect("expected withdrawal document"); + + setup_document( + &platform.drive, + &document_2, + &data_contract, + document_type, + Some(&transaction), + ); + + let documents = vec![document_1, document_2]; + + let transactions = platform + .build_untied_withdrawal_transactions_from_documents_v0(&documents, 50) + .expect("to build transactions from documents"); + + assert_eq!( + transactions + .values() + .cloned() + .sorted() + .collect::>(), + vec![ + ( + 50, + vec![ + 1, 0, 9, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 23, 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 0, 0, 0, + 1, 50, 0, 0, 0, 0, 0, 0, 0, 190, 0, 0, 0 + ], + ), + ( + 51, + vec![ + 1, 0, 9, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 23, 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 0, 0, 0, + 1, 51, 0, 0, 0, 0, 0, 0, 0, 190, 0, 0, 0 + ], + ), + ] + .into_iter() + .sorted() + .collect::>(), + ); + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/check_withdrawals/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/check_withdrawals/mod.rs deleted file mode 100644 index a1f73a4753a..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/check_withdrawals/mod.rs +++ /dev/null @@ -1,74 +0,0 @@ -use crate::abci::AbciError; -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::platform_types::platform::Platform; -use crate::platform_types::withdrawal::withdrawal_txs; -use crate::rpc::core::CoreRPCLike; -use dpp::bls_signatures; -use dpp::validation::SimpleValidationResult; -use dpp::version::PlatformVersion; - -mod v0; - -impl Platform -where - C: CoreRPCLike, -{ - /// Version-dependent method that checks the validity of withdrawal transactions. - /// - /// Based on the `platform_version` passed, this function will route to the appropriate versioned - /// implementation of the `check_withdrawals` method. Each implementation will compare the received - /// withdrawal transactions with the expected ones, returning an error if they do not match. - /// - /// If a validator public key is provided, each versioned method also verifies the withdrawal - /// transactions' signatures. The `platform_version` parameter dictates which version of the - /// method to call. If an unsupported version is passed, the function will return an - /// `Error::Execution` with an `ExecutionError::UnknownVersionMismatch` error. - /// - /// # Arguments - /// - /// * `received_withdrawals` - The withdrawal transactions received. - /// * `our_withdrawals` - The expected withdrawal transactions. - /// * `height` - The block height. - /// * `round` - The consensus round. - /// * `verify_with_validator_public_key` - An optional reference to a validator public key. - /// * `quorum_hash` - An optional byte slice reference containing the quorum hash. - /// * `platform_version` - A `PlatformVersion` reference dictating which version of the method to call. - /// - /// # Returns - /// - /// * `Result, Error>` - On success, a `SimpleValidationResult` - /// containing an `AbciError` is returned. On error, an `Error` is returned. - /// - pub(crate) fn check_withdrawals( - &self, - received_withdrawals: &withdrawal_txs::v0::WithdrawalTxs, - our_withdrawals: &withdrawal_txs::v0::WithdrawalTxs, - height: u64, - round: u32, - verify_with_validator_public_key: Option<&bls_signatures::PublicKey>, - quorum_hash: Option<&[u8]>, - platform_version: &PlatformVersion, - ) -> Result, Error> { - match platform_version - .drive_abci - .methods - .withdrawals - .check_withdrawals - { - 0 => Ok(self.check_withdrawals_v0( - received_withdrawals, - our_withdrawals, - height, - round, - verify_with_validator_public_key, - quorum_hash, - )), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "check_withdrawals".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/check_withdrawals/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/check_withdrawals/v0/mod.rs deleted file mode 100644 index 7c7594d1bb3..00000000000 --- a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/check_withdrawals/v0/mod.rs +++ /dev/null @@ -1,78 +0,0 @@ -use crate::abci::AbciError; -use crate::platform_types::platform::Platform; -use crate::platform_types::withdrawal::withdrawal_txs; -use crate::rpc::core::CoreRPCLike; -use dpp::bls_signatures; -use dpp::validation::SimpleValidationResult; - -impl Platform -where - C: CoreRPCLike, -{ - /// Checks if the received withdrawal transactions are correct and match the expected withdrawal transactions. - /// - /// This function compares the received withdrawal transactions with the expected ones. If they don't match, - /// an error is returned. If a validator public key is provided, the function also verifies the withdrawal - /// transactions' signatures. - /// - /// # Arguments - /// - /// * `received_withdrawals` - The withdrawal transactions received. - /// * `our_withdrawals` - The expected withdrawal transactions. - /// * `height` - The block height. - /// * `round` - The consensus round. - /// * `verify_with_validator_public_key` - An optional reference to a validator public key. - /// * `quorum_hash` - An optional byte slice reference containing the quorum hash. - /// - /// # Returns - /// - /// * `SimpleValidationResult` - If the received withdrawal transactions match the expected ones - /// and the signatures are valid (if provided), it returns a default `SimpleValidationResult`. Otherwise, - /// it returns a `SimpleValidationResult` with an error. - /// - pub(super) fn check_withdrawals_v0( - &self, - received_withdrawals: &withdrawal_txs::v0::WithdrawalTxs, - our_withdrawals: &withdrawal_txs::v0::WithdrawalTxs, - height: u64, - round: u32, - verify_with_validator_public_key: Option<&bls_signatures::PublicKey>, - quorum_hash: Option<&[u8]>, - ) -> SimpleValidationResult { - if received_withdrawals.ne(our_withdrawals) { - return SimpleValidationResult::new_with_error( - AbciError::VoteExtensionMismatchReceived { - got: received_withdrawals.to_string(), - expected: our_withdrawals.to_string(), - }, - ); - } - - // we only verify if verify_with_validator_public_key exists - if let Some(validator_public_key) = verify_with_validator_public_key { - let quorum_hash = quorum_hash.expect("quorum hash is required to verify signature"); - let validation_result = received_withdrawals.verify_signatures( - &self.config.abci.chain_id, - self.config.quorum_type(), - quorum_hash, - height, - round, - validator_public_key, - ); - - if validation_result.is_valid() { - SimpleValidationResult::default() - } else { - SimpleValidationResult::new_with_error( - validation_result - .errors - .into_iter() - .next() - .expect("expected an error"), - ) - } - } else { - SimpleValidationResult::default() - } - } -} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/dequeue_and_build_unsigned_withdrawal_transactions/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/dequeue_and_build_unsigned_withdrawal_transactions/mod.rs new file mode 100644 index 00000000000..b67a25a1b31 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/dequeue_and_build_unsigned_withdrawal_transactions/mod.rs @@ -0,0 +1,56 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::withdrawal::unsigned_withdrawal_txs::v0::UnsignedWithdrawalTxs; +use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +mod v0; + +impl Platform +where + C: CoreRPCLike, +{ + /// Prepares a list of an unsigned withdrawal transaction bytes. This function is a version handler that + /// directs to specific version implementations of the `fetch_and_prepare_unsigned_withdrawal_transactions` function. + /// + /// # Arguments + /// + /// * `validator_set_quorum_hash` - A byte array. + /// * `block_execution_context` - A `BlockExecutionContext` reference. + /// * `transaction` - A `Transaction` reference. + /// * `platform_version` - A `PlatformVersion` reference that dictates which version of + /// the method to call. + /// + /// # Returns + /// + /// * `Result>, Error>` - Returns a Vector of unsigned withdrawal transactions if found, otherwise returns an `Error`. + pub(in crate::execution) fn dequeue_and_build_unsigned_withdrawal_transactions( + &self, + validator_set_quorum_hash: [u8; 32], + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .methods + .withdrawals + .dequeue_and_build_unsigned_withdrawal_transactions + { + 0 => self.dequeue_and_build_unsigned_withdrawal_transactions_v0( + validator_set_quorum_hash, + block_info, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "dequeue_and_build_unsigned_withdrawal_transactions".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/dequeue_and_build_unsigned_withdrawal_transactions/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/dequeue_and_build_unsigned_withdrawal_transactions/v0/mod.rs new file mode 100644 index 00000000000..9659528dc2b --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/dequeue_and_build_unsigned_withdrawal_transactions/v0/mod.rs @@ -0,0 +1,190 @@ +use dashcore_rpc::dashcore::{ + blockdata::transaction::special_transaction::asset_unlock::request_info::AssetUnlockRequestInfo, + hashes::Hash, QuorumHash, +}; +use dpp::block::block_info::BlockInfo; +use dpp::dashcore::transaction::special_transaction::asset_unlock::qualified_asset_unlock::build_asset_unlock_tx; +use dpp::dashcore::Transaction; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::document::document_methods::DocumentMethodsV0; +use dpp::document::{Document, DocumentV0Setters}; +use dpp::version::PlatformVersion; + +use drive::dpp::system_data_contracts::withdrawals_contract; +use drive::dpp::system_data_contracts::withdrawals_contract::v1::document_types::withdrawal; + +use drive::drive::batch::DriveOperation; +use drive::drive::identity::withdrawals::WithdrawalTransactionIndex; +use drive::query::TransactionArg; + +use crate::platform_types::withdrawal::unsigned_withdrawal_txs::v0::UnsignedWithdrawalTxs; +use crate::rpc::core::CoreHeight; +use crate::{ + error::{execution::ExecutionError, Error}, + platform_types::platform::Platform, + rpc::core::CoreRPCLike, +}; +use dpp::errors::ProtocolError; +use drive::drive::config::DEFAULT_QUERY_LIMIT; + +const WITHDRAWAL_TRANSACTIONS_QUERY_LIMIT: u16 = 16; + +impl Platform +where + C: CoreRPCLike, +{ + /// Prepares a list of an unsigned withdrawal transaction bytes + pub(super) fn dequeue_and_build_unsigned_withdrawal_transactions_v0( + &self, + validator_set_quorum_hash: [u8; 32], + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let mut drive_operations: Vec = vec![]; + + // Get 16 latest withdrawal transactions from the queue + let untied_withdrawal_transactions = self.drive.dequeue_untied_withdrawal_transactions( + WITHDRAWAL_TRANSACTIONS_QUERY_LIMIT, + transaction, + &mut drive_operations, + platform_version, + )?; + + if untied_withdrawal_transactions.is_empty() { + return Ok(UnsignedWithdrawalTxs::default()); + } + + let transaction_indices = untied_withdrawal_transactions + .iter() + .map(|(transaction_id, _)| *transaction_id) + .collect::>(); + + let documents = self.fetch_and_modify_withdrawal_documents_to_broadcasted_by_indices( + &transaction_indices, + block_info, + transaction, + platform_version, + )?; + + tracing::debug!( + "Deque {} unsigned withdrawal transactions for signing with indices from {} to {}", + documents.len(), + transaction_indices.first().expect("must be present"), + transaction_indices.last().expect("must be present") + ); + + let withdrawals_contract = self.drive.cache.system_data_contracts.load_withdrawals(); + + self.drive.add_update_multiple_documents_operations( + &documents, + &withdrawals_contract, + withdrawals_contract + .document_type_for_name(withdrawal::NAME) + .map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "could not get document type", + )) + })?, + &mut drive_operations, + &platform_version.drive, + )?; + + // Appending request_height and quorum_hash to withdrawal transaction + let unsigned_withdrawal_transactions = untied_withdrawal_transactions + .into_iter() + .map(|(_, untied_transaction_bytes)| { + build_unsigned_transaction( + untied_transaction_bytes, + validator_set_quorum_hash, + block_info.core_height, + ) + }) + .collect::>()?; + + self.drive.apply_drive_operations( + drive_operations, + true, + block_info, + transaction, + platform_version, + )?; + + Ok(UnsignedWithdrawalTxs::from_vec( + unsigned_withdrawal_transactions, + )) + } + + fn fetch_and_modify_withdrawal_documents_to_broadcasted_by_indices( + &self, + transaction_indices: &[WithdrawalTransactionIndex], + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let documents = self + .drive + .find_withdrawal_documents_by_status_and_transaction_indices( + withdrawals_contract::WithdrawalStatus::POOLED, + transaction_indices, + DEFAULT_QUERY_LIMIT, + transaction, + platform_version, + )?; + + documents + .into_iter() + .map(|mut document| { + document.set_i64( + withdrawal::properties::STATUS, + withdrawals_contract::WithdrawalStatus::BROADCASTED as i64, + ); + + document.set_u64( + withdrawal::properties::TRANSACTION_SIGN_HEIGHT, + block_info.core_height as u64, + ); + + document.set_updated_at(Some(block_info.time_ms)); + + document.increment_revision().map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "Could not increment document revision", + )) + })?; + + Ok(document) + }) + .collect() + } +} + +fn build_unsigned_transaction( + untied_transaction_bytes: Vec, + mut validator_set_quorum_hash: [u8; 32], + core_chain_locked_height: CoreHeight, +) -> Result { + // Core expects it reversed + validator_set_quorum_hash.reverse(); + + let request_info = AssetUnlockRequestInfo { + request_height: core_chain_locked_height, + quorum_hash: QuorumHash::from_byte_array(validator_set_quorum_hash), + }; + + let mut unsigned_transaction_bytes = vec![]; + + request_info + .consensus_append_to_base_encode( + untied_transaction_bytes.clone(), + &mut unsigned_transaction_bytes, + ) + .map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "could not add additional request info to asset unlock transaction", + )) + })?; + + build_asset_unlock_tx(&unsigned_transaction_bytes) + .map_err(|error| Error::Protocol(ProtocolError::DashCoreError(error))) +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/fetch_transactions_block_inclusion_status/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/fetch_transactions_block_inclusion_status/mod.rs new file mode 100644 index 00000000000..0a4b17062eb --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/fetch_transactions_block_inclusion_status/mod.rs @@ -0,0 +1,52 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dashcore_rpc::json::AssetUnlockStatus; +use dpp::version::PlatformVersion; +use drive::drive::identity::withdrawals::WithdrawalTransactionIndex; +use std::collections::BTreeMap; + +mod v0; + +impl Platform +where + C: CoreRPCLike, +{ + /// Fetch Core transactions by range of Core heights. This function is a version handler that + /// directs to specific version implementations of the `fetch_transactions_block_inclusion_status` function. + /// + /// # Arguments + /// + /// * `current_chain_locked_core_height` - The current chain locked core height + /// * `transactions` - A list of transactions to fetch. + /// * `platform_version` - A `PlatformVersion` reference that dictates which version of + /// the method to call. + /// + /// # Returns + /// + /// * `Result, Error>` - Returns a Vector of transaction hashes if found, otherwise returns an `Error`. + pub(in crate::execution::platform_events::withdrawals) fn fetch_transactions_block_inclusion_status( + &self, + current_chain_locked_core_height: u32, + withdrawal_indices: &[WithdrawalTransactionIndex], + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .methods + .withdrawals + .fetch_transactions_block_inclusion_status + { + 0 => self.fetch_transactions_block_inclusion_status_v0( + current_chain_locked_core_height, + withdrawal_indices, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "fetch_transactions_block_inclusion_status".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/fetch_transactions_block_inclusion_status/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/fetch_transactions_block_inclusion_status/v0/mod.rs new file mode 100644 index 00000000000..86433d8c03f --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/fetch_transactions_block_inclusion_status/v0/mod.rs @@ -0,0 +1,31 @@ +use dashcore_rpc::dashcore_rpc_json::AssetUnlockStatus; +use drive::drive::identity::withdrawals::WithdrawalTransactionIndex; +use std::collections::BTreeMap; + +use crate::{error::Error, platform_types::platform::Platform, rpc::core::CoreRPCLike}; + +impl Platform +where + C: CoreRPCLike, +{ + /// Fetch Core transactions by range of Core heights + pub(super) fn fetch_transactions_block_inclusion_status_v0( + &self, + current_chain_locked_core_height: u32, + withdrawal_indices: &[WithdrawalTransactionIndex], + ) -> Result, Error> { + let asset_unlock_statuses_result = self + .core_rpc + .get_asset_unlock_statuses(withdrawal_indices, current_chain_locked_core_height)?; + + Ok(asset_unlock_statuses_result + .into_iter() + .map(|asset_unlock_status_result| { + ( + asset_unlock_status_result.index, + asset_unlock_status_result.status, + ) + }) + .collect()) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/mod.rs index 2c5c4be28ed..75412110566 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/mod.rs @@ -1 +1,6 @@ -mod check_withdrawals; +pub(in crate::execution) mod append_signatures_and_broadcast_withdrawal_transactions; +pub(in crate::execution) mod build_untied_withdrawal_transactions_from_documents; +pub(in crate::execution) mod dequeue_and_build_unsigned_withdrawal_transactions; +pub(in crate::execution) mod fetch_transactions_block_inclusion_status; +pub(in crate::execution) mod pool_withdrawals_into_transactions_queue; +pub(in crate::execution) mod update_broadcasted_withdrawal_statuses; diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/pool_withdrawals_into_transactions_queue/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/pool_withdrawals_into_transactions_queue/mod.rs new file mode 100644 index 00000000000..5d79a1c6018 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/pool_withdrawals_into_transactions_queue/mod.rs @@ -0,0 +1,52 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +mod v0; + +impl Platform +where + C: CoreRPCLike, +{ + /// Pool withdrawal documents into transactions. This function is a version handler that + /// directs to specific version implementations of the `pool_withdrawals_into_transactions_queue` function. + /// + /// # Arguments + /// + /// * `block_execution_context` - A `BlockExecutionContext` reference that provides context for block execution. + /// * `transaction` - A `Transaction` reference representing the current transaction. + /// * `platform_version` - A `PlatformVersion` reference that dictates which version of + /// the method to call. + /// + /// # Returns + /// + /// * `Result<(), Error>` - Returns `Ok(())` if successful, otherwise returns an `Error`. + pub(in crate::execution) fn pool_withdrawals_into_transactions_queue( + &self, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive_abci + .methods + .withdrawals + .pool_withdrawals_into_transactions_queue + { + 0 => self.pool_withdrawals_into_transactions_queue_v0( + block_info, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "pool_withdrawals_into_transactions_queue".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/pool_withdrawals_into_transactions_queue/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/pool_withdrawals_into_transactions_queue/v0/mod.rs new file mode 100644 index 00000000000..d65b4138f5d --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/pool_withdrawals_into_transactions_queue/v0/mod.rs @@ -0,0 +1,279 @@ +use dpp::block::block_info::BlockInfo; + +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::document::document_methods::DocumentMethodsV0; +use dpp::document::{DocumentV0Getters, DocumentV0Setters}; +use dpp::version::PlatformVersion; + +use drive::drive::identity::withdrawals::WithdrawalTransactionIndexAndBytes; +use drive::grovedb::TransactionArg; + +use dpp::system_data_contracts::withdrawals_contract; +use dpp::system_data_contracts::withdrawals_contract::v1::document_types::withdrawal; +use drive::drive::config::DEFAULT_QUERY_LIMIT; + +use crate::{ + error::{execution::ExecutionError, Error}, + platform_types::platform::Platform, + rpc::core::CoreRPCLike, +}; + +impl Platform +where + C: CoreRPCLike, +{ + /// Pool withdrawal documents into transactions + pub(super) fn pool_withdrawals_into_transactions_queue_v0( + &self, + block_info: &BlockInfo, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let mut documents = self.drive.fetch_oldest_withdrawal_documents_by_status( + withdrawals_contract::WithdrawalStatus::QUEUED.into(), + DEFAULT_QUERY_LIMIT, + transaction, + platform_version, + )?; + + if documents.is_empty() { + return Ok(()); + } + + let start_transaction_index = self + .drive + .fetch_next_withdrawal_transaction_index(transaction, platform_version)?; + + let untied_withdrawal_transactions = self + .build_untied_withdrawal_transactions_from_documents( + &documents, + start_transaction_index, + platform_version, + )?; + + for document in documents.iter_mut() { + let Some((transaction_index, _)) = untied_withdrawal_transactions.get(&document.id()) + else { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "transactions must contain a transaction", + ))); + }; + + document.set_u64( + withdrawal::properties::TRANSACTION_INDEX, + *transaction_index, + ); + + document.set_u8( + withdrawal::properties::STATUS, + withdrawals_contract::WithdrawalStatus::POOLED as u8, + ); + + document.set_updated_at(Some(block_info.time_ms)); + + document.increment_revision().map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "Could not increment document revision", + )) + })?; + } + + let withdrawal_transactions: Vec = + untied_withdrawal_transactions.into_values().collect(); + + let withdrawal_transactions_count = withdrawal_transactions.len(); + + let mut drive_operations = Vec::new(); + + self.drive + .add_enqueue_untied_withdrawal_transaction_operations( + withdrawal_transactions, + &mut drive_operations, + platform_version, + )?; + + let end_transaction_index = start_transaction_index + withdrawal_transactions_count as u64; + + self.drive + .add_update_next_withdrawal_transaction_index_operation( + end_transaction_index, + &mut drive_operations, + platform_version, + )?; + + tracing::debug!( + "Pooled {} withdrawal documents into {} transactions with indices from {} to {}", + documents.len(), + withdrawal_transactions_count, + start_transaction_index, + end_transaction_index, + ); + + let withdrawals_contract = self.drive.cache.system_data_contracts.load_withdrawals(); + + self.drive.add_update_multiple_documents_operations( + &documents, + &withdrawals_contract, + withdrawals_contract + .document_type_for_name(withdrawal::NAME) + .map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "Can't fetch withdrawal data contract", + )) + })?, + &mut drive_operations, + &platform_version.drive, + )?; + + self.drive.apply_drive_operations( + drive_operations, + true, + block_info, + transaction, + platform_version, + )?; + + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use dpp::block::epoch::Epoch; + use itertools::Itertools; + + use dpp::data_contracts::SystemDataContract; + use dpp::identifier::Identifier; + use dpp::identity::core_script::CoreScript; + use dpp::tests::fixtures::get_withdrawal_document_fixture; + use dpp::withdrawal::Pooling; + use drive::tests::helpers::setup::{setup_document, setup_system_data_contract}; + + use crate::test::helpers::setup::TestPlatformBuilder; + use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; + use dpp::platform_value::platform_value; + use dpp::system_data_contracts::load_system_data_contract; + use dpp::version::PlatformVersion; + + #[test] + fn test_pooling() { + let platform_version = PlatformVersion::latest(); + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + let transaction = platform.drive.grove.start_transaction(); + + let block_info = BlockInfo { + time_ms: 1, + height: 1, + core_height: 96, + epoch: Epoch::default(), + }; + + let data_contract = + load_system_data_contract(SystemDataContract::Withdrawals, platform_version) + .expect("to load system data contract"); + + setup_system_data_contract(&platform.drive, &data_contract, Some(&transaction)); + + let owner_id = Identifier::new([1u8; 32]); + + let document_1 = get_withdrawal_document_fixture( + &data_contract, + owner_id, + platform_value!({ + "amount": 1000u64, + "coreFeePerByte": 1u32, + "pooling": Pooling::Never as u8, + "outputScript": CoreScript::from_bytes((0..23).collect::>()), + "status": withdrawals_contract::WithdrawalStatus::QUEUED as u8, + "transactionIndex": 1u64, + }), + None, + platform_version.protocol_version, + ) + .expect("expected withdrawal document"); + + let document_type = data_contract + .document_type_for_name(withdrawal::NAME) + .expect("expected to get document type"); + + setup_document( + &platform.drive, + &document_1, + &data_contract, + document_type, + Some(&transaction), + ); + + let document_2 = get_withdrawal_document_fixture( + &data_contract, + owner_id, + platform_value!({ + "amount": 1000u64, + "coreFeePerByte": 1u32, + "pooling": Pooling::Never as u8, + "outputScript": CoreScript::from_bytes((0..23).collect::>()), + "status": withdrawals_contract::WithdrawalStatus::QUEUED as u8, + "transactionIndex": 2u64, + }), + None, + platform_version.protocol_version, + ) + .expect("expected withdrawal document"); + + setup_document( + &platform.drive, + &document_2, + &data_contract, + document_type, + Some(&transaction), + ); + + platform + .pool_withdrawals_into_transactions_queue_v0( + &block_info, + Some(&transaction), + platform_version, + ) + .expect("to pool withdrawal documents into transactions"); + + let updated_documents = platform + .drive + .fetch_oldest_withdrawal_documents_by_status( + withdrawals_contract::WithdrawalStatus::POOLED.into(), + DEFAULT_QUERY_LIMIT, + Some(&transaction), + platform_version, + ) + .expect("to fetch withdrawal documents"); + + for (i, document) in updated_documents + .into_iter() + // Sort by index because updated_at is the same for all documents within batch + .sorted_by(|a, b| { + let a_index = a + .properties() + .get_u64(withdrawal::properties::TRANSACTION_INDEX) + .expect("to get transactionIndex"); + let b_index = b + .properties() + .get_u64(withdrawal::properties::TRANSACTION_INDEX) + .expect("to get transactionIndex"); + a_index.cmp(&b_index) + }) + .enumerate() + { + assert_eq!(document.revision(), Some(2)); + + let tx_index = document + .properties() + .get_u64(withdrawal::properties::TRANSACTION_INDEX) + .expect("to get transactionIndex"); + + assert_eq!(tx_index, i as u64); + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/mod.rs new file mode 100644 index 00000000000..af763467638 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/mod.rs @@ -0,0 +1,62 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; +use dpp::version::PlatformVersion; +use drive::grovedb::Transaction; + +mod v0; + +impl Platform +where + C: CoreRPCLike, +{ + /// Update statuses for broadcasted withdrawals + /// + /// This method is responsible for updating the status of withdrawal transactions that have been broadcasted and reached finality. + /// This is done based on the height of the last synced core block, which helps in determining whether the withdrawal + /// transaction has been completed or expired. + /// + /// # Arguments + /// + /// * `block_execution_context` - Contextual information about the current block execution. + /// * `transaction` - A transaction argument to interact with the underlying storage. + /// + /// # Returns + /// + /// * `Result<(), Error>` - Returns an Ok(()) if the statuses are successfully updated. + /// Otherwise, it returns an Error. + /// + /// # Errors + /// + /// This function may return an error if any of the following conditions are met: + /// + /// * There is an issue interacting with the underlying storage. + /// * There is an error fetching the withdrawal data contract. + /// * There is an error getting the transactionId or transactionSignHeight from the withdrawal document. + pub fn update_broadcasted_withdrawal_statuses( + &self, + block_info: &BlockInfo, + transaction: &Transaction, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive_abci + .methods + .withdrawals + .update_broadcasted_withdrawal_statuses + { + 0 => self.update_broadcasted_withdrawal_statuses_v0( + block_info, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "update_broadcasted_withdrawal_statuses".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/v0/mod.rs new file mode 100644 index 00000000000..97b5a922ba9 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/v0/mod.rs @@ -0,0 +1,325 @@ +use dashcore_rpc::json::AssetUnlockStatus; +use dpp::block::block_info::BlockInfo; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contracts::withdrawals_contract::WithdrawalStatus; +use dpp::document::document_methods::DocumentMethodsV0; +use dpp::document::{DocumentV0Getters, DocumentV0Setters}; +use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; +use dpp::system_data_contracts::withdrawals_contract::v1::document_types::withdrawal; +use dpp::version::PlatformVersion; +use itertools::Itertools; +use std::collections::HashSet; + +use drive::drive::batch::DriveOperation; +use drive::drive::config::DEFAULT_QUERY_LIMIT; +use drive::drive::identity::withdrawals::WithdrawalTransactionIndex; +use drive::grovedb::Transaction; + +use crate::{ + error::{execution::ExecutionError, Error}, + platform_types::platform::Platform, + rpc::core::CoreRPCLike, +}; + +const NUMBER_OF_BLOCKS_BEFORE_EXPIRED: u32 = 48; + +impl Platform +where + C: CoreRPCLike, +{ + /// Update statuses for broadcasted withdrawals + pub(super) fn update_broadcasted_withdrawal_statuses_v0( + &self, + block_info: &BlockInfo, + transaction: &Transaction, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let broadcasted_withdrawal_documents = + self.drive.fetch_oldest_withdrawal_documents_by_status( + WithdrawalStatus::BROADCASTED.into(), + DEFAULT_QUERY_LIMIT, + transaction.into(), + platform_version, + )?; + + if broadcasted_withdrawal_documents.is_empty() { + return Ok(()); + } + + // Collecting unique withdrawal indices + let broadcasted_withdrawal_indices = broadcasted_withdrawal_documents + .iter() + .map(|document| { + document + .properties() + .get_optional_u64(withdrawal::properties::TRANSACTION_INDEX)? + .ok_or(Error::Execution(ExecutionError::CorruptedDriveResponse( + "Can't get transaction index from withdrawal document".to_string(), + ))) + }) + .collect::, Error>>()? + .into_iter() + .collect_vec(); + + let withdrawal_transaction_statuses = self.fetch_transactions_block_inclusion_status( + block_info.core_height, + &broadcasted_withdrawal_indices, + platform_version, + )?; + + let mut drive_operations: Vec = vec![]; + + // Collecting only documents that have been updated + let mut documents_to_update = Vec::new(); + + for mut document in broadcasted_withdrawal_documents { + let withdrawal_index = document + .properties() + .get_optional_u64(withdrawal::properties::TRANSACTION_INDEX)? + .ok_or(Error::Execution(ExecutionError::CorruptedDriveResponse( + "Can't get transaction index from withdrawal document".to_string(), + )))?; + + let transaction_sign_height = document + .properties() + .get_optional_u64(withdrawal::properties::TRANSACTION_SIGN_HEIGHT)? + .ok_or(Error::Execution(ExecutionError::CorruptedDriveResponse( + "Can't get transaction sign height from withdrawal document".to_string(), + )))? as u32; + + let withdrawal_transaction_status = withdrawal_transaction_statuses + .get(&withdrawal_index) + .unwrap_or_else(|| { + tracing::warn!( + "Withdrawal transaction with index {} is not found in Core", + withdrawal_index + ); + + &AssetUnlockStatus::Unknown + }); + + let block_height_difference = block_info.core_height - transaction_sign_height; + + let status = if withdrawal_transaction_status == &AssetUnlockStatus::Chainlocked { + tracing::debug!( + transaction_sign_height, + "Withdrawal with transaction index {} is marked as complete", + withdrawal_index + ); + + WithdrawalStatus::COMPLETE + } else if block_height_difference > NUMBER_OF_BLOCKS_BEFORE_EXPIRED { + tracing::debug!( + transaction_sign_height, + "Withdrawal with transaction index {} is marked as expired", + withdrawal_index + ); + + WithdrawalStatus::EXPIRED + } else { + continue; + }; + + document.set_u8(withdrawal::properties::STATUS, status.into()); + + document.set_updated_at(Some(block_info.time_ms)); + + document.increment_revision().map_err(Error::Protocol)?; + + documents_to_update.push(document); + } + + if documents_to_update.is_empty() { + return Ok(()); + } + + let withdrawals_contract = self.drive.cache.system_data_contracts.load_withdrawals(); + + self.drive.add_update_multiple_documents_operations( + &documents_to_update, + &withdrawals_contract, + withdrawals_contract + .document_type_for_name(withdrawal::NAME) + .map_err(|_| { + Error::Execution(ExecutionError::CorruptedCodeExecution( + "Can't fetch withdrawal data contract", + )) + })?, + &mut drive_operations, + &platform_version.drive, + )?; + + self.drive.apply_drive_operations( + drive_operations, + true, + block_info, + transaction.into(), + platform_version, + )?; + + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::rpc::core::MockCoreRPCLike; + use crate::test::helpers::setup::TestPlatformBuilder; + use dashcore_rpc::json::{AssetUnlockStatus, AssetUnlockStatusResult}; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::document::DocumentV0Getters; + use dpp::identity::core_script::CoreScript; + use dpp::platform_value::platform_value; + use dpp::system_data_contracts::withdrawals_contract::v1::document_types::withdrawal; + use dpp::version::PlatformVersion; + use dpp::withdrawal::Pooling; + use dpp::{ + data_contracts::withdrawals_contract, tests::fixtures::get_withdrawal_document_fixture, + }; + use dpp::{ + prelude::Identifier, + system_data_contracts::{load_system_data_contract, SystemDataContract}, + }; + use drive::tests::helpers::setup::setup_document; + use drive::tests::helpers::setup::setup_system_data_contract; + + #[test] + fn test_statuses_are_updated() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + let mut mock_rpc_client = MockCoreRPCLike::new(); + + mock_rpc_client + .expect_get_asset_unlock_statuses() + .returning(move |indices: &[u64], _core_chain_locked_height| { + Ok(indices + .iter() + .map(|index| { + let status = if index == &1 { + AssetUnlockStatus::Chainlocked + } else { + AssetUnlockStatus::Unknown + }; + + AssetUnlockStatusResult { + index: *index, + status, + } + }) + .collect()) + }); + + platform.core_rpc = mock_rpc_client; + + let transaction = platform.drive.grove.start_transaction(); + + let block_info = BlockInfo { + time_ms: 0, + height: 1, + core_height: 96, + epoch: Default::default(), + }; + + let data_contract = + load_system_data_contract(SystemDataContract::Withdrawals, platform_version) + .expect("to load system data contract"); + + setup_system_data_contract(&platform.drive, &data_contract, Some(&transaction)); + + let owner_id = Identifier::new([1u8; 32]); + + let document_1 = get_withdrawal_document_fixture( + &data_contract, + owner_id, + platform_value!({ + "amount": 1000u64, + "coreFeePerByte": 1u32, + "pooling": Pooling::Never, + "outputScript": CoreScript::from_bytes((0..23).collect::>()), + "status": withdrawals_contract::WithdrawalStatus::BROADCASTED as u8, + "transactionIndex": 1u64, + "transactionSignHeight": 1, + }), + None, + platform_version.protocol_version, + ) + .expect("expected withdrawal document"); + + let document_type = data_contract + .document_type_for_name(withdrawal::NAME) + .expect("expected to get document type"); + + setup_document( + &platform.drive, + &document_1, + &data_contract, + document_type, + Some(&transaction), + ); + + let document_2 = get_withdrawal_document_fixture( + &data_contract, + owner_id, + platform_value!({ + "amount": 1000u64, + "coreFeePerByte": 1u32, + "pooling": Pooling::Never as u8, + "outputScript": CoreScript::from_bytes((0..23).collect::>()), + "status": withdrawals_contract::WithdrawalStatus::BROADCASTED as u8, + "transactionIndex": 2u64, + "transactionSignHeight": 1, + }), + None, + platform_version.protocol_version, + ) + .expect("expected withdrawal document"); + + setup_document( + &platform.drive, + &document_2, + &data_contract, + document_type, + Some(&transaction), + ); + + platform + .update_broadcasted_withdrawal_statuses_v0(&block_info, &transaction, platform_version) + .expect("to update withdrawal statuses"); + + let documents = platform + .drive + .fetch_oldest_withdrawal_documents_by_status( + WithdrawalStatus::EXPIRED.into(), + DEFAULT_QUERY_LIMIT, + Some(&transaction), + platform_version, + ) + .expect("to fetch documents by status"); + + assert_eq!(documents.len(), 1); + assert_eq!( + documents.first().unwrap().id().to_vec(), + document_2.id().to_vec() + ); + + let documents = platform + .drive + .fetch_oldest_withdrawal_documents_by_status( + WithdrawalStatus::COMPLETE.into(), + DEFAULT_QUERY_LIMIT, + Some(&transaction), + platform_version, + ) + .expect("to fetch documents by status"); + + assert_eq!(documents.len(), 1); + assert_eq!( + documents.first().unwrap().id().to_vec(), + document_1.id().to_vec() + ); + } +} diff --git a/packages/rs-drive-abci/src/execution/storage/fetch_platform_state/mod.rs b/packages/rs-drive-abci/src/execution/storage/fetch_platform_state/mod.rs new file mode 100644 index 00000000000..f2537eca34f --- /dev/null +++ b/packages/rs-drive-abci/src/execution/storage/fetch_platform_state/mod.rs @@ -0,0 +1,32 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use dpp::version::PlatformVersion; +use drive::drive::Drive; +use drive::query::TransactionArg; + +mod v0; + +impl Platform { + /// Fetches execution state from grovedb storage + pub fn fetch_platform_state( + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .methods + .platform_state_storage + .fetch_platform_state + { + 0 => Platform::::fetch_platform_state_v0(drive, transaction, platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "fetch_platform_state".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/storage/fetch_platform_state/v0/mod.rs b/packages/rs-drive-abci/src/execution/storage/fetch_platform_state/v0/mod.rs new file mode 100644 index 00000000000..25960bf5b39 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/storage/fetch_platform_state/v0/mod.rs @@ -0,0 +1,24 @@ +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use dpp::serialization::PlatformDeserializableFromVersionedStructure; +use dpp::version::PlatformVersion; +use drive::drive::Drive; +use drive::query::TransactionArg; + +impl Platform { + pub(super) fn fetch_platform_state_v0( + drive: &Drive, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + drive + .fetch_platform_state_bytes(transaction, platform_version) + .map_err(Error::Drive)? + .map(|bytes| { + PlatformState::versioned_deserialize(&bytes, platform_version) + .map_err(Error::Protocol) + }) + .transpose() + } +} diff --git a/packages/rs-drive-abci/src/execution/storage/mod.rs b/packages/rs-drive-abci/src/execution/storage/mod.rs new file mode 100644 index 00000000000..54302920e5d --- /dev/null +++ b/packages/rs-drive-abci/src/execution/storage/mod.rs @@ -0,0 +1,2 @@ +mod fetch_platform_state; +mod store_platform_state; diff --git a/packages/rs-drive-abci/src/execution/storage/store_platform_state/mod.rs b/packages/rs-drive-abci/src/execution/storage/store_platform_state/mod.rs new file mode 100644 index 00000000000..203b81d2019 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/storage/store_platform_state/mod.rs @@ -0,0 +1,32 @@ +mod v0; + +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use dpp::version::PlatformVersion; +use drive::query::TransactionArg; + +impl Platform { + /// Store the execution state in grovedb storage + pub fn store_platform_state( + &self, + state: &PlatformState, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive_abci + .methods + .platform_state_storage + .store_platform_state + { + 0 => self.store_platform_state_v0(state, transaction, platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "store_platform_state".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/storage/store_platform_state/v0/mod.rs b/packages/rs-drive-abci/src/execution/storage/store_platform_state/v0/mod.rs new file mode 100644 index 00000000000..68893fbb0eb --- /dev/null +++ b/packages/rs-drive-abci/src/execution/storage/store_platform_state/v0/mod.rs @@ -0,0 +1,25 @@ +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use dpp::serialization::PlatformSerializable; +use dpp::version::PlatformVersion; +use drive::query::TransactionArg; + +impl Platform { + pub(super) fn store_platform_state_v0( + &self, + state: &PlatformState, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + self.drive + .store_platform_state_bytes(&state.serialize_to_bytes()?, transaction, platform_version) + .map_err(Error::Drive)?; + + // We need to persist new protocol version as well be able to read block state + self.drive + .store_current_protocol_version(platform_version.protocol_version, transaction)?; + + Ok(()) + } +} diff --git a/packages/rs-drive-abci/src/execution/types/block_execution_context/mod.rs b/packages/rs-drive-abci/src/execution/types/block_execution_context/mod.rs index 0ff0b617492..a0054fff7a9 100644 --- a/packages/rs-drive-abci/src/execution/types/block_execution_context/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/block_execution_context/mod.rs @@ -9,13 +9,12 @@ use crate::execution::types::block_execution_context::v0::{ use crate::execution::types::block_state_info::BlockStateInfo; use crate::platform_types::epoch_info::EpochInfo; use crate::platform_types::platform_state::PlatformState; +use crate::platform_types::withdrawal::unsigned_withdrawal_txs::v0::UnsignedWithdrawalTxs; use derive_more::From; -use dpp::dashcore::Txid; -use std::collections::BTreeMap; use tenderdash_abci::proto::abci::ResponsePrepareProposal; /// The versioned block execution context -#[derive(Debug, From)] +#[derive(Debug, From, Clone)] pub enum BlockExecutionContext { /// Version 0 V0(v0::BlockExecutionContextV0), @@ -49,9 +48,9 @@ impl BlockExecutionContextV0Getters for BlockExecutionContext { } } - fn withdrawal_transactions(&self) -> &BTreeMap> { + fn unsigned_withdrawal_transactions(&self) -> &UnsignedWithdrawalTxs { match self { - BlockExecutionContext::V0(v0) => &v0.withdrawal_transactions, + BlockExecutionContext::V0(v0) => &v0.unsigned_withdrawal_transactions, } } @@ -87,9 +86,9 @@ impl BlockExecutionContextV0Setters for BlockExecutionContext { } } - fn set_withdrawal_transactions(&mut self, transactions: BTreeMap>) { + fn set_unsigned_withdrawal_transactions(&mut self, transactions: UnsignedWithdrawalTxs) { match self { - BlockExecutionContext::V0(v0) => v0.withdrawal_transactions = transactions, + BlockExecutionContext::V0(v0) => v0.unsigned_withdrawal_transactions = transactions, } } @@ -119,12 +118,6 @@ impl BlockExecutionContextV0MutableGetters for BlockExecutionContext { } } - fn withdrawal_transactions_mut(&mut self) -> &mut BTreeMap> { - match self { - BlockExecutionContext::V0(v0) => v0.withdrawal_transactions_mut(), - } - } - fn block_platform_state_mut(&mut self) -> &mut PlatformState { match self { BlockExecutionContext::V0(v0) => v0.block_platform_state_mut(), @@ -136,6 +129,12 @@ impl BlockExecutionContextV0MutableGetters for BlockExecutionContext { BlockExecutionContext::V0(v0) => v0.proposer_results_mut(), } } + + fn unsigned_withdrawal_transactions_mut(&mut self) -> &mut UnsignedWithdrawalTxs { + match self { + BlockExecutionContext::V0(v0) => v0.unsigned_withdrawal_transactions_mut(), + } + } } impl BlockExecutionContextV0OwnedGetters for BlockExecutionContext { @@ -153,13 +152,6 @@ impl BlockExecutionContextV0OwnedGetters for BlockExecutionContext { } } - /// Consumes the object and returns the owned `withdrawal_transactions`. - fn withdrawal_transactions_owned(self) -> BTreeMap> { - match self { - BlockExecutionContext::V0(v0) => v0.withdrawal_transactions, - } - } - /// Consumes the object and returns the owned `PlatformState`. fn block_platform_state_owned(self) -> PlatformState { match self { diff --git a/packages/rs-drive-abci/src/execution/types/block_execution_context/v0/mod.rs b/packages/rs-drive-abci/src/execution/types/block_execution_context/v0/mod.rs index 33cd7fa2f19..9f6aaa8f4ea 100644 --- a/packages/rs-drive-abci/src/execution/types/block_execution_context/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/block_execution_context/v0/mod.rs @@ -31,12 +31,12 @@ use crate::execution::types::block_state_info::BlockStateInfo; use crate::platform_types::epoch_info::EpochInfo; use crate::platform_types::platform_state::PlatformState; -use dashcore_rpc::dashcore::Txid; -use std::collections::BTreeMap; +use crate::platform_types::withdrawal::unsigned_withdrawal_txs::v0::UnsignedWithdrawalTxs; + use tenderdash_abci::proto::abci::ResponsePrepareProposal; /// V0 of the Block execution context -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct BlockExecutionContextV0 { /// Block info pub block_state_info: BlockStateInfo, @@ -44,8 +44,8 @@ pub struct BlockExecutionContextV0 { pub epoch_info: EpochInfo, /// Total hpmn count pub hpmn_count: u32, - /// Current withdrawal transactions hash -> Transaction - pub withdrawal_transactions: BTreeMap>, + /// Unsigned withdrawal transactions to be available for extend and verify vote handlers + pub unsigned_withdrawal_transactions: UnsignedWithdrawalTxs, /// Block state pub block_platform_state: PlatformState, /// The response prepare proposal if proposed by us @@ -63,7 +63,7 @@ pub trait BlockExecutionContextV0Getters { fn hpmn_count(&self) -> u32; /// Returns a reference of the withdrawal_transactions field. - fn withdrawal_transactions(&self) -> &BTreeMap>; + fn unsigned_withdrawal_transactions(&self) -> &UnsignedWithdrawalTxs; /// Returns a reference of the block_platform_state field. fn block_platform_state(&self) -> &PlatformState; @@ -84,7 +84,7 @@ pub trait BlockExecutionContextV0Setters { fn set_hpmn_count(&mut self, count: u32); /// Sets the withdrawal_transactions field. - fn set_withdrawal_transactions(&mut self, transactions: BTreeMap>); + fn set_unsigned_withdrawal_transactions(&mut self, transactions: UnsignedWithdrawalTxs); /// Sets the block_platform_state field. fn set_block_platform_state(&mut self, state: PlatformState); @@ -101,14 +101,14 @@ pub trait BlockExecutionContextV0MutableGetters { /// Returns a mutable reference to the epoch_info field. fn epoch_info_mut(&mut self) -> &mut EpochInfo; - /// Returns a mutable reference to the withdrawal_transactions field. - fn withdrawal_transactions_mut(&mut self) -> &mut BTreeMap>; - /// Returns a mutable reference to the block_platform_state field. fn block_platform_state_mut(&mut self) -> &mut PlatformState; /// Returns a mutable reference to the proposer_results field. fn proposer_results_mut(&mut self) -> Option<&mut ResponsePrepareProposal>; + + /// Returns a mut reference of the withdrawal_transactions field. + fn unsigned_withdrawal_transactions_mut(&mut self) -> &mut UnsignedWithdrawalTxs; } /// A trait defining methods for interacting with a BlockExecutionContextV0. @@ -119,9 +119,6 @@ pub trait BlockExecutionContextV0OwnedGetters { /// Consumes the BlockExecutionContextV0 and returns the epoch_info field. fn epoch_info_owned(self) -> EpochInfo; - /// Consumes the BlockExecutionContextV0 and returns the withdrawal_transactions field. - fn withdrawal_transactions_owned(self) -> BTreeMap>; - /// Consumes the BlockExecutionContextV0 and returns the block_platform_state field. fn block_platform_state_owned(self) -> PlatformState; @@ -145,9 +142,9 @@ impl BlockExecutionContextV0Getters for BlockExecutionContextV0 { self.hpmn_count } - /// Returns a reference to the withdrawal_transactions field. - fn withdrawal_transactions(&self) -> &BTreeMap> { - &self.withdrawal_transactions + /// Returns a reference to the unsigned withdrawal transactions + fn unsigned_withdrawal_transactions(&self) -> &UnsignedWithdrawalTxs { + &self.unsigned_withdrawal_transactions } /// Returns a reference to the block_platform_state field. @@ -175,8 +172,8 @@ impl BlockExecutionContextV0Setters for BlockExecutionContextV0 { self.hpmn_count = count; } /// Sets the withdrawal_transactions field. - fn set_withdrawal_transactions(&mut self, transactions: BTreeMap>) { - self.withdrawal_transactions = transactions; + fn set_unsigned_withdrawal_transactions(&mut self, transactions: UnsignedWithdrawalTxs) { + self.unsigned_withdrawal_transactions = transactions; } /// Sets the block_platform_state field. fn set_block_platform_state(&mut self, state: PlatformState) { @@ -199,11 +196,6 @@ impl BlockExecutionContextV0MutableGetters for BlockExecutionContextV0 { &mut self.epoch_info } - /// Returns a mutable reference to the withdrawal_transactions field. - fn withdrawal_transactions_mut(&mut self) -> &mut BTreeMap> { - &mut self.withdrawal_transactions - } - /// Returns a mutable reference to the block_platform_state field. fn block_platform_state_mut(&mut self) -> &mut PlatformState { &mut self.block_platform_state @@ -213,6 +205,10 @@ impl BlockExecutionContextV0MutableGetters for BlockExecutionContextV0 { fn proposer_results_mut(&mut self) -> Option<&mut ResponsePrepareProposal> { self.proposer_results.as_mut() } + + fn unsigned_withdrawal_transactions_mut(&mut self) -> &mut UnsignedWithdrawalTxs { + &mut self.unsigned_withdrawal_transactions + } } impl BlockExecutionContextV0OwnedGetters for BlockExecutionContextV0 { @@ -226,11 +222,6 @@ impl BlockExecutionContextV0OwnedGetters for BlockExecutionContextV0 { self.epoch_info } - /// Consumes the object and returns the owned `BTreeMap` of withdrawal transactions. - fn withdrawal_transactions_owned(self) -> BTreeMap> { - self.withdrawal_transactions - } - /// Consumes the object and returns the owned `PlatformState`. fn block_platform_state_owned(self) -> PlatformState { self.block_platform_state diff --git a/packages/rs-drive-abci/src/execution/types/block_state_info/mod.rs b/packages/rs-drive-abci/src/execution/types/block_state_info/mod.rs index 86e794cc001..684bcaaa569 100644 --- a/packages/rs-drive-abci/src/execution/types/block_state_info/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/block_state_info/mod.rs @@ -11,7 +11,7 @@ use dpp::block::block_info::BlockInfo; use dpp::block::epoch::Epoch; /// The versioned block state info -#[derive(Debug, From)] +#[derive(Debug, From, Clone, Eq, PartialEq)] pub enum BlockStateInfo { /// Version 0 V0(v0::BlockStateInfoV0), diff --git a/packages/rs-drive-abci/src/execution/types/block_state_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/types/block_state_info/v0/mod.rs index 1b58804fdbb..8e3b405e651 100644 --- a/packages/rs-drive-abci/src/execution/types/block_state_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/block_state_info/v0/mod.rs @@ -34,7 +34,7 @@ use dpp::block::block_info::BlockInfo; use dpp::block::epoch::Epoch; /// Block info -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct BlockStateInfoV0 { /// Block height pub height: u64, diff --git a/packages/rs-drive-abci/src/execution/types/execution_event/mod.rs b/packages/rs-drive-abci/src/execution/types/execution_event/mod.rs index 9e799bd0648..a5b011522ba 100644 --- a/packages/rs-drive-abci/src/execution/types/execution_event/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/execution_event/mod.rs @@ -2,77 +2,66 @@ mod v0; use crate::error::execution::ExecutionError; use crate::error::Error; -use crate::execution::types::execution_event::ExecutionEvent::{ - PaidDriveEvent, PaidFromAssetLockDriveEvent, -}; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValueGettersV0; use dpp::block::epoch::Epoch; use dpp::fee::Credits; use dpp::identity::PartialIdentity; +use dpp::prelude::UserFeeIncrease; use dpp::version::PlatformVersion; use drive::state_transition_action::StateTransitionAction; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; use drive::drive::batch::transitions::DriveHighLevelOperationConverter; use drive::drive::batch::DriveOperation; +use drive::state_transition_action::system::partially_use_asset_lock_action::PartiallyUseAssetLockActionAccessorsV0; /// An execution event #[derive(Clone)] pub(in crate::execution) enum ExecutionEvent<'a> { /// A drive event that is paid by an identity - PaidDriveEvent { + Paid { /// The identity requesting the event identity: PartialIdentity, + /// The removed balance in the case of a transfer or withdrawal + removed_balance: Option, /// the operations that the identity is requesting to perform operations: Vec>, + /// the execution operations that we must also pay for + execution_operations: Vec, + /// the fee multiplier that the user agreed to, 0 means 100% of the base fee, 1 means 101% + user_fee_increase: UserFeeIncrease, }, /// A drive event that is paid from an asset lock - PaidFromAssetLockDriveEvent { + PaidFromAssetLock { /// The identity requesting the event identity: PartialIdentity, /// The added balance added_balance: Credits, /// the operations that should be performed operations: Vec>, + /// the execution operations that we must also pay for + execution_operations: Vec, + /// the fee multiplier that the user agreed to, 0 means 100% of the base fee, 1 means 101% + user_fee_increase: UserFeeIncrease, }, - /// A drive event that is free - FreeDriveEvent { + /// A drive event that is paid from an asset lock + PaidFromAssetLockWithoutIdentity { + /// The processing fees that should be distributed to validators + processing_fees: Credits, /// the operations that should be performed operations: Vec>, }, -} - -impl<'a> ExecutionEvent<'a> { - /// Creates a new identity Insertion Event - pub fn new_document_operation( - identity: PartialIdentity, - operation: DriveOperation<'a>, - ) -> Self { - Self::PaidDriveEvent { - identity, - operations: vec![operation], - } - } - /// Creates a new identity Insertion Event - pub fn new_contract_operation( - identity: PartialIdentity, - operation: DriveOperation<'a>, - ) -> Self { - Self::PaidDriveEvent { - identity, - operations: vec![operation], - } - } - /// Creates a new identity Insertion Event - pub fn new_identity_insertion( - identity: PartialIdentity, + /// A drive event that is free + #[allow(dead_code)] // TODO investigate why `variant `Free` is never constructed` + Free { + /// the operations that should be performed operations: Vec>, - ) -> Self { - Self::PaidDriveEvent { - identity, - operations, - } - } + }, } impl<'a> ExecutionEvent<'a> { @@ -80,46 +69,126 @@ impl<'a> ExecutionEvent<'a> { action: StateTransitionAction, identity: Option, epoch: &Epoch, + execution_context: StateTransitionExecutionContext, platform_version: &PlatformVersion, ) -> Result { match &action { StateTransitionAction::IdentityCreateAction(identity_create_action) => { + let user_fee_increase = identity_create_action.user_fee_increase(); let identity = identity_create_action.into(); let operations = action.into_high_level_drive_operations(epoch, platform_version)?; - Ok(PaidFromAssetLockDriveEvent { + Ok(ExecutionEvent::PaidFromAssetLock { identity, added_balance: 0, operations, + execution_operations: execution_context.operations_consume(), + user_fee_increase, }) } StateTransitionAction::IdentityTopUpAction(identity_top_up_action) => { - let added_balance = identity_top_up_action.top_up_balance_amount(); + let user_fee_increase = identity_top_up_action.user_fee_increase(); + let added_balance = identity_top_up_action + .top_up_asset_lock_value() + .remaining_credit_value(); let operations = action.into_high_level_drive_operations(epoch, platform_version)?; if let Some(identity) = identity { - Ok(PaidFromAssetLockDriveEvent { + Ok(ExecutionEvent::PaidFromAssetLock { identity, added_balance, operations, + execution_operations: execution_context.operations_consume(), + user_fee_increase, + }) + } else { + Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "partial identity should be present for identity top up action", + ))) + } + } + StateTransitionAction::PartiallyUseAssetLockAction(partially_used_asset_lock) => { + let used_credits = partially_used_asset_lock.used_credits(); + let operations = + action.into_high_level_drive_operations(epoch, platform_version)?; + // We mark it as a free operation because the event itself is paying for itself + Ok(ExecutionEvent::PaidFromAssetLockWithoutIdentity { + processing_fees: used_credits, + operations, + }) + } + StateTransitionAction::IdentityCreditWithdrawalAction(identity_credit_withdrawal) => { + let user_fee_increase = identity_credit_withdrawal.user_fee_increase(); + let removed_balance = identity_credit_withdrawal.amount(); + let operations = + action.into_high_level_drive_operations(epoch, platform_version)?; + if let Some(identity) = identity { + Ok(ExecutionEvent::Paid { + identity, + removed_balance: Some(removed_balance), + operations, + execution_operations: execution_context.operations_consume(), + user_fee_increase, + }) + } else { + Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "partial identity should be present for identity credit withdrawal action", + ))) + } + } + StateTransitionAction::IdentityCreditTransferAction(identity_credit_transfer) => { + let user_fee_increase = identity_credit_transfer.user_fee_increase(); + let removed_balance = identity_credit_transfer.transfer_amount(); + let operations = + action.into_high_level_drive_operations(epoch, platform_version)?; + if let Some(identity) = identity { + Ok(ExecutionEvent::Paid { + identity, + removed_balance: Some(removed_balance), + operations, + execution_operations: execution_context.operations_consume(), + user_fee_increase, + }) + } else { + Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "partial identity should be present for identity credit transfer action", + ))) + } + } + StateTransitionAction::DocumentsBatchAction(document_batch_action) => { + let user_fee_increase = action.user_fee_increase(); + let removed_balance = document_batch_action.all_purchases_amount(); + let operations = + action.into_high_level_drive_operations(epoch, platform_version)?; + if let Some(identity) = identity { + Ok(ExecutionEvent::Paid { + identity, + removed_balance, + operations, + execution_operations: execution_context.operations_consume(), + user_fee_increase, }) } else { Err(Error::Execution(ExecutionError::CorruptedCodeExecution( - "partial identity should be present", + "partial identity should be present for other state transitions", ))) } } _ => { + let user_fee_increase = action.user_fee_increase(); let operations = action.into_high_level_drive_operations(epoch, platform_version)?; if let Some(identity) = identity { - Ok(PaidDriveEvent { + Ok(ExecutionEvent::Paid { identity, + removed_balance: None, operations, + execution_operations: execution_context.operations_consume(), + user_fee_increase, }) } else { Err(Error::Execution(ExecutionError::CorruptedCodeExecution( - "partial identity should be present", + "partial identity should be present for other state transitions", ))) } } diff --git a/packages/rs-drive-abci/src/execution/types/execution_operation/mod.rs b/packages/rs-drive-abci/src/execution/types/execution_operation/mod.rs index a15e2095c19..a3c116c04c8 100644 --- a/packages/rs-drive-abci/src/execution/types/execution_operation/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/execution_operation/mod.rs @@ -1,14 +1,57 @@ +use crate::error::execution::ExecutionError; use crate::error::Error; use crate::execution::types::execution_operation::signature_verification_operation::SignatureVerificationOperation; use dpp::fee::fee_result::FeeResult; use dpp::fee::Credits; +use dpp::identity::KeyCount; +use dpp::validation::operations::ProtocolValidationOperation; use dpp::version::PlatformVersion; -use drive::drive::batch::DriveOperation; pub mod signature_verification_operation; #[derive(Debug, Clone, PartialEq, Eq)] -pub enum ExecutionOperation { +pub struct RetrieveIdentityInfo { + query_by_key_id_key_count: u16, + request_balance: bool, + request_revision: bool, +} + +impl RetrieveIdentityInfo { + pub fn only_balance() -> Self { + RetrieveIdentityInfo { + query_by_key_id_key_count: 0, + request_balance: true, + request_revision: false, + } + } + + pub fn one_key_and_balance_and_revision() -> Self { + RetrieveIdentityInfo { + query_by_key_id_key_count: 1, + request_balance: true, + request_revision: true, + } + } + + pub fn one_key_and_balance() -> Self { + RetrieveIdentityInfo { + query_by_key_id_key_count: 1, + request_balance: true, + request_revision: false, + } + } +} + +pub type HashBlockCount = u16; + +pub const SHA256_BLOCK_SIZE: u16 = 64; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum ValidationOperation { + Protocol(ProtocolValidationOperation), + RetrieveIdentity(RetrieveIdentityInfo), + DoubleSha256(HashBlockCount), + ValidateKeyStructure(KeyCount), // This is extremely cheap SignatureVerification(SignatureVerificationOperation), PrecalculatedOperation(FeeResult), } @@ -18,3 +61,114 @@ pub trait OperationLike { fn storage_cost(&self, platform_version: &PlatformVersion) -> Result; } + +impl ValidationOperation { + pub fn add_many_to_fee_result( + execution_operations: &[ValidationOperation], + fee_result: &mut FeeResult, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + for execution_operation in execution_operations { + match execution_operation { + ValidationOperation::SignatureVerification(signature_verification_operation) => { + fee_result.processing_fee = fee_result + .processing_fee + .checked_add( + signature_verification_operation.processing_cost(platform_version)?, + ) + .ok_or(ExecutionError::Overflow( + "execution processing fee overflow error", + ))?; + } + ValidationOperation::PrecalculatedOperation(precalculated_operation) => { + fee_result.checked_add_assign(precalculated_operation.clone())?; + } + ValidationOperation::DoubleSha256(block_count) => { + fee_result.processing_fee = fee_result + .processing_fee + .checked_add( + platform_version.fee_version.hashing.double_sha256_base + + platform_version.fee_version.hashing.double_sha256_per_block + * (*block_count as u64), + ) + .ok_or(ExecutionError::Overflow( + "execution processing fee overflow error", + ))?; + } + ValidationOperation::RetrieveIdentity(RetrieveIdentityInfo { + query_by_key_id_key_count, + request_balance, + request_revision, + }) => { + let base_cost = match (request_balance, request_revision) { + (true, true) => { + platform_version + .fee_version + .processing + .fetch_identity_balance_and_revision_processing_cost + } + (true, false) => { + platform_version + .fee_version + .processing + .fetch_identity_revision_processing_cost + } + (false, true) => { + platform_version + .fee_version + .processing + .fetch_identity_balance_processing_cost + } + (false, false) => 0, + }; + + let key_cost = platform_version + .fee_version + .processing + .fetch_identity_cost_per_look_up_key_by_id + .checked_mul(*query_by_key_id_key_count as u64) + .ok_or(ExecutionError::Overflow( + "execution processing fee overflow error", + ))?; + + let operation_cost = + base_cost + .checked_add(key_cost) + .ok_or(ExecutionError::Overflow( + "execution processing fee overflow error", + ))?; + + fee_result.processing_fee = fee_result + .processing_fee + .checked_add(operation_cost) + .ok_or(ExecutionError::Overflow( + "execution processing fee overflow error", + ))?; + } + ValidationOperation::ValidateKeyStructure(key_count) => { + fee_result.processing_fee = fee_result + .processing_fee + .checked_add( + platform_version + .fee_version + .processing + .validate_key_structure + * (*key_count as u64), + ) + .ok_or(ExecutionError::Overflow( + "execution processing fee overflow error", + ))?; + } + ValidationOperation::Protocol(dpp_validation_operation) => { + fee_result.processing_fee = fee_result + .processing_fee + .checked_add(dpp_validation_operation.processing_cost(platform_version)) + .ok_or(ExecutionError::Overflow( + "execution processing fee overflow error", + ))?; + } + } + } + Ok(()) + } +} diff --git a/packages/rs-drive-abci/src/execution/types/mod.rs b/packages/rs-drive-abci/src/execution/types/mod.rs index 1a50965d3d6..ba0208c1743 100644 --- a/packages/rs-drive-abci/src/execution/types/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/mod.rs @@ -15,10 +15,13 @@ pub(in crate::execution) mod processed_block_fees_outcome; /// Proposer payouts pub(in crate::execution) mod proposer_payouts; /// A structure representing the context of the execution of a state transition -pub(in crate::execution) mod state_transition_execution_context; +pub mod state_transition_execution_context; /// A structure used in the distribution of storage fees pub(in crate::execution) mod storage_fee_distribution_outcome; /// A structure representing an unpaid epoch pub(in crate::execution) mod unpaid_epoch; /// A structure representing the outcome of updating a masternode list in the state pub(in crate::execution) mod update_state_masternode_list_outcome; + +/// A container for the state transitions +pub(in crate::execution) mod state_transition_container; diff --git a/packages/rs-drive-abci/src/execution/types/state_transition_container/mod.rs b/packages/rs-drive-abci/src/execution/types/state_transition_container/mod.rs new file mode 100644 index 00000000000..664247ca31e --- /dev/null +++ b/packages/rs-drive-abci/src/execution/types/state_transition_container/mod.rs @@ -0,0 +1,42 @@ +use crate::execution::types::state_transition_container::v0::{ + DecodedStateTransition, StateTransitionContainerV0, +}; +use derive_more::From; + +pub(crate) mod v0; + +#[derive(Debug, From)] +pub enum StateTransitionContainer<'a> { + V0(StateTransitionContainerV0<'a>), +} + +impl<'a> IntoIterator for &'a StateTransitionContainer<'a> { + type Item = &'a DecodedStateTransition<'a>; + type IntoIter = std::slice::Iter<'a, DecodedStateTransition<'a>>; + + fn into_iter(self) -> Self::IntoIter { + match self { + StateTransitionContainer::V0(v0) => v0.into_iter(), + } + } +} + +impl<'a> IntoIterator for StateTransitionContainer<'a> { + type Item = DecodedStateTransition<'a>; + type IntoIter = std::vec::IntoIter>; + + fn into_iter(self) -> Self::IntoIter { + match self { + StateTransitionContainer::V0(v0) => v0.into_iter(), + } + } +} + +#[allow(clippy::from_over_into)] +impl<'a> Into>> for StateTransitionContainer<'a> { + fn into(self) -> Vec> { + match self { + StateTransitionContainer::V0(v0) => v0.into(), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/types/state_transition_container/v0/mod.rs b/packages/rs-drive-abci/src/execution/types/state_transition_container/v0/mod.rs new file mode 100644 index 00000000000..1cf580930d5 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/types/state_transition_container/v0/mod.rs @@ -0,0 +1,76 @@ +use dpp::consensus::ConsensusError; +use dpp::state_transition::StateTransition; +use dpp::ProtocolError; +use std::time::Duration; + +/// Decoded state transition result +#[derive(Debug)] +pub enum DecodedStateTransition<'a> { + SuccessfullyDecoded(SuccessfullyDecodedStateTransition<'a>), + InvalidEncoding(InvalidStateTransition<'a>), + FailedToDecode(InvalidWithProtocolErrorStateTransition<'a>), +} + +/// Invalid encoded state transition +#[derive(Debug)] +pub struct InvalidStateTransition<'a> { + pub raw: &'a [u8], + pub error: ConsensusError, + pub elapsed_time: Duration, +} + +/// State transition that failed to decode +#[derive(Debug)] +pub struct InvalidWithProtocolErrorStateTransition<'a> { + pub raw: &'a [u8], + pub error: ProtocolError, + pub elapsed_time: Duration, +} + +/// Successfully decoded state transition +#[derive(Debug)] +pub struct SuccessfullyDecodedStateTransition<'a> { + pub decoded: StateTransition, + pub raw: &'a [u8], + pub elapsed_time: Duration, +} + +/// This is a container that holds state transitions +#[derive(Debug)] +pub struct StateTransitionContainerV0<'a> { + // We collect all decoding results in the same vector because we want to + // keep the original input order when we process them and log results we can + // easily match with txs in block + state_transitions: Vec>, +} + +impl<'a> StateTransitionContainerV0<'a> { + pub fn new(state_transitions: Vec>) -> Self { + Self { state_transitions } + } +} + +impl<'a> IntoIterator for &'a StateTransitionContainerV0<'a> { + type Item = &'a DecodedStateTransition<'a>; + type IntoIter = std::slice::Iter<'a, DecodedStateTransition<'a>>; + + fn into_iter(self) -> Self::IntoIter { + self.state_transitions.iter() + } +} + +impl<'a> IntoIterator for StateTransitionContainerV0<'a> { + type Item = DecodedStateTransition<'a>; + type IntoIter = std::vec::IntoIter>; + + fn into_iter(self) -> Self::IntoIter { + self.state_transitions.into_iter() + } +} + +#[allow(clippy::from_over_into)] +impl<'a> Into>> for StateTransitionContainerV0<'a> { + fn into(self) -> Vec> { + self.state_transitions + } +} diff --git a/packages/rs-drive-abci/src/execution/types/state_transition_execution_context/mod.rs b/packages/rs-drive-abci/src/execution/types/state_transition_execution_context/mod.rs index a3b397de511..4d9ede1066c 100644 --- a/packages/rs-drive-abci/src/execution/types/state_transition_execution_context/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/state_transition_execution_context/mod.rs @@ -1,48 +1,75 @@ use crate::error::execution::ExecutionError; -use crate::execution::types::execution_operation::ExecutionOperation; +use crate::error::Error; +use crate::execution::types::execution_operation::ValidationOperation; use crate::execution::types::state_transition_execution_context::v0::StateTransitionExecutionContextV0; use derive_more::From; +use dpp::fee::fee_result::FeeResult; +use dpp::validation::operations::ProtocolValidationOperation; use dpp::version::{DefaultForPlatformVersion, PlatformVersion}; +/// V0 module pub mod v0; #[derive(Debug, Clone, From)] +/// The state transition execution context pub enum StateTransitionExecutionContext { + /// Version 0 V0(StateTransitionExecutionContextV0), } +/// The trait defining state transition execution context methods for v0 pub trait StateTransitionExecutionContextMethodsV0 { - fn add_operation(&mut self, operation: ExecutionOperation); - fn add_operations(&mut self, operations: Vec); - fn operations_consume(self) -> Vec; - fn operations_slice(&self) -> &[ExecutionOperation]; + /// Add an operation to the state transition execution context + fn add_operation(&mut self, operation: ValidationOperation); + /// Add operations to the state transition execution context + fn add_operations(&mut self, operations: Vec); + /// Add dpp operations to the state transition execution context + fn add_dpp_operations(&mut self, operations: Vec); + /// Consume the operations of the context + fn operations_consume(self) -> Vec; + /// Returns a slice of operations, does not consume the context + fn operations_slice(&self) -> &[ValidationOperation]; + /// Are we in a dry run? fn in_dry_run(&self) -> bool; + /// Set us to be in a dry run fn enable_dry_run(&mut self); + /// Set us not to be in a dry run fn disable_dry_run(&mut self); + + /// Get the fee costs of all operations in the execution context + fn fee_cost(&self, platform_version: &PlatformVersion) -> Result; } impl StateTransitionExecutionContextMethodsV0 for StateTransitionExecutionContext { - fn add_operation(&mut self, operation: ExecutionOperation) { + fn add_operation(&mut self, operation: ValidationOperation) { match self { StateTransitionExecutionContext::V0(v0) => v0.operations.push(operation), } } - fn add_operations(&mut self, operations: Vec) { + fn add_operations(&mut self, operations: Vec) { match self { StateTransitionExecutionContext::V0(v0) => v0.operations.extend(operations), } } - fn operations_consume(self) -> Vec { + fn add_dpp_operations(&mut self, operations: Vec) { + match self { + StateTransitionExecutionContext::V0(v0) => v0 + .operations + .extend(operations.into_iter().map(ValidationOperation::Protocol)), + } + } + + fn operations_consume(self) -> Vec { match self { StateTransitionExecutionContext::V0(v0) => v0.operations, } } - fn operations_slice(&self) -> &[ExecutionOperation] { + fn operations_slice(&self) -> &[ValidationOperation] { match self { StateTransitionExecutionContext::V0(v0) => v0.operations.as_slice(), } @@ -65,6 +92,19 @@ impl StateTransitionExecutionContextMethodsV0 for StateTransitionExecutionContex StateTransitionExecutionContext::V0(v0) => v0.dry_run = false, } } + fn fee_cost(&self, platform_version: &PlatformVersion) -> Result { + match self { + StateTransitionExecutionContext::V0(v0) => { + let mut fee_result = FeeResult::default(); + ValidationOperation::add_many_to_fee_result( + v0.operations.as_slice(), + &mut fee_result, + platform_version, + )?; + Ok(fee_result) + } + } + } } impl DefaultForPlatformVersion for StateTransitionExecutionContext { diff --git a/packages/rs-drive-abci/src/execution/types/state_transition_execution_context/v0/mod.rs b/packages/rs-drive-abci/src/execution/types/state_transition_execution_context/v0/mod.rs index dbf0c508252..d3c6330e5b1 100644 --- a/packages/rs-drive-abci/src/execution/types/state_transition_execution_context/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/state_transition_execution_context/v0/mod.rs @@ -1,9 +1,12 @@ -use crate::execution::types::execution_operation::ExecutionOperation; +use crate::execution::types::execution_operation::ValidationOperation; +/// The V0 struct of the state transition execution context #[derive(Debug, Clone, Default)] pub struct StateTransitionExecutionContextV0 { // Are we executing the state transition in a dry run // Dry run is execution on check tx + /// Are we in a dry run? pub dry_run: bool, - pub operations: Vec, + /// The execution operations + pub operations: Vec, } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/check_tx_verification/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/check_tx_verification/mod.rs new file mode 100644 index 00000000000..bd7eb14d372 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/check_tx_verification/mod.rs @@ -0,0 +1,47 @@ +pub(crate) mod v0; + +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::execution_event::ExecutionEvent; +use crate::platform_types::platform::PlatformRef; +use crate::rpc::core::CoreRPCLike; +use dpp::prelude::ConsensusValidationResult; +use dpp::state_transition::StateTransition; + +use crate::execution::check_tx::CheckTxLevel; + +/// === CHECK TX: NEW ==== +/// Full validation for identity create and identity top up +/// Otherwise only validate: +/// * identity has enough balance for fee +/// * identity signature on tx is valid +/// * ST structure is valid +/// +/// === CHECK TX: RECHECK === +/// For identity create and identity top up, make sure asset lock has not been used up +/// For other state transitions verify that the user still has enough balance +/// +pub(in crate::execution) fn state_transition_to_execution_event_for_check_tx<'a, C: CoreRPCLike>( + platform: &'a PlatformRef, + state_transition: StateTransition, + check_tx_level: CheckTxLevel, +) -> Result>>, Error> { + let platform_version = platform.state.current_platform_version()?; + match platform_version + .drive_abci + .validation_and_processing + .state_transition_to_execution_event_for_check_tx + { + 0 => v0::state_transition_to_execution_event_for_check_tx_v0( + platform, + state_transition, + check_tx_level, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "state_transition_to_execution_event_for_check_tx".to_string(), + known_versions: vec![0], + received: version, + })), + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/check_tx_verification/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/check_tx_verification/v0/mod.rs new file mode 100644 index 00000000000..3846ebad994 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/check_tx_verification/v0/mod.rs @@ -0,0 +1,288 @@ +use crate::error::Error; +use crate::execution::types::execution_event::ExecutionEvent; +use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; +use crate::platform_types::platform::PlatformRef; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::rpc::core::CoreRPCLike; +use dpp::identity::state_transition::OptionallyAssetLockProved; +use dpp::prelude::ConsensusValidationResult; +use dpp::serialization::Signable; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; +use dpp::ProtocolError; + +use dpp::state_transition::StateTransition; +use dpp::version::{DefaultForPlatformVersion, PlatformVersion}; +use crate::error::execution::ExecutionError; +use crate::execution::check_tx::CheckTxLevel; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::common::asset_lock::proof::verify_is_not_spent::AssetLockProofVerifyIsNotSpent; +use crate::execution::validation::state_transition::processor::v0::{StateTransitionBalanceValidationV0, StateTransitionBasicStructureValidationV0, StateTransitionNonceValidationV0, StateTransitionIdentityBasedSignatureValidationV0, StateTransitionStructureKnownInStateValidationV0}; +use crate::execution::validation::state_transition::ValidationMode; + +pub(super) fn state_transition_to_execution_event_for_check_tx_v0<'a, C: CoreRPCLike>( + platform: &'a PlatformRef, + state_transition: StateTransition, + check_tx_level: CheckTxLevel, + platform_version: &PlatformVersion, +) -> Result>>, Error> { + // we need to validate the structure, the fees, and the signature + let mut state_transition_execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version)?; + + match check_tx_level { + CheckTxLevel::FirstTimeCheck => { + // Only identity top up and identity create do not have nonces validation + if state_transition.has_nonces_validation() { + let result = state_transition.validate_nonces( + &platform.into(), + platform.state.last_block_info(), + None, + &mut state_transition_execution_context, + platform_version, + )?; + + if !result.is_valid() { + return Ok( + ConsensusValidationResult::>::new_with_errors( + result.errors, + ), + ); + } + } + + // Only Data contract update does not have basic structure validation + if state_transition.has_basic_structure_validation() { + // First we validate the basic structure + let result = state_transition.validate_basic_structure(platform_version)?; + + if !result.is_valid() { + return Ok( + ConsensusValidationResult::>::new_with_errors( + result.errors, + ), + ); + } + } + + // Only identity create does not use identity in state validation, because it doesn't yet have the identity in state + let mut maybe_identity = if state_transition.uses_identity_in_state() { + // Validating signature for identity based state transitions (all those except identity create and identity top up) + // As we already have removed identity create above, it just splits between identity top up (below - false) and + // all other state transitions (above - true) + let result = if state_transition.validates_signature_based_on_identity_info() { + state_transition.validate_identity_signed_state_transition( + platform.drive, + None, + &mut state_transition_execution_context, + platform_version, + ) + } else { + state_transition.retrieve_identity_info( + platform.drive, + None, + &mut state_transition_execution_context, + platform_version, + ) + }?; + if !result.is_valid() { + // If the signature is not valid or if we could not retrieve identity info + // we do not have the user pay for the state transition. + // Since it is most likely not from them + // Proposers should remove such transactions from the block + // Other validators should reject blocks with such transactions + return Ok( + ConsensusValidationResult::>::new_with_errors( + result.errors, + ), + ); + } + Some(result.into_data()?) + } else { + None + }; + + let action = if state_transition + .requires_advanced_structure_validation_with_state_on_check_tx() + { + let state_transition_action_result = state_transition.transform_into_action( + platform, + platform.state.last_block_info(), + ValidationMode::CheckTx, + &mut state_transition_execution_context, + None, + )?; + if !state_transition_action_result.is_valid_with_data() { + return Ok( + ConsensusValidationResult::>::new_with_errors( + state_transition_action_result.errors, + ), + ); + } + let action = state_transition_action_result.into_data()?; + + // Validating structure + let result = state_transition.validate_advanced_structure_from_state( + &action, + maybe_identity.as_ref(), + &mut state_transition_execution_context, + platform_version, + )?; + + if !result.is_valid() { + return Ok( + ConsensusValidationResult::>::new_with_errors( + result.errors, + ), + ); + } + Some(action) + } else { + None + }; + + // For identity credit withdrawal and identity credit transfers we have a balance pre check that includes a + // processing amount and the transfer amount. + // For other state transitions we only check a min balance for an amount set per version. + // This is not done for identity create and identity top up who don't have this check here + if state_transition.has_balance_pre_check_validation() { + // Validating that we have sufficient balance for a transfer or withdrawal, + // this must happen after validating the signature + let identity = + maybe_identity + .as_mut() + .ok_or(ProtocolError::CorruptedCodeExecution( + "identity must be known to validate the balance".to_string(), + ))?; + + let result = state_transition + .validate_minimum_balance_pre_check(identity, platform_version)?; + + if !result.is_valid() { + return Ok( + ConsensusValidationResult::>::new_with_errors( + result.errors, + ), + ); + } + } + + let action = if let Some(action) = action { + action + } else { + let state_transition_action_result = state_transition.transform_into_action( + platform, + platform.state.last_block_info(), + ValidationMode::CheckTx, + &mut state_transition_execution_context, + None, + )?; + if !state_transition_action_result.is_valid_with_data() { + return Ok( + ConsensusValidationResult::>::new_with_errors( + state_transition_action_result.errors, + ), + ); + } + state_transition_action_result.into_data()? + }; + + let execution_event = ExecutionEvent::create_from_state_transition_action( + action, + maybe_identity, + platform.state.last_committed_block_epoch_ref(), + state_transition_execution_context, + platform_version, + )?; + + Ok( + ConsensusValidationResult::>::new_with_data(Some( + execution_event, + )), + ) + } + CheckTxLevel::Recheck => { + if let Some(asset_lock_proof) = state_transition.optional_asset_lock_proof() { + let mut signable_bytes_hasher = + SignableBytesHasher::Bytes(state_transition.signable_bytes()?); + // we should check that the asset lock is still valid + let validation_result = asset_lock_proof + .verify_is_not_spent_and_has_enough_balance( + platform, + &mut signable_bytes_hasher, + state_transition + .required_asset_lock_balance_for_processing_start(platform_version), + None, + platform_version, + )?; + + if validation_result.is_valid() { + Ok(ConsensusValidationResult::>::new_with_data(None)) + } else { + Ok( + ConsensusValidationResult::>::new_with_errors( + validation_result.errors, + ), + ) + } + } else { + if state_transition.has_nonces_validation() { + let result = state_transition.validate_nonces( + &platform.into(), + platform.state.last_block_info(), + None, + &mut state_transition_execution_context, + platform_version, + )?; + + if !result.is_valid() { + return Ok( + ConsensusValidationResult::>::new_with_errors( + result.errors, + ), + ); + } + } + + let state_transition_action_result = state_transition.transform_into_action( + platform, + platform.state.last_block_info(), + ValidationMode::RecheckTx, + &mut state_transition_execution_context, + None, + )?; + + if !state_transition_action_result.is_valid_with_data() { + return Ok( + ConsensusValidationResult::>::new_with_errors( + state_transition_action_result.errors, + ), + ); + } + let action = state_transition_action_result.into_data()?; + + let maybe_identity = platform.drive.fetch_identity_with_balance( + state_transition.owner_id().to_buffer(), + None, + platform_version, + )?; + + let execution_event = ExecutionEvent::create_from_state_transition_action( + action, + maybe_identity, + platform.state.last_committed_block_epoch_ref(), + state_transition_execution_context, + platform_version, + )?; + + Ok( + ConsensusValidationResult::>::new_with_data(Some( + execution_event, + )), + ) + } + } + _ => Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "CheckTxLevel must be first time check or recheck", + ))), + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/chain/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/chain/mod.rs deleted file mode 100644 index bcca8030c28..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/chain/mod.rs +++ /dev/null @@ -1,58 +0,0 @@ -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::execution::validation::state_transition::common::asset_lock::proof::AssetLockProofStateValidation; -use crate::platform_types::platform::PlatformRef; -use crate::rpc::core::CoreRPCLike; -use dpp::consensus::basic::identity::{ - IdentityAssetLockTransactionOutPointAlreadyExistsError, - InvalidAssetLockProofCoreChainHeightError, -}; -use dpp::identity::state_transition::asset_lock_proof::chain::ChainAssetLockProof; -use dpp::platform_value::Bytes36; -use dpp::validation::SimpleConsensusValidationResult; -use dpp::version::PlatformVersion; -use drive::grovedb::TransactionArg; - -// TODO: Versioning -impl AssetLockProofStateValidation for ChainAssetLockProof { - fn validate_state( - &self, - platform_ref: &PlatformRef, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result { - let mut result = SimpleConsensusValidationResult::default(); - - if platform_ref.block_info.core_height < self.core_chain_locked_height { - result.add_error(InvalidAssetLockProofCoreChainHeightError::new( - self.core_chain_locked_height, - platform_ref.block_info.core_height, - )); - - return Ok(result); - } - - // Make sure that asset lock isn't spent yet - - let outpoint_bytes = self.out_point.try_into().map_err(|e| { - Error::Execution(ExecutionError::Conversion(String::from( - "can't convert output to bytes", - ))) - })?; - - let is_already_spent = platform_ref.drive.has_asset_lock_outpoint( - &Bytes36::new(outpoint_bytes), - transaction, - &platform_version.drive, - )?; - - if is_already_spent { - result.add_error(IdentityAssetLockTransactionOutPointAlreadyExistsError::new( - self.out_point.txid, - self.out_point.vout as usize, - )) - } - - Ok(result) - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/instant/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/instant/mod.rs deleted file mode 100644 index 4f193c2c33b..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/instant/mod.rs +++ /dev/null @@ -1,68 +0,0 @@ -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::execution::validation::state_transition::common::asset_lock::proof::AssetLockProofStateValidation; -use crate::platform_types::platform::PlatformRef; -use crate::rpc::core::CoreRPCLike; -use crate::rpc::signature::CoreSignatureVerification; -use dpp::consensus::basic::identity::{ - IdentityAssetLockTransactionOutPointAlreadyExistsError, - InvalidInstantAssetLockProofSignatureError, -}; -use dpp::identity::state_transition::asset_lock_proof::InstantAssetLockProof; -use dpp::platform_value::Bytes36; -use dpp::validation::SimpleConsensusValidationResult; -use dpp::version::PlatformVersion; -use drive::grovedb::TransactionArg; - -// TODO: Versioning -impl AssetLockProofStateValidation for InstantAssetLockProof { - fn validate_state( - &self, - platform_ref: &PlatformRef, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result { - let mut result = SimpleConsensusValidationResult::default(); - - // Make sure that asset lock isn't spent yet - - let Some(asset_lock_outpoint) = self.out_point() else { - return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( - "asset lock outpoint must be present", - ))); - }; - - let outpoint_bytes = asset_lock_outpoint.try_into().map_err(|e| { - Error::Execution(ExecutionError::Conversion(format!( - "can't convert output to bytes: {e}", - ))) - })?; - - let is_already_spent = platform_ref.drive.has_asset_lock_outpoint( - &Bytes36::new(outpoint_bytes), - transaction, - &platform_version.drive, - )?; - - if is_already_spent { - result.add_error(IdentityAssetLockTransactionOutPointAlreadyExistsError::new( - asset_lock_outpoint.txid, - asset_lock_outpoint.vout as usize, - )) - } - - // Verify instant lock signature with Core - - let is_instant_lock_signature_valid = self - .instant_lock() - .verify_signature(platform_ref.core_rpc, platform_ref.block_info.core_height)?; - - if !is_instant_lock_signature_valid { - result.add_error(InvalidInstantAssetLockProofSignatureError::new()); - - return Ok(result); - } - - Ok(result) - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/mod.rs index d498e0f5de5..c1e44b07b05 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/mod.rs @@ -1,52 +1,2 @@ -mod chain; -mod instant; - -use crate::error::Error; -use crate::platform_types::platform::PlatformRef; -use crate::rpc::core::CoreRPCLike; -use dpp::prelude::AssetLockProof; -use dpp::validation::SimpleConsensusValidationResult; -use dpp::version::PlatformVersion; -use drive::grovedb::TransactionArg; - -/// A trait for validating state transitions within a blockchain. -pub trait AssetLockProofStateValidation { - /// Validates the state transition by analyzing the changes in the platform state after applying the transaction. - /// - /// # Arguments - /// - /// * `platform` - A reference to the platform containing the state data. - /// * `tx` - The transaction argument to be applied. - /// - /// # Type Parameters - /// - /// * `C: CoreRPCLike` - A type constraint indicating that C should implement `CoreRPCLike`. - /// - /// # Returns - /// - /// * `Result` - A result with either a SimpleConsensusValidationResult or an Error. - fn validate_state( - &self, - platform_ref: &PlatformRef, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result; -} - -impl AssetLockProofStateValidation for AssetLockProof { - fn validate_state( - &self, - platform_ref: &PlatformRef, - transaction: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result { - match self { - AssetLockProof::Instant(proof) => { - proof.validate_state(platform_ref, transaction, platform_version) - } - AssetLockProof::Chain(proof) => { - proof.validate_state(platform_ref, transaction, platform_version) - } - } - } -} +pub mod validate; +pub mod verify_is_not_spent; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/validate/chain/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/validate/chain/mod.rs new file mode 100644 index 00000000000..f0ff6ac4c81 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/validate/chain/mod.rs @@ -0,0 +1,50 @@ +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; +use crate::error::Error; +use crate::platform_types::platform::PlatformRef; +use crate::rpc::core::CoreRPCLike; +use dpp::consensus::basic::identity::{ + InvalidAssetLockProofCoreChainHeightError, +}; +use dpp::fee::Credits; +use dpp::identity::state_transition::asset_lock_proof::chain::ChainAssetLockProof; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; +use dpp::validation::ConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use crate::execution::validation::state_transition::common::asset_lock::proof::validate::AssetLockProofValidation; +use crate::execution::validation::state_transition::common::asset_lock::proof::verify_is_not_spent::AssetLockProofVerifyIsNotSpent; +use crate::execution::validation::state_transition::ValidationMode; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; + +// TODO: Versioning +impl AssetLockProofValidation for ChainAssetLockProof { + fn validate( + &self, + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + required_balance: Credits, + validation_mode: ValidationMode, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + if validation_mode != ValidationMode::RecheckTx + && platform_ref.state.last_committed_core_height() < self.core_chain_locked_height + { + return Ok(ConsensusValidationResult::new_with_error( + InvalidAssetLockProofCoreChainHeightError::new( + self.core_chain_locked_height, + platform_ref.state.last_committed_core_height(), + ) + .into(), + )); + } + + self.verify_is_not_spent_and_has_enough_balance( + platform_ref, + signable_bytes_hasher, + required_balance, + transaction, + platform_version, + ) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/validate/instant/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/validate/instant/mod.rs new file mode 100644 index 00000000000..e9fb84b8f8d --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/validate/instant/mod.rs @@ -0,0 +1,62 @@ +use crate::error::Error; +use crate::platform_types::platform::PlatformRef; +use crate::rpc::core::CoreRPCLike; +use crate::rpc::signature::CoreSignatureVerification; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; +use dpp::consensus::basic::identity::InvalidInstantAssetLockProofSignatureError; +use dpp::fee::Credits; +use dpp::identity::state_transition::asset_lock_proof::InstantAssetLockProof; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; + +use dpp::validation::ConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use crate::execution::validation::state_transition::common::asset_lock::proof::validate::AssetLockProofValidation; +use crate::execution::validation::state_transition::common::asset_lock::proof::verify_is_not_spent::AssetLockProofVerifyIsNotSpent; +use crate::execution::validation::state_transition::ValidationMode; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; + +// TODO: Versioning +impl AssetLockProofValidation for InstantAssetLockProof { + fn validate( + &self, + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + required_balance: Credits, + validation_mode: ValidationMode, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + // Verify instant lock signature with Core + + let validation_result = self.verify_is_not_spent_and_has_enough_balance( + platform_ref, + signable_bytes_hasher, + required_balance, + transaction, + platform_version, + )?; + + if !validation_result.is_valid() { + return Ok(validation_result); + } + + // If we have a partially spent asset lock then we do not need to verify the signature of the instant lock + // As we know this outpoint was already considered final and locked. + + if validation_mode != ValidationMode::RecheckTx && !validation_result.has_data() { + let is_instant_lock_signature_valid = self.instant_lock().verify_signature( + platform_ref.core_rpc, + platform_ref.state.last_committed_core_height(), + )?; + + if !is_instant_lock_signature_valid { + return Ok(ConsensusValidationResult::new_with_error( + InvalidInstantAssetLockProofSignatureError::new().into(), + )); + } + } + + Ok(validation_result) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/validate/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/validate/mod.rs new file mode 100644 index 00000000000..ee7e2652e0d --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/validate/mod.rs @@ -0,0 +1,72 @@ +mod chain; +mod instant; + +use crate::error::Error; +use crate::execution::validation::state_transition::ValidationMode; +use crate::platform_types::platform::PlatformRef; +use crate::rpc::core::CoreRPCLike; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; +use dpp::fee::Credits; +use dpp::prelude::AssetLockProof; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; +use dpp::validation::ConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +/// A trait for validating state transitions within a blockchain. +pub trait AssetLockProofValidation { + /// Validates the state transition by analyzing the changes in the platform state after applying the transaction. + /// + /// # Arguments + /// + /// * `platform` - A reference to the platform containing the state data. + /// * `tx` - The transaction argument to be applied. + /// + /// # Type Parameters + /// + /// * `C: CoreRPCLike` - A type constraint indicating that C should implement `CoreRPCLike`. + /// + /// # Returns + /// + /// * `Result` - A result with either a SimpleConsensusValidationResult or an Error. + fn validate( + &self, + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + required_balance: Credits, + validation_mode: ValidationMode, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error>; +} + +impl AssetLockProofValidation for AssetLockProof { + fn validate( + &self, + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + required_balance: Credits, + validation_mode: ValidationMode, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match self { + AssetLockProof::Instant(proof) => proof.validate( + platform_ref, + signable_bytes_hasher, + required_balance, + validation_mode, + transaction, + platform_version, + ), + AssetLockProof::Chain(proof) => proof.validate( + platform_ref, + signable_bytes_hasher, + required_balance, + validation_mode, + transaction, + platform_version, + ), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/chain/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/chain/mod.rs new file mode 100644 index 00000000000..3eb45e3b8d9 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/chain/mod.rs @@ -0,0 +1,33 @@ +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; +use crate::error::Error; +use crate::platform_types::platform::PlatformRef; +use dpp::fee::Credits; +use dpp::identity::state_transition::asset_lock_proof::chain::ChainAssetLockProof; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; +use dpp::validation::ConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use crate::execution::validation::state_transition::common::asset_lock::proof::verify_is_not_spent::AssetLockProofVerifyIsNotSpent; + +use super::verify_asset_lock_is_not_spent_and_has_enough_balance; + +// TODO: Versioning +impl AssetLockProofVerifyIsNotSpent for ChainAssetLockProof { + fn verify_is_not_spent_and_has_enough_balance( + &self, + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + required_balance: Credits, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + verify_asset_lock_is_not_spent_and_has_enough_balance( + platform_ref, + signable_bytes_hasher, + self.out_point, + required_balance, + transaction, + platform_version, + ) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/instant/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/instant/mod.rs new file mode 100644 index 00000000000..f6ad4a3a793 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/instant/mod.rs @@ -0,0 +1,43 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::PlatformRef; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; + +use dpp::fee::Credits; +use dpp::identity::state_transition::asset_lock_proof::InstantAssetLockProof; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; +use dpp::validation::ConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use crate::execution::validation::state_transition::common::asset_lock::proof::verify_is_not_spent::AssetLockProofVerifyIsNotSpent; + +use super::verify_asset_lock_is_not_spent_and_has_enough_balance; + +// TODO: Versioning +impl AssetLockProofVerifyIsNotSpent for InstantAssetLockProof { + fn verify_is_not_spent_and_has_enough_balance( + &self, + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + required_balance: Credits, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + // Make sure that asset lock isn't spent yet + + let Some(asset_lock_outpoint) = self.out_point() else { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "asset lock outpoint must be present", + ))); + }; + + verify_asset_lock_is_not_spent_and_has_enough_balance( + platform_ref, + signable_bytes_hasher, + asset_lock_outpoint, + required_balance, + transaction, + platform_version, + ) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/mod.rs new file mode 100644 index 00000000000..a38cf9a5097 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/mod.rs @@ -0,0 +1,105 @@ +mod chain; +mod instant; +mod v0; + +use crate::error::Error; +use crate::platform_types::platform::PlatformRef; +use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; +use dpp::dashcore::OutPoint; +use dpp::fee::Credits; + +use dpp::prelude::AssetLockProof; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; +use dpp::validation::ConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use crate::error::execution::ExecutionError; +use crate::execution::validation::state_transition::common::asset_lock::proof::verify_is_not_spent::v0::verify_asset_lock_is_not_spent_and_has_enough_balance_v0; + +/// A trait for validating that an asset lock is not spent +pub trait AssetLockProofVerifyIsNotSpent { + /// Validates that the asset lock was not spent + /// + /// # Arguments + /// + /// * `platform` - A reference to the platform containing the state data. + /// * `transaction` - The database transaction to check on, can be None. + /// * `platform_version` - The platform version that we are using + /// + /// # Type Parameters + /// + /// * `C: CoreRPCLike` - A type constraint indicating that C should implement `CoreRPCLike`. + /// + /// # Returns + /// + /// * `Result` - A result with either a SimpleConsensusValidationResult or an Error. + fn verify_is_not_spent_and_has_enough_balance( + &self, + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + required_balance: Credits, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error>; +} + +impl AssetLockProofVerifyIsNotSpent for AssetLockProof { + fn verify_is_not_spent_and_has_enough_balance( + &self, + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + required_balance: Credits, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match self { + AssetLockProof::Instant(proof) => proof.verify_is_not_spent_and_has_enough_balance( + platform_ref, + signable_bytes_hasher, + required_balance, + transaction, + platform_version, + ), + AssetLockProof::Chain(proof) => proof.verify_is_not_spent_and_has_enough_balance( + platform_ref, + signable_bytes_hasher, + required_balance, + transaction, + platform_version, + ), + } + } +} + +#[inline(always)] +fn verify_asset_lock_is_not_spent_and_has_enough_balance( + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + out_point: OutPoint, + required_balance: Credits, + transaction: TransactionArg, + platform_version: &PlatformVersion, +) -> Result, Error> { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .common_validation_methods + .asset_locks + .verify_asset_lock_is_not_spent_and_has_enough_balance + { + 0 => verify_asset_lock_is_not_spent_and_has_enough_balance_v0( + platform_ref, + signable_bytes_hasher, + out_point, + required_balance, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "verify_asset_lock_is_not_spent_and_has_enough_balance".to_string(), + known_versions: vec![0], + received: version, + })), + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/v0/mod.rs new file mode 100644 index 00000000000..1ca28e3ff83 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/proof/verify_is_not_spent/v0/mod.rs @@ -0,0 +1,88 @@ +use crate::error::Error; +use crate::platform_types::platform::PlatformRef; +use dpp::asset_lock::reduced_asset_lock_value::{AssetLockValue, AssetLockValueGettersV0}; +use dpp::asset_lock::StoredAssetLockInfo; +use dpp::consensus::basic::identity::{ + IdentityAssetLockStateTransitionReplayError, + IdentityAssetLockTransactionOutPointAlreadyConsumedError, + IdentityAssetLockTransactionOutPointNotEnoughBalanceError, +}; +use dpp::dashcore::OutPoint; +use dpp::fee::Credits; +use dpp::platform_value::Bytes36; +use dpp::prelude::ConsensusValidationResult; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +/// Both proofs share the same verification logic +#[inline(always)] +pub(super) fn verify_asset_lock_is_not_spent_and_has_enough_balance_v0( + platform_ref: &PlatformRef, + signable_bytes_hasher: &mut SignableBytesHasher, + out_point: OutPoint, + required_balance: Credits, + transaction: TransactionArg, + platform_version: &PlatformVersion, +) -> Result, Error> { + // Make sure that asset lock isn't spent yet + + let stored_asset_lock_info = platform_ref.drive.fetch_asset_lock_outpoint_info( + &Bytes36::new(out_point.into()), + transaction, + &platform_version.drive, + )?; + + match stored_asset_lock_info { + StoredAssetLockInfo::FullyConsumed => { + // It was already entirely spent + Ok(ConsensusValidationResult::new_with_error( + IdentityAssetLockTransactionOutPointAlreadyConsumedError::new( + out_point.txid, + out_point.vout as usize, + ) + .into(), + )) + } + StoredAssetLockInfo::PartiallyConsumed(reduced_asset_lock_value) => { + if reduced_asset_lock_value.remaining_credit_value() == 0 { + Ok(ConsensusValidationResult::new_with_error( + IdentityAssetLockTransactionOutPointAlreadyConsumedError::new( + out_point.txid, + out_point.vout as usize, + ) + .into(), + )) + } else if reduced_asset_lock_value.remaining_credit_value() < required_balance { + Ok(ConsensusValidationResult::new_with_error( + IdentityAssetLockTransactionOutPointNotEnoughBalanceError::new( + out_point.txid, + out_point.vout as usize, + reduced_asset_lock_value.initial_credit_value(), + reduced_asset_lock_value.remaining_credit_value(), + required_balance, + ) + .into(), + )) + } else if signable_bytes_hasher + .hash_bytes_and_check_if_vec_contains(reduced_asset_lock_value.used_tags_ref()) + { + // Here we check that the transaction was not already tried to be execution + // This is the replay attack prevention + Ok(ConsensusValidationResult::new_with_error( + IdentityAssetLockStateTransitionReplayError::new( + out_point.txid, + out_point.vout as usize, + signable_bytes_hasher.to_hashed_bytes(), + ) + .into(), + )) + } else { + Ok(ConsensusValidationResult::new_with_data( + reduced_asset_lock_value, + )) + } + } + StoredAssetLockInfo::NotPresent => Ok(ConsensusValidationResult::new()), + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/transaction/fetch_asset_lock_transaction_output_sync/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/transaction/fetch_asset_lock_transaction_output_sync/v0/mod.rs index d4e70a394e8..6347c9515c0 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/transaction/fetch_asset_lock_transaction_output_sync/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/transaction/fetch_asset_lock_transaction_output_sync/v0/mod.rs @@ -6,7 +6,6 @@ use dpp::consensus::basic::identity::{ InvalidAssetLockProofTransactionHeightError, }; use dpp::dashcore::secp256k1::ThirtyTwoByteHash; -use dpp::dashcore::transaction::special_transaction::TransactionPayload; use dpp::dashcore::TxOut; use dpp::identity::state_transition::asset_lock_proof::validate_asset_lock_transaction_structure::validate_asset_lock_transaction_structure; use dpp::prelude::{AssetLockProof, ConsensusValidationResult}; @@ -41,6 +40,8 @@ pub fn fetch_asset_lock_transaction_output_sync_v0( let maybe_transaction_info = core_rpc .get_optional_transaction_extended_info(&transaction_hash) .map_err(|e| { + //todo multiple errors are possible from core, some that + // would lead to consensus errors, other execution errors Error::Execution(ExecutionError::DashCoreBadResponseError(format!( "can't fetch asset transaction for chain asset lock proof: {e}", ))) @@ -95,33 +96,13 @@ pub fn fetch_asset_lock_transaction_output_sync_v0( // Validate asset lock transaction - let validate_asset_lock_transaction_result = validate_asset_lock_transaction_structure( - &transaction, - output_index, - platform_version, - )?; - - if !validate_asset_lock_transaction_result.is_valid() { - return Ok(ConsensusValidationResult::new_with_errors( - validate_asset_lock_transaction_result.errors, - )); - } - - // Extract outpoint from the payload - if let Some(TransactionPayload::AssetLockPayloadType(mut payload)) = - transaction.special_transaction_payload - { - // We are dealing with old Rust edition so we can't use optional remove - if payload.credit_outputs.get(output_index as usize).is_some() { - let output = payload.credit_outputs.remove(output_index as usize); - - return Ok(ValidationResult::new_with_data(output)); - } - } - - Err(Error::Execution(ExecutionError::CorruptedCodeExecution( - "transaction should have outpoint", - ))) + // While we don't need this validation for recheck, we still need to get the tx_out + // To get the Tx_out we need some sanity checks, then this checks that we are p2pkh. + // The check for p2pkh is only marginally more expensive than the check to see if we are + // on a recheck, so there's no point making the code more complicated and stripping + // out a very cheap check on recheck tx + validate_asset_lock_transaction_structure(&transaction, output_index, platform_version) + .map_err(Error::Protocol) } } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/mod.rs index c27af2cf33d..8e425890600 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/mod.rs @@ -3,5 +3,7 @@ pub mod asset_lock; pub mod validate_identity_public_key_contract_bounds; pub mod validate_identity_public_key_ids_dont_exist_in_state; pub mod validate_identity_public_key_ids_exist_in_state; +pub mod validate_not_disabling_last_master_key; +pub mod validate_simple_pre_check_balance; pub mod validate_state_transition_identity_signed; pub mod validate_unique_identity_public_key_hashes_in_state; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_contract_bounds/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_contract_bounds/v0/mod.rs index 43acebf0c00..48753f8193a 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_contract_bounds/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_contract_bounds/v0/mod.rs @@ -1,7 +1,7 @@ use crate::error::Error; use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use dpp::consensus::basic::document::{ - DataContractNotPresentError, InvalidDocumentTypeError, MissingDocumentTypeError, + DataContractNotPresentError, InvalidDocumentTypeError, }; use dpp::consensus::basic::identity::DataContractBoundsNotPresentError; use dpp::consensus::basic::BasicError; @@ -22,7 +22,7 @@ use dpp::validation::SimpleConsensusValidationResult; use dpp::version::PlatformVersion; use drive::drive::Drive; use drive::drive::identity::key::fetch::{IdentityKeysRequest, KeyKindRequestType, KeyRequestType, OptionalSingleIdentityPublicKeyOutcome}; -use drive::grovedb::{Transaction, TransactionArg}; +use drive::grovedb::TransactionArg; pub(super) fn validate_identity_public_keys_contract_bounds_v0( identity_id: Identifier, @@ -55,7 +55,7 @@ fn validate_identity_public_key_contract_bounds_v0( identity_public_key_in_creation: &IdentityPublicKeyInCreation, drive: &Drive, transaction: TransactionArg, - execution_context: &mut StateTransitionExecutionContext, + _execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, ) -> Result { //todo: we should add to the execution context the cost of fetching contracts diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_dont_exist_in_state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_dont_exist_in_state/v0/mod.rs index dde54fe0540..a9feed80d56 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_dont_exist_in_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_dont_exist_in_state/v0/mod.rs @@ -21,7 +21,7 @@ pub(super) fn validate_identity_public_key_ids_dont_exist_in_state_v0( identity_public_keys_with_witness: &[IdentityPublicKeyInCreation], drive: &Drive, transaction: TransactionArg, - execution_context: &mut StateTransitionExecutionContext, + _execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, ) -> Result { // first let's check that the identity has no keys with the same id diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_exist_in_state/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_exist_in_state/mod.rs index 933e1ec9c88..aa252d7d03a 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_exist_in_state/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_exist_in_state/mod.rs @@ -1,6 +1,6 @@ use dpp::identifier::Identifier; -use dpp::identity::KeyID; -use dpp::validation::SimpleConsensusValidationResult; +use dpp::identity::{IdentityPublicKey, KeyID}; +use dpp::validation::ConsensusValidationResult; use drive::drive::Drive; use drive::grovedb::TransactionArg; use dpp::version::PlatformVersion; @@ -18,7 +18,7 @@ pub(crate) fn validate_identity_public_key_ids_exist_in_state( execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, -) -> Result { +) -> Result>, Error> { match platform_version .drive_abci .validation_and_processing diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_exist_in_state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_exist_in_state/v0/mod.rs index 32f596f1e36..6422faf196e 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_exist_in_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_exist_in_state/v0/mod.rs @@ -2,28 +2,28 @@ use crate::error::Error; use dpp::consensus::state::identity::missing_identity_public_key_ids_error::MissingIdentityPublicKeyIdsError; -use dpp::identity::KeyID; +use dpp::identity::{IdentityPublicKey, KeyID}; use dpp::platform_value::Identifier; +use dpp::prelude::ConsensusValidationResult; -use dpp::validation::SimpleConsensusValidationResult; - -use drive::drive::identity::key::fetch::{IdentityKeysRequest, KeyIDVec, KeyRequestType}; +use drive::drive::identity::key::fetch::{ + IdentityKeysRequest, KeyIDIdentityPublicKeyPairBTreeMap, KeyRequestType, +}; use drive::drive::Drive; use drive::grovedb::TransactionArg; use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use dpp::version::PlatformVersion; -use std::collections::BTreeSet; /// This will validate that all keys are valid against the state pub(super) fn validate_identity_public_key_ids_exist_in_state_v0( identity_id: Identifier, key_ids: &[KeyID], drive: &Drive, - execution_context: &mut StateTransitionExecutionContext, + _execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, -) -> Result { +) -> Result>, Error> { let limit = key_ids.len() as u16; let identity_key_request = IdentityKeysRequest { identity_id: identity_id.to_buffer(), @@ -31,20 +31,20 @@ pub(super) fn validate_identity_public_key_ids_exist_in_state_v0( limit: Some(limit), offset: None, }; - let keys = drive.fetch_identity_keys::( + let to_remove_keys = drive.fetch_identity_keys::( identity_key_request, transaction, platform_version, )?; - if keys.len() != key_ids.len() { - let to_remove = BTreeSet::from_iter(keys); + if to_remove_keys.len() != key_ids.len() { let mut missing_keys = key_ids.to_vec(); - missing_keys.retain(|found_key| !to_remove.contains(found_key)); + missing_keys.retain(|found_key| !to_remove_keys.contains_key(found_key)); // keys should all exist - Ok(SimpleConsensusValidationResult::new_with_error( + Ok(ConsensusValidationResult::new_with_error( MissingIdentityPublicKeyIdsError::new(missing_keys).into(), )) } else { - Ok(SimpleConsensusValidationResult::default()) + let values: Vec<_> = to_remove_keys.into_values().collect(); + Ok(ConsensusValidationResult::new_with_data(values)) } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_not_disabling_last_master_key/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_not_disabling_last_master_key/mod.rs new file mode 100644 index 00000000000..a4d29d4b8b0 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_not_disabling_last_master_key/mod.rs @@ -0,0 +1,30 @@ +use dpp::identity::IdentityPublicKey; +use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; +use crate::error::Error; +use crate::error::execution::ExecutionError; +use crate::execution::validation::state_transition::common::validate_not_disabling_last_master_key::v0::validate_master_key_uniqueness_v0; + +pub mod v0; + +pub(crate) fn validate_master_key_uniqueness( + public_keys_being_added: &[IdentityPublicKeyInCreation], + public_keys_to_disable: &[IdentityPublicKey], + platform_version: &PlatformVersion, +) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .common_validation_methods + .validate_master_key_uniqueness + { + 0 => validate_master_key_uniqueness_v0(public_keys_being_added, public_keys_to_disable), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "validate_not_disabling_last_master_key".to_string(), + known_versions: vec![0], + received: version, + })), + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_not_disabling_last_master_key/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_not_disabling_last_master_key/v0/mod.rs new file mode 100644 index 00000000000..3abdc332e3d --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_not_disabling_last_master_key/v0/mod.rs @@ -0,0 +1,42 @@ +use crate::error::Error; +use dpp::consensus::basic::BasicError; +use dpp::consensus::state::identity::master_public_key_update_error::MasterPublicKeyUpdateError; + +use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; +use dpp::identity::{IdentityPublicKey, SecurityLevel}; +use dpp::state_transition::public_key_in_creation::accessors::IdentityPublicKeyInCreationV0Getters; + +use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; +use dpp::validation::SimpleConsensusValidationResult; + +/// This will validate that all keys are valid against the state +pub(super) fn validate_master_key_uniqueness_v0( + public_keys_being_added: &[IdentityPublicKeyInCreation], + public_keys_to_disable: &[IdentityPublicKey], +) -> Result { + let master_keys_to_disable_count = public_keys_to_disable + .iter() + .filter(|key| key.security_level() == SecurityLevel::MASTER) + .count(); + + let master_keys_being_added_count = public_keys_being_added + .iter() + .filter(|key| key.security_level() == SecurityLevel::MASTER) + .count(); + + // Check that at most one master key is being disabled and at most one is being added + if master_keys_to_disable_count > 1 + || master_keys_being_added_count > 1 + || ((master_keys_to_disable_count == 1) ^ (master_keys_being_added_count == 1)) + { + Ok(SimpleConsensusValidationResult::new_with_error( + BasicError::MasterPublicKeyUpdateError(MasterPublicKeyUpdateError::new( + master_keys_being_added_count, + master_keys_to_disable_count, + )) + .into(), + )) + } else { + Ok(SimpleConsensusValidationResult::default()) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_simple_pre_check_balance/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_simple_pre_check_balance/mod.rs new file mode 100644 index 00000000000..38ad05a89f2 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_simple_pre_check_balance/mod.rs @@ -0,0 +1,39 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::validation::state_transition::common::validate_simple_pre_check_balance::v0::ValidateSimplePreCheckBalanceV0; +use dpp::identity::PartialIdentity; +use dpp::state_transition::StateTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; +pub mod v0; + +pub trait ValidateSimplePreCheckBalance { + fn validate_simple_pre_check_minimum_balance( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl ValidateSimplePreCheckBalance for StateTransition { + fn validate_simple_pre_check_minimum_balance( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .common_validation_methods + .validate_simple_pre_check_balance + { + 0 => self.validate_simple_pre_check_minimum_balance_v0(identity, platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "StateTransition::validate_simple_pre_check_balance".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_simple_pre_check_balance/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_simple_pre_check_balance/v0/mod.rs new file mode 100644 index 00000000000..07c2895c251 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_simple_pre_check_balance/v0/mod.rs @@ -0,0 +1,78 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use dpp::consensus::state::identity::IdentityInsufficientBalanceError; +use dpp::identity::PartialIdentity; +use dpp::state_transition::StateTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; + +pub trait ValidateSimplePreCheckBalanceV0 { + fn validate_simple_pre_check_minimum_balance_v0( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl ValidateSimplePreCheckBalanceV0 for StateTransition { + fn validate_simple_pre_check_minimum_balance_v0( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result { + let amount = match self { + StateTransition::DataContractCreate(_) => { + platform_version + .fee_version + .state_transition_min_fees + .contract_create + } + StateTransition::DataContractUpdate(_) => { + platform_version + .fee_version + .state_transition_min_fees + .contract_update + } + StateTransition::DocumentsBatch(_) => { + platform_version + .fee_version + .state_transition_min_fees + .document_batch_sub_transition + } + StateTransition::IdentityCreate(_) | StateTransition::IdentityTopUp(_) => 0, + StateTransition::IdentityCreditWithdrawal(_) => { + platform_version + .fee_version + .state_transition_min_fees + .credit_withdrawal + } + StateTransition::IdentityUpdate(_) => { + platform_version + .fee_version + .state_transition_min_fees + .identity_update + } + StateTransition::IdentityCreditTransfer(_) => { + platform_version + .fee_version + .state_transition_min_fees + .credit_transfer + } + }; + + let balance = + identity + .balance + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expected to have a balance on identity for identity based operations", + )))?; + + if balance < amount { + return Ok(SimpleConsensusValidationResult::new_with_error( + IdentityInsufficientBalanceError::new(identity.id, balance, amount).into(), + )); + } + + Ok(SimpleConsensusValidationResult::new()) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/mod.rs index 73b3aa83886..2d837657961 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/mod.rs @@ -1,15 +1,9 @@ -use std::sync::Arc; - -use dpp::identifier::Identifier; use dpp::identity::PartialIdentity; -use dpp::ProtocolError; use dpp::state_transition::StateTransition; use dpp::validation::ConsensusValidationResult; use dpp::version::{PlatformVersion}; -use drive::drive::contract::DataContractFetchInfo; use drive::drive::Drive; use drive::grovedb::TransactionArg; -use drive::state_transition_action::StateTransitionAction; use crate::error::Error; use crate::error::execution::ExecutionError; use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; @@ -17,13 +11,10 @@ use crate::execution::validation::state_transition::common::validate_state_trans pub mod v0; -pub type GetDataContractFn = fn(Identifier) -> Result, ProtocolError>; - pub trait ValidateStateTransitionIdentitySignature { fn validate_state_transition_identity_signed( &self, drive: &Drive, - action: Option<&StateTransitionAction>, request_revision: bool, transaction: TransactionArg, execution_context: &mut StateTransitionExecutionContext, @@ -35,7 +26,6 @@ impl ValidateStateTransitionIdentitySignature for StateTransition { fn validate_state_transition_identity_signed( &self, drive: &Drive, - action: Option<&StateTransitionAction>, request_revision: bool, transaction: TransactionArg, execution_context: &mut StateTransitionExecutionContext, @@ -50,7 +40,6 @@ impl ValidateStateTransitionIdentitySignature for StateTransition { { 0 => self.validate_state_transition_identity_signed_v0( drive, - action, request_revision, transaction, execution_context, diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/v0/mod.rs index be7cd864eb1..00bc6ef6826 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/v0/mod.rs @@ -1,40 +1,34 @@ use crate::error::Error; use dpp::consensus::signature::{ - IdentityNotFoundError, InvalidSignaturePublicKeySecurityLevelError, - InvalidStateTransitionSignatureError, PublicKeySecurityLevelNotMetError, + IdentityNotFoundError, InvalidSignaturePublicKeyPurposeError, + InvalidSignaturePublicKeySecurityLevelError, InvalidStateTransitionSignatureError, + PublicKeySecurityLevelNotMetError, }; use dpp::identity::PartialIdentity; use crate::execution::types::execution_operation::signature_verification_operation::SignatureVerificationOperation; -use crate::execution::types::execution_operation::ExecutionOperation; +use crate::execution::types::execution_operation::{RetrieveIdentityInfo, ValidationOperation}; use crate::execution::types::state_transition_execution_context::{ StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, }; use dpp::consensus::ConsensusError; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; -use crate::error::execution::ExecutionError; +use dpp::consensus::signature::{ + InvalidIdentityPublicKeyTypeError, MissingPublicKeyError, PublicKeyIsDisabledError, + SignatureError, +}; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; -use dpp::state_transition::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; +use dpp::native_bls::NativeBlsModule; use dpp::state_transition::StateTransition; use dpp::validation::ConsensusValidationResult; use dpp::version::PlatformVersion; use dpp::ProtocolError; -use dpp::{ - consensus::signature::{ - InvalidIdentityPublicKeyTypeError, MissingPublicKeyError, PublicKeyIsDisabledError, - SignatureError, - }, - NativeBlsModule, -}; use drive::dpp::identity::KeyType; use drive::drive::identity::key::fetch::IdentityKeysRequest; use drive::drive::Drive; use drive::grovedb::TransactionArg; -use drive::state_transition_action::StateTransitionAction; use lazy_static::lazy_static; use std::collections::HashSet; @@ -52,7 +46,6 @@ pub(super) trait ValidateStateTransitionIdentitySignatureV0<'a> { fn validate_state_transition_identity_signed_v0( &self, drive: &Drive, - action: Option<&StateTransitionAction>, request_revision: bool, transaction: TransactionArg, execution_context: &mut StateTransitionExecutionContext, @@ -64,8 +57,7 @@ impl<'a> ValidateStateTransitionIdentitySignatureV0<'a> for StateTransition { fn validate_state_transition_identity_signed_v0( &self, drive: &Drive, - action: Option<&StateTransitionAction>, - request_revision: bool, + request_identity_revision: bool, transaction: TransactionArg, execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, @@ -80,35 +72,33 @@ impl<'a> ValidateStateTransitionIdentitySignatureV0<'a> for StateTransition { let owner_id = self.owner_id(); - let security_levels = match self { - StateTransition::DocumentsBatch(_) => { - let action = action.ok_or(ProtocolError::CorruptedCodeExecution( - "we expect a state transition action when validating the signature of the documents batch transition".to_string(), - ))?; - let StateTransitionAction::DocumentsBatchAction(documents_batch_action) = action - else { - return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( - "we expect a documents batch state transition action when validating the signature of the documents batch transition", - ))); - }; - documents_batch_action.contract_based_security_level_requirement() - } - _ => self - .security_level_requirement() + let security_levels = + self.security_level_requirement() .ok_or(ProtocolError::CorruptedCodeExecution( - "state_transition does not have a owner Id to verify".to_string(), - )), - }?; + "state_transition does not have security level".to_string(), + ))?; + + let purpose = self + .purpose_requirement() + .ok_or(ProtocolError::CorruptedCodeExecution( + "state_transition does not have a key purpose requirement".to_string(), + ))?; let key_request = IdentityKeysRequest::new_specific_key_query(owner_id.as_bytes(), key_id); - let maybe_partial_identity = if request_revision { + let maybe_partial_identity = if request_identity_revision { + execution_context.add_operation(ValidationOperation::RetrieveIdentity( + RetrieveIdentityInfo::one_key_and_balance_and_revision(), + )); drive.fetch_identity_balance_with_keys_and_revision( key_request, transaction, platform_version, )? } else { + execution_context.add_operation(ValidationOperation::RetrieveIdentity( + RetrieveIdentityInfo::one_key_and_balance(), + )); drive.fetch_identity_balance_with_keys(key_request, transaction, platform_version)? }; @@ -130,6 +120,7 @@ impl<'a> ValidateStateTransitionIdentitySignatureV0<'a> for StateTransition { return Ok(validation_result); } + // This is very cheap because there will only be 1 key let Some(public_key) = partial_identity.loaded_public_keys.get(&key_id) else { validation_result.add_error(SignatureError::MissingPublicKeyError( MissingPublicKeyError::new(key_id), @@ -137,6 +128,7 @@ impl<'a> ValidateStateTransitionIdentitySignatureV0<'a> for StateTransition { return Ok(validation_result); }; + // Todo: is this needed? if !SUPPORTED_KEY_TYPES.contains(&public_key.key_type()) { validation_result.add_error(SignatureError::InvalidIdentityPublicKeyTypeError( InvalidIdentityPublicKeyTypeError::new(public_key.key_type()), @@ -144,6 +136,13 @@ impl<'a> ValidateStateTransitionIdentitySignatureV0<'a> for StateTransition { return Ok(validation_result); } + if purpose != public_key.purpose() { + validation_result.add_error(SignatureError::InvalidSignaturePublicKeyPurposeError( + InvalidSignaturePublicKeyPurposeError::new(public_key.purpose(), purpose), + )); + return Ok(validation_result); + } + if !security_levels.contains(&public_key.security_level()) { validation_result.add_error( SignatureError::InvalidSignaturePublicKeySecurityLevelError( @@ -164,11 +163,7 @@ impl<'a> ValidateStateTransitionIdentitySignatureV0<'a> for StateTransition { } let operation = SignatureVerificationOperation::new(public_key.key_type()); - execution_context.add_operation(ExecutionOperation::SignatureVerification(operation)); - - // if execution_context.is_dry_run() { - // return Ok(validation_result); - // } + execution_context.add_operation(ValidationOperation::SignatureVerification(operation)); let signature_is_valid = self.verify_signature(public_key, &NativeBlsModule); diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/mod.rs index 830dca757a9..84398f0dde9 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/mod.rs @@ -6,11 +6,11 @@ use dpp::version::PlatformVersion; use crate::error::Error; use crate::error::execution::ExecutionError; use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; -use crate::execution::validation::state_transition::common::validate_unique_identity_public_key_hashes_in_state::v0::validate_unique_identity_public_key_hashes_in_state_v0; +use crate::execution::validation::state_transition::common::validate_unique_identity_public_key_hashes_in_state::v0::validate_unique_identity_public_key_hashes_not_in_state_v0; pub mod v0; -pub(crate) fn validate_unique_identity_public_key_hashes_in_state( +pub(crate) fn validate_unique_identity_public_key_hashes_not_in_state( identity_public_keys_with_witness: &[IdentityPublicKeyInCreation], drive: &Drive, execution_context: &mut StateTransitionExecutionContext, @@ -24,7 +24,7 @@ pub(crate) fn validate_unique_identity_public_key_hashes_in_state( .common_validation_methods .validate_unique_identity_public_key_hashes_in_state { - 0 => validate_unique_identity_public_key_hashes_in_state_v0( + 0 => validate_unique_identity_public_key_hashes_not_in_state_v0( identity_public_keys_with_witness, drive, execution_context, diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/v0/mod.rs index b58dcf59c8e..ff1f78ef018 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/v0/mod.rs @@ -18,10 +18,10 @@ use dpp::version::PlatformVersion; use std::collections::HashMap; /// This will validate that all keys are valid against the state -pub(super) fn validate_unique_identity_public_key_hashes_in_state_v0( +pub(super) fn validate_unique_identity_public_key_hashes_not_in_state_v0( identity_public_keys_with_witness: &[IdentityPublicKeyInCreation], drive: &Drive, - execution_context: &mut StateTransitionExecutionContext, + _execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result { diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/mod.rs index 6e781129222..0ef51bf5856 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/mod.rs @@ -1,3 +1,4 @@ +pub(crate) mod check_tx_verification; mod common; pub(crate) mod processor; mod state_transitions; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/processor/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/processor/mod.rs index 58b133813b0..9771c5e5d6a 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/processor/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/processor/mod.rs @@ -5,13 +5,18 @@ use crate::error::Error; use crate::execution::types::execution_event::ExecutionEvent; use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; use dpp::prelude::ConsensusValidationResult; use dpp::state_transition::StateTransition; use drive::grovedb::TransactionArg; -/// There are 3 stages in a state transition processing: -/// Structure, Signature and State validation, +/// There are multiple stages in a state transition processing: +/// Basic Structure +/// Signature +/// Balance +/// Advanced Structure +/// State /// /// The structure validation verifies that the form of the state transition is good, for example /// that a contract is well formed, or that a document is valid against the contract. @@ -25,6 +30,7 @@ use drive::grovedb::TransactionArg; /// pub(in crate::execution) fn process_state_transition<'a, C: CoreRPCLike>( platform: &'a PlatformRef, + block_info: &BlockInfo, state_transition: StateTransition, transaction: TransactionArg, ) -> Result>, Error> { @@ -36,6 +42,7 @@ pub(in crate::execution) fn process_state_transition<'a, C: CoreRPCLike>( { 0 => v0::process_state_transition_v0( platform, + block_info, state_transition, transaction, platform_version, diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/processor/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/processor/v0/mod.rs index 4f9f4f7d351..2b98dd8b1ce 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/processor/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/processor/v0/mod.rs @@ -4,25 +4,32 @@ use crate::execution::validation::state_transition::transformer::StateTransition use crate::platform_types::platform::{PlatformRef, PlatformStateRef}; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; +use dpp::block::epoch::Epoch; use dpp::identity::PartialIdentity; use dpp::prelude::ConsensusValidationResult; +use dpp::ProtocolError; +use crate::error::execution::ExecutionError; use dpp::serialization::Signable; -use dpp::state_transition::{StateTransition}; -use drive::state_transition_action::StateTransitionAction; +use dpp::state_transition::StateTransition; use dpp::validation::SimpleConsensusValidationResult; use dpp::version::{DefaultForPlatformVersion, PlatformVersion}; use drive::drive::Drive; use drive::grovedb::TransactionArg; -use crate::error::execution::ExecutionError; -use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use drive::state_transition_action::StateTransitionAction; + +use crate::execution::types::state_transition_execution_context::{StateTransitionExecutionContext}; +use crate::execution::validation::state_transition::common::validate_simple_pre_check_balance::ValidateSimplePreCheckBalance; use crate::execution::validation::state_transition::common::validate_state_transition_identity_signed::{ValidateStateTransitionIdentitySignature}; -use crate::execution::validation::state_transition::state_transitions::identity_update::identity_and_signatures::v0::IdentityUpdateStateTransitionIdentityAndSignaturesValidationV0; -use crate::execution::validation::state_transition::state_transitions::identity_create::identity_and_signatures::v0::IdentityCreateStateTransitionIdentityAndSignaturesValidationV0; +use crate::execution::validation::state_transition::identity_create::{StateTransitionStateValidationForIdentityCreateTransitionV0, StateTransitionStructureKnownInStateValidationForIdentityCreateTransitionV0}; +use crate::execution::validation::state_transition::identity_top_up::StateTransitionIdentityTopUpTransitionActionTransformer; +use crate::execution::validation::state_transition::state_transitions::identity_update::advanced_structure::v0::IdentityUpdateStateTransitionIdentityAndSignaturesValidationV0; use crate::execution::validation::state_transition::state_transitions::identity_top_up::identity_retrieval::v0::IdentityTopUpStateTransitionIdentityRetrievalV0; - -pub(in crate::execution) fn process_state_transition_v0<'a, C: CoreRPCLike>( +use crate::execution::validation::state_transition::ValidationMode; +pub(super) fn process_state_transition_v0<'a, C: CoreRPCLike>( platform: &'a PlatformRef, + block_info: &BlockInfo, state_transition: StateTransition, transaction: TransactionArg, platform_version: &PlatformVersion, @@ -30,79 +37,204 @@ pub(in crate::execution) fn process_state_transition_v0<'a, C: CoreRPCLike>( let mut state_transition_execution_context = StateTransitionExecutionContext::default_for_platform_version(platform_version)?; - let action = if state_transition.requires_state_to_validate_structure() { - let state_transition_action_result = - state_transition.transform_into_action(platform, true, transaction)?; - if !state_transition_action_result.is_valid_with_data() { + // Only identity create does not use identity in state validation, because it doesn't yet have the identity in state + let mut maybe_identity = if state_transition.uses_identity_in_state() { + // Validating signature for identity based state transitions (all those except identity create and identity top up) + // As we already have removed identity create above, it just splits between identity top up (below - false) and + // all other state transitions (above - true) + let result = if state_transition.validates_signature_based_on_identity_info() { + state_transition.validate_identity_signed_state_transition( + platform.drive, + transaction, + &mut state_transition_execution_context, + platform_version, + ) + } else { + // Currently only identity top up uses this, + // We will add the cost for a balance retrieval + state_transition.retrieve_identity_info( + platform.drive, + transaction, + &mut state_transition_execution_context, + platform_version, + ) + }?; + if !result.is_valid() { + // If the signature is not valid or if we could not retrieve identity info + // we do not have the user pay for the state transition. + // Since it is most likely not from them + // Proposers should remove such transactions from the block + // Other validators should reject blocks with such transactions + return Ok(ConsensusValidationResult::::new_with_errors(result.errors)); + } + Some(result.into_data()?) + } else { + // Currently only identity create + None + }; + + // Only identity top up and identity create do not have nonces validation + if state_transition.has_nonces_validation() { + // Validating identity contract nonce, this must happen after validating the signature + let result = state_transition.validate_nonces( + &platform.into(), + platform.state.last_block_info(), + transaction, + &mut state_transition_execution_context, + platform_version, + )?; + + if !result.is_valid() { + // If the nonce is not valid the state transition is not paid for, most likely because + // this is just a replayed block + // Proposers should remove such transactions from the block + // Other validators should reject blocks with such transactions + return Ok(ConsensusValidationResult::::new_with_errors(result.errors)); + } + } + + // Only Data contract state transitions do not have basic structure validation + if state_transition.has_basic_structure_validation() { + // We validate basic structure validation after verifying the identity, + // this is structure validation that does not require state and is already checked on check_tx + let consensus_result = state_transition.validate_basic_structure(platform_version)?; + + if !consensus_result.is_valid() { + // Basic structure validation is extremely cheap to process, because of this attacks are + // not likely. + // Often the basic structure validation is necessary for estimated costs + // Proposers should remove such transactions from the block + // Other validators should reject blocks with such transactions return Ok( ConsensusValidationResult::::new_with_errors( - state_transition_action_result.errors, + consensus_result.errors, ), ); } - Some(state_transition_action_result.into_data()?) - } else { - None - }; + } - // Validating structure - let result = state_transition.validate_structure( - &platform.into(), - action.as_ref(), - platform.state.current_protocol_version_in_consensus(), - )?; - if !result.is_valid() { - return Ok(ConsensusValidationResult::::new_with_errors(result.errors)); + // For identity credit withdrawal and identity credit transfers we have a balance pre check that includes a + // processing amount and the transfer amount. + // For other state transitions we only check a min balance for an amount set per version. + // This is not done for identity create and identity top up who don't have this check here + if state_transition.has_balance_pre_check_validation() { + // Validating that we have sufficient balance for a transfer or withdrawal, + // this must happen after validating the signature + + let identity = maybe_identity + .as_mut() + .ok_or(ProtocolError::CorruptedCodeExecution( + "identity must be known to validate the balance".to_string(), + ))?; + let result = + state_transition.validate_minimum_balance_pre_check(identity, platform_version)?; + + if !result.is_valid() { + return Ok(ConsensusValidationResult::::new_with_errors(result.errors)); + } } - let action = if state_transition.requires_state_to_validate_identity_and_signatures() { - if let Some(action) = action { - Some(action) - } else { - let state_transition_action_result = - state_transition.transform_into_action(platform, true, transaction)?; - if !state_transition_action_result.is_valid_with_data() { - return Ok( - ConsensusValidationResult::::new_with_errors( - state_transition_action_result.errors, - ), - ); - } - Some(state_transition_action_result.into_data()?) + // Only identity update and data contract create have advanced structure validation without state + if state_transition.has_advanced_structure_validation_without_state() { + // Currently only used for Identity Update + // Next we have advanced structure validation, this is structure validation that does not require + // state but isn't checked on check_tx. If advanced structure fails identity nonces or identity + // contract nonces will be bumped + let identity = maybe_identity + .as_ref() + .ok_or(ProtocolError::CorruptedCodeExecution( + "the identity should always be known on advanced structure validation".to_string(), + ))?; + let consensus_result = state_transition.validate_advanced_structure( + identity, + &mut state_transition_execution_context, + platform_version, + )?; + + if !consensus_result.is_valid() { + return consensus_result.map_result(|action| { + ExecutionEvent::create_from_state_transition_action( + action, + maybe_identity, + platform.state.last_committed_block_epoch_ref(), + state_transition_execution_context, + platform_version, + ) + }); + } + } + + // Identity create and documents batch both have advanced structure validation with state + let action = if state_transition.has_advanced_structure_validation_with_state() { + // Currently used for identity create and documents batch + let state_transition_action_result = state_transition.transform_into_action( + platform, + block_info, + ValidationMode::Validator, + &mut state_transition_execution_context, + transaction, + )?; + if !state_transition_action_result.is_valid_with_data() { + return state_transition_action_result.map_result(|action| { + ExecutionEvent::create_from_state_transition_action( + action, + maybe_identity, + platform.state.last_committed_block_epoch_ref(), + state_transition_execution_context, + platform_version, + ) + }); + } + let action = state_transition_action_result.into_data()?; + + // Validating structure + let result = state_transition.validate_advanced_structure_from_state( + &action, + maybe_identity.as_ref(), + &mut state_transition_execution_context, + platform_version, + )?; + if !result.is_valid() { + return result.map_result(|action| { + ExecutionEvent::create_from_state_transition_action( + action, + maybe_identity, + platform.state.last_committed_block_epoch_ref(), + state_transition_execution_context, + platform_version, + ) + }); } + + Some(action) } else { None }; - // - let result = state_transition.validate_identity_and_signatures( - platform.drive, - action.as_ref(), - transaction, + // Validating state + // Only identity Top up does not validate state and instead just returns the action for topping up + let result = state_transition.validate_state( + action, + platform, + ValidationMode::Validator, + &block_info.epoch, &mut state_transition_execution_context, - platform_version, + transaction, )?; - // Validating signatures - if !result.is_valid() { - return Ok(ConsensusValidationResult::::new_with_errors(result.errors)); - } - let maybe_identity = result.into_data()?; - - // Validating state - let result = state_transition.validate_state(action, platform, transaction)?; result.map_result(|action| { ExecutionEvent::create_from_state_transition_action( action, maybe_identity, - platform.state.epoch_ref(), + platform.state.last_committed_block_epoch_ref(), + state_transition_execution_context, platform_version, ) }) } /// A trait for validating state transitions within a blockchain. -pub(crate) trait StateTransitionSignatureValidationV0 { +pub(crate) trait StateTransitionIdentityBasedSignatureValidationV0 { /// Validates the identity and signatures of a transaction to ensure its authenticity. /// /// # Arguments @@ -118,34 +250,162 @@ pub(crate) trait StateTransitionSignatureValidationV0 { /// - `Ok(ConsensusValidationResult>)`: Indicates that the transaction has passed authentication, and the result contains an optional `PartialIdentity`. /// - `Err(Error)`: Indicates that the transaction failed authentication, and the result contains an `Error` indicating the reason for failure. /// - fn validate_identity_and_signatures( + fn validate_identity_signed_state_transition( &self, drive: &Drive, - action: Option<&StateTransitionAction>, tx: TransactionArg, execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, - ) -> Result>, Error>; + ) -> Result, Error>; + + /// fetches identity info + fn retrieve_identity_info( + &self, + drive: &Drive, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error>; + + /// Is the state transition supposed to have an identity in the state to succeed + fn uses_identity_in_state(&self) -> bool; + + /// Do we validate the signature based on identity info? + fn validates_signature_based_on_identity_info(&self) -> bool; } /// A trait for validating state transitions within a blockchain. -pub(crate) trait StateTransitionStructureValidationV0 { +pub(crate) trait StateTransitionBasicStructureValidationV0 { /// Validates the structure of a transaction by checking its basic elements. /// /// # Arguments /// - /// * `drive` - A reference to the drive containing the transaction data. - /// * `tx` - The transaction argument to be checked. + /// * `platform` - A reference to the platform state ref. + /// * `platform_version` - The platform version. + /// + /// # Returns + /// + /// * `Result` - A result with either a SimpleConsensusValidationResult or an Error. + fn validate_basic_structure( + &self, + platform_version: &PlatformVersion, + ) -> Result; + + /// True if the state transition has basic structure validation. + /// Currently only data contract update does not + fn has_basic_structure_validation(&self) -> bool { + true + } +} + +/// A trait for validating state transitions within a blockchain. +/// The advanced structure validation should always happen in a block +/// and not in check_tx +pub(crate) trait StateTransitionAdvancedStructureValidationV0 { + /// Validates the structure of a transaction by checking its basic elements. + /// + /// # Arguments + /// + /// * `platform` - A reference to the platform state ref. + /// * `platform_version` - The platform version. + /// + /// # Returns + /// + /// * `Result` - A result with either a SimpleConsensusValidationResult or an Error. + fn validate_advanced_structure( + &self, + identity: &PartialIdentity, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error>; + + /// True if the state transition has advanced structure validation. + /// This structure validation makes users pay if there is a failure + fn has_advanced_structure_validation_without_state(&self) -> bool; +} + +/// A trait for validating state transitions within a blockchain. +pub(crate) trait StateTransitionNonceValidationV0 { + /// Validates the structure of a transaction by checking its basic elements. + /// + /// # Arguments + /// + /// * `platform_version` - The platform version. /// /// # Returns /// /// * `Result` - A result with either a SimpleConsensusValidationResult or an Error. - fn validate_structure( + fn validate_nonces( &self, platform: &PlatformStateRef, - action: Option<&StateTransitionAction>, - protocol_version: u32, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result; + + /// True if the state transition validates nonces, either identity nonces or identity contract + /// nonces + fn has_nonces_validation(&self) -> bool { + true + } +} + +/// A trait for validating state transitions within a blockchain. +pub(crate) trait StateTransitionStructureKnownInStateValidationV0 { + /// Validates the structure of a transaction by checking its basic elements. + /// + /// # Arguments + /// + /// * `action` - An optional reference to the state transition action. + /// * `platform_version` - The platform version. + /// + /// # Returns + /// + /// * `Result` - A result with either a SimpleConsensusValidationResult or an Error. + fn validate_advanced_structure_from_state( + &self, + action: &StateTransitionAction, + maybe_identity: Option<&PartialIdentity>, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error>; + + /// This means we should transform into the action before validation of the structure + fn has_advanced_structure_validation_with_state(&self) -> bool; + /// This means we should transform into the action before validation of the advanced structure, + /// and that we must even do this on check_tx + fn requires_advanced_structure_validation_with_state_on_check_tx(&self) -> bool; +} + +/// A trait for validating state transitions within a blockchain. +pub(crate) trait StateTransitionBalanceValidationV0 { + /// Validates the state transition by analyzing the changes in the platform state after applying the transaction. + /// + /// # Arguments + /// + /// * `platform` - A reference to the platform containing the state data. + /// * `tx` - The transaction argument to be applied. + /// + /// # Type Parameters + /// + /// * `C: CoreRPCLike` - A type constraint indicating that C should implement `CoreRPCLike`. + /// + /// # Returns + /// + /// * `Result, Error>` - A result with either a ConsensusValidationResult containing a StateTransitionAction or an Error. + fn validate_minimum_balance_pre_check( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, ) -> Result; + + /// True if the state transition has a balance validation. + /// This balance validation is not for the operations of the state transition, but more as a + /// quick early verification that the user has the balance they want to transfer or withdraw. + fn has_balance_pre_check_validation(&self) -> bool { + true + } } /// A trait for validating state transitions within a blockchain. @@ -170,187 +430,323 @@ pub(crate) trait StateTransitionStateValidationV0: &self, action: Option, platform: &PlatformRef, + validation_mode: ValidationMode, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error>; } -impl StateTransitionStructureValidationV0 for StateTransition { - fn validate_structure( +impl StateTransitionBasicStructureValidationV0 for StateTransition { + fn validate_basic_structure( &self, - platform: &PlatformStateRef, - action: Option<&StateTransitionAction>, - protocol_version: u32, + platform_version: &PlatformVersion, ) -> Result { match self { - StateTransition::DataContractCreate(st) => { - st.validate_structure(platform, action, protocol_version) - } - StateTransition::DataContractUpdate(st) => { - st.validate_structure(platform, action, protocol_version) - } - StateTransition::IdentityCreate(st) => { - st.validate_structure(platform, action, protocol_version) - } - StateTransition::IdentityUpdate(st) => { - st.validate_structure(platform, action, protocol_version) - } - StateTransition::IdentityTopUp(st) => { - st.validate_structure(platform, action, protocol_version) + StateTransition::DataContractCreate(_) | StateTransition::DataContractUpdate(_) => { + // no basic structure validation + Ok(SimpleConsensusValidationResult::new()) } + StateTransition::IdentityCreate(st) => st.validate_basic_structure(platform_version), + StateTransition::IdentityUpdate(st) => st.validate_basic_structure(platform_version), + StateTransition::IdentityTopUp(st) => st.validate_basic_structure(platform_version), StateTransition::IdentityCreditWithdrawal(st) => { - st.validate_structure(platform, action, protocol_version) - } - StateTransition::DocumentsBatch(st) => { - st.validate_structure(platform, action, protocol_version) + st.validate_basic_structure(platform_version) } + StateTransition::DocumentsBatch(st) => st.validate_basic_structure(platform_version), StateTransition::IdentityCreditTransfer(st) => { - st.validate_structure(platform, action, protocol_version) + st.validate_basic_structure(platform_version) } } } + fn has_basic_structure_validation(&self) -> bool { + !matches!( + self, + StateTransition::DataContractCreate(_) | StateTransition::DataContractUpdate(_) + ) + } } -impl StateTransitionSignatureValidationV0 for StateTransition { - fn validate_identity_and_signatures( +impl StateTransitionNonceValidationV0 for StateTransition { + fn validate_nonces( &self, - drive: &Drive, - action: Option<&StateTransitionAction>, + platform: &PlatformStateRef, + block_info: &BlockInfo, tx: TransactionArg, execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, - ) -> Result>, Error> { + ) -> Result { + match self { + StateTransition::DocumentsBatch(st) => st.validate_nonces( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + StateTransition::DataContractCreate(st) => st.validate_nonces( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + StateTransition::DataContractUpdate(st) => st.validate_nonces( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + StateTransition::IdentityUpdate(st) => st.validate_nonces( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + StateTransition::IdentityCreditTransfer(st) => st.validate_nonces( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + StateTransition::IdentityCreditWithdrawal(st) => st.validate_nonces( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + _ => Ok(SimpleConsensusValidationResult::new()), + } + } + + fn has_nonces_validation(&self) -> bool { + matches!( + self, + StateTransition::DocumentsBatch(_) + | StateTransition::DataContractCreate(_) + | StateTransition::DataContractUpdate(_) + | StateTransition::IdentityUpdate(_) + | StateTransition::IdentityCreditTransfer(_) + | StateTransition::IdentityCreditWithdrawal(_) + ) + } +} + +impl StateTransitionBalanceValidationV0 for StateTransition { + fn validate_minimum_balance_pre_check( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result { match self { + StateTransition::IdentityCreditTransfer(st) => { + st.validate_minimum_balance_pre_check(identity, platform_version) + } + StateTransition::IdentityCreditWithdrawal(st) => { + st.validate_minimum_balance_pre_check(identity, platform_version) + } + StateTransition::DocumentsBatch(st) => { + st.validate_minimum_balance_pre_check(identity, platform_version) + } StateTransition::DataContractCreate(_) | StateTransition::DataContractUpdate(_) - | StateTransition::IdentityCreditWithdrawal(_) - | StateTransition::IdentityCreditTransfer(_) - | StateTransition::DocumentsBatch(_) => { - //Basic signature verification - Ok(self - .validate_state_transition_identity_signed( - drive, - action, - false, - tx, - execution_context, - platform_version, - )? - .map(Some)) + | StateTransition::IdentityUpdate(_) => { + self.validate_simple_pre_check_minimum_balance(identity, platform_version) + } + StateTransition::IdentityCreate(_) | StateTransition::IdentityTopUp(_) => { + Ok(SimpleConsensusValidationResult::new()) } + } + } + + fn has_balance_pre_check_validation(&self) -> bool { + matches!( + self, + StateTransition::IdentityCreditTransfer(_) + | StateTransition::IdentityCreditWithdrawal(_) + | StateTransition::DataContractCreate(_) + | StateTransition::DataContractUpdate(_) + | StateTransition::DocumentsBatch(_) + | StateTransition::IdentityUpdate(_) + ) + } +} + +impl StateTransitionAdvancedStructureValidationV0 for StateTransition { + fn validate_advanced_structure( + &self, + identity: &PartialIdentity, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match self { StateTransition::IdentityUpdate(st) => { match platform_version .drive_abci .validation_and_processing .state_transitions .identity_update_state_transition - .identity_signatures + .advanced_structure { Some(0) => { let signable_bytes: Vec = self.signable_bytes()?; - let mut validation_result = self - .validate_state_transition_identity_signed( - drive, - action, - true, - tx, - execution_context, - platform_version, - )?; - if !validation_result.is_valid() { - Ok(validation_result.map(Some)) - } else { - let partial_identity = validation_result.data_as_borrowed()?; - let result = st - .validate_identity_update_state_transition_signatures_v0( - signable_bytes, - partial_identity, - )?; - validation_result.merge(result); - Ok(validation_result.map(Some)) - } + st.validate_identity_update_state_transition_signatures_v0( + signable_bytes, + identity, + execution_context, + ) } - None => Err(Error::Execution(ExecutionError::VersionNotActive { - method: "identity update transition: validate_identity_and_signatures" - .to_string(), - known_versions: vec![0], - })), Some(version) => { Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity update transition: validate_identity_and_signatures" + method: "identity update transition: validate_advanced_structure" .to_string(), known_versions: vec![0], received: version, })) } + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity update transition: validate_advanced_structure" + .to_string(), + known_versions: vec![0], + })), } } - StateTransition::IdentityCreate(st) => { - match platform_version - .drive_abci - .validation_and_processing - .state_transitions - .identity_create_state_transition - .identity_signatures - { - Some(0) => { - let mut validation_result = - ConsensusValidationResult::>::default(); + StateTransition::DataContractCreate(st) => { + st.validate_advanced_structure(identity, execution_context, platform_version) + } + _ => Ok(ConsensusValidationResult::::new()), + } + } - let signable_bytes: Vec = self.signable_bytes()?; + fn has_advanced_structure_validation_without_state(&self) -> bool { + matches!( + self, + StateTransition::IdentityUpdate(_) | StateTransition::DataContractCreate(_) + ) + } +} - let result = st.validate_identity_create_state_transition_signatures_v0( - signable_bytes, - )?; +impl StateTransitionStructureKnownInStateValidationV0 for StateTransition { + fn validate_advanced_structure_from_state( + &self, + action: &StateTransitionAction, + maybe_identity: Option<&PartialIdentity>, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match self { + StateTransition::DocumentsBatch(st) => st.validate_advanced_structure_from_state( + action, + maybe_identity, + execution_context, + platform_version, + ), + StateTransition::IdentityCreate(st) => { + let signable_bytes = self.signable_bytes()?; + let StateTransitionAction::IdentityCreateAction(identity_create_action) = action + else { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "action must be a identity create transition action", + ))); + }; + st.validate_advanced_structure_from_state_for_identity_create_transition( + identity_create_action, + signable_bytes, + execution_context, + platform_version, + ) + } + _ => Ok(ConsensusValidationResult::new()), + } + } - validation_result.merge(result); - validation_result.set_data(None); + /// This means we should transform into the action before validation of the advanced structure + fn has_advanced_structure_validation_with_state(&self) -> bool { + matches!( + self, + StateTransition::DocumentsBatch(_) | StateTransition::IdentityCreate(_) + ) + } - Ok(validation_result) - } - None => Err(Error::Execution(ExecutionError::VersionNotActive { - method: "identity create transition: validate_identity_and_signatures" - .to_string(), - known_versions: vec![0], - })), - Some(version) => { - Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity create transition: validate_identity_and_signatures" - .to_string(), - known_versions: vec![0], - received: version, - })) - } - } + /// This means we should transform into the action before validation of the advanced structure, + /// and that we must even do this on check_tx + fn requires_advanced_structure_validation_with_state_on_check_tx(&self) -> bool { + matches!(self, StateTransition::DocumentsBatch(_)) + } +} + +impl StateTransitionIdentityBasedSignatureValidationV0 for StateTransition { + fn validate_identity_signed_state_transition( + &self, + drive: &Drive, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match self { + StateTransition::DataContractCreate(_) + | StateTransition::DataContractUpdate(_) + | StateTransition::IdentityCreditWithdrawal(_) + | StateTransition::IdentityCreditTransfer(_) + | StateTransition::DocumentsBatch(_) => { + //Basic signature verification + Ok(self.validate_state_transition_identity_signed( + drive, + false, + tx, + execution_context, + platform_version, + )?) } - StateTransition::IdentityTopUp(st) => { - match platform_version - .drive_abci - .validation_and_processing - .state_transitions - .identity_top_up_state_transition - .identity_signatures - { - // The validation of the signature happens on the state level - Some(0) => Ok(st - .retrieve_topped_up_identity(drive, tx, platform_version)? - .map(Some)), - None => Err(Error::Execution(ExecutionError::VersionNotActive { - method: "identity top up transition: validate_identity_and_signatures" - .to_string(), - known_versions: vec![0], - })), - Some(version) => { - Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity top up transition: validate_identity_and_signatures" - .to_string(), - known_versions: vec![0], - received: version, - })) - } - } + StateTransition::IdentityUpdate(_) => { + //Basic signature verification + Ok(self.validate_state_transition_identity_signed( + drive, + true, + tx, + execution_context, + platform_version, + )?) } + StateTransition::IdentityCreate(_) => Ok(ConsensusValidationResult::new()), + StateTransition::IdentityTopUp(_) => Ok(ConsensusValidationResult::new()), + } + } + + fn retrieve_identity_info( + &self, + drive: &Drive, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match self { + StateTransition::IdentityTopUp(st) => Ok(st.retrieve_topped_up_identity( + drive, + tx, + execution_context, + platform_version, + )?), + _ => Ok(ConsensusValidationResult::new()), } } + + /// Is the state transition supposed to have an identity in the state to succeed + fn uses_identity_in_state(&self) -> bool { + !matches!(self, StateTransition::IdentityCreate(_)) + } + + /// Do we validate the signature based on identity info? + fn validates_signature_based_on_identity_info(&self) -> bool { + !matches!( + self, + StateTransition::IdentityCreate(_) | StateTransition::IdentityTopUp(_) + ) + } } impl StateTransitionStateValidationV0 for StateTransition { @@ -358,19 +754,95 @@ impl StateTransitionStateValidationV0 for StateTransition { &self, action: Option, platform: &PlatformRef, + validation_mode: ValidationMode, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error> { match self { - StateTransition::DataContractCreate(st) => st.validate_state(action, platform, tx), - StateTransition::DataContractUpdate(st) => st.validate_state(action, platform, tx), - StateTransition::IdentityCreate(st) => st.validate_state(action, platform, tx), - StateTransition::IdentityUpdate(st) => st.validate_state(action, platform, tx), - StateTransition::IdentityTopUp(st) => st.validate_state(action, platform, tx), - StateTransition::IdentityCreditWithdrawal(st) => { - st.validate_state(action, platform, tx) + // The replay attack is prevented by checking if a data contract exists with this id first + StateTransition::DataContractCreate(st) => st.validate_state( + action, + platform, + validation_mode, + epoch, + execution_context, + tx, + ), + // The replay attack is prevented by identity data contract nonce + StateTransition::DataContractUpdate(st) => st.validate_state( + action, + platform, + validation_mode, + epoch, + execution_context, + tx, + ), + StateTransition::IdentityCreate(st) => { + let action = + action.ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "identity create validation should always an action", + )))?; + let StateTransitionAction::IdentityCreateAction(action) = action else { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "action must be a identity create transition action", + ))); + }; + st.validate_state_for_identity_create_transition( + action, + platform, + execution_context, + tx, + ) + } + StateTransition::IdentityUpdate(st) => st.validate_state( + action, + platform, + validation_mode, + epoch, + execution_context, + tx, + ), + StateTransition::IdentityTopUp(st) => { + // Nothing to validate from state + if let Some(action) = action { + Ok(ConsensusValidationResult::new_with_data(action)) + } else { + let signable_bytes = self.signable_bytes()?; + st.transform_into_action_for_identity_top_up_transition( + platform, + signable_bytes, + validation_mode, + execution_context, + tx, + ) + } } - StateTransition::DocumentsBatch(st) => st.validate_state(action, platform, tx), - StateTransition::IdentityCreditTransfer(st) => st.validate_state(action, platform, tx), + StateTransition::IdentityCreditWithdrawal(st) => st.validate_state( + action, + platform, + validation_mode, + epoch, + execution_context, + tx, + ), + // The replay attack is prevented by identity data contract nonce + StateTransition::DocumentsBatch(st) => st.validate_state( + action, + platform, + validation_mode, + epoch, + execution_context, + tx, + ), + StateTransition::IdentityCreditTransfer(st) => st.validate_state( + action, + platform, + validation_mode, + epoch, + execution_context, + tx, + ), } } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/structure/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/advanced_structure/mod.rs similarity index 100% rename from packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/structure/mod.rs rename to packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/advanced_structure/mod.rs diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/advanced_structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/advanced_structure/v0/mod.rs new file mode 100644 index 00000000000..9bdc1119eb6 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/advanced_structure/v0/mod.rs @@ -0,0 +1,193 @@ +use crate::error::Error; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use dpp::consensus::basic::data_contract::{ + InvalidDataContractIdError, InvalidDataContractVersionError, +}; +use dpp::consensus::basic::BasicError; +use dpp::data_contract::INITIAL_DATA_CONTRACT_VERSION; +use dpp::prelude::DataContract; +use dpp::state_transition::data_contract_create_transition::accessors::DataContractCreateTransitionAccessorsV0; +use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition; +use dpp::validation::ConsensusValidationResult; +use drive::state_transition_action::system::bump_identity_nonce_action::BumpIdentityNonceAction; +use drive::state_transition_action::StateTransitionAction; + +pub(in crate::execution::validation::state_transition::state_transitions::data_contract_create) trait DataContractCreatedStateTransitionAdvancedStructureValidationV0 { + fn validate_advanced_structure_v0(&self, execution_context: &mut StateTransitionExecutionContext) -> Result, Error>; +} + +impl DataContractCreatedStateTransitionAdvancedStructureValidationV0 + for DataContractCreateTransition +{ + fn validate_advanced_structure_v0( + &self, + execution_context: &mut StateTransitionExecutionContext, + ) -> Result, Error> { + if self.data_contract().version() != INITIAL_DATA_CONTRACT_VERSION { + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_data_contract_create_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![InvalidDataContractVersionError::new( + INITIAL_DATA_CONTRACT_VERSION, + self.data_contract().version(), + ) + .into()], + )); + } + + // Validate data contract id + let generated_id = DataContract::generate_data_contract_id_v0( + self.data_contract().owner_id(), + self.identity_nonce(), + ); + + // This hash will only take 1 block (64 bytes) + execution_context.add_operation(ValidationOperation::DoubleSha256(1)); + + if generated_id != self.data_contract().id() { + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_data_contract_create_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![ + BasicError::InvalidDataContractIdError(InvalidDataContractIdError::new( + generated_id.to_vec(), + self.data_contract().id().to_vec(), + )) + .into(), + ], + )); + } + + Ok(ConsensusValidationResult::default()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use assert_matches::assert_matches; + + mod validate_advanced_structure { + use super::*; + use dpp::consensus::ConsensusError; + use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; + use dpp::prelude::{Identifier, IdentityNonce}; + use dpp::state_transition::data_contract_create_transition::DataContractCreateTransitionV0; + use dpp::tests::fixtures::get_data_contract_fixture; + use drive::state_transition_action::system::bump_identity_nonce_action::BumpIdentityNonceActionAccessorsV0; + use platform_version::version::PlatformVersion; + use platform_version::{DefaultForPlatformVersion, TryIntoPlatformVersioned}; + + #[test] + fn should_return_invalid_result_if_contract_version_is_not_initial() { + let platform_version = PlatformVersion::latest(); + let identity_nonce = IdentityNonce::default(); + + let mut data_contract = + get_data_contract_fixture(None, identity_nonce, platform_version.protocol_version) + .data_contract_owned(); + + data_contract.set_version(6); + + let identity_id = data_contract.owner_id(); + + let data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + let transition: DataContractCreateTransition = DataContractCreateTransitionV0 { + data_contract: data_contract_for_serialization, + identity_nonce, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let result = transition + .validate_advanced_structure_v0(&mut execution_context) + .expect("failed to validate advanced structure"); + + assert_matches!(execution_context.operations_slice(), []); + + assert_matches!( + result.data, + Some(StateTransitionAction::BumpIdentityNonceAction(action)) + if action.identity_id() == identity_id && action.identity_nonce() == identity_nonce + ); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError(BasicError::InvalidDataContractVersionError(e))] if e.expected_version() == INITIAL_DATA_CONTRACT_VERSION && e.version() == 6 + ); + } + + #[test] + fn should_return_invalid_result_if_contract_id_is_not_valid() { + let platform_version = PlatformVersion::latest(); + let identity_nonce = IdentityNonce::default(); + + let mut data_contract = + get_data_contract_fixture(None, identity_nonce, platform_version.protocol_version) + .data_contract_owned(); + + let identity_id = data_contract.owner_id(); + let original_id = data_contract.id(); + let invalid_id = Identifier::default(); + + data_contract.set_id(invalid_id); + + let data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + let transition: DataContractCreateTransition = DataContractCreateTransitionV0 { + data_contract: data_contract_for_serialization, + identity_nonce, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let result = transition + .validate_advanced_structure_v0(&mut execution_context) + .expect("failed to validate advanced structure"); + + assert_matches!( + execution_context.operations_slice(), + [ValidationOperation::DoubleSha256(1)] + ); + + assert_matches!( + result.data, + Some(StateTransitionAction::BumpIdentityNonceAction(action)) + if action.identity_id() == identity_id && action.identity_nonce() == identity_nonce + ); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError(BasicError::InvalidDataContractIdError(e))] + if Identifier::try_from(e.expected_id()).unwrap() == original_id + && Identifier::try_from(e.invalid_id()).unwrap() == invalid_id + ); + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/identity_nonce/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/identity_nonce/mod.rs new file mode 100644 index 00000000000..a220f2d16fa --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/identity_nonce/mod.rs @@ -0,0 +1,48 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::data_contract_create::identity_nonce::v0::DataContractCreateTransitionIdentityNonceV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionNonceValidationV0; +use crate::platform_types::platform::PlatformStateRef; +use dpp::block::block_info::BlockInfo; +use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(crate) mod v0; +impl StateTransitionNonceValidationV0 for DataContractCreateTransition { + fn validate_nonces( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .contract_create_state_transition + .nonce + { + Some(0) => self.validate_nonce_v0( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "data contract create transition: validate_nonces".to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "data contract create transition: validate_nonces".to_string(), + known_versions: vec![0], + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/identity_nonce/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/identity_nonce/v0/mod.rs new file mode 100644 index 00000000000..f47704af14f --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/identity_nonce/v0/mod.rs @@ -0,0 +1,71 @@ +use crate::error::Error; +use dpp::block::block_info::BlockInfo; +use dpp::consensus::basic::document::NonceOutOfBoundsError; +use dpp::consensus::basic::BasicError; +use dpp::identity::identity_nonce::{ + validate_identity_nonce_update, validate_new_identity_nonce, MISSING_IDENTITY_REVISIONS_FILTER, +}; +use dpp::state_transition::data_contract_create_transition::accessors::DataContractCreateTransitionAccessorsV0; +use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition; + +use dpp::validation::SimpleConsensusValidationResult; + +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::platform_types::platform::PlatformStateRef; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(in crate::execution::validation::state_transition::state_transitions) trait DataContractCreateTransitionIdentityNonceV0 +{ + fn validate_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl DataContractCreateTransitionIdentityNonceV0 for DataContractCreateTransition { + fn validate_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + let revision_nonce = self.identity_nonce(); + + if revision_nonce & MISSING_IDENTITY_REVISIONS_FILTER > 0 { + return Ok(SimpleConsensusValidationResult::new_with_error( + BasicError::NonceOutOfBoundsError(NonceOutOfBoundsError::new(revision_nonce)) + .into(), + )); + } + + let identity_id = self.data_contract().owner_id(); + + let (existing_nonce, fee) = platform.drive.fetch_identity_nonce_with_fees( + identity_id.to_buffer(), + block_info, + true, + tx, + platform_version, + )?; + + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee)); + + let result = if let Some(existing_nonce) = existing_nonce { + validate_identity_nonce_update(existing_nonce, revision_nonce, identity_id) + } else { + validate_new_identity_nonce(revision_nonce, identity_id) + }; + + Ok(result) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/mod.rs index 1238d95630a..3b30f36a9b2 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/mod.rs @@ -1,9 +1,12 @@ +mod advanced_structure; +mod identity_nonce; mod state; -mod structure; +use dpp::block::block_info::BlockInfo; +use dpp::block::epoch::Epoch; +use dpp::identity::PartialIdentity; use dpp::prelude::ConsensusValidationResult; use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition; -use dpp::validation::SimpleConsensusValidationResult; use dpp::version::PlatformVersion; use drive::grovedb::TransactionArg; @@ -11,27 +14,42 @@ use drive::state_transition_action::StateTransitionAction; use crate::error::execution::ExecutionError; use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::data_contract_create::advanced_structure::v0::DataContractCreatedStateTransitionAdvancedStructureValidationV0; use crate::execution::validation::state_transition::data_contract_create::state::v0::DataContractCreateStateTransitionStateValidationV0; -use crate::execution::validation::state_transition::data_contract_create::structure::v0::DataContractCreatedStateTransitionStructureValidationV0; -use crate::platform_types::platform::{PlatformRef, PlatformStateRef}; +use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; use crate::execution::validation::state_transition::processor::v0::{ - StateTransitionStateValidationV0, StateTransitionStructureValidationV0, + StateTransitionAdvancedStructureValidationV0, StateTransitionStateValidationV0, }; use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::execution::validation::state_transition::ValidationMode; + +impl ValidationMode { + /// Returns if we should validate the contract when we transform it from its serialized form + pub fn should_fully_validate_contract_on_transform_into_action(&self) -> bool { + match self { + ValidationMode::CheckTx => false, + ValidationMode::RecheckTx => false, + ValidationMode::Validator => true, + ValidationMode::NoValidation => false, + } + } +} impl StateTransitionActionTransformerV0 for DataContractCreateTransition { fn transform_into_action( &self, platform: &PlatformRef, - _validate: bool, + _block_info: &BlockInfo, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, _tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing @@ -39,7 +57,11 @@ impl StateTransitionActionTransformerV0 for DataContractCreateTransition { .contract_create_state_transition .transform_into_action { - 0 => self.transform_into_action_v0::(platform_version), + 0 => self.transform_into_action_v0::( + validation_mode, + execution_context, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "data contract create transition: transform_into_action".to_string(), known_versions: vec![0], @@ -49,29 +71,36 @@ impl StateTransitionActionTransformerV0 for DataContractCreateTransition { } } -impl StateTransitionStructureValidationV0 for DataContractCreateTransition { - fn validate_structure( +impl StateTransitionAdvancedStructureValidationV0 for DataContractCreateTransition { + fn validate_advanced_structure( &self, - _platform: &PlatformStateRef, - _action: Option<&StateTransitionAction>, - protocol_version: u32, - ) -> Result { - let platform_version = PlatformVersion::get(protocol_version)?; + _identity: &PartialIdentity, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { match platform_version .drive_abci .validation_and_processing .state_transitions .contract_create_state_transition - .structure + .basic_structure { - 0 => self.validate_base_structure_v0(platform_version), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "data contract create transition: validate_structure".to_string(), + Some(0) => self.validate_advanced_structure_v0(execution_context), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "data contract create transition: validate_basic_structure".to_string(), known_versions: vec![0], received: version, })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "data contract create transition: validate_basic_structure".to_string(), + known_versions: vec![0], + })), } } + + fn has_advanced_structure_validation_without_state(&self) -> bool { + true + } } impl StateTransitionStateValidationV0 for DataContractCreateTransition { @@ -79,10 +108,13 @@ impl StateTransitionStateValidationV0 for DataContractCreateTransition { &self, _action: Option, platform: &PlatformRef, + validation_mode: ValidationMode, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing @@ -90,7 +122,14 @@ impl StateTransitionStateValidationV0 for DataContractCreateTransition { .contract_create_state_transition .state { - 0 => self.validate_state_v0(platform, tx, platform_version), + 0 => self.validate_state_v0( + platform, + validation_mode, + epoch, + tx, + execution_context, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "data contract create transition: validate_state".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/state/v0/mod.rs index 15e656dce8b..27c7a5ce4ed 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/state/v0/mod.rs @@ -1,28 +1,42 @@ use crate::error::Error; use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; +use dpp::block::epoch::Epoch; use dpp::consensus::state::data_contract::data_contract_already_present_error::DataContractAlreadyPresentError; use dpp::consensus::state::state_error::StateError; use dpp::prelude::ConsensusValidationResult; use dpp::state_transition::data_contract_create_transition::accessors::DataContractCreateTransitionAccessorsV0; use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition; +use dpp::ProtocolError; -use dpp::version::{PlatformVersion, TryIntoPlatformVersioned}; +use crate::error::execution::ExecutionError; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::execution::validation::state_transition::ValidationMode; +use dpp::version::PlatformVersion; use drive::grovedb::TransactionArg; use drive::state_transition_action::contract::data_contract_create::DataContractCreateTransitionAction; +use drive::state_transition_action::system::bump_identity_nonce_action::BumpIdentityNonceAction; use drive::state_transition_action::StateTransitionAction; pub(in crate::execution::validation::state_transition::state_transitions::data_contract_create) trait DataContractCreateStateTransitionStateValidationV0 { fn validate_state_v0( &self, platform: &PlatformRef, + validation_mode: ValidationMode, + epoch: &Epoch, tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, ) -> Result, Error>; fn transform_into_action_v0( &self, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, ) -> Result, Error>; } @@ -31,40 +45,465 @@ impl DataContractCreateStateTransitionStateValidationV0 for DataContractCreateTr fn validate_state_v0( &self, platform: &PlatformRef, + validation_mode: ValidationMode, + epoch: &Epoch, tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, ) -> Result, Error> { - let drive = platform.drive; + let action = self.transform_into_action_v0::( + validation_mode, + execution_context, + platform_version, + )?; + + if !action.is_valid() { + return Ok(action); + } + + let contract_fetch_info = platform.drive.get_contract_with_fetch_info_and_fee( + self.data_contract().id().to_buffer(), + Some(epoch), + false, + tx, + platform_version, + )?; + + let fee = contract_fetch_info.0.ok_or(Error::Execution( + ExecutionError::CorruptedCodeExecution( + "fee must exist in validate state for data contract create transition", + ), + ))?; + + // We add the cost for fetching the contract even if the contract doesn't exist or was in cache + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee)); + // Data contract shouldn't exist - if drive - .get_contract_with_fetch_info_and_fee( - self.data_contract().id().to_buffer(), - None, - false, - tx, - platform_version, - )? - .1 - .is_some() - { - Ok(ConsensusValidationResult::new_with_errors(vec![ - StateError::DataContractAlreadyPresentError(DataContractAlreadyPresentError::new( - self.data_contract().id().to_owned(), - )) - .into(), - ])) - } else { - self.transform_into_action_v0::(platform_version) + if contract_fetch_info.1.is_some() { + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_data_contract_create_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![StateError::DataContractAlreadyPresentError( + DataContractAlreadyPresentError::new(self.data_contract().id().to_owned()), + ) + .into()], + )); } + + Ok(action) } fn transform_into_action_v0( &self, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, ) -> Result, Error> { - let create_action: DataContractCreateTransitionAction = - self.try_into_platform_versioned(platform_version)?; - let action: StateTransitionAction = create_action.into(); - Ok(action.into()) + let mut validation_operations = vec![]; + + // The transformation of the state transition into the state transition action will transform + // The contract in serialized form into it's execution form + let result = DataContractCreateTransitionAction::try_from_borrowed_transition( + self, + validation_mode.should_fully_validate_contract_on_transform_into_action(), + &mut validation_operations, + platform_version, + ); + + execution_context.add_dpp_operations(validation_operations); + + // Return validation result if any consensus errors happened + // during data contract validation + match result { + Err(ProtocolError::ConsensusError(consensus_error)) => { + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_data_contract_create_transition(self), + ); + + Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![*consensus_error], + )) + } + Err(protocol_error) => Err(protocol_error.into()), + Ok(create_action) => { + let action: StateTransitionAction = create_action.into(); + Ok(action.into()) + } + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + use crate::rpc::core::MockCoreRPCLike; + use crate::test::helpers::setup::TestPlatformBuilder; + use assert_matches::assert_matches; + use dpp::block::block_info::BlockInfo; + use dpp::consensus::basic::BasicError; + use dpp::consensus::ConsensusError; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::data_contract::errors::DataContractError; + use dpp::data_contract::serialized_version::DataContractInSerializationFormat; + use dpp::platform_value::Value; + use dpp::prelude::IdentityNonce; + use dpp::state_transition::data_contract_create_transition::DataContractCreateTransitionV0; + use dpp::tests::fixtures::get_data_contract_fixture; + use drive::state_transition_action::system::bump_identity_nonce_action::BumpIdentityNonceActionAccessorsV0; + use platform_version::{DefaultForPlatformVersion, TryIntoPlatformVersioned}; + + mod validate_state_v0 { + use super::*; + + #[test] + fn should_return_invalid_result_when_transform_into_action_failed() { + let platform_version = PlatformVersion::latest(); + let identity_nonce = IdentityNonce::default(); + + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let data_contract = + get_data_contract_fixture(None, identity_nonce, platform_version.protocol_version) + .data_contract_owned(); + + let identity_id = data_contract.owner_id(); + + platform + .drive + .apply_contract( + &data_contract, + BlockInfo::default(), + true, + None, + None, + platform_version, + ) + .expect("failed to apply contract"); + + let mut data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + // Make the contract invalid + let DataContractInSerializationFormat::V0(ref mut contract) = + data_contract_for_serialization; + + contract + .document_schemas + .insert("invalidType".to_string(), Value::Null); + + let transition: DataContractCreateTransition = DataContractCreateTransitionV0 { + data_contract: data_contract_for_serialization, + identity_nonce, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let state = platform.state.load_full(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + + let result = transition + .validate_state_v0::( + &platform_ref, + ValidationMode::Validator, + &Epoch::default(), + None, + &mut execution_context, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::ContractError( + DataContractError::InvalidContractStructure(message) + ) + )] if message == "document schema must be an object: structure error: value is not a map" + ); + + assert_matches!( + result.data, + Some(StateTransitionAction::BumpIdentityNonceAction(action)) if action.identity_id() == identity_id && action.identity_nonce() == identity_nonce + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); + } + + #[test] + fn should_return_invalid_result_when_contract_with_specified_id_already_exists() { + let platform_version = PlatformVersion::latest(); + let identity_nonce = IdentityNonce::default(); + + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let data_contract = + get_data_contract_fixture(None, identity_nonce, platform_version.protocol_version) + .data_contract_owned(); + + let identity_id = data_contract.owner_id(); + let data_contract_id = data_contract.id(); + + platform + .drive + .apply_contract( + &data_contract, + BlockInfo::default(), + true, + None, + None, + platform_version, + ) + .expect("failed to apply contract"); + + let data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + let transition: DataContractCreateTransition = DataContractCreateTransitionV0 { + data_contract: data_contract_for_serialization, + identity_nonce, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let state = platform.state.load_full(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + + let result = transition + .validate_state_v0::( + &platform_ref, + ValidationMode::Validator, + &Epoch::default(), + None, + &mut execution_context, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::StateError(StateError::DataContractAlreadyPresentError(e))] if *e.data_contract_id() == data_contract_id + ); + + assert_matches!( + result.data, + Some(StateTransitionAction::BumpIdentityNonceAction(action)) + if action.identity_id() == identity_id && action.identity_nonce() == identity_nonce + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); + } + + #[test] + fn should_pass_when_data_contract_valid_and_does_not_exist() { + let platform_version = PlatformVersion::latest(); + let identity_nonce = IdentityNonce::default(); + + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let data_contract = + get_data_contract_fixture(None, identity_nonce, platform_version.protocol_version) + .data_contract_owned(); + + let data_contract_id = data_contract.id(); + + let data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + let transition: DataContractCreateTransition = DataContractCreateTransitionV0 { + data_contract: data_contract_for_serialization, + identity_nonce, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let state = platform.state.load_full(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + + let result = transition + .validate_state_v0::( + &platform_ref, + ValidationMode::Validator, + &Epoch::default(), + None, + &mut execution_context, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!(result.errors.as_slice(), []); + + assert_matches!( + result.data, + Some(StateTransitionAction::DataContractCreateAction(action)) if action.data_contract_ref().id() == data_contract_id + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); + } + } + + mod transform_into_action_v0 { + use super::*; + + #[test] + fn should_return_invalid_result_if_data_contract_is_not_valid() { + let platform_version = PlatformVersion::latest(); + let identity_nonce = IdentityNonce::default(); + + let data_contract = + get_data_contract_fixture(None, identity_nonce, platform_version.protocol_version) + .data_contract_owned(); + + let identity_id = data_contract.owner_id(); + + let mut data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + // Make the contract invalid + let DataContractInSerializationFormat::V0(ref mut contract) = + data_contract_for_serialization; + + contract + .document_schemas + .insert("invalidType".to_string(), Value::Null); + + let transition: DataContractCreateTransition = DataContractCreateTransitionV0 { + data_contract: data_contract_for_serialization, + identity_nonce, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let result = transition + .transform_into_action_v0::( + ValidationMode::Validator, + &mut execution_context, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::ContractError( + DataContractError::InvalidContractStructure(message) + ) + )] if message == "document schema must be an object: structure error: value is not a map" + ); + + assert_matches!( + result.data, + Some(StateTransitionAction::BumpIdentityNonceAction(action)) if action.identity_id() == identity_id && action.identity_nonce() == identity_nonce + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); + } + + #[test] + fn should_pass_when_data_contract_is_valid() { + let platform_version = PlatformVersion::latest(); + let identity_nonce = IdentityNonce::default(); + + let data_contract = + get_data_contract_fixture(None, identity_nonce, platform_version.protocol_version) + .data_contract_owned(); + + let data_contract_id = data_contract.id(); + + let data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + let transition: DataContractCreateTransition = DataContractCreateTransitionV0 { + data_contract: data_contract_for_serialization, + identity_nonce, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let result = transition + .transform_into_action_v0::( + ValidationMode::Validator, + &mut execution_context, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!(result.errors.as_slice(), []); + + assert_matches!( + result.data, + Some(StateTransitionAction::DataContractCreateAction(action)) if action.data_contract_ref().id() == data_contract_id + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); + } } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/structure/v0/mod.rs deleted file mode 100644 index 6ef443a4adc..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/structure/v0/mod.rs +++ /dev/null @@ -1,57 +0,0 @@ -use crate::error::Error; -use dpp::consensus::basic::data_contract::InvalidDataContractIdError; -use dpp::consensus::basic::BasicError; -use dpp::prelude::DataContract; -use dpp::state_transition::data_contract_create_transition::accessors::DataContractCreateTransitionAccessorsV0; -use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition; -use dpp::validation::SimpleConsensusValidationResult; -use dpp::version::PlatformVersion; -use dpp::ProtocolError; - -pub(in crate::execution::validation::state_transition::state_transitions::data_contract_create) trait DataContractCreatedStateTransitionStructureValidationV0 { - fn validate_base_structure_v0(&self, platform_version: &PlatformVersion) -> Result; -} - -impl DataContractCreatedStateTransitionStructureValidationV0 for DataContractCreateTransition { - fn validate_base_structure_v0( - &self, - platform_version: &PlatformVersion, - ) -> Result { - // Validate data contract - let result = DataContract::try_from_platform_versioned( - self.data_contract().clone(), - true, - platform_version, - ); - - // Return validation result if any consensus errors happened - // during data contract validation - match result { - Err(ProtocolError::ConsensusError(consensus_error)) => { - return Ok(SimpleConsensusValidationResult::new_with_error( - *consensus_error, - )) - } - Err(protocol_error) => return Err(protocol_error.into()), - Ok(_) => {} - } - - // Validate data contract id - let generated_id = DataContract::generate_data_contract_id_v0( - self.data_contract().owner_id(), - self.entropy(), - ); - - if generated_id != self.data_contract().id() { - return Ok(SimpleConsensusValidationResult::new_with_error( - BasicError::InvalidDataContractIdError(InvalidDataContractIdError::new( - generated_id.to_vec(), - self.data_contract().id().to_vec(), - )) - .into(), - )); - } - - Ok(SimpleConsensusValidationResult::default()) - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/identity_contract_nonce/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/identity_contract_nonce/mod.rs new file mode 100644 index 00000000000..6b977fccd61 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/identity_contract_nonce/mod.rs @@ -0,0 +1,51 @@ +use dpp::block::block_info::BlockInfo; +use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; +use dpp::validation::SimpleConsensusValidationResult; +use drive::grovedb::TransactionArg; +use dpp::version::PlatformVersion; +use crate::error::Error; +use crate::error::execution::ExecutionError; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::data_contract_update::identity_contract_nonce::v0::DataContractUpdateStateTransitionIdentityContractNonceV0; +use crate::execution::validation::state_transition::processor::v0::{StateTransitionNonceValidationV0}; +use crate::platform_types::platform::{PlatformStateRef}; + +pub(crate) mod v0; + +impl StateTransitionNonceValidationV0 for DataContractUpdateTransition { + fn validate_nonces( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .contract_update_state_transition + .nonce + { + Some(0) => self.validate_identity_contract_nonce_v0( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "data contract update transition: validate_identity_contract_nonce" + .to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "data contract update transition: validate_identity_contract_nonce" + .to_string(), + known_versions: vec![0], + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/identity_contract_nonce/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/identity_contract_nonce/v0/mod.rs new file mode 100644 index 00000000000..2f012f5a0c4 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/identity_contract_nonce/v0/mod.rs @@ -0,0 +1,72 @@ +use crate::error::Error; +use dpp::block::block_info::BlockInfo; +use dpp::consensus::basic::document::NonceOutOfBoundsError; +use dpp::consensus::basic::BasicError; +use dpp::identity::identity_nonce::{ + validate_identity_nonce_update, validate_new_identity_nonce, MISSING_IDENTITY_REVISIONS_FILTER, +}; +use dpp::state_transition::data_contract_update_transition::accessors::DataContractUpdateTransitionAccessorsV0; +use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; + +use dpp::validation::SimpleConsensusValidationResult; + +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::platform_types::platform::PlatformStateRef; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(in crate::execution::validation::state_transition::state_transitions) trait DataContractUpdateStateTransitionIdentityContractNonceV0 +{ + fn validate_identity_contract_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl DataContractUpdateStateTransitionIdentityContractNonceV0 for DataContractUpdateTransition { + fn validate_identity_contract_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + let revision_nonce = self.identity_contract_nonce(); + + if revision_nonce & MISSING_IDENTITY_REVISIONS_FILTER > 0 { + return Ok(SimpleConsensusValidationResult::new_with_error( + BasicError::NonceOutOfBoundsError(NonceOutOfBoundsError::new(revision_nonce)) + .into(), + )); + } + + let identity_id = self.data_contract().owner_id(); + let contract_id = self.data_contract().id(); + let (existing_nonce, fee) = platform.drive.fetch_identity_contract_nonce_with_fees( + identity_id.to_buffer(), + contract_id.to_buffer(), + block_info, + true, + tx, + platform_version, + )?; + + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee)); + + let result = if let Some(existing_nonce) = existing_nonce { + validate_identity_nonce_update(existing_nonce, revision_nonce, identity_id) + } else { + validate_new_identity_nonce(revision_nonce, identity_id) + }; + + Ok(result) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/mod.rs index 1fc864b41fa..dffa542954d 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/mod.rs @@ -1,36 +1,36 @@ +mod identity_contract_nonce; mod state; -mod structure; +use dpp::block::block_info::BlockInfo; use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; -use dpp::validation::{ConsensusValidationResult, SimpleConsensusValidationResult}; +use dpp::validation::ConsensusValidationResult; use drive::grovedb::TransactionArg; use crate::error::execution::ExecutionError; use crate::error::Error; -use dpp::version::PlatformVersion; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; + use drive::state_transition_action::StateTransitionAction; use crate::execution::validation::state_transition::data_contract_update::state::v0::DataContractUpdateStateTransitionStateValidationV0; -use crate::execution::validation::state_transition::data_contract_update::structure::v0::DataContractUpdateStateTransitionStructureValidationV0; -use crate::execution::validation::state_transition::processor::v0::{ - StateTransitionStateValidationV0, StateTransitionStructureValidationV0, -}; use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; -use crate::platform_types::platform::{PlatformRef, PlatformStateRef}; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::execution::validation::state_transition::ValidationMode; +use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; impl StateTransitionActionTransformerV0 for DataContractUpdateTransition { fn transform_into_action( &self, platform: &PlatformRef, - _validate: bool, + _block_info: &BlockInfo, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, _tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing @@ -38,7 +38,9 @@ impl StateTransitionActionTransformerV0 for DataContractUpdateTransition { .contract_update_state_transition .transform_into_action { - 0 => self.transform_into_action_v0(platform_version), + 0 => { + self.transform_into_action_v0(validation_mode, execution_context, platform_version) + } version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "data contract update transition: transform_into_action".to_string(), known_versions: vec![0], @@ -48,57 +50,6 @@ impl StateTransitionActionTransformerV0 for DataContractUpdateTransition { } } -impl StateTransitionStructureValidationV0 for DataContractUpdateTransition { - fn validate_structure( - &self, - _platform: &PlatformStateRef, - _action: Option<&StateTransitionAction>, - protocol_version: u32, - ) -> Result { - let platform_version = PlatformVersion::get(protocol_version)?; - match platform_version - .drive_abci - .validation_and_processing - .state_transitions - .contract_update_state_transition - .structure - { - 0 => self.validate_base_structure_v0(platform_version), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "data contract update transition: validate_structure".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} - -impl StateTransitionStateValidationV0 for DataContractUpdateTransition { - fn validate_state( - &self, - _action: Option, - platform: &PlatformRef, - tx: TransactionArg, - ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; - match platform_version - .drive_abci - .validation_and_processing - .state_transitions - .contract_update_state_transition - .state - { - 0 => self.validate_state_v0(platform, tx, platform_version), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "data contract update transition: validate_state".to_string(), - known_versions: vec![0], - received: version, - })), - } - } -} - #[cfg(test)] mod tests { use crate::config::{ExecutionConfig, PlatformConfig, PlatformTestConfig}; @@ -106,19 +57,98 @@ mod tests { use crate::rpc::core::MockCoreRPCLike; use crate::test::helpers::setup::{TempPlatform, TestPlatformBuilder}; use dpp::block::block_info::BlockInfo; + use dpp::consensus::basic::BasicError; + use dpp::consensus::state::state_error::StateError; + use dpp::consensus::ConsensusError; + use dpp::dash_to_credits; + use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; + use rand::prelude::StdRng; + use rand::SeedableRng; + use std::collections::BTreeMap; use dpp::data_contract::DataContract; + use dpp::fee::Credits; + use dpp::identifier::Identifier; + use dpp::identity::accessors::IdentityGettersV0; + use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; + use dpp::identity::{Identity, IdentityPublicKey, IdentityV0}; use dpp::platform_value::BinaryData; - use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransitionV0; + use dpp::serialization::PlatformSerializable; + use dpp::state_transition::data_contract_update_transition::methods::DataContractUpdateTransitionMethodsV0; + use dpp::state_transition::data_contract_update_transition::{ + DataContractUpdateTransition, DataContractUpdateTransitionV0, + }; + use crate::platform_types::state_transitions_processing_result::StateTransitionExecutionResult; use dpp::tests::fixtures::get_data_contract_fixture; + use dpp::tests::json_document::json_document_to_contract; use dpp::version::PlatformVersion; + use drive::drive::flags::StorageFlags; + use simple_signer::signer::SimpleSigner; struct TestData { data_contract: DataContract, platform: TempPlatform, } + fn setup_identity( + platform: &mut TempPlatform, + seed: u64, + credits: Credits, + ) -> (Identity, SimpleSigner, IdentityPublicKey) { + let platform_version = PlatformVersion::latest(); + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(seed); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key_with_rng( + 0, + &mut rng, + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (critical_public_key, private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key_with_rng( + 1, + &mut rng, + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(critical_public_key.clone(), private_key.clone()); + + let identity: Identity = IdentityV0 { + id: Identifier::random_with_rng(&mut rng), + public_keys: BTreeMap::from([ + (0, master_key.clone()), + (1, critical_public_key.clone()), + ]), + balance: credits, + revision: 0, + } + .into(); + + // We just add this identity to the system first + + platform + .drive + .add_new_identity( + identity.clone(), + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to add a new identity"); + + (identity, signer, critical_public_key) + } + fn apply_contract( platform: &TempPlatform, data_contract: &DataContract, @@ -140,14 +170,14 @@ mod tests { fn setup_test() -> TestData { let platform_version = PlatformVersion::latest(); - let data_contract = get_data_contract_fixture(None, platform_version.protocol_version) + let data_contract = get_data_contract_fixture(None, 0, platform_version.protocol_version) .data_contract_owned(); let config = PlatformConfig { - quorum_size: 10, + validator_set_quorum_size: 10, execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 300, @@ -175,6 +205,7 @@ mod tests { use crate::execution::validation::state_transition::processor::v0::StateTransitionStateValidationV0; use dpp::block::block_info::BlockInfo; + use dpp::block::epoch::Epoch; use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; use dpp::data_contract::config::v0::DataContractConfigSettersV0; @@ -184,9 +215,11 @@ mod tests { use dpp::platform_value::platform_value; use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; + use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; + use crate::execution::validation::state_transition::ValidationMode; use dpp::version::TryFromPlatformVersioned; use platform_version::version::LATEST_PLATFORM_VERSION; - use platform_version::TryIntoPlatformVersioned; + use platform_version::{DefaultForPlatformVersion, TryIntoPlatformVersioned}; #[test] pub fn should_return_error_if_trying_to_update_document_schema_in_a_readonly_contract() { @@ -220,29 +253,49 @@ mod tests { data_contract.increment_version(); data_contract - .set_document_schema("niceDocument", updated_document, true, platform_version) + .set_document_schema( + "niceDocument", + updated_document, + true, + &mut vec![], + platform_version, + ) .expect("to be able to set document schema"); let state_transition = DataContractUpdateTransitionV0 { + identity_contract_nonce: 1, data_contract: DataContractInSerializationFormat::try_from_platform_versioned( data_contract, platform_version, ) .expect("to be able to convert data contract to serialization format"), + user_fee_increase: 0, signature: BinaryData::new(vec![0; 65]), signature_public_key_id: 0, }; + let state = platform.state.load(); + let platform_ref = PlatformRef { drive: &platform.drive, - state: &platform.state.read().unwrap(), + state: &state, config: &platform.config, core_rpc: &platform.core_rpc, - block_info: &BlockInfo::default(), }; + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("expected a platform version"); + let result = DataContractUpdateTransition::V0(state_transition) - .validate_state(None, &platform_ref, None) + .validate_state( + None, + &platform_ref, + ValidationMode::Validator, + &Epoch::new(0).unwrap(), + &mut execution_context, + None, + ) .expect("state transition to be validated"); assert!(!result.is_valid()); @@ -293,30 +346,50 @@ mod tests { data_contract.increment_version(); data_contract - .set_document_schema("niceDocument", updated_document, true, platform_version) + .set_document_schema( + "niceDocument", + updated_document, + true, + &mut vec![], + platform_version, + ) .expect("to be able to set document schema"); // TODO: add a data contract stop transition let state_transition = DataContractUpdateTransitionV0 { + identity_contract_nonce: 1, data_contract: DataContractInSerializationFormat::try_from_platform_versioned( data_contract.clone(), platform_version, ) .expect("to be able to convert data contract to serialization format"), + user_fee_increase: 0, signature: BinaryData::new(vec![0; 65]), signature_public_key_id: 0, }; + let state = platform.state.load(); + let platform_ref = PlatformRef { drive: &platform.drive, - state: &platform.state.read().unwrap(), + state: &state, config: &platform.config, core_rpc: &platform.core_rpc, - block_info: &BlockInfo::default(), }; + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("expected a platform version"); + let result = DataContractUpdateTransition::V0(state_transition) - .validate_state(None, &platform_ref, None) + .validate_state( + None, + &platform_ref, + ValidationMode::Validator, + &Epoch::new(0).unwrap(), + &mut execution_context, + None, + ) .expect("state transition to be validated"); assert!(result.is_valid()); @@ -392,12 +465,14 @@ mod tests { } #[test] - fn should_fail_if_trying_to_update_config() { + fn should_return_invalid_result_if_trying_to_update_config() { let TestData { mut data_contract, platform, } = setup_test(); + let platform_version = PlatformVersion::latest(); + data_contract.config_mut().set_keeps_history(true); data_contract.config_mut().set_readonly(false); @@ -437,6 +512,7 @@ mod tests { "niceDocument", updated_document_type.into(), true, + &mut vec![], LATEST_PLATFORM_VERSION, ) .expect("to be able to set document schema"); @@ -444,22 +520,34 @@ mod tests { // It should be not possible to modify this data_contract.config_mut().set_keeps_history(false); - let state_transition: DataContractUpdateTransitionV0 = data_contract + let state_transition: DataContractUpdateTransitionV0 = (data_contract, 1) .try_into_platform_versioned(LATEST_PLATFORM_VERSION) .expect("expected an update transition"); let state_transition: DataContractUpdateTransition = state_transition.into(); + let state = platform.state.load(); + let platform_ref = PlatformRef { drive: &platform.drive, - state: &platform.state.read().unwrap(), + state: &state, config: &platform.config, core_rpc: &platform.core_rpc, - block_info: &BlockInfo::default(), }; + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("expected a platform version"); + let result = state_transition - .validate_state(None, &platform_ref, None) + .validate_state( + None, + &platform_ref, + ValidationMode::Validator, + &Epoch::new(0).unwrap(), + &mut execution_context, + None, + ) .expect("state transition to be validated"); assert!(!result.is_valid()); @@ -468,11 +556,112 @@ mod tests { StateError::DataContractConfigUpdateError, 1 ); - let error = errors.get(0).expect("to have an error"); + let error = errors.first().expect("to have an error"); assert_eq!( error.additional_message(), "contract can not change whether it keeps history: changing from true to false" ); } } + + #[test] + fn test_data_contract_update_changing_various_document_type_options() { + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let card_game_path = "tests/supporting_files/contract/crypto-card-game/crypto-card-game-direct-purchase-creation-restricted-to-owner.json"; + + let platform_version = platform + .state + .load() + .current_platform_version() + .expect("expected to get current platform version"); + + // let's construct the grovedb structure for the card game data contract + let mut contract = json_document_to_contract(card_game_path, true, platform_version) + .expect("expected to get data contract"); + + contract.set_owner_id(identity.id()); + + platform + .drive + .apply_contract( + &contract, + BlockInfo::default(), + true, + StorageFlags::optional_default_as_cow(), + None, + platform_version, + ) + .expect("expected to apply contract successfully"); + + let updated_card_game_path = "tests/supporting_files/contract/crypto-card-game/crypto-card-game-direct-purchase.json"; + + // let's construct the grovedb structure for the card game data contract + let mut contract_not_restricted_to_owner = + json_document_to_contract(updated_card_game_path, true, platform_version) + .expect("expected to get data contract"); + + contract_not_restricted_to_owner.set_owner_id(identity.id()); + + contract_not_restricted_to_owner.set_version(2); + + let data_contract_update_transition = DataContractUpdateTransition::new_from_data_contract( + contract_not_restricted_to_owner, + &identity.into_partial_identity_info(), + key.id(), + 2, + 0, + &signer, + platform_version, + None, + ) + .expect("expect to create documents batch transition"); + + let data_contract_update_serialized_transition = data_contract_update_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![data_contract_update_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + // There is no issue because the creator of the contract made the document + + assert_eq!(processing_result.invalid_paid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let result = processing_result.into_execution_results().remove(0); + + assert!(matches!( + result, + StateTransitionExecutionResult::PaidConsensusError( + ConsensusError::StateError( + StateError::DocumentTypeUpdateError(error) + ), _ + ) if error.data_contract_id() == &contract.id() + && error.document_type_name() == "card" + && error.additional_message() == "document type can not change creation restriction mode: changing from Owner Only to No Restrictions" + )); + } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/mod.rs index 9a1925de7fc..39e007b6b48 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/mod.rs @@ -1 +1,56 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::data_contract_update::state::v0::DataContractUpdateStateTransitionStateValidationV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionStateValidationV0; +use crate::execution::validation::state_transition::ValidationMode; +use crate::platform_types::platform::PlatformRef; +use crate::rpc::core::CoreRPCLike; +use dpp::block::epoch::Epoch; +use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; +use dpp::validation::ConsensusValidationResult; +use drive::grovedb::TransactionArg; +use drive::state_transition_action::StateTransitionAction; + pub(crate) mod v0; + +impl StateTransitionStateValidationV0 for DataContractUpdateTransition { + fn validate_state( + &self, + action: Option, + platform: &PlatformRef, + validation_mode: ValidationMode, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, + tx: TransactionArg, + ) -> Result, Error> { + let platform_version = platform.state.current_platform_version()?; + + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .contract_update_state_transition + .state + { + 0 => { + if action.is_some() { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution("data contract update is calling validate state, and the action is already known. It should not be known at this point"))); + } + self.validate_state_v0( + platform, + validation_mode, + epoch, + execution_context, + tx, + platform_version, + ) + } + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "data contract update transition: validate_state".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/v0/mod.rs index 92d98021473..ef81c1a3650 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/v0/mod.rs @@ -1,49 +1,48 @@ use crate::error::Error; use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; -use serde::Serialize; +use dpp::block::epoch::Epoch; -use dpp::consensus::basic::data_contract::{ - DataContractInvalidIndexDefinitionUpdateError, IncompatibleDataContractSchemaError, - InvalidDataContractVersionError, -}; use dpp::consensus::basic::document::DataContractNotPresentError; use dpp::consensus::basic::BasicError; -use dpp::consensus::state::data_contract::data_contract_is_readonly_error::DataContractIsReadonlyError; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::data_contract::config::v0::DataContractConfigGettersV0; +use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; -use dpp::data_contract::document_type::schema::{ - get_operation_and_property_name_json, validate_schema_compatibility, EMPTY_JSON, -}; -use dpp::data_contract::schema::DataContractSchemaMethodsV0; -use dpp::data_contract::JsonValue; -use dpp::platform_value::converter::serde_json::BTreeValueJsonConverter; -use dpp::platform_value::{Value, ValueMap}; +use dpp::data_contract::validate_update::DataContractUpdateValidationMethodsV0; use dpp::prelude::ConsensusValidationResult; -use dpp::state_transition::data_contract_update_transition::accessors::DataContractUpdateTransitionAccessorsV0; use dpp::ProtocolError; use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; -use dpp::version::{PlatformVersion, TryIntoPlatformVersioned}; +use dpp::version::PlatformVersion; +use crate::error::execution::ExecutionError; +use crate::execution::validation::state_transition::ValidationMode; use drive::grovedb::TransactionArg; use drive::state_transition_action::contract::data_contract_update::DataContractUpdateTransitionAction; +use drive::state_transition_action::system::bump_identity_data_contract_nonce_action::BumpIdentityDataContractNonceAction; + +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; use drive::state_transition_action::StateTransitionAction; pub(in crate::execution::validation::state_transition::state_transitions::data_contract_update) trait DataContractUpdateStateTransitionStateValidationV0 { fn validate_state_v0( &self, platform: &PlatformRef, + validation_mode: ValidationMode, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error>; fn transform_into_action_v0( &self, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion ) -> Result, Error>; } @@ -52,16 +51,24 @@ impl DataContractUpdateStateTransitionStateValidationV0 for DataContractUpdateTr fn validate_state_v0( &self, platform: &PlatformRef, + validation_mode: ValidationMode, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error> { - let action = self.transform_into_action_v0(platform_version)?; + let action = + self.transform_into_action_v0(validation_mode, execution_context, platform_version)?; - if !action.is_valid_with_data() { + if !action.is_valid() { return Ok(action); } - let state_transition_action = action.data.as_ref().unwrap(); + let state_transition_action = action.data.as_ref().ok_or(Error::Execution( + ExecutionError::CorruptedCodeExecution( + "we should always have an action at this point in data contract update", + ), + ))?; let new_data_contract = match state_transition_action { StateTransitionAction::DataContractUpdateAction(action) => { @@ -69,192 +76,578 @@ impl DataContractUpdateStateTransitionStateValidationV0 for DataContractUpdateTr } _ => None, } - .unwrap(); + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "we should always have a data contract at this point in data contract update", + )))?; let drive = platform.drive; - let mut validation_result = ConsensusValidationResult::default(); + + // Check previous data contract already exists in the state + // Failure (contract does not exist): Keep ST and transform it to a nonce bump action. + // How: A user pushed an update for a data contract that didn’t exist. + // Note: Existing in the state can also mean that it exists in the current block state, meaning that the contract was inserted in the same block with a previous transition. + // Data contract should exist - let add_to_cache_if_pulled = tx.is_some(); + let add_to_cache_if_pulled = validation_mode.can_alter_cache(); + + let data_contract_fetch_info = drive.get_contract_with_fetch_info_and_fee( + new_data_contract.id().to_buffer(), + Some(epoch), + add_to_cache_if_pulled, + tx, + platform_version, + )?; + + let fee = data_contract_fetch_info.0.ok_or(Error::Execution( + ExecutionError::CorruptedCodeExecution( + "fee must exist in validate state for data contract update transition", + ), + ))?; + + // We add the cost for fetching the contract even if the contract doesn't exist or was in cache + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee)); + // Data contract should exist - let Some(contract_fetch_info) = drive - .get_contract_with_fetch_info_and_fee( - new_data_contract.id().to_buffer(), - None, - add_to_cache_if_pulled, - tx, - platform_version, - )? - .1 - else { - validation_result.add_error(BasicError::DataContractNotPresentError( - DataContractNotPresentError::new(new_data_contract.id()), + let Some(contract_fetch_info) = data_contract_fetch_info.1 else { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_data_contract_update_transition( + self, + ), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![ + BasicError::DataContractNotPresentError(DataContractNotPresentError::new( + new_data_contract.id(), + )) + .into(), + ], )); - return Ok(validation_result); }; let old_data_contract = &contract_fetch_info.contract; - let new_version = new_data_contract.version(); - let old_version = old_data_contract.version(); - if new_version < old_version || new_version - old_version != 1 { - validation_result.add_error(BasicError::InvalidDataContractVersionError( - InvalidDataContractVersionError::new(old_version + 1, new_version), - )) + let validation_result = + old_data_contract.validate_update(new_data_contract, platform_version)?; + + if !validation_result.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_data_contract_update_transition( + self, + ), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + validation_result.errors, + )); } - if old_data_contract.config().readonly() { - validation_result.add_error(DataContractIsReadonlyError::new(new_data_contract.id())); - return Ok(validation_result); + Ok(action) + } + + fn transform_into_action_v0( + &self, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut validation_operations = vec![]; + + let result = DataContractUpdateTransitionAction::try_from_borrowed_transition( + self, + validation_mode.should_fully_validate_contract_on_transform_into_action(), + &mut validation_operations, + platform_version, + ); + + execution_context.add_dpp_operations(validation_operations); + + // Return validation result if any consensus errors happened + // during data contract validation + match result { + Err(ProtocolError::ConsensusError(consensus_error)) => { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_data_contract_update_transition(self), + ); + + Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![*consensus_error], + )) + } + Err(protocol_error) => Err(protocol_error.into()), + Ok(create_action) => { + let action: StateTransitionAction = create_action.into(); + Ok(action.into()) + } } + } +} - // We should now validate that new indexes contains all old indexes - // This is most easily done by using the index level construct - - for (new_contract_document_type_name, new_contract_document_type) in - new_data_contract.document_types() - { - let Some(old_contract_document_type) = - old_data_contract.document_type_optional_for_name(new_contract_document_type_name) - else { - // if it's a new document type (ie the old data contract didn't have it) - // then new indices on it are fine - continue; +#[cfg(test)] +mod tests { + use super::*; + use crate::rpc::core::MockCoreRPCLike; + use crate::test::helpers::setup::TestPlatformBuilder; + use assert_matches::assert_matches; + use dpp::block::block_info::BlockInfo; + use dpp::consensus::ConsensusError; + use dpp::data_contract::accessors::v0::DataContractV0Setters; + use dpp::data_contract::errors::DataContractError; + use dpp::data_contract::serialized_version::DataContractInSerializationFormat; + use dpp::platform_value::Value; + use dpp::prelude::IdentityNonce; + use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransitionV0; + use dpp::tests::fixtures::get_data_contract_fixture; + use drive::state_transition_action::system::bump_identity_data_contract_nonce_action::BumpIdentityDataContractNonceActionAccessorsV0; + use platform_version::{DefaultForPlatformVersion, TryIntoPlatformVersioned}; + + mod validate_state_v0 { + use super::*; + + #[test] + fn should_return_invalid_result_when_transform_into_action_failed() { + let platform_version = PlatformVersion::latest(); + let identity_contract_nonce = IdentityNonce::default(); + + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let data_contract = get_data_contract_fixture( + None, + identity_contract_nonce, + platform_version.protocol_version, + ) + .data_contract_owned(); + + let identity_id = data_contract.owner_id(); + let data_contract_id = data_contract.id(); + + let mut data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + // Make the contract invalid + let DataContractInSerializationFormat::V0(ref mut contract) = + data_contract_for_serialization; + + contract + .document_schemas + .insert("invalidType".to_string(), Value::Null); + + let transition: DataContractUpdateTransition = DataContractUpdateTransitionV0 { + identity_contract_nonce, + data_contract: data_contract_for_serialization, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let state = platform.state.load_full(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &state, + config: &platform.config, + core_rpc: &platform.core_rpc, }; - // If the new contract document type doesn't contain all previous indexes then - // there is a problem - if let Some(non_subset_path) = new_contract_document_type - .index_structure() - .contains_subset_first_non_subset_path(old_contract_document_type.index_structure()) - { - validation_result.add_error( - BasicError::DataContractInvalidIndexDefinitionUpdateError( - DataContractInvalidIndexDefinitionUpdateError::new( - new_contract_document_type_name.clone(), - non_subset_path, - ), - ), + + let result = transition + .validate_state_v0::( + &platform_ref, + ValidationMode::Validator, + &Epoch::default(), + &mut execution_context, + None, + platform_version, ) - } + .expect("failed to validate advanced structure"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::ContractError( + DataContractError::InvalidContractStructure(message) + ) + )] if message == "document schema must be an object: structure error: value is not a map" + ); + + assert_matches!( + result.data, + Some(StateTransitionAction::BumpIdentityDataContractNonceAction(action)) + if action.identity_id() == identity_id && action.identity_contract_nonce() == identity_contract_nonce && action.data_contract_id() == data_contract_id + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); } - if !validation_result.is_valid() { - return Ok(validation_result); - } + #[test] + fn should_return_invalid_result_when_data_contract_does_not_exist() { + let platform_version = PlatformVersion::latest(); + let identity_contract_nonce = IdentityNonce::default(); - let config_validation_result = old_data_contract.config().validate_config_update( - new_data_contract.config(), - self.data_contract().id(), - platform_version, - )?; + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let data_contract = get_data_contract_fixture( + None, + identity_contract_nonce, + platform_version.protocol_version, + ) + .data_contract_owned(); + + let identity_id = data_contract.owner_id(); + let data_contract_id = data_contract.id(); + + let data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + let transition: DataContractUpdateTransition = DataContractUpdateTransitionV0 { + identity_contract_nonce, + data_contract: data_contract_for_serialization, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let state = platform.state.load_full(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; - if !config_validation_result.is_valid() { - validation_result.merge(config_validation_result); - return Ok(validation_result); + let result = transition + .validate_state_v0::( + &platform_ref, + ValidationMode::Validator, + &Epoch::default(), + &mut execution_context, + None, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::DataContractNotPresentError(e) + )] if e.data_contract_id() == data_contract_id + ); + + assert_matches!( + result.data, + Some(StateTransitionAction::BumpIdentityDataContractNonceAction(action)) + if action.identity_id() == identity_id && action.identity_contract_nonce() == identity_contract_nonce && action.data_contract_id() == data_contract_id + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); } - // Schema defs should be compatible - - // TODO: WE need to combine defs with documents schema and and resolve all refs - // Having such full schema we can make sure that changes in defs are actually - // affect document schema. Current simplified solution just apply the same logic - // as for document schema - if let Some(old_defs) = old_data_contract.schema_defs() { - let Some(new_defs) = self.data_contract().schema_defs() else { - validation_result.add_error(BasicError::IncompatibleDataContractSchemaError( - IncompatibleDataContractSchemaError::new( - self.data_contract().id(), - "remove".to_string(), - "$defs".to_string(), - old_defs.into(), - Value::Null, - ), - )); - - return Ok(validation_result); + #[test] + fn should_return_invalid_result_when_new_data_contract_has_incompatible_changes() { + let platform_version = PlatformVersion::latest(); + let identity_contract_nonce = IdentityNonce::default(); + + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let data_contract = get_data_contract_fixture( + None, + identity_contract_nonce, + platform_version.protocol_version, + ) + .data_contract_owned(); + + platform + .drive + .apply_contract( + &data_contract, + BlockInfo::default(), + true, + None, + None, + platform_version, + ) + .expect("failed to apply contract"); + + let identity_id = data_contract.owner_id(); + let data_contract_id = data_contract.id(); + + let data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + let transition: DataContractUpdateTransition = DataContractUpdateTransitionV0 { + identity_contract_nonce, + data_contract: data_contract_for_serialization, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let state = platform.state.load_full(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &state, + config: &platform.config, + core_rpc: &platform.core_rpc, }; - let old_defs_json: JsonValue = old_defs - .to_json_value() - .map_err(ProtocolError::ValueError)?; + let result = transition + .validate_state_v0::( + &platform_ref, + ValidationMode::Validator, + &Epoch::default(), + &mut execution_context, + None, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::InvalidDataContractVersionError(e) + )] if e.expected_version() == 2 && e.version() == 1 + ); + + assert_matches!( + result.data, + Some(StateTransitionAction::BumpIdentityDataContractNonceAction(action)) + if action.identity_id() == identity_id && action.identity_contract_nonce() == identity_contract_nonce && action.data_contract_id() == data_contract_id + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); + } + + #[test] + fn should_pass_when_contract_exists_and_update_is_compatible() { + let platform_version = PlatformVersion::latest(); + let identity_contract_nonce = IdentityNonce::default(); + + let platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); - let new_defs_json: JsonValue = new_defs - .to_json_value() - .map_err(ProtocolError::ValueError)?; + let mut data_contract = get_data_contract_fixture( + None, + identity_contract_nonce, + platform_version.protocol_version, + ) + .data_contract_owned(); + + platform + .drive + .apply_contract( + &data_contract, + BlockInfo::default(), + true, + None, + None, + platform_version, + ) + .expect("failed to apply contract"); - let diffs = - validate_schema_compatibility(&old_defs_json, &new_defs_json, platform_version)?; + let data_contract_id = data_contract.id(); - if diffs.len() > 0 { - let (operation_name, property_name) = - get_operation_and_property_name_json(&diffs[0]); + data_contract.set_version(2); - validation_result.add_error(BasicError::IncompatibleDataContractSchemaError( - IncompatibleDataContractSchemaError::new( - self.data_contract().id(), - operation_name.to_owned(), - property_name.to_owned(), - old_defs_json.into(), - new_defs_json.into(), - ), - )); + let data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); - return Ok(validation_result); + let transition: DataContractUpdateTransition = DataContractUpdateTransitionV0 { + identity_contract_nonce, + data_contract: data_contract_for_serialization, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let state = platform.state.load_full(); + + let platform_ref = PlatformRef { + drive: &platform.drive, + state: &state, + config: &platform.config, + core_rpc: &platform.core_rpc, + }; + + let result = transition + .validate_state_v0::( + &platform_ref, + ValidationMode::Validator, + &Epoch::default(), + &mut execution_context, + None, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!(result.errors.as_slice(), []); + + assert_matches!( + result.data, + Some(StateTransitionAction::DataContractUpdateAction(action)) + if action.data_contract_ref().id() == data_contract_id + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); } + } - for (document_type_name, old_document_schema) in old_data_contract.document_schemas() { - let old_document_schema_json: JsonValue = old_document_schema - .clone() - .try_into() - .map_err(ProtocolError::ValueError)?; - - let new_document_schema = new_data_contract - .document_type_optional_for_name(&document_type_name) - .map(|document_type| document_type.schema().clone()) - .unwrap_or(ValueMap::new().into()); - - let new_document_schema_json: JsonValue = new_document_schema - .clone() - .try_into() - .map_err(ProtocolError::ValueError)?; - - let diffs = validate_schema_compatibility( - &old_document_schema_json, - &new_document_schema_json, - platform_version, - )?; - - if diffs.len() > 0 { - let (operation_name, property_name) = - get_operation_and_property_name_json(&diffs[0]); - - validation_result.add_error(BasicError::IncompatibleDataContractSchemaError( - IncompatibleDataContractSchemaError::new( - self.data_contract().id(), - operation_name.to_owned(), - property_name.to_owned(), - old_document_schema.clone(), - new_document_schema, - ), - )); - - return Ok(validation_result); + mod transform_into_action_v0 { + use super::*; + + #[test] + fn should_return_invalid_result_when_new_data_contract_is_not_valid() { + let platform_version = PlatformVersion::latest(); + let identity_contract_nonce = IdentityNonce::default(); + + let data_contract = get_data_contract_fixture( + None, + identity_contract_nonce, + platform_version.protocol_version, + ) + .data_contract_owned(); + + let identity_id = data_contract.owner_id(); + let data_contract_id = data_contract.id(); + + let mut data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + // Make the contract invalid + let DataContractInSerializationFormat::V0(ref mut contract) = + data_contract_for_serialization; + + contract + .document_schemas + .insert("invalidType".to_string(), Value::Null); + + let transition: DataContractUpdateTransition = DataContractUpdateTransitionV0 { + identity_contract_nonce, + data_contract: data_contract_for_serialization, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let result = transition + .transform_into_action_v0( + ValidationMode::Validator, + &mut execution_context, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError( + BasicError::ContractError( + DataContractError::InvalidContractStructure(message) + ) + )] if message == "document schema must be an object: structure error: value is not a map" + ); + + assert_matches!( + result.data, + Some(StateTransitionAction::BumpIdentityDataContractNonceAction(action)) + if action.identity_id() == identity_id && action.identity_contract_nonce() == identity_contract_nonce && action.data_contract_id() == data_contract_id + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); } - Ok(action) - } + #[test] + fn should_pass_when_new_data_contract_is_valid() { + let platform_version = PlatformVersion::latest(); + let identity_contract_nonce = IdentityNonce::default(); - fn transform_into_action_v0( - &self, - platform_version: &PlatformVersion, - ) -> Result, Error> { - let action: StateTransitionAction = TryIntoPlatformVersioned::< - DataContractUpdateTransitionAction, - >::try_into_platform_versioned( - self, platform_version - )? - .into(); - Ok(action.into()) + let data_contract = get_data_contract_fixture( + None, + identity_contract_nonce, + platform_version.protocol_version, + ) + .data_contract_owned(); + + let data_contract_id = data_contract.id(); + + let data_contract_for_serialization = data_contract + .try_into_platform_versioned(platform_version) + .expect("failed to convert data contract"); + + let transition: DataContractUpdateTransition = DataContractUpdateTransitionV0 { + identity_contract_nonce, + data_contract: data_contract_for_serialization, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + } + .into(); + + let mut execution_context = + StateTransitionExecutionContext::default_for_platform_version(platform_version) + .expect("failed to create execution context"); + + let result = transition + .transform_into_action_v0( + ValidationMode::Validator, + &mut execution_context, + platform_version, + ) + .expect("failed to validate advanced structure"); + + assert_matches!(result.errors.as_slice(), []); + + assert_matches!( + result.data, + Some(StateTransitionAction::DataContractUpdateAction(action)) if action.data_contract_ref().id() == data_contract_id + ); + + // We have tons of operations here so not sure we want to assert all of them + assert!(!execution_context.operations_slice().is_empty()); + } } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/structure/v0/mod.rs deleted file mode 100644 index 20853351aeb..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/structure/v0/mod.rs +++ /dev/null @@ -1,31 +0,0 @@ -use crate::error::Error; -use dpp::data_contract::DataContract; -use dpp::state_transition::data_contract_update_transition::accessors::DataContractUpdateTransitionAccessorsV0; -use dpp::ProtocolError; - -use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition; -use dpp::validation::SimpleConsensusValidationResult; -use dpp::version::PlatformVersion; - -pub(in crate::execution::validation::state_transition::state_transitions::data_contract_update) trait DataContractUpdateStateTransitionStructureValidationV0 { - fn validate_base_structure_v0(&self, platform_version: &PlatformVersion) -> Result; -} - -impl DataContractUpdateStateTransitionStructureValidationV0 for DataContractUpdateTransition { - fn validate_base_structure_v0( - &self, - platform_version: &PlatformVersion, - ) -> Result { - match DataContract::try_from_platform_versioned( - self.data_contract().clone(), - true, - platform_version, - ) { - Ok(_) => Ok(SimpleConsensusValidationResult::default()), - Err(ProtocolError::ConsensusError(e)) => Ok( - SimpleConsensusValidationResult::new_with_error(e.as_ref().clone()), - ), - Err(e) => Err(e.into()), - } - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/mod.rs index 1d287f1095c..2d5e116aa85 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/mod.rs @@ -1,3 +1,4 @@ +use dpp::block::epoch::Epoch; use dpp::identifier::Identifier; use dpp::validation::SimpleConsensusValidationResult; use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionAction; @@ -5,6 +6,7 @@ use dpp::version::PlatformVersion; use drive::grovedb::TransactionArg; use crate::error::Error; use crate::error::execution::ExecutionError; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use crate::execution::validation::state_transition::documents_batch::action_validation::document_create_transition_action::state_v0::DocumentCreateTransitionActionStateValidationV0; use crate::execution::validation::state_transition::documents_batch::action_validation::document_create_transition_action::structure_v0::DocumentCreateTransitionActionStructureValidationV0; use crate::platform_types::platform::PlatformStateRef; @@ -15,7 +17,7 @@ mod structure_v0; pub trait DocumentCreateTransitionActionValidation { fn validate_structure( &self, - platform: &PlatformStateRef, + owner_id: Identifier, platform_version: &PlatformVersion, ) -> Result; @@ -23,6 +25,8 @@ pub trait DocumentCreateTransitionActionValidation { &self, platform: &PlatformStateRef, owner_id: Identifier, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result; @@ -31,7 +35,7 @@ pub trait DocumentCreateTransitionActionValidation { impl DocumentCreateTransitionActionValidation for DocumentCreateTransitionAction { fn validate_structure( &self, - platform: &PlatformStateRef, + owner_id: Identifier, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -41,7 +45,7 @@ impl DocumentCreateTransitionActionValidation for DocumentCreateTransitionAction .documents_batch_state_transition .document_create_transition_structure_validation { - 0 => self.validate_structure_v0(platform, platform_version), + 0 => self.validate_structure_v0(owner_id, platform_version), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "DocumentCreateTransitionAction::validate_structure".to_string(), known_versions: vec![0], @@ -54,6 +58,8 @@ impl DocumentCreateTransitionActionValidation for DocumentCreateTransitionAction &self, platform: &PlatformStateRef, owner_id: Identifier, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result { @@ -64,7 +70,14 @@ impl DocumentCreateTransitionActionValidation for DocumentCreateTransitionAction .documents_batch_state_transition .document_create_transition_state_validation { - 0 => self.validate_state_v0(platform, owner_id, transaction, platform_version), + 0 => self.validate_state_v0( + platform, + owner_id, + epoch, + execution_context, + transaction, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "DocumentCreateTransitionAction::validate_state".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/state_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/state_v0/mod.rs index 963bb4708d1..aff96c03378 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/state_v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/state_v0/mod.rs @@ -1,9 +1,10 @@ +use dpp::block::epoch::Epoch; use dpp::consensus::basic::document::InvalidDocumentTypeError; use dpp::consensus::ConsensusError; use dpp::consensus::state::document::document_already_present_error::DocumentAlreadyPresentError; use dpp::consensus::state::state_error::StateError; use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::document::{DocumentV0Getters}; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; use dpp::prelude::{ConsensusValidationResult, Identifier}; use dpp::validation::SimpleConsensusValidationResult; use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; @@ -11,6 +12,7 @@ use drive::state_transition_action::document::documents_batch::document_transiti use dpp::version::PlatformVersion; use drive::query::TransactionArg; use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use crate::execution::validation::state_transition::documents_batch::state::v0::fetch_documents::fetch_document_with_id; use crate::platform_types::platform::PlatformStateRef; @@ -19,6 +21,8 @@ pub(super) trait DocumentCreateTransitionActionStateValidationV0 { &self, platform: &PlatformStateRef, owner_id: Identifier, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result; @@ -28,6 +32,8 @@ impl DocumentCreateTransitionActionStateValidationV0 for DocumentCreateTransitio &self, platform: &PlatformStateRef, owner_id: Identifier, + _epoch: &Epoch, + _execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result { @@ -65,16 +71,21 @@ impl DocumentCreateTransitionActionStateValidationV0 for DocumentCreateTransitio // we also need to validate that the new document wouldn't conflict with any other document // this means for example having overlapping unique indexes - platform - .drive - .validate_document_create_transition_action_uniqueness( - contract, - document_type, - self, - owner_id, - transaction, - platform_version, - ) - .map_err(Error::Drive) + + if document_type.indices().iter().any(|index| index.unique) { + platform + .drive + .validate_document_create_transition_action_uniqueness( + contract, + document_type, + self, + owner_id, + transaction, + platform_version, + ) + .map_err(Error::Drive) + } else { + Ok(SimpleConsensusValidationResult::new()) + } } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/structure_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/structure_v0/mod.rs index 22409379a81..1fbfb2096a2 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/structure_v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/structure_v0/mod.rs @@ -1,34 +1,26 @@ -use dpp::consensus::basic::document::{InvalidDocumentTypeError, MissingDocumentTypeError}; -use dpp::consensus::ConsensusError; -use dpp::consensus::state::document::document_timestamp_window_violation_error::DocumentTimestampWindowViolationError; -use dpp::consensus::state::document::document_timestamps_mismatch_error::DocumentTimestampsMismatchError; -use dpp::consensus::state::state_error::StateError; +use dpp::consensus::basic::document::{DocumentCreationNotAllowedError, InvalidDocumentTypeError}; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; -use dpp::data_contract::validation::DataContractValidationMethodsV0; -use dpp::document::extended_document::property_names; -use dpp::identity::TimestampMillis; -use dpp::ProtocolError; +use dpp::data_contract::document_type::restricted_creation::CreationRestrictionMode; +use dpp::data_contract::validate_document::DataContractDocumentValidationMethodsV0; +use dpp::identifier::Identifier; use dpp::validation::{SimpleConsensusValidationResult}; -use dpp::validation::block_time_window::validate_time_in_block_time_window::validate_time_in_block_time_window; use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::{DocumentCreateTransitionAction, DocumentCreateTransitionActionAccessorsV0}; use dpp::version::PlatformVersion; use crate::error::Error; -use crate::platform_types::platform::PlatformStateRef; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; pub(super) trait DocumentCreateTransitionActionStructureValidationV0 { fn validate_structure_v0( &self, - platform: &PlatformStateRef, + owner_id: Identifier, platform_version: &PlatformVersion, ) -> Result; } impl DocumentCreateTransitionActionStructureValidationV0 for DocumentCreateTransitionAction { fn validate_structure_v0( &self, - platform: &PlatformStateRef, + owner_id: Identifier, platform_version: &PlatformVersion, ) -> Result { let contract_fetch_info = self.base().data_contract_fetch_info(); @@ -44,64 +36,29 @@ impl DocumentCreateTransitionActionStructureValidationV0 for DocumentCreateTrans )); }; - // Make sure that timestamps are present if required - let required_fields = document_type.required_fields(); - - if required_fields.contains(property_names::CREATED_AT) && self.created_at().is_none() { - // TODO: Create a special consensus error for this - return Ok(SimpleConsensusValidationResult::new_with_error( - MissingDocumentTypeError::new().into(), - )); - } - - if required_fields.contains(property_names::UPDATED_AT) && self.updated_at().is_none() { - // TODO: Create a special consensus error for this - return Ok(SimpleConsensusValidationResult::new_with_error( - MissingDocumentTypeError::new().into(), - )); - } - - if self.created_at().is_some() - && self.updated_at().is_some() - && self.created_at() != self.updated_at() - { - return Ok(SimpleConsensusValidationResult::new_with_error( - DocumentTimestampsMismatchError::new(self.base().id()).into(), - )); - } - - let validation_result = check_if_timestamps_are_equal(self); - if !validation_result.is_valid() { - return Ok(validation_result); - } - - // Validate timestamps against block time - // we do validation here but not in validate state because it's a cheap validation - // and validate state implements expensive validation only - let latest_block_time_ms = platform.state.last_block_time_ms(); - let average_block_spacing_ms = platform.config.block_spacing_ms; - - // We do not need to perform these checks on genesis - if let Some(latest_block_time_ms) = latest_block_time_ms { - let validation_result = check_created_inside_time_window( - self, - latest_block_time_ms, - average_block_spacing_ms, - platform_version, - )?; - if !validation_result.is_valid() { - return Ok(validation_result); + match document_type.creation_restriction_mode() { + CreationRestrictionMode::NoRestrictions => {} + CreationRestrictionMode::OwnerOnly => { + if owner_id != data_contract.owner_id() { + return Ok(SimpleConsensusValidationResult::new_with_error( + DocumentCreationNotAllowedError::new( + self.base().data_contract_id(), + document_type_name.clone(), + document_type.creation_restriction_mode(), + ) + .into(), + )); + } } - - let validation_result = check_updated_inside_time_window( - self, - latest_block_time_ms, - average_block_spacing_ms, - platform_version, - )?; - - if !validation_result.is_valid() { - return Ok(validation_result); + CreationRestrictionMode::NoCreationAllowed => { + return Ok(SimpleConsensusValidationResult::new_with_error( + DocumentCreationNotAllowedError::new( + self.base().data_contract_id(), + document_type_name.clone(), + document_type.creation_restriction_mode(), + ) + .into(), + )); } } @@ -112,91 +69,3 @@ impl DocumentCreateTransitionActionStructureValidationV0 for DocumentCreateTrans .map_err(Error::Protocol) } } - -fn check_if_timestamps_are_equal( - document_transition: &DocumentCreateTransitionAction, -) -> SimpleConsensusValidationResult { - let mut result = SimpleConsensusValidationResult::default(); - let created_at = document_transition.created_at(); - let updated_at = document_transition.updated_at(); - - if created_at.is_some() && updated_at.is_some() && updated_at.unwrap() != created_at.unwrap() { - result.add_error(ConsensusError::StateError( - StateError::DocumentTimestampsMismatchError(DocumentTimestampsMismatchError::new( - document_transition.base().id(), - )), - )); - } - - result -} - -fn check_created_inside_time_window( - document_transition: &DocumentCreateTransitionAction, - last_block_ts_millis: TimestampMillis, - average_block_spacing_ms: u64, - platform_version: &PlatformVersion, -) -> Result { - let mut result = SimpleConsensusValidationResult::default(); - let created_at = match document_transition.created_at() { - Some(t) => t, - None => return Ok(result), - }; - - let window_validation = validate_time_in_block_time_window( - last_block_ts_millis, - created_at, - average_block_spacing_ms, - platform_version, - ) - .map_err(|e| Error::Protocol(ProtocolError::NonConsensusError(e)))?; - if !window_validation.valid { - result.add_error(ConsensusError::StateError( - StateError::DocumentTimestampWindowViolationError( - DocumentTimestampWindowViolationError::new( - String::from("createdAt"), - document_transition.base().id(), - created_at as i64, - window_validation.time_window_start as i64, - window_validation.time_window_end as i64, - ), - ), - )); - } - Ok(result) -} - -fn check_updated_inside_time_window( - document_transition: &DocumentCreateTransitionAction, - last_block_ts_millis: TimestampMillis, - average_block_spacing_ms: u64, - platform_version: &PlatformVersion, -) -> Result { - let mut result = SimpleConsensusValidationResult::default(); - let updated_at = match document_transition.updated_at() { - Some(t) => t, - None => return Ok(result), - }; - - let window_validation = validate_time_in_block_time_window( - last_block_ts_millis, - updated_at, - average_block_spacing_ms, - platform_version, - ) - .map_err(|e| Error::Protocol(ProtocolError::NonConsensusError(e)))?; - if !window_validation.valid { - result.add_error(ConsensusError::StateError( - StateError::DocumentTimestampWindowViolationError( - DocumentTimestampWindowViolationError::new( - String::from("updatedAt"), - document_transition.base().id(), - updated_at as i64, - window_validation.time_window_start as i64, - window_validation.time_window_end as i64, - ), - ), - )); - } - Ok(result) -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/mod.rs index 3257028d794..79f55e4fcf8 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/mod.rs @@ -1,3 +1,4 @@ +use dpp::block::epoch::Epoch; use dpp::identifier::Identifier; use dpp::validation::SimpleConsensusValidationResult; use drive::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::DocumentDeleteTransitionAction; @@ -5,6 +6,7 @@ use dpp::version::PlatformVersion; use drive::grovedb::TransactionArg; use crate::error::Error; use crate::error::execution::ExecutionError; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use crate::execution::validation::state_transition::documents_batch::action_validation::document_delete_transition_action::state_v0::DocumentDeleteTransitionActionStateValidationV0; use crate::execution::validation::state_transition::documents_batch::action_validation::document_delete_transition_action::structure_v0::DocumentDeleteTransitionActionStructureValidationV0; use crate::platform_types::platform::PlatformStateRef; @@ -22,6 +24,8 @@ pub trait DocumentDeleteTransitionActionValidation { &self, platform: &PlatformStateRef, owner_id: Identifier, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result; @@ -52,6 +56,8 @@ impl DocumentDeleteTransitionActionValidation for DocumentDeleteTransitionAction &self, platform: &PlatformStateRef, owner_id: Identifier, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result { @@ -62,7 +68,14 @@ impl DocumentDeleteTransitionActionValidation for DocumentDeleteTransitionAction .documents_batch_state_transition .document_delete_transition_state_validation { - 0 => self.validate_state_v0(platform, owner_id, transaction, platform_version), + 0 => self.validate_state_v0( + platform, + owner_id, + epoch, + execution_context, + transaction, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "DocumentDeleteTransitionAction::validate_state".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/state_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/state_v0/mod.rs index be9d279253e..b598a2fd0af 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/state_v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/state_v0/mod.rs @@ -1,3 +1,4 @@ +use dpp::block::epoch::Epoch; use dpp::consensus::basic::document::InvalidDocumentTypeError; use dpp::consensus::ConsensusError; use dpp::consensus::state::document::document_not_found_error::DocumentNotFoundError; @@ -14,6 +15,7 @@ use drive::grovedb::TransactionArg; use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; use drive::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::v0::DocumentDeleteTransitionActionAccessorsV0; use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use crate::execution::validation::state_transition::documents_batch::state::v0::fetch_documents::fetch_document_with_id; use crate::platform_types::platform::PlatformStateRef; @@ -22,6 +24,8 @@ pub(super) trait DocumentDeleteTransitionActionStateValidationV0 { &self, platform: &PlatformStateRef, owner_id: Identifier, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result; @@ -31,6 +35,8 @@ impl DocumentDeleteTransitionActionStateValidationV0 for DocumentDeleteTransitio &self, platform: &PlatformStateRef, owner_id: Identifier, + _epoch: &Epoch, + _execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result { diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/structure_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/structure_v0/mod.rs index ed3222d459b..3813405201c 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/structure_v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_delete_transition_action/structure_v0/mod.rs @@ -1,5 +1,10 @@ +use dpp::consensus::basic::document::{InvalidDocumentTransitionActionError, InvalidDocumentTypeError}; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; use dpp::validation::SimpleConsensusValidationResult; +use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; use drive::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::DocumentDeleteTransitionAction; +use drive::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::v0::DocumentDeleteTransitionActionAccessorsV0; use crate::error::Error; @@ -8,6 +13,29 @@ pub(super) trait DocumentDeleteTransitionActionStructureValidationV0 { } impl DocumentDeleteTransitionActionStructureValidationV0 for DocumentDeleteTransitionAction { fn validate_structure_v0(&self) -> Result { - Ok(SimpleConsensusValidationResult::new()) + let contract_fetch_info = self.base().data_contract_fetch_info(); + let data_contract = &contract_fetch_info.contract; + let document_type_name = self.base().document_type_name(); + + // Make sure that the document type is defined in the contract + let Some(document_type) = data_contract.document_type_optional_for_name(document_type_name) + else { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTypeError::new(document_type_name.clone(), data_contract.id()) + .into(), + )); + }; + + if !document_type.documents_can_be_deleted() { + Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTransitionActionError::new(format!( + "documents of type {} can not be deleted", + document_type_name + )) + .into(), + )) + } else { + Ok(SimpleConsensusValidationResult::new()) + } } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_purchase_transition_action/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_purchase_transition_action/mod.rs new file mode 100644 index 00000000000..c72f4ea28db --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_purchase_transition_action/mod.rs @@ -0,0 +1,87 @@ +use dpp::block::epoch::Epoch; +use dpp::identifier::Identifier; + +use dpp::validation::SimpleConsensusValidationResult; +use drive::state_transition_action::document::documents_batch::document_transition::document_purchase_transition_action::DocumentPurchaseTransitionAction; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use crate::error::Error; +use crate::error::execution::ExecutionError; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_purchase_transition_action::state_v0::DocumentPurchaseTransitionActionStateValidationV0; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_purchase_transition_action::structure_v0::DocumentPurchaseTransitionActionStructureValidationV0; +use crate::platform_types::platform::PlatformStateRef; + +mod state_v0; +mod structure_v0; + +pub trait DocumentPurchaseTransitionActionValidation { + fn validate_structure( + &self, + platform_version: &PlatformVersion, + ) -> Result; + + fn validate_state( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl DocumentPurchaseTransitionActionValidation for DocumentPurchaseTransitionAction { + fn validate_structure( + &self, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .documents_batch_state_transition + .document_purchase_transition_structure_validation + { + 0 => self.validate_structure_v0(platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "DocumentPurchaseTransitionAction::validate_structure".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + fn validate_state( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .documents_batch_state_transition + .document_purchase_transition_state_validation + { + 0 => self.validate_state_v0( + platform, + owner_id, + epoch, + execution_context, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "DocumentPurchaseTransitionAction::validate_state".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_purchase_transition_action/state_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_purchase_transition_action/state_v0/mod.rs new file mode 100644 index 00000000000..e4a59552eb6 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_purchase_transition_action/state_v0/mod.rs @@ -0,0 +1,70 @@ +use dpp::block::epoch::Epoch; +use dpp::consensus::basic::document::InvalidDocumentTypeError; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::identifier::Identifier; +use dpp::validation::SimpleConsensusValidationResult; +use drive::state_transition_action::document::documents_batch::document_transition::document_purchase_transition_action::{DocumentPurchaseTransitionAction, DocumentPurchaseTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::platform_types::platform::PlatformStateRef; + +pub(super) trait DocumentPurchaseTransitionActionStateValidationV0 { + fn validate_state_v0( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; +} +impl DocumentPurchaseTransitionActionStateValidationV0 for DocumentPurchaseTransitionAction { + fn validate_state_v0( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + _epoch: &Epoch, + _execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let contract_fetch_info = self.base().data_contract_fetch_info(); + + let contract = &contract_fetch_info.contract; + + let document_type_name = self.base().document_type_name(); + + let Some(document_type) = contract.document_type_optional_for_name(document_type_name) + else { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTypeError::new(document_type_name.clone(), contract.id()).into(), + )); + }; + + // There is no need to verify that the document already existed, since this is done when + // transforming into an action + + // We need to verify that the resultant document doesn't violate any unique properties + + if document_type.indices().iter().any(|index| index.unique) { + platform + .drive + .validate_document_purchase_transition_action_uniqueness( + contract, + document_type, + self, + owner_id, + transaction, + platform_version, + ) + .map_err(Error::Drive) + } else { + Ok(SimpleConsensusValidationResult::new()) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_purchase_transition_action/structure_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_purchase_transition_action/structure_v0/mod.rs new file mode 100644 index 00000000000..afbe3ae28b2 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_purchase_transition_action/structure_v0/mod.rs @@ -0,0 +1,61 @@ +use dpp::consensus::basic::document::{InvalidDocumentTransitionActionError, InvalidDocumentTypeError}; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::document::DocumentV0Getters; +use dpp::nft::TradeMode; +use dpp::validation::SimpleConsensusValidationResult; +use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use drive::state_transition_action::document::documents_batch::document_transition::document_purchase_transition_action::{DocumentPurchaseTransitionAction, DocumentPurchaseTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; +use crate::error::Error; + +pub(super) trait DocumentPurchaseTransitionActionStructureValidationV0 { + fn validate_structure_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result; +} +impl DocumentPurchaseTransitionActionStructureValidationV0 for DocumentPurchaseTransitionAction { + fn validate_structure_v0( + &self, + _platform_version: &PlatformVersion, + ) -> Result { + let contract_fetch_info = self.base().data_contract_fetch_info(); + let data_contract = &contract_fetch_info.contract; + let document_type_name = self.base().document_type_name(); + + // Make sure that the document type is defined in the contract + let Some(document_type) = data_contract.document_type_optional_for_name(document_type_name) + else { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTypeError::new(document_type_name.clone(), data_contract.id()) + .into(), + )); + }; + + // We can not purchase from ourselves + // The document owner id is already our owner id, as the action we want to take is to + // insert this document into the state (with our owner id) + if self.original_owner_id() == self.document().owner_id() { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTransitionActionError::new(format!( + "on document type: {} identity trying to purchase a document that is already owned by the purchaser", + document_type_name + )) + .into(), + )); + } + + if document_type.trade_mode() != TradeMode::DirectPurchase { + Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTransitionActionError::new(format!( + "{} trade mode is not direct purchase but we are trying to purchase directly", + document_type_name + )) + .into(), + )) + } else { + Ok(SimpleConsensusValidationResult::default()) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/mod.rs index 1ac0639b8f7..f745e690f23 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/mod.rs @@ -1,3 +1,4 @@ +use dpp::block::epoch::Epoch; use dpp::identifier::Identifier; use dpp::validation::SimpleConsensusValidationResult; @@ -6,6 +7,7 @@ use dpp::version::PlatformVersion; use drive::grovedb::TransactionArg; use crate::error::Error; use crate::error::execution::ExecutionError; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use crate::execution::validation::state_transition::documents_batch::action_validation::document_replace_transition_action::state_v0::DocumentReplaceTransitionActionStateValidationV0; use crate::execution::validation::state_transition::documents_batch::action_validation::document_replace_transition_action::structure_v0::DocumentReplaceTransitionActionStructureValidationV0; use crate::platform_types::platform::PlatformStateRef; @@ -16,7 +18,6 @@ mod structure_v0; pub trait DocumentReplaceTransitionActionValidation { fn validate_structure( &self, - platform: &PlatformStateRef, platform_version: &PlatformVersion, ) -> Result; @@ -24,6 +25,8 @@ pub trait DocumentReplaceTransitionActionValidation { &self, platform: &PlatformStateRef, owner_id: Identifier, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result; @@ -32,7 +35,6 @@ pub trait DocumentReplaceTransitionActionValidation { impl DocumentReplaceTransitionActionValidation for DocumentReplaceTransitionAction { fn validate_structure( &self, - platform: &PlatformStateRef, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -42,7 +44,7 @@ impl DocumentReplaceTransitionActionValidation for DocumentReplaceTransitionActi .documents_batch_state_transition .document_replace_transition_structure_validation { - 0 => self.validate_structure_v0(platform, platform_version), + 0 => self.validate_structure_v0(platform_version), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "DocumentReplaceTransitionAction::validate_structure".to_string(), known_versions: vec![0], @@ -55,6 +57,8 @@ impl DocumentReplaceTransitionActionValidation for DocumentReplaceTransitionActi &self, platform: &PlatformStateRef, owner_id: Identifier, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result { @@ -65,7 +69,14 @@ impl DocumentReplaceTransitionActionValidation for DocumentReplaceTransitionActi .documents_batch_state_transition .document_replace_transition_state_validation { - 0 => self.validate_state_v0(platform, owner_id, transaction, platform_version), + 0 => self.validate_state_v0( + platform, + owner_id, + epoch, + execution_context, + transaction, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "DocumentReplaceTransitionAction::validate_state".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/state_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/state_v0/mod.rs index c2ec518776b..ea9e1529e8e 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/state_v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/state_v0/mod.rs @@ -1,5 +1,7 @@ +use dpp::block::epoch::Epoch; use dpp::consensus::basic::document::InvalidDocumentTypeError; use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; use dpp::identifier::Identifier; use dpp::validation::SimpleConsensusValidationResult; use drive::state_transition_action::document::documents_batch::document_transition::document_replace_transition_action::{DocumentReplaceTransitionAction, DocumentReplaceTransitionActionAccessorsV0}; @@ -7,6 +9,7 @@ use dpp::version::PlatformVersion; use drive::grovedb::TransactionArg; use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use crate::platform_types::platform::PlatformStateRef; pub(super) trait DocumentReplaceTransitionActionStateValidationV0 { @@ -14,6 +17,8 @@ pub(super) trait DocumentReplaceTransitionActionStateValidationV0 { &self, platform: &PlatformStateRef, owner_id: Identifier, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result; @@ -23,6 +28,8 @@ impl DocumentReplaceTransitionActionStateValidationV0 for DocumentReplaceTransit &self, platform: &PlatformStateRef, owner_id: Identifier, + _epoch: &Epoch, + _execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result { @@ -39,19 +46,23 @@ impl DocumentReplaceTransitionActionStateValidationV0 for DocumentReplaceTransit )); }; - // The rest of state validation is actually happening in documents batch transition transformer - // TODO: Think more about this architecture + // There is no need to verify that the document already existed, since this is done when + // transforming into an action - platform - .drive - .validate_document_replace_transition_action_uniqueness( - contract, - document_type, - self, - owner_id, - transaction, - platform_version, - ) - .map_err(Error::Drive) + if document_type.indices().iter().any(|index| index.unique) { + platform + .drive + .validate_document_replace_transition_action_uniqueness( + contract, + document_type, + self, + owner_id, + transaction, + platform_version, + ) + .map_err(Error::Drive) + } else { + Ok(SimpleConsensusValidationResult::new()) + } } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/structure_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/structure_v0/mod.rs index 1bf0ba9b8d3..6f77359d1ad 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/structure_v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/structure_v0/mod.rs @@ -1,35 +1,22 @@ -use dpp::consensus::basic::document::{InvalidDocumentTypeError, MissingDocumentTypeError}; -use dpp::consensus::state::document::document_timestamp_window_violation_error::DocumentTimestampWindowViolationError; -use dpp::consensus::ConsensusError; - -use dpp::consensus::state::state_error::StateError; +use dpp::consensus::basic::document::{InvalidDocumentTransitionActionError, InvalidDocumentTypeError}; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; -use dpp::data_contract::validation::DataContractValidationMethodsV0; -use dpp::document::{DocumentV0Getters}; -use dpp::document::extended_document::property_names; -use dpp::identity::TimestampMillis; -use dpp::ProtocolError; -use dpp::validation::block_time_window::validate_time_in_block_time_window::validate_time_in_block_time_window; +use dpp::data_contract::validate_document::DataContractDocumentValidationMethodsV0; use dpp::validation::SimpleConsensusValidationResult; use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; use drive::state_transition_action::document::documents_batch::document_transition::document_replace_transition_action::{DocumentReplaceTransitionAction, DocumentReplaceTransitionActionAccessorsV0}; use dpp::version::PlatformVersion; use crate::error::Error; -use crate::platform_types::platform::PlatformStateRef; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; pub(super) trait DocumentReplaceTransitionActionStructureValidationV0 { fn validate_structure_v0( &self, - platform: &PlatformStateRef, platform_version: &PlatformVersion, ) -> Result; } impl DocumentReplaceTransitionActionStructureValidationV0 for DocumentReplaceTransitionAction { fn validate_structure_v0( &self, - platform: &PlatformStateRef, platform_version: &PlatformVersion, ) -> Result { let contract_fetch_info = self.base().data_contract_fetch_info(); @@ -45,35 +32,16 @@ impl DocumentReplaceTransitionActionStructureValidationV0 for DocumentReplaceTra )); }; - // Make sure that timestamps are present if required - let required_fields = document_type.required_fields(); - - if required_fields.contains(property_names::UPDATED_AT) && self.updated_at().is_none() { - // TODO: Create a special consensus error for this + if !document_type.documents_mutable() { return Ok(SimpleConsensusValidationResult::new_with_error( - MissingDocumentTypeError::new().into(), + InvalidDocumentTransitionActionError::new(format!( + "{} is not mutable and can not be replaced", + document_type_name + )) + .into(), )); } - // Validate timestamps against block time - // we do validation here but not in validate state because it's a cheap validation - // and validate state implements expensive validation only - let latest_block_time_ms = platform.state.last_block_time_ms(); - let average_block_spacing_ms = platform.config.block_spacing_ms; - - if let Some(latest_block_time_ms) = latest_block_time_ms { - let validation_result = check_updated_inside_time_window( - self, - latest_block_time_ms, - average_block_spacing_ms, - platform_version, - )?; - - if !validation_result.is_valid() { - return Ok(validation_result); - } - } - // Validate user defined properties data_contract @@ -81,38 +49,3 @@ impl DocumentReplaceTransitionActionStructureValidationV0 for DocumentReplaceTra .map_err(Error::Protocol) } } - -fn check_updated_inside_time_window( - document_transition: &DocumentReplaceTransitionAction, - last_block_ts_millis: TimestampMillis, - average_block_spacing_ms: u64, - platform_version: &PlatformVersion, -) -> Result { - let mut result = SimpleConsensusValidationResult::default(); - let updated_at = match document_transition.updated_at() { - Some(t) => t, - None => return Ok(result), - }; - - let window_validation = validate_time_in_block_time_window( - last_block_ts_millis, - updated_at, - average_block_spacing_ms, - platform_version, - ) - .map_err(|e| Error::Protocol(ProtocolError::NonConsensusError(e)))?; - if !window_validation.valid { - result.add_error(ConsensusError::StateError( - StateError::DocumentTimestampWindowViolationError( - DocumentTimestampWindowViolationError::new( - String::from("updatedAt"), - document_transition.base().id(), - updated_at as i64, - window_validation.time_window_start as i64, - window_validation.time_window_end as i64, - ), - ), - )); - } - Ok(result) -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_transfer_transition_action/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_transfer_transition_action/mod.rs new file mode 100644 index 00000000000..376932cb421 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_transfer_transition_action/mod.rs @@ -0,0 +1,87 @@ +use dpp::block::epoch::Epoch; +use dpp::identifier::Identifier; + +use dpp::validation::SimpleConsensusValidationResult; +use drive::state_transition_action::document::documents_batch::document_transition::document_transfer_transition_action::DocumentTransferTransitionAction; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use crate::error::Error; +use crate::error::execution::ExecutionError; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_transfer_transition_action::state_v0::DocumentTransferTransitionActionStateValidationV0; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_transfer_transition_action::structure_v0::DocumentTransferTransitionActionStructureValidationV0; +use crate::platform_types::platform::PlatformStateRef; + +mod state_v0; +mod structure_v0; + +pub trait DocumentTransferTransitionActionValidation { + fn validate_structure( + &self, + platform_version: &PlatformVersion, + ) -> Result; + + fn validate_state( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl DocumentTransferTransitionActionValidation for DocumentTransferTransitionAction { + fn validate_structure( + &self, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .documents_batch_state_transition + .document_transfer_transition_structure_validation + { + 0 => self.validate_structure_v0(platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "DocumentTransferTransitionAction::validate_structure".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + fn validate_state( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .documents_batch_state_transition + .document_transfer_transition_state_validation + { + 0 => self.validate_state_v0( + platform, + owner_id, + epoch, + execution_context, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "DocumentTransferTransitionAction::validate_state".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_transfer_transition_action/state_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_transfer_transition_action/state_v0/mod.rs new file mode 100644 index 00000000000..7e1e64bab40 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_transfer_transition_action/state_v0/mod.rs @@ -0,0 +1,68 @@ +use dpp::block::epoch::Epoch; +use dpp::consensus::basic::document::InvalidDocumentTypeError; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::identifier::Identifier; +use dpp::validation::SimpleConsensusValidationResult; +use drive::state_transition_action::document::documents_batch::document_transition::document_transfer_transition_action::{DocumentTransferTransitionAction, DocumentTransferTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::platform_types::platform::PlatformStateRef; + +pub(super) trait DocumentTransferTransitionActionStateValidationV0 { + fn validate_state_v0( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; +} +impl DocumentTransferTransitionActionStateValidationV0 for DocumentTransferTransitionAction { + fn validate_state_v0( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + _epoch: &Epoch, + _execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let contract_fetch_info = self.base().data_contract_fetch_info(); + + let contract = &contract_fetch_info.contract; + + let document_type_name = self.base().document_type_name(); + + let Some(document_type) = contract.document_type_optional_for_name(document_type_name) + else { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTypeError::new(document_type_name.clone(), contract.id()).into(), + )); + }; + + // There is no need to verify that the document already existed, since this is done when + // transforming into an action + + if document_type.indices().iter().any(|index| index.unique) { + platform + .drive + .validate_document_transfer_transition_action_uniqueness( + contract, + document_type, + self, + owner_id, + transaction, + platform_version, + ) + .map_err(Error::Drive) + } else { + Ok(SimpleConsensusValidationResult::new()) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_transfer_transition_action/structure_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_transfer_transition_action/structure_v0/mod.rs new file mode 100644 index 00000000000..3910574a615 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_transfer_transition_action/structure_v0/mod.rs @@ -0,0 +1,46 @@ +use dpp::consensus::basic::document::{InvalidDocumentTransitionActionError, InvalidDocumentTypeError}; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::validation::SimpleConsensusValidationResult; +use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use drive::state_transition_action::document::documents_batch::document_transition::document_transfer_transition_action::{DocumentTransferTransitionAction, DocumentTransferTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; +use crate::error::Error; + +pub(super) trait DocumentTransferTransitionActionStructureValidationV0 { + fn validate_structure_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result; +} +impl DocumentTransferTransitionActionStructureValidationV0 for DocumentTransferTransitionAction { + fn validate_structure_v0( + &self, + _platform_version: &PlatformVersion, + ) -> Result { + let contract_fetch_info = self.base().data_contract_fetch_info(); + let data_contract = &contract_fetch_info.contract; + let document_type_name = self.base().document_type_name(); + + // Make sure that the document type is defined in the contract + let Some(document_type) = data_contract.document_type_optional_for_name(document_type_name) + else { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTypeError::new(document_type_name.clone(), data_contract.id()) + .into(), + )); + }; + + if !document_type.documents_transferable().is_transferable() { + Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTransitionActionError::new(format!( + "{} is not a transferable document type", + document_type_name + )) + .into(), + )) + } else { + Ok(SimpleConsensusValidationResult::default()) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_update_price_transition_action/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_update_price_transition_action/mod.rs new file mode 100644 index 00000000000..18876a8fe83 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_update_price_transition_action/mod.rs @@ -0,0 +1,87 @@ +use dpp::block::epoch::Epoch; +use dpp::identifier::Identifier; + +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use drive::state_transition_action::document::documents_batch::document_transition::document_update_price_transition_action::DocumentUpdatePriceTransitionAction; +use crate::error::Error; +use crate::error::execution::ExecutionError; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_update_price_transition_action::state_v0::DocumentUpdatePriceTransitionActionStateValidationV0; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_update_price_transition_action::structure_v0::DocumentUpdatePriceTransitionActionStructureValidationV0; +use crate::platform_types::platform::PlatformStateRef; + +mod state_v0; +mod structure_v0; + +pub trait DocumentUpdatePriceTransitionActionValidation { + fn validate_structure( + &self, + platform_version: &PlatformVersion, + ) -> Result; + + fn validate_state( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl DocumentUpdatePriceTransitionActionValidation for DocumentUpdatePriceTransitionAction { + fn validate_structure( + &self, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .documents_batch_state_transition + .document_transfer_transition_structure_validation + { + 0 => self.validate_structure_v0(platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "DocumentUpdatePriceTransitionAction::validate_structure".to_string(), + known_versions: vec![0], + received: version, + })), + } + } + + fn validate_state( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .documents_batch_state_transition + .document_transfer_transition_state_validation + { + 0 => self.validate_state_v0( + platform, + owner_id, + epoch, + execution_context, + transaction, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "DocumentUpdatePriceTransitionAction::validate_state".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_update_price_transition_action/state_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_update_price_transition_action/state_v0/mod.rs new file mode 100644 index 00000000000..4f622331b52 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_update_price_transition_action/state_v0/mod.rs @@ -0,0 +1,68 @@ +use dpp::block::epoch::Epoch; +use dpp::consensus::basic::document::InvalidDocumentTypeError; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::identifier::Identifier; +use dpp::validation::SimpleConsensusValidationResult; +use drive::state_transition_action::document::documents_batch::document_transition::document_update_price_transition_action::{DocumentUpdatePriceTransitionAction, DocumentUpdatePriceTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; +use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::platform_types::platform::PlatformStateRef; + +pub(super) trait DocumentUpdatePriceTransitionActionStateValidationV0 { + fn validate_state_v0( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result; +} +impl DocumentUpdatePriceTransitionActionStateValidationV0 for DocumentUpdatePriceTransitionAction { + fn validate_state_v0( + &self, + platform: &PlatformStateRef, + owner_id: Identifier, + _epoch: &Epoch, + _execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let contract_fetch_info = self.base().data_contract_fetch_info(); + + let contract = &contract_fetch_info.contract; + + let document_type_name = self.base().document_type_name(); + + let Some(document_type) = contract.document_type_optional_for_name(document_type_name) + else { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTypeError::new(document_type_name.clone(), contract.id()).into(), + )); + }; + + // There is no need to verify that the document already existed, since this is done when + // transforming into an action + + if document_type.indices().iter().any(|index| index.unique) { + platform + .drive + .validate_document_update_price_transition_action_uniqueness( + contract, + document_type, + self, + owner_id, + transaction, + platform_version, + ) + .map_err(Error::Drive) + } else { + Ok(SimpleConsensusValidationResult::new()) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_update_price_transition_action/structure_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_update_price_transition_action/structure_v0/mod.rs new file mode 100644 index 00000000000..f8b66fe3746 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_update_price_transition_action/structure_v0/mod.rs @@ -0,0 +1,49 @@ +use dpp::consensus::basic::document::{InvalidDocumentTransitionActionError, InvalidDocumentTypeError}; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; +use dpp::validation::SimpleConsensusValidationResult; +use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; +use drive::state_transition_action::document::documents_batch::document_transition::document_update_price_transition_action::{DocumentUpdatePriceTransitionAction, DocumentUpdatePriceTransitionActionAccessorsV0}; +use dpp::version::PlatformVersion; +use crate::error::Error; + +pub(super) trait DocumentUpdatePriceTransitionActionStructureValidationV0 { + fn validate_structure_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result; +} +impl DocumentUpdatePriceTransitionActionStructureValidationV0 + for DocumentUpdatePriceTransitionAction +{ + fn validate_structure_v0( + &self, + _platform_version: &PlatformVersion, + ) -> Result { + let contract_fetch_info = self.base().data_contract_fetch_info(); + let data_contract = &contract_fetch_info.contract; + let document_type_name = self.base().document_type_name(); + + // Make sure that the document type is defined in the contract + let Some(document_type) = data_contract.document_type_optional_for_name(document_type_name) + else { + return Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTypeError::new(document_type_name.clone(), data_contract.id()) + .into(), + )); + }; + + if !document_type.trade_mode().seller_sets_price() { + Ok(SimpleConsensusValidationResult::new_with_error( + InvalidDocumentTransitionActionError::new(format!( + "{} is in trade mode {} that does not support the seller setting the price", + document_type_name, + document_type.trade_mode(), + )) + .into(), + )) + } else { + Ok(SimpleConsensusValidationResult::default()) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/mod.rs index 5689698caaf..32c28c43faa 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/mod.rs @@ -1,3 +1,6 @@ pub(crate) mod document_create_transition_action; pub(crate) mod document_delete_transition_action; +pub(crate) mod document_purchase_transition_action; pub(crate) mod document_replace_transition_action; +pub(crate) mod document_transfer_transition_action; +pub(crate) mod document_update_price_transition_action; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/structure/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/advanced_structure/mod.rs similarity index 100% rename from packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/structure/mod.rs rename to packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/advanced_structure/mod.rs diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/advanced_structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/advanced_structure/v0/mod.rs new file mode 100644 index 00000000000..6c9f7b93b42 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/advanced_structure/v0/mod.rs @@ -0,0 +1,208 @@ +use crate::error::Error; +use dpp::consensus::basic::document::InvalidDocumentTransitionIdError; +use dpp::consensus::signature::{InvalidSignaturePublicKeySecurityLevelError, SignatureError}; +use dpp::document::Document; +use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; +use dpp::identity::PartialIdentity; +use dpp::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; +use dpp::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; +use dpp::state_transition::documents_batch_transition::document_transition::{ + DocumentTransition, DocumentTransitionV0Methods, +}; + +use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; +use dpp::state_transition::{StateTransitionIdentitySigned, StateTransitionLike}; + +use dpp::validation::ConsensusValidationResult; + +use dpp::version::PlatformVersion; + +use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; +use drive::state_transition_action::document::documents_batch::DocumentsBatchTransitionAction; +use crate::execution::validation::state_transition::state_transitions::documents_batch::action_validation::document_replace_transition_action::DocumentReplaceTransitionActionValidation; +use crate::execution::validation::state_transition::state_transitions::documents_batch::action_validation::document_delete_transition_action::DocumentDeleteTransitionActionValidation; +use crate::execution::validation::state_transition::state_transitions::documents_batch::action_validation::document_create_transition_action::DocumentCreateTransitionActionValidation; +use dpp::state_transition::documents_batch_transition::document_create_transition::v0::v0_methods::DocumentCreateTransitionV0Methods; +use drive::state_transition_action::StateTransitionAction; +use drive::state_transition_action::system::bump_identity_data_contract_nonce_action::BumpIdentityDataContractNonceAction; +use crate::error::execution::ExecutionError; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0}; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_purchase_transition_action::DocumentPurchaseTransitionActionValidation; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_transfer_transition_action::DocumentTransferTransitionActionValidation; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_update_price_transition_action::DocumentUpdatePriceTransitionActionValidation; + +pub(in crate::execution::validation::state_transition::state_transitions::documents_batch) trait DocumentsBatchStateTransitionStructureValidationV0 +{ + fn validate_advanced_structure_from_state_v0( + &self, + action: &DocumentsBatchTransitionAction, + identity: &PartialIdentity, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error>; +} + +impl DocumentsBatchStateTransitionStructureValidationV0 for DocumentsBatchTransition { + fn validate_advanced_structure_from_state_v0( + &self, + action: &DocumentsBatchTransitionAction, + identity: &PartialIdentity, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let security_levels = action.contract_based_security_level_requirement()?; + + let signing_key = identity.loaded_public_keys.get(&self.signature_public_key_id()).ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution("the key must exist for advanced structure validation as we already fetched it during signature validation")))?; + + if !security_levels.contains(&signing_key.security_level()) { + // We only need to bump the first identity data contract nonce as that will make a replay + // attack not possible + + let first_transition = self.transitions().first().ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution("There must be at least one state transition as this is already verified in basic validation")))?; + + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_document_base_transition( + first_transition.base(), + self.owner_id(), + self.user_fee_increase(), + ), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![SignatureError::InvalidSignaturePublicKeySecurityLevelError( + InvalidSignaturePublicKeySecurityLevelError::new( + signing_key.security_level(), + security_levels, + ), + ) + .into()], + )); + } + + // We should validate that all newly created documents have valid ids + for transition in self.transitions() { + if let DocumentTransition::Create(create_transition) = transition { + // Validate the ID + let generated_document_id = Document::generate_document_id_v0( + create_transition.base().data_contract_id_ref(), + &self.owner_id(), + create_transition.base().document_type_name(), + &create_transition.entropy(), + ); + + // This hash will take 2 blocks (128 bytes) + execution_context.add_operation(ValidationOperation::DoubleSha256(2)); + + let id = create_transition.base().id(); + if generated_document_id != id { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_document_base_transition( + transition.base(), + self.owner_id(), + self.user_fee_increase(), + ), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![ + InvalidDocumentTransitionIdError::new(generated_document_id, id).into(), + ], + )); + } + } + } + + // Next we need to validate the structure of all actions (this means with the data contract) + for transition in action.transitions() { + match transition { + DocumentTransitionAction::CreateAction(create_action) => { + let result = create_action.validate_structure(identity.id, platform_version)?; + if !result.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_document_base_transition_action(transition.base().expect("there is always a base for the create action"), self.owner_id(), self.user_fee_increase()), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + result.errors, + )); + } + } + DocumentTransitionAction::ReplaceAction(replace_action) => { + let result = replace_action.validate_structure(platform_version)?; + if !result.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_document_base_transition_action(transition.base().expect("there is always a base for the replace action"), self.owner_id(), self.user_fee_increase()), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + result.errors, + )); + } + } + DocumentTransitionAction::DeleteAction(delete_action) => { + let result = delete_action.validate_structure(platform_version)?; + if !result.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_document_base_transition_action(transition.base().expect("there is always a base for the delete action"), self.owner_id(), self.user_fee_increase()), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + result.errors, + )); + } + } + DocumentTransitionAction::TransferAction(transfer_action) => { + let result = transfer_action.validate_structure(platform_version)?; + if !result.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_document_base_transition_action(transition.base().expect("there is always a base for the transfer action"), self.owner_id(), self.user_fee_increase()), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + result.errors, + )); + } + } + DocumentTransitionAction::UpdatePriceAction(update_price_action) => { + let result = update_price_action.validate_structure(platform_version)?; + if !result.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_document_base_transition_action(transition.base().expect("there is always a base for the update price action"), self.owner_id(), self.user_fee_increase()), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + result.errors, + )); + } + } + DocumentTransitionAction::PurchaseAction(purchase_action) => { + let result = purchase_action.validate_structure(platform_version)?; + if !result.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityDataContractNonceAction( + BumpIdentityDataContractNonceAction::from_borrowed_document_base_transition_action(transition.base().expect("there is always a base for the purchase action"), self.owner_id(), self.user_fee_increase()), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + result.errors, + )); + } + } + DocumentTransitionAction::BumpIdentityDataContractNonce(_) => { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "we should not have a bump identity contract nonce at this stage", + ))); + } + } + } + Ok(ConsensusValidationResult::new()) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/balance/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/balance/mod.rs new file mode 100644 index 00000000000..4ca24ddc1cb --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/balance/mod.rs @@ -0,0 +1,33 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::validation::state_transition::documents_batch::balance::v0::DocumentsBatchTransitionBalanceValidationV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionBalanceValidationV0; +use dpp::identity::PartialIdentity; +use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; + +pub(crate) mod v0; +impl StateTransitionBalanceValidationV0 for DocumentsBatchTransition { + fn validate_minimum_balance_pre_check( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .documents_batch_state_transition + .balance_pre_check + { + 0 => self.validate_advanced_minimum_balance_pre_check_v0(identity, platform_version), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "documents batch transition: validate_minimum_balance_pre_check" + .to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/balance/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/balance/v0/mod.rs new file mode 100644 index 00000000000..a46b1aad9b0 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/balance/v0/mod.rs @@ -0,0 +1,54 @@ +use crate::error::Error; +use dpp::consensus::state::identity::IdentityInsufficientBalanceError; +use dpp::identity::PartialIdentity; +use dpp::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; +use dpp::state_transition::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; +use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; + +use dpp::validation::SimpleConsensusValidationResult; + +use crate::error::execution::ExecutionError; +use dpp::version::PlatformVersion; + +pub(in crate::execution::validation::state_transition::state_transitions) trait DocumentsBatchTransitionBalanceValidationV0 +{ + fn validate_advanced_minimum_balance_pre_check_v0( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl DocumentsBatchTransitionBalanceValidationV0 for DocumentsBatchTransition { + fn validate_advanced_minimum_balance_pre_check_v0( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result { + let balance = + identity + .balance + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expected to have a balance on identity for documents batch transition", + )))?; + + let purchases_amount = self.all_purchases_amount().unwrap_or_default(); + + let base_fees = platform_version.fee_version.state_transition_min_fees.document_batch_sub_transition.checked_mul(self.transitions().len() as u64).ok_or(Error::Execution(ExecutionError::Overflow("overflow when multiplying base fee and amount of sub transitions in documents batch transition")))?; + + // This is just the needed balance to pass this validation step, most likely the actual fees are smaller + let needed_balance = purchases_amount + .checked_add(base_fees) + .ok_or(Error::Execution(ExecutionError::Overflow( + "overflow when adding all purchases amount and base fees in documents batch transition", + )))?; + + if balance < needed_balance { + return Ok(SimpleConsensusValidationResult::new_with_error( + IdentityInsufficientBalanceError::new(identity.id, balance, needed_balance).into(), + )); + } + + Ok(SimpleConsensusValidationResult::new()) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/base_structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/base_structure/v0/mod.rs deleted file mode 100644 index cf7b9490eb8..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/base_structure/v0/mod.rs +++ /dev/null @@ -1,94 +0,0 @@ -use crate::error::Error; -use dpp::consensus::basic::document::InvalidDocumentTransitionIdError; -use dpp::document::Document; -use dpp::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; -use dpp::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; -use dpp::state_transition::documents_batch_transition::document_transition::DocumentTransition; - -use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; -use dpp::state_transition::StateTransitionLike; - -use dpp::validation::SimpleConsensusValidationResult; - -use dpp::version::PlatformVersion; - -use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; -use drive::state_transition_action::document::documents_batch::DocumentsBatchTransitionAction; -use crate::execution::validation::state_transition::state_transitions::documents_batch::action_validation::document_replace_transition_action::DocumentReplaceTransitionActionValidation; -use crate::execution::validation::state_transition::state_transitions::documents_batch::action_validation::document_delete_transition_action::DocumentDeleteTransitionActionValidation; -use crate::execution::validation::state_transition::state_transitions::documents_batch::action_validation::document_create_transition_action::DocumentCreateTransitionActionValidation; -use dpp::state_transition::documents_batch_transition::document_create_transition::v0::v0_methods::DocumentCreateTransitionV0Methods; -use crate::platform_types::platform::PlatformStateRef; - -pub(in crate::execution::validation::state_transition::state_transitions::documents_batch) trait DocumentsBatchStateTransitionStructureValidationV0 -{ - fn validate_structure_v0( - &self, - platform: &PlatformStateRef, - action: &DocumentsBatchTransitionAction, - platform_version: &PlatformVersion, - ) -> Result; -} - -impl DocumentsBatchStateTransitionStructureValidationV0 for DocumentsBatchTransition { - fn validate_structure_v0( - &self, - platform: &PlatformStateRef, - action: &DocumentsBatchTransitionAction, - platform_version: &PlatformVersion, - ) -> Result { - // First we should validate the base structure - let result = self - .validate_base_structure(platform_version) - .map_err(Error::Protocol)?; - - if !result.is_valid() { - return Ok(result); - } - - // We should validate that all newly created documents have valid ids - for transition in self.transitions() { - if let DocumentTransition::Create(create_transition) = transition { - // Validate the ID - let generated_document_id = Document::generate_document_id_v0( - create_transition.base().data_contract_id_ref(), - &self.owner_id(), - create_transition.base().document_type_name(), - &create_transition.entropy(), - ); - - let id = create_transition.base().id(); - if generated_document_id != id { - return Ok(SimpleConsensusValidationResult::new_with_error( - InvalidDocumentTransitionIdError::new(generated_document_id, id).into(), - )); - } - } - } - - // Next we need to validate the structure of all actions (this means with the data contract) - for transition in action.transitions() { - match transition { - DocumentTransitionAction::CreateAction(create_action) => { - let result = create_action.validate_structure(platform, platform_version)?; - if !result.is_valid() { - return Ok(result); - } - } - DocumentTransitionAction::ReplaceAction(replace_action) => { - let result = replace_action.validate_structure(platform, platform_version)?; - if !result.is_valid() { - return Ok(result); - } - } - DocumentTransitionAction::DeleteAction(delete_action) => { - let result = delete_action.validate_structure(platform_version)?; - if !result.is_valid() { - return Ok(result); - } - } - } - } - Ok(SimpleConsensusValidationResult::new()) - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/bindings/data_trigger_binding/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/bindings/data_trigger_binding/v0/mod.rs index a719f3cde91..7c390af6f24 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/bindings/data_trigger_binding/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/bindings/data_trigger_binding/v0/mod.rs @@ -88,7 +88,7 @@ impl DataTriggerBindingV0Getters for DataTriggerBindingV0 { document_type: &str, transition_action_type: DocumentTransitionActionType, ) -> bool { - &self.data_contract_id == data_contract_id + self.data_contract_id == data_contract_id && self.document_type == document_type && self.transition_action_type == transition_action_type } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/bindings/list/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/bindings/list/v0/mod.rs index d4498a54241..05ede54a775 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/bindings/list/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/bindings/list/v0/mod.rs @@ -2,13 +2,12 @@ use crate::execution::validation::state_transition::documents_batch::data_trigge use crate::execution::validation::state_transition::documents_batch::data_triggers::triggers::dpns::create_domain_data_trigger; use crate::execution::validation::state_transition::documents_batch::data_triggers::triggers::feature_flags::create_feature_flag_data_trigger; use crate::execution::validation::state_transition::documents_batch::data_triggers::triggers::reject::reject_data_trigger; -use crate::execution::validation::state_transition::documents_batch::data_triggers::triggers::reward_share::create_masternode_reward_shares_data_trigger; use crate::execution::validation::state_transition::documents_batch::data_triggers::triggers::withdrawals::delete_withdrawal_data_trigger; use crate::execution::validation::state_transition::documents_batch::data_triggers::bindings::data_trigger_binding::DataTriggerBindingV0; use dpp::errors::ProtocolError; -use dpp::system_data_contracts::feature_flags_contract::document_types::update_consensus_params; -use dpp::system_data_contracts::withdrawals_contract::document_types::withdrawal; +use dpp::system_data_contracts::feature_flags_contract::v1::document_types::update_consensus_params; +use dpp::system_data_contracts::withdrawals_contract::v1::document_types::withdrawal; use dpp::system_data_contracts::{dashpay_contract, dpns_contract, SystemDataContract}; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionActionType; @@ -24,7 +23,8 @@ use drive::state_transition_action::document::documents_batch::document_transiti /// # Errors /// /// Returns a `ProtocolError` if there was an error. -pub fn data_trigger_bindings_list_v0() -> Result, ProtocolError> { +#[inline(always)] +pub(super) fn data_trigger_bindings_list_v0() -> Result, ProtocolError> { let data_triggers = vec![ DataTriggerBindingV0 { data_contract_id: dpns_contract::ID, @@ -62,18 +62,6 @@ pub fn data_trigger_bindings_list_v0() -> Result, Prot transition_action_type: DocumentTransitionActionType::Create, data_trigger: create_contact_request_data_trigger, }, - DataTriggerBindingV0 { - data_contract_id: dashpay_contract::ID, - document_type: "contactRequest".to_string(), - transition_action_type: DocumentTransitionActionType::Replace, - data_trigger: reject_data_trigger, - }, - DataTriggerBindingV0 { - data_contract_id: dashpay_contract::ID, - document_type: "contactRequest".to_string(), - transition_action_type: DocumentTransitionActionType::Delete, - data_trigger: reject_data_trigger, - }, DataTriggerBindingV0 { data_contract_id: dashpay_contract::ID, document_type: update_consensus_params::NAME.to_string(), @@ -94,15 +82,21 @@ pub fn data_trigger_bindings_list_v0() -> Result, Prot }, DataTriggerBindingV0 { data_contract_id: SystemDataContract::MasternodeRewards.id(), - document_type: update_consensus_params::NAME.to_string(), + document_type: "rewardShare".to_string(), transition_action_type: DocumentTransitionActionType::Create, - data_trigger: create_masternode_reward_shares_data_trigger, + data_trigger: reject_data_trigger, }, DataTriggerBindingV0 { data_contract_id: SystemDataContract::MasternodeRewards.id(), document_type: "rewardShare".to_string(), transition_action_type: DocumentTransitionActionType::Replace, - data_trigger: create_masternode_reward_shares_data_trigger, + data_trigger: reject_data_trigger, + }, + DataTriggerBindingV0 { + data_contract_id: SystemDataContract::MasternodeRewards.id(), + document_type: "rewardShare".to_string(), + transition_action_type: DocumentTransitionActionType::Delete, + data_trigger: reject_data_trigger, }, DataTriggerBindingV0 { data_contract_id: SystemDataContract::Withdrawals.id(), diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/executor.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/executor.rs index 6fcd49f3d5c..ac229976a55 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/executor.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/executor.rs @@ -9,11 +9,12 @@ use dpp::version::PlatformVersion; use crate::execution::validation::state_transition::documents_batch::data_triggers::bindings::data_trigger_binding::DataTriggerBinding; use crate::execution::validation::state_transition::documents_batch::data_triggers::bindings::data_trigger_binding::DataTriggerBindingV0Getters; use crate::error::Error; +use crate::error::execution::ExecutionError; pub trait DataTriggerExecutor { fn validate_with_data_triggers( &self, - data_trigger_bindings: &Vec, + data_trigger_bindings: &[DataTriggerBinding], context: &DataTriggerExecutionContext<'_>, platform_version: &PlatformVersion, ) -> Result; @@ -22,12 +23,22 @@ pub trait DataTriggerExecutor { impl DataTriggerExecutor for DocumentTransitionAction { fn validate_with_data_triggers( &self, - data_trigger_bindings: &Vec, + data_trigger_bindings: &[DataTriggerBinding], context: &DataTriggerExecutionContext, platform_version: &PlatformVersion, ) -> Result { - let data_contract_id = self.base().data_contract_id(); - let document_type_name = self.base().document_type_name(); + let data_contract_id = self + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .data_contract_id(); + let document_type_name = self + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .document_type_name(); let transition_action = self.action_type(); // Match data triggers by action type, contract ID and document type name diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/mod.rs index 0cc6304e022..9920418f531 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/mod.rs @@ -1,7 +1,7 @@ use dpp::validation::SimpleValidationResult; -///! Data triggers implement custom validation logic for state transitions -///! that modifies documents in a specific data contract. -///! Data triggers can be assigned based on the data contract ID, document type, and action. +/// Data triggers implement custom validation logic for state transitions +/// that modifies documents in a specific data contract. +/// Data triggers can be assigned based on the data contract ID, document type, and action. use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; use crate::error::Error; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dashpay/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dashpay/v0/mod.rs index 42b07516598..3a70730e389 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dashpay/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dashpay/v0/mod.rs @@ -1,4 +1,4 @@ -///! The `dashpay_data_triggers` module contains data triggers specific to the DashPay data contract. +//! The `dashpay_data_triggers` module contains data triggers specific to the DashPay data contract. use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; @@ -10,7 +10,8 @@ use dpp::ProtocolError; use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionActionAccessorsV0; -use dpp::system_data_contracts::dashpay_contract::document_types::contact_request::properties::{CORE_HEIGHT_CREATED_AT, TO_USER_ID}; +use dpp::system_data_contracts::dashpay_contract::v1::document_types::contact_request::properties +::{CORE_HEIGHT_CREATED_AT, TO_USER_ID}; use dpp::version::PlatformVersion; use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContextMethodsV0; use crate::execution::validation::state_transition::documents_batch::data_triggers::{DataTriggerExecutionContext, DataTriggerExecutionResult}; @@ -32,12 +33,18 @@ const BLOCKS_SIZE_WINDOW: u32 = 8; /// # Returns /// /// A `DataTriggerExecutionResult` indicating the success or failure of the trigger execution. -pub fn create_contact_request_data_trigger_v0( +#[inline(always)] +pub(super) fn create_contact_request_data_trigger_v0( document_transition: &DocumentTransitionAction, context: &DataTriggerExecutionContext<'_>, platform_version: &PlatformVersion, ) -> Result { - let data_contract_fetch_info = document_transition.base().data_contract_fetch_info(); + let data_contract_fetch_info = document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .data_contract_fetch_info(); let data_contract = &data_contract_fetch_info.contract; let mut result = DataTriggerExecutionResult::default(); let is_dry_run = context.state_transition_execution_context.in_dry_run(); @@ -49,7 +56,12 @@ pub fn create_contact_request_data_trigger_v0( return Err(Error::Execution(ExecutionError::DataTriggerExecutionError( format!( "the Document Transition {} isn't 'CREATE", - document_transition.base().id() + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base" + )))? + .id() ), ))) } @@ -67,7 +79,12 @@ pub fn create_contact_request_data_trigger_v0( if owner_id == &to_user_id { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), format!("Identity {to_user_id} must not be equal to owner id"), ); @@ -77,7 +94,7 @@ pub fn create_contact_request_data_trigger_v0( } if let Some(core_height_created_at) = maybe_core_height_created_at { - let core_chain_locked_height = context.platform.state.core_height(); + let core_chain_locked_height = context.platform.state.last_committed_core_height(); let height_window_start = core_chain_locked_height.saturating_sub(BLOCKS_SIZE_WINDOW); let height_window_end = core_chain_locked_height.saturating_add(BLOCKS_SIZE_WINDOW); @@ -127,6 +144,7 @@ pub fn create_contact_request_data_trigger_v0( mod test { use dpp::block::block_info::BlockInfo; use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0; + use std::collections::BTreeMap; use std::sync::Arc; use dpp::document::{DocumentV0Getters, DocumentV0Setters}; @@ -149,37 +167,43 @@ mod test { let platform = TestPlatformBuilder::new() .build_with_mock_rpc() .set_initial_state_structure(); - let state_read_guard = platform.state.read().unwrap(); + + let mut nonce_counter = BTreeMap::new(); + let state = platform.state.load(); let platform_ref = PlatformStateRef { drive: &platform.drive, - state: &state_read_guard, + state: &state, config: &platform.config, }; - let protocol_version = state_read_guard.current_protocol_version_in_consensus(); - let platform_version = state_read_guard + let protocol_version = state.current_protocol_version_in_consensus(); + let platform_version = state .current_platform_version() .expect("should return a platform version"); let mut contact_request_document = get_contact_request_document_fixture( None, + 0, None, - state_read_guard.current_protocol_version_in_consensus(), + state.current_protocol_version_in_consensus(), ); contact_request_document.set(CORE_HEIGHT_CREATED_AT, platform_value!(10u32)); let owner_id = &contact_request_document.owner_id(); let data_contract = - get_dashpay_contract_fixture(None, protocol_version).data_contract_owned(); + get_dashpay_contract_fixture(None, 0, protocol_version).data_contract_owned(); let document_type = data_contract .document_type_for_name("contactRequest") .expect("expected a contact request"); - let document_transitions = get_document_transitions_fixture([( - DocumentTransitionActionType::Create, - vec![(contact_request_document, document_type, Bytes32::default())], - )]); + let document_transitions = get_document_transitions_fixture( + [( + DocumentTransitionActionType::Create, + vec![(contact_request_document, document_type, Bytes32::default())], + )], + &mut nonce_counter, + ); let document_transition = document_transitions - .get(0) + .first() .expect("document transition should be present"); let document_create_transition = document_transition @@ -200,7 +224,7 @@ mod test { }; let result = create_contact_request_data_trigger( - &DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup(document_create_transition, |_identifier| { + &DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup(document_create_transition, &BlockInfo::default(), |_identifier| { Ok(Arc::new(DataContractFetchInfo::dashpay_contract_fixture(protocol_version))) }).expect("expected to create action").into(), &data_trigger_context, @@ -212,13 +236,17 @@ mod test { } #[test] - fn should_fail_if_owner_id_equals_to_user_id() { + fn should_return_invalid_result_if_owner_id_equals_to_user_id() { let platform = TestPlatformBuilder::new() .build_with_mock_rpc() .set_initial_state_structure(); - let mut state_write_guard = platform.state.write().unwrap(); - state_write_guard.set_last_committed_block_info(Some( + let mut nonce_counter = BTreeMap::new(); + + let platform_state = platform.state.load(); + let mut platform_state = (**platform_state).clone(); + + platform_state.set_last_committed_block_info(Some( ExtendedBlockInfoV0 { basic_info: BlockInfo { time_ms: 500000, @@ -236,37 +264,42 @@ mod test { )); let platform_ref = PlatformStateRef { drive: &platform.drive, - state: &state_write_guard, + state: &platform_state, config: &platform.config, }; - let protocol_version = state_write_guard.current_protocol_version_in_consensus(); - let platform_version = state_write_guard + let protocol_version = platform_state.current_protocol_version_in_consensus(); + let platform_version = platform_state .current_platform_version() .expect("should return a platform version"); let mut contact_request_document = get_contact_request_document_fixture( None, + 0, None, - state_write_guard.current_protocol_version_in_consensus(), + platform_state.current_protocol_version_in_consensus(), ); let owner_id = contact_request_document.owner_id(); contact_request_document.set("toUserId", platform_value::to_value(owner_id).unwrap()); let data_contract = get_dashpay_contract_fixture( None, - state_write_guard.current_protocol_version_in_consensus(), + 0, + platform_state.current_protocol_version_in_consensus(), ) .data_contract_owned(); let document_type = data_contract .document_type_for_name("contactRequest") .expect("expected a contact request"); - let document_transitions = get_document_transitions_fixture([( - DocumentTransitionActionType::Create, - vec![(contact_request_document, document_type, Bytes32::default())], - )]); + let document_transitions = get_document_transitions_fixture( + [( + DocumentTransitionActionType::Create, + vec![(contact_request_document, document_type, Bytes32::default())], + )], + &mut nonce_counter, + ); let document_transition = document_transitions - .get(0) + .first() .expect("document transition should be present"); let document_create_transition = document_transition @@ -277,7 +310,7 @@ mod test { StateTransitionExecutionContext::default_for_platform_version(platform_version) .unwrap(); let identity_fixture = - get_identity_fixture(state_write_guard.current_protocol_version_in_consensus()) + get_identity_fixture(platform_state.current_protocol_version_in_consensus()) .expect("expected to get identity fixture"); platform @@ -288,7 +321,7 @@ mod test { &BlockInfo::default(), true, None, - state_write_guard.current_platform_version().unwrap(), + platform_state.current_platform_version().unwrap(), ) .expect("expected to insert identity"); @@ -302,7 +335,7 @@ mod test { let _dashpay_identity_id = data_trigger_context.owner_id.to_owned(); let result = create_contact_request_data_trigger( - &DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup(document_create_transition, |_identifier| { + &DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup(document_create_transition, &BlockInfo::default(), |_identifier| { Ok(Arc::new(DataContractFetchInfo::dashpay_contract_fixture(protocol_version))) }).expect("expected to create action").into(), &data_trigger_context, @@ -315,19 +348,23 @@ mod test { assert!(matches!( &result.errors.first().unwrap(), &DataTriggerError::DataTriggerConditionError(e) if { - e.message() == &format!("Identity {owner_id} must not be equal to owner id") + e.message() == format!("Identity {owner_id} must not be equal to owner id") } )); } #[test] - fn should_fail_if_id_not_exists() { + fn should_return_invalid_result_if_id_not_exists() { let platform = TestPlatformBuilder::new() .build_with_mock_rpc() .set_initial_state_structure(); - let mut state_write_guard = platform.state.write().unwrap(); - state_write_guard.set_last_committed_block_info(Some( + let mut nonce_counter = BTreeMap::new(); + + let platform_state = platform.state.load(); + let mut platform_state = (**platform_state).clone(); + + platform_state.set_last_committed_block_info(Some( ExtendedBlockInfoV0 { basic_info: BlockInfo { time_ms: 500000, @@ -346,22 +383,24 @@ mod test { let platform_ref = PlatformStateRef { drive: &platform.drive, - state: &state_write_guard, + state: &platform_state, config: &platform.config, }; - let protocol_version = state_write_guard.current_protocol_version_in_consensus(); - let platform_version = state_write_guard + let protocol_version = platform_state.current_protocol_version_in_consensus(); + let platform_version = platform_state .current_platform_version() .expect("should return a platform version"); let contact_request_document = get_contact_request_document_fixture( None, + 0, None, - state_write_guard.current_protocol_version_in_consensus(), + platform_state.current_protocol_version_in_consensus(), ); let data_contract = get_dashpay_contract_fixture( None, - state_write_guard.current_protocol_version_in_consensus(), + 0, + platform_state.current_protocol_version_in_consensus(), ) .data_contract_owned(); let document_type = data_contract @@ -373,12 +412,15 @@ mod test { .get_identifier("toUserId") .expect("expected to get toUserId"); - let document_transitions = get_document_transitions_fixture([( - DocumentTransitionActionType::Create, - vec![(contact_request_document, document_type, Bytes32::default())], - )]); + let document_transitions = get_document_transitions_fixture( + [( + DocumentTransitionActionType::Create, + vec![(contact_request_document, document_type, Bytes32::default())], + )], + &mut nonce_counter, + ); let document_transition = document_transitions - .get(0) + .first() .expect("document transition should be present"); let document_create_transition = document_transition @@ -399,7 +441,7 @@ mod test { let _dashpay_identity_id = data_trigger_context.owner_id.to_owned(); let result = create_contact_request_data_trigger( - &DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup(document_create_transition, |_identifier| { + &DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup(document_create_transition, &BlockInfo::default(), |_identifier| { Ok(Arc::new(DataContractFetchInfo::dashpay_contract_fixture(protocol_version))) }).expect("expected to create action").into(), &data_trigger_context, @@ -413,7 +455,7 @@ mod test { assert!(matches!( data_trigger_error, DataTriggerError::DataTriggerConditionError(e) if { - e.message() == &format!("Identity {contract_request_to_user_id} doesn't exist") + e.message() == format!("Identity {contract_request_to_user_id} doesn't exist") } )); } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dpns/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dpns/v0/mod.rs index c4a0ab9ae70..eb46dd4e7a9 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dpns/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dpns/v0/mod.rs @@ -1,8 +1,8 @@ use dpp::consensus::state::data_trigger::data_trigger_condition_error::DataTriggerConditionError; use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::data_contracts::dpns_contract::document_types::domain::properties::PARENT_DOMAIN_NAME; -///! The `dpns_triggers` module contains data triggers specific to the DPNS data contract. -use dpp::util::hash::hash; +use dpp::data_contracts::dpns_contract::v1::document_types::domain::properties::PARENT_DOMAIN_NAME; +/// The `dpns_triggers` module contains data triggers specific to the DPNS data contract. +use dpp::util::hash::hash_double; use std::collections::BTreeMap; use crate::error::execution::ExecutionError; @@ -19,7 +19,8 @@ use drive::state_transition_action::document::documents_batch::document_transiti use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionActionAccessorsV0; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; use dpp::system_data_contracts::dpns_contract; -use dpp::system_data_contracts::dpns_contract::document_types::domain::properties::{ALLOW_SUBDOMAINS, DASH_ALIAS_IDENTITY_ID, DASH_UNIQUE_IDENTITY_ID, LABEL, NORMALIZED_LABEL, NORMALIZED_PARENT_DOMAIN_NAME, PREORDER_SALT, RECORDS}; +use dpp::system_data_contracts::dpns_contract::v1::document_types::domain::properties::{ALLOW_SUBDOMAINS, + DASH_ALIAS_IDENTITY_ID, DASH_UNIQUE_IDENTITY_ID, LABEL, NORMALIZED_LABEL, NORMALIZED_PARENT_DOMAIN_NAME, PREORDER_SALT, RECORDS}; use dpp::util::strings::convert_to_homograph_safe_chars; use dpp::version::PlatformVersion; use drive::drive::document::query::QueryDocumentsOutcomeV0Methods; @@ -43,12 +44,18 @@ pub const MAX_PRINTABLE_DOMAIN_NAME_LENGTH: usize = 253; /// # Returns /// /// A `DataTriggerExecutionResult` indicating the success or failure of the trigger execution. -pub fn create_domain_data_trigger_v0( +#[inline(always)] +pub(super) fn create_domain_data_trigger_v0( document_transition: &DocumentTransitionAction, context: &DataTriggerExecutionContext<'_>, platform_version: &PlatformVersion, ) -> Result { - let data_contract_fetch_info = document_transition.base().data_contract_fetch_info(); + let data_contract_fetch_info = document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .data_contract_fetch_info(); let data_contract = &data_contract_fetch_info.contract; let is_dry_run = context.state_transition_execution_context.in_dry_run(); let document_create_transition = match document_transition { @@ -57,7 +64,12 @@ pub fn create_domain_data_trigger_v0( return Err(Error::Execution(ExecutionError::DataTriggerExecutionError( format!( "the Document Transition {} isn't 'CREATE", - document_transition.base().id() + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base" + )))? + .id() ), ))) } @@ -106,7 +118,12 @@ pub fn create_domain_data_trigger_v0( if full_domain_name.len() > MAX_PRINTABLE_DOMAIN_NAME_LENGTH { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), format!( "Full domain name length can not be more than {} characters long but got {}", MAX_PRINTABLE_DOMAIN_NAME_LENGTH, @@ -120,7 +137,12 @@ pub fn create_domain_data_trigger_v0( if normalized_label != convert_to_homograph_safe_chars(label.as_str()) { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), format!( "Normalized label doesn't match label: {} != {}", normalized_label, label @@ -135,7 +157,12 @@ pub fn create_domain_data_trigger_v0( { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), format!( "Normalized parent domain name doesn't match parent domain name: {} != {}", normalized_parent_domain_name, parent_domain_name @@ -152,7 +179,12 @@ pub fn create_domain_data_trigger_v0( if id != owner_id { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), format!( "ownerId {} doesn't match {} {}", owner_id, DASH_UNIQUE_IDENTITY_ID, id @@ -170,7 +202,12 @@ pub fn create_domain_data_trigger_v0( if id != owner_id { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), format!( "ownerId {} doesn't match {} {}", owner_id, DASH_ALIAS_IDENTITY_ID, id @@ -185,7 +222,12 @@ pub fn create_domain_data_trigger_v0( { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), "Can't create top level domain for this identity".to_string(), ); @@ -257,7 +299,12 @@ pub fn create_domain_data_trigger_v0( if documents.is_empty() { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), "Parent domain is not present".to_string(), ); @@ -270,7 +317,12 @@ pub fn create_domain_data_trigger_v0( if rule_allow_subdomains { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), "Allowing subdomains registration is forbidden for this domain".to_string(), ); @@ -287,7 +339,12 @@ pub fn create_domain_data_trigger_v0( { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), "The subdomain can be created only by the parent domain owner".to_string(), ); @@ -302,7 +359,7 @@ pub fn create_domain_data_trigger_v0( salted_domain_buffer.extend(preorder_salt); salted_domain_buffer.extend(full_domain_name.as_bytes()); - let salted_domain_hash = hash(salted_domain_buffer); + let salted_domain_hash = hash_double(salted_domain_buffer); let document_type = data_contract.document_type_for_name("preorder")?; @@ -350,7 +407,12 @@ pub fn create_domain_data_trigger_v0( if preorder_documents.is_empty() { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), "preorderDocument was not found".to_string(), ); result.add_error(err) @@ -362,6 +424,7 @@ pub fn create_domain_data_trigger_v0( #[cfg(test)] mod test { use std::sync::Arc; + use dpp::block::block_info::BlockInfo; use dpp::platform_value::Bytes32; use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionAction; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionActionType; @@ -380,15 +443,18 @@ mod test { let platform = TestPlatformBuilder::new() .build_with_mock_rpc() .set_initial_state_structure(); - let state_read_guard = platform.state.read().unwrap(); + + let mut nonce_counter = BTreeMap::new(); + + let state = platform.state.load(); let platform_ref = PlatformStateRef { drive: &platform.drive, - state: &state_read_guard, + state: &state, config: &platform.config, }; - let platform_version = state_read_guard + let platform_version = state .current_platform_version() .expect("should return a platform version"); @@ -401,21 +467,25 @@ mod test { owner_id, ..Default::default() }, - state_read_guard.current_protocol_version_in_consensus(), + state.current_protocol_version_in_consensus(), ); let data_contract = get_dpns_data_contract_fixture( Some(owner_id), - state_read_guard.current_protocol_version_in_consensus(), + 0, + state.current_protocol_version_in_consensus(), ) .data_contract_owned(); let document_type = data_contract .document_type_for_name("domain") .expect("expected to get domain document type"); - let transitions = get_document_transitions_fixture([( - DocumentTransitionActionType::Create, - vec![(document, document_type, Bytes32::default())], - )]); - let first_transition = transitions.get(0).expect("transition should be present"); + let transitions = get_document_transitions_fixture( + [( + DocumentTransitionActionType::Create, + vec![(document, document_type, Bytes32::default())], + )], + &mut nonce_counter, + ); + let first_transition = transitions.first().expect("transition should be present"); let document_create_transition = first_transition .as_transition_create() @@ -432,7 +502,7 @@ mod test { let result = create_domain_data_trigger_v0( &DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup( - document_create_transition,|_identifier| { + document_create_transition, &BlockInfo::default(), |_identifier| { Ok(Arc::new(DataContractFetchInfo::dpns_contract_fixture(platform_version.protocol_version))) }).expect("expected to create action").into(), &data_trigger_context, diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/feature_flags/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/feature_flags/v0/mod.rs index 2a307ea5dae..8e3da385d98 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/feature_flags/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/feature_flags/v0/mod.rs @@ -1,4 +1,4 @@ -///! The `feature_flags_data_triggers` module contains data triggers related to feature flags. +//! The `feature_flags_data_triggers` module contains data triggers related to feature flags. use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; @@ -10,7 +10,8 @@ use drive::state_transition_action::document::documents_batch::document_transiti use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionActionAccessorsV0; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; use dpp::system_data_contracts::feature_flags_contract; -use dpp::system_data_contracts::feature_flags_contract::document_types::update_consensus_params::properties::PROPERTY_ENABLE_AT_HEIGHT; +use dpp::system_data_contracts::feature_flags_contract::v1::document_types::update_consensus_params::properties +::PROPERTY_ENABLE_AT_HEIGHT; use dpp::version::PlatformVersion; use super::{DataTriggerExecutionContext, DataTriggerExecutionResult}; @@ -30,13 +31,19 @@ use super::{DataTriggerExecutionContext, DataTriggerExecutionResult}; /// # Returns /// /// A `DataTriggerExecutionResult` indicating the success or failure of the trigger execution. -pub fn create_feature_flag_data_trigger_v0( +#[inline(always)] +pub(super) fn create_feature_flag_data_trigger_v0( document_transition: &DocumentTransitionAction, context: &DataTriggerExecutionContext<'_>, _platform_version: &PlatformVersion, ) -> Result { let mut result = DataTriggerExecutionResult::default(); - let data_contract_fetch_info = document_transition.base().data_contract_fetch_info(); + let data_contract_fetch_info = document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .data_contract_fetch_info(); let data_contract = &data_contract_fetch_info.contract; let document_create_transition = match document_transition { @@ -45,7 +52,12 @@ pub fn create_feature_flag_data_trigger_v0( return Err(Error::Execution(ExecutionError::DataTriggerExecutionError( format!( "the Document Transition {} isn't 'CREATE", - document_transition.base().id() + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base" + )))? + .id() ), ))) } @@ -60,12 +72,17 @@ pub fn create_feature_flag_data_trigger_v0( ))) })?; - let latest_block_height = context.platform.state.height(); + let latest_block_height = context.platform.state.last_committed_block_height(); if enable_at_height < latest_block_height { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), "This identity can't activate selected feature flag".to_string(), ); @@ -77,7 +94,12 @@ pub fn create_feature_flag_data_trigger_v0( if context.owner_id != &feature_flags_contract::OWNER_ID { let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), "This identity can't activate selected feature flag".to_string(), ); @@ -96,7 +118,7 @@ mod test { // let platform = TestPlatformBuilder::new() // .build_with_mock_rpc() // .set_initial_state_structure(); - // let state_read_guard = platform.state.read().unwrap(); + // let state_read_guard = platform.state.load(); // // let platform_ref = PlatformStateRef { // drive: &platform.drive, diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/mod.rs index 1b4a0167369..0b320c59295 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/mod.rs @@ -2,5 +2,4 @@ pub mod dashpay; pub mod dpns; pub mod feature_flags; pub mod reject; -pub mod reward_share; pub mod withdrawals; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reject/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reject/v0/mod.rs index 48d087672a1..69c287e6004 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reject/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reject/v0/mod.rs @@ -4,6 +4,7 @@ use drive::state_transition_action::document::documents_batch::document_transiti use crate::error::Error; use crate::execution::validation::state_transition::documents_batch::data_triggers::DataTriggerExecutionResult; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; +use crate::error::execution::ExecutionError; /// Creates a data trigger for handling document rejections. /// @@ -21,16 +22,27 @@ use drive::state_transition_action::document::documents_batch::document_transiti /// /// A `SimpleValidationResult` containing either a `DataTriggerActionError` indicating the failure of the trigger /// or an empty result indicating the success of the trigger. -pub fn reject_data_trigger_v0( +#[inline(always)] +pub(super) fn reject_data_trigger_v0( document_transition: &DocumentTransitionAction, ) -> Result { - let data_contract_fetch_info = document_transition.base().data_contract_fetch_info(); + let data_contract_fetch_info = document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .data_contract_fetch_info(); let data_contract = &data_contract_fetch_info.contract; let mut result = DataTriggerExecutionResult::default(); let err = DataTriggerConditionError::new( data_contract.id(), - document_transition.base().id(), + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .id(), "Action is not allowed".to_string(), ); diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reward_share/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reward_share/mod.rs deleted file mode 100644 index e546b4f8baf..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reward_share/mod.rs +++ /dev/null @@ -1,35 +0,0 @@ -use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; -use dpp::version::PlatformVersion; -use crate::error::Error; -use crate::error::execution::ExecutionError; -use crate::execution::validation::state_transition::documents_batch::data_triggers::{DataTriggerExecutionContext, DataTriggerExecutionResult}; -use crate::execution::validation::state_transition::documents_batch::data_triggers::triggers::reward_share::v0::create_masternode_reward_shares_data_trigger_v0; - -mod v0; - -pub fn create_masternode_reward_shares_data_trigger( - document_transition: &DocumentTransitionAction, - context: &DataTriggerExecutionContext<'_>, - platform_version: &PlatformVersion, -) -> Result { - match platform_version - .drive_abci - .validation_and_processing - .state_transitions - .documents_batch_state_transition - .data_triggers - .triggers - .create_masternode_reward_shares_data_trigger - { - 0 => create_masternode_reward_shares_data_trigger_v0( - document_transition, - context, - platform_version, - ), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "create_masternode_reward_shares_data_trigger".to_string(), - known_versions: vec![0], - received: version, - })), - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reward_share/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reward_share/v0/mod.rs deleted file mode 100644 index 78c48f1e905..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/reward_share/v0/mod.rs +++ /dev/null @@ -1,806 +0,0 @@ -///! The `reward_share_data_triggers` module contains data triggers related to reward sharing. -use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; -use dpp::platform_value::Value; - -use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; -use dpp::version::PlatformVersion; -use drive::query::{DriveQuery, InternalClauses, WhereClause, WhereOperator}; -use std::collections::BTreeMap; -use dpp::consensus::state::data_trigger::data_trigger_condition_error::DataTriggerConditionError; -use dpp::data_contract::accessors::v0::DataContractV0Getters; -use dpp::document::DocumentV0Getters; -use dpp::ProtocolError; -use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; -use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionActionAccessorsV0; -use dpp::system_data_contracts::masternode_reward_shares_contract::document_types::reward_share::properties::{PAY_TO_ID, PERCENTAGE}; -use drive::drive::document::query::QueryDocumentsOutcomeV0Methods; - -use crate::error::execution::ExecutionError; -use crate::error::Error; -use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContextMethodsV0; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; - -use super::{DataTriggerExecutionContext, DataTriggerExecutionResult}; - -const MAX_PERCENTAGE: u64 = 10000; -const MAX_DOCUMENTS: usize = 16; - -/// Creates a data trigger for handling masternode reward share documents. -/// -/// The trigger is executed whenever a new masternode reward share document is created on the blockchain. -/// It performs various actions depending on the state of the document and the context in which it was created. -/// -/// # Arguments -/// -/// * `document_transition` - A reference to the document transition that triggered the data trigger. -/// * `context` - A reference to the data trigger execution context. -/// * `platform_version` - A reference to the platform version. -/// -/// # Returns -/// -/// A `DataTriggerExecutionResult` indicating the success or failure of the trigger execution. -pub fn create_masternode_reward_shares_data_trigger_v0( - document_transition: &DocumentTransitionAction, - context: &DataTriggerExecutionContext<'_>, - platform_version: &PlatformVersion, -) -> Result { - let mut result = DataTriggerExecutionResult::default(); - - let is_dry_run = context.state_transition_execution_context.in_dry_run(); - let data_contract_fetch_info = document_transition.base().data_contract_fetch_info(); - let data_contract = &data_contract_fetch_info.contract; - - let document_create_transition = match document_transition { - DocumentTransitionAction::CreateAction(d) => d, - _ => { - return Err(Error::Execution(ExecutionError::DataTriggerExecutionError( - format!( - "the Document Transition {} isn't 'CREATE", - document_transition.base().id() - ), - ))) - } - }; - - let properties = &document_create_transition.data(); - - let pay_to_id = properties - .get_hash256_bytes(PAY_TO_ID) - .map_err(ProtocolError::ValueError)?; - let percentage = properties - .get_integer(PERCENTAGE) - .map_err(ProtocolError::ValueError)?; - - if !is_dry_run { - let valid_masternodes_list = &context.platform.state.hpmn_masternode_list(); - - let owner_id_in_sml = valid_masternodes_list - .get(context.owner_id.as_slice()) - .is_some(); - - if !owner_id_in_sml { - let err = DataTriggerConditionError::new( - data_contract.id(), - document_transition.base().id(), - "Only masternode identities can share rewards".to_string(), - ); - - result.add_error(err); - } - } - - let maybe_identity = context.platform.drive.fetch_identity_balance( - pay_to_id, - context.transaction, - platform_version, - )?; - - if !is_dry_run && maybe_identity.is_none() { - let err = DataTriggerConditionError::new( - data_contract.id(), - document_transition.base().id(), - format!( - "Identity '{}' doesn't exist", - bs58::encode(pay_to_id).into_string() - ), - ); - - result.add_error(err); - - return Ok(result); - } - - let document_type = data_contract - .document_type_for_name(document_create_transition.base().document_type_name())?; - - let drive_query = DriveQuery { - contract: data_contract, - document_type, - internal_clauses: InternalClauses { - primary_key_in_clause: None, - primary_key_equal_clause: None, - in_clause: None, - range_clause: None, - equal_clauses: BTreeMap::from([( - "$ownerId".to_string(), - WhereClause { - field: "$ownerId".to_string(), - operator: WhereOperator::Equal, - value: Value::Identifier(context.owner_id.to_buffer()), - }, - )]), - }, - offset: None, - limit: Some((MAX_DOCUMENTS + 1) as u16), - order_by: Default::default(), - start_at: None, - start_at_included: false, - block_time_ms: None, - }; - - let documents = context - .platform - .drive - .query_documents( - drive_query, - None, - false, - context.transaction, - Some(platform_version.protocol_version), - )? - .documents_owned(); - - if is_dry_run { - return Ok(result); - } - - if documents.len() >= MAX_DOCUMENTS { - let err = DataTriggerConditionError::new( - data_contract.id(), - document_transition.base().id(), - format!( - "Reward shares cannot contain more than {} identities", - MAX_DOCUMENTS - ), - ); - - result.add_error(err); - - return Ok(result); - } - - let mut total_percent: u64 = percentage; - for d in documents.iter() { - total_percent += d - .properties() - .get_integer::(PERCENTAGE) - .map_err(ProtocolError::ValueError)?; - } - - if total_percent > MAX_PERCENTAGE { - let err = DataTriggerConditionError::new( - data_contract.id(), - document_transition.base().id(), - format!("Percentage can not be more than {}", MAX_PERCENTAGE), - ); - - result.add_error(err); - } - - Ok(result) -} - -#[cfg(test)] -mod test { - use super::*; - - use crate::platform_types::platform::PlatformStateRef; - use crate::test::helpers::setup::TestPlatformBuilder; - use dashcore_rpc::dashcore::hashes::Hash; - use dashcore_rpc::dashcore::{ProTxHash, Txid}; - use dashcore_rpc::dashcore_rpc_json::{DMNState, MasternodeListItem, MasternodeType}; - use dpp::block::block_info::BlockInfo; - use dpp::data_contract::document_type::random_document::CreateRandomDocument; - use dpp::data_contract::DataContract; - use dpp::document::{Document, DocumentV0Setters}; - use dpp::identity::Identity; - - use dpp::platform_value::{Bytes32, Identifier, Value}; - use dpp::tests::fixtures::{ - get_document_transitions_fixture, get_masternode_reward_shares_documents_fixture, - }; - use dpp::tests::utils::generate_random_identifier_struct; - - use crate::platform_types::platform_state::v0::PlatformStateV0; - use dpp::consensus::state::data_trigger::DataTriggerError; - use drive::drive::object_size_info::DocumentInfo::{DocumentOwnedInfo, DocumentRefInfo}; - use drive::drive::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; - use std::net::SocketAddr; - use std::str::FromStr; - use std::sync::Arc; - - use dpp::identity::accessors::IdentitySettersV0; - use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionAction; - use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionActionType; - use dpp::version::DefaultForPlatformVersion; - use drive::drive::contract::DataContractFetchInfo; - use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; - - struct TestData { - top_level_identifier: Identifier, - data_contract: DataContract, - document_type_name: String, - documents: Vec, - document_create_transition: DocumentCreateTransitionAction, - } - - fn setup_test(platform_state: &mut PlatformStateV0) -> TestData { - let top_level_identifier_hex = - "c286807d463b06c7aba3b9a60acf64c1fc03da8c1422005cd9b4293f08cf0562"; - let top_level_identifier = - Identifier::from_bytes(&hex::decode(top_level_identifier_hex).unwrap()).unwrap(); - - let pro_tx_hash = ProTxHash::from_byte_array(top_level_identifier.to_buffer()); - - platform_state.hpmn_masternode_list.insert(pro_tx_hash, MasternodeListItem { - node_type: MasternodeType::Evo, - pro_tx_hash, - collateral_hash: Txid::from_str("4eb56228c535db3b234907113fd41d57bcc7cdcb8e0e00e57590af27ee88c119").expect("expected to decode collateral hash"), - collateral_index: 0, - collateral_address: [0;20], - operator_reward: 0.0, - state: DMNState { - service: SocketAddr::from_str("1.2.3.4:1234").unwrap(), - registered_height: 0, - pose_revived_height: None, - pose_ban_height: None, - revocation_reason: 0, - owner_address: [1;20], - voting_address: [2;20], - payout_address: [3;20], - pub_key_operator: hex::decode("987a4873caba62cd45a2f7d4aa6d94519ee6753e9bef777c927cb94ade768a542b0ff34a93231d3a92b4e75ffdaa366e").expect("expected to decode collateral hash"), - operator_payout_address: None, - platform_node_id: None, - platform_p2p_port: None, - platform_http_port: None, - }, - }); - - let pro_tx_hash = - ProTxHash::from_str("a3e1edc6bd352eeaf0ae58e30781ef4b127854241a3fe7fddf36d5b7e1dc2b3f") - .expect("expected to create pro-tx-hash from slice"); - - platform_state.hpmn_masternode_list.insert(pro_tx_hash, MasternodeListItem { - node_type: MasternodeType::Evo, - pro_tx_hash, - collateral_hash: Txid::from_str("4eb56228c535db3b234907113fd41d57bcc7cdcb8e0e00e57590af27ee88c119").expect("expected to decode collateral hash"), - collateral_index: 0, - collateral_address: [0;20], - operator_reward: 0.0, - state: DMNState { - service: SocketAddr::from_str("1.2.3.5:1234").unwrap(), - registered_height: 0, - pose_revived_height: None, - pose_ban_height: None, - revocation_reason: 0, - owner_address: [1;20], - voting_address: [2;20], - payout_address: [3;20], - pub_key_operator: hex::decode("a87a4873caba62cd45a2f7d4aa6d94519ee6753e9bef777c927cb94ade768a542b0ff34a93231d3a92b4e75ffdaa366e").expect("expected to decode collateral hash"), - operator_payout_address: None, - platform_node_id: None, - platform_p2p_port: None, - platform_http_port: None, - }, - }); - - let (documents, data_contract) = get_masternode_reward_shares_documents_fixture(1); - let document_type = data_contract - .document_type_for_name("rewardShare") - .expect("expected the rewards document type"); - let document_transitions = get_document_transitions_fixture([( - DocumentTransitionActionType::Create, - vec![(documents[0].clone(), document_type, Bytes32::default())], - )]); - - let document_create_transition = document_transitions[0] - .as_transition_create() - .unwrap() - .clone(); - TestData { - documents, - data_contract, - document_type_name: "rewardShare".to_string(), - top_level_identifier, - document_create_transition: DocumentCreateTransitionAction::from_document_create_transition_with_contract_lookup(document_create_transition, |_identifier| { - Ok(Arc::new(DataContractFetchInfo::masternode_rewards_contract_fixture(platform_state.current_protocol_version_in_consensus))) - }).expect("expected to create action"), - } - } - - fn get_data_trigger_error( - result: &Result, - error_number: usize, - ) -> &DataTriggerError { - let execution_result = result.as_ref().expect("it should return execution result"); - execution_result - .get_error(error_number) - .expect("errors should exist") - } - - #[test] - fn should_return_an_error_if_percentage_greater_than_10000() { - let platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - let mut state_write_guard = platform.state.write().unwrap(); - - let platform_version = state_write_guard - .current_platform_version() - .expect("should return a platform version"); - - let TestData { - mut document_create_transition, - documents, - data_contract, - document_type_name, - top_level_identifier, - .. - } = setup_test(state_write_guard.v0_mut().expect("expected v0")); - - let document_type = data_contract - .document_type_for_name(document_type_name.as_str()) - .expect("expected the rewards document type"); - - let platform_ref = PlatformStateRef { - drive: &platform.drive, - state: &state_write_guard, - config: &platform.config, - }; - - for (i, document) in documents.iter().enumerate() { - platform_ref - .drive - .apply_contract( - &data_contract, - BlockInfo::default(), - true, - None, - None, - platform_version, - ) - .expect("expected to apply contract"); - let mut identity = - Identity::random_identity(2, Some(i as u64), platform_version).unwrap(); - - identity.set_id(document.owner_id()); - - platform_ref - .drive - .add_new_identity( - identity, - false, - &BlockInfo::default(), - true, - None, - state_write_guard.current_platform_version().unwrap(), - ) - .expect("expected to add an identity"); - - let mut identity = Identity::random_identity(2, Some(100 - i as u64), platform_version) - .expect("expected a platform identity"); - identity.set_id( - document - .properties() - .get_identifier("payToId") - .expect("expected pay to id"), - ); - - platform_ref - .drive - .add_new_identity( - identity, - false, - &BlockInfo::default(), - true, - None, - state_write_guard - .current_platform_version() - .expect("expected a platform version"), - ) - .expect("expected to add an identity"); - - platform_ref - .drive - .add_document_for_contract( - DocumentAndContractInfo { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentRefInfo((document, None)), - owner_id: None, - }, - contract: &data_contract, - document_type, - }, - false, - BlockInfo::default(), - true, - None, - platform_version, - ) - .expect("expected to add document"); - } - - // documentsFixture contains percentage = 500 - document_create_transition - .data_mut() - .insert("percentage".to_string(), Value::U64(90501)); - - let execution_context = - StateTransitionExecutionContext::default_for_platform_version(platform_version) - .expect("expected to get an execution context"); - let context = DataTriggerExecutionContext { - platform: &platform_ref, - owner_id: &top_level_identifier, - state_transition_execution_context: &execution_context, - transaction: None, - }; - - let result = create_masternode_reward_shares_data_trigger_v0( - &document_create_transition.into(), - &context, - platform_version, - ); - - let percentage_error = get_data_trigger_error(&result, 0); - assert_eq!( - "Percentage can not be more than 10000", - percentage_error.to_string() - ); - } - - #[test] - fn should_return_an_error_if_pay_to_id_does_not_exists() { - let platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - - let mut state_write_guard = platform.state.write().unwrap(); - - let platform_version = state_write_guard - .current_platform_version() - .expect("should return a platform version"); - - let TestData { - document_create_transition, - - top_level_identifier, - .. - } = setup_test(state_write_guard.v0_mut().expect("expected v0")); - - let platform_ref = PlatformStateRef { - drive: &platform.drive, - state: &state_write_guard, - config: &platform.config, - }; - - let execution_context = - StateTransitionExecutionContext::default_for_platform_version(platform_version) - .unwrap(); - let context = DataTriggerExecutionContext { - platform: &platform_ref, - owner_id: &top_level_identifier, - state_transition_execution_context: &execution_context, - transaction: None, - }; - let pay_to_id_bytes = document_create_transition - .data() - .get_hash256_bytes(PAY_TO_ID) - .expect("expected to be able to get a hash"); - let result = create_masternode_reward_shares_data_trigger_v0( - &document_create_transition.into(), - &context, - platform_version, - ); - - let error = get_data_trigger_error(&result, 0); - - let pay_to_id = Identifier::from(pay_to_id_bytes); - - assert_eq!( - format!("Identity '{}' doesn't exist", pay_to_id), - error.to_string() - ); - } - - #[test] - fn should_return_an_error_if_owner_id_is_not_a_masternode_identity() { - let platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - - let mut state_write_guard = platform.state.write().unwrap(); - - let platform_version = state_write_guard - .current_platform_version() - .expect("should return a platform version"); - - let TestData { - document_create_transition, - .. - } = setup_test(state_write_guard.v0_mut().expect("expected v0")); - - let platform_ref = PlatformStateRef { - drive: &platform.drive, - state: &state_write_guard, - config: &platform.config, - }; - - let execution_context = - StateTransitionExecutionContext::default_for_platform_version(platform_version) - .unwrap(); - let context = DataTriggerExecutionContext { - platform: &platform_ref, - owner_id: &generate_random_identifier_struct(), - state_transition_execution_context: &execution_context, - transaction: None, - }; - let result = create_masternode_reward_shares_data_trigger_v0( - &document_create_transition.into(), - &context, - platform_version, - ); - let error = get_data_trigger_error(&result, 0); - - assert_eq!( - "Only masternode identities can share rewards", - error.to_string() - ); - } - - #[test] - fn should_pass() { - let platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - - let mut state_write_guard = platform.state.write().unwrap(); - - let platform_version = state_write_guard - .current_platform_version() - .expect("should return a platform version"); - - let TestData { - document_create_transition, - - top_level_identifier, - .. - } = setup_test(state_write_guard.v0_mut().expect("expected v0")); - - let platform_ref = PlatformStateRef { - drive: &platform.drive, - state: &state_write_guard, - config: &platform.config, - }; - - let mut identity = Identity::random_identity( - 2, - Some(9), - state_write_guard.current_platform_version().unwrap(), - ) - .expect("expected a platform identity"); - identity.set_id( - document_create_transition - .data() - .get_identifier("payToId") - .expect("expected pay to id"), - ); - - platform_ref - .drive - .add_new_identity( - identity, - false, - &BlockInfo::default(), - true, - None, - state_write_guard.current_platform_version().unwrap(), - ) - .expect("expected to add an identity"); - - let execution_context = - StateTransitionExecutionContext::default_for_platform_version(platform_version) - .unwrap(); - let context = DataTriggerExecutionContext { - platform: &platform_ref, - owner_id: &top_level_identifier, - state_transition_execution_context: &execution_context, - transaction: None, - }; - let result = create_masternode_reward_shares_data_trigger_v0( - &document_create_transition.into(), - &context, - platform_version, - ) - .expect("the execution result should be returned"); - assert!(result.is_valid(), "{}", result.errors.first().unwrap()) - } - - #[test] - fn should_return_error_if_there_are_16_stored_shares() { - let platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - - let mut state_write_guard = platform.state.write().unwrap(); - - let TestData { - document_create_transition, - data_contract, - top_level_identifier, - .. - } = setup_test(state_write_guard.v0_mut().expect("expected v0")); - - let platform_version = state_write_guard - .current_platform_version() - .expect("should return platform version"); - - let platform_ref = PlatformStateRef { - drive: &platform.drive, - state: &state_write_guard, - config: &platform.config, - }; - - platform_ref - .drive - .apply_contract( - &data_contract, - BlockInfo::default(), - true, - None, - None, - platform_version, - ) - .expect("expected to apply contract"); - - let document_type = data_contract - .document_type_for_name(document_create_transition.base().document_type_name()) - .expect("expected to get document type"); - - let mut main_identity = Identity::random_identity(2, Some(1000_u64), platform_version) - .expect("expected a platform identity"); - - main_identity.set_id( - document_create_transition - .data() - .get_identifier("payToId") - .expect("expected pay to id"), - ); - - platform_ref - .drive - .add_new_identity( - main_identity, - false, - &BlockInfo::default(), - true, - None, - platform_version, - ) - .expect("expected to add an identity"); - - for i in 0..16 { - let mut document = document_type - .random_document(Some(i), platform_version) - .expect("should generate a document"); - - document.set_owner_id(top_level_identifier); - - let mut identity = Identity::random_identity(2, Some(100 - i), platform_version) - .expect("expected a platform identity"); - identity.set_id( - document - .properties() - .get_identifier("payToId") - .expect("expected pay to id"), - ); - - platform_ref - .drive - .add_new_identity( - identity, - false, - &BlockInfo::default(), - true, - None, - platform_version, - ) - .expect("expected to add an identity"); - - platform - .drive - .add_document_for_contract( - DocumentAndContractInfo { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentOwnedInfo((document, None)), - owner_id: Some(top_level_identifier.to_buffer()), - }, - contract: &data_contract, - document_type, - }, - false, - BlockInfo::genesis(), - true, - None, - platform_version, - ) - .expect("expected to insert a document successfully"); - } - - let execution_context = - StateTransitionExecutionContext::default_for_platform_version(platform_version) - .unwrap(); - let context = DataTriggerExecutionContext { - platform: &platform_ref, - owner_id: &top_level_identifier, - state_transition_execution_context: &execution_context, - transaction: None, - }; - - let result = create_masternode_reward_shares_data_trigger_v0( - &document_create_transition.into(), - &context, - platform_version, - ); - let error = get_data_trigger_error(&result, 0); - - assert_eq!( - "Reward shares cannot contain more than 16 identities", - error.to_string() - ); - } - - #[test] - fn should_pass_on_dry_run() { - let platform = TestPlatformBuilder::new() - .build_with_mock_rpc() - .set_initial_state_structure(); - - let mut state_write_guard = platform.state.write().unwrap(); - - let platform_version = state_write_guard - .current_platform_version() - .expect("should return a platform version"); - - let TestData { - document_create_transition, - - top_level_identifier, - .. - } = setup_test(state_write_guard.v0_mut().expect("expected v0")); - - let platform_ref = PlatformStateRef { - drive: &platform.drive, - state: &state_write_guard, - config: &platform.config, - }; - - let mut execution_context = - StateTransitionExecutionContext::default_for_platform_version(platform_version) - .unwrap(); - execution_context.enable_dry_run(); - - let context = DataTriggerExecutionContext { - platform: &platform_ref, - owner_id: &top_level_identifier, - state_transition_execution_context: &execution_context, - transaction: None, - }; - let result = create_masternode_reward_shares_data_trigger_v0( - &document_create_transition.into(), - &context, - platform_version, - ) - .expect("the execution result should be returned"); - assert!(result.is_valid()); - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/withdrawals/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/withdrawals/v0/mod.rs index 466f0154fdf..93b86034d62 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/withdrawals/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/withdrawals/v0/mod.rs @@ -1,4 +1,4 @@ -///! The `withdrawals_data_triggers` module contains data triggers related to withdrawals. +//! The `withdrawals_data_triggers` module contains data triggers related to withdrawals. use crate::error::execution::ExecutionError; use crate::error::Error; @@ -15,7 +15,7 @@ use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::document::DocumentV0Getters; use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; use drive::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::v0::DocumentDeleteTransitionActionAccessorsV0; -use dpp::system_data_contracts::withdrawals_contract::document_types::withdrawal; +use dpp::system_data_contracts::withdrawals_contract::v1::document_types::withdrawal; use drive::drive::document::query::QueryDocumentsOutcomeV0Methods; use crate::execution::validation::state_transition::documents_batch::data_triggers::{DataTriggerExecutionContext, DataTriggerExecutionResult}; @@ -33,12 +33,18 @@ use crate::execution::validation::state_transition::documents_batch::data_trigge /// # Returns /// /// A `DataTriggerExecutionResult` indicating the success or failure of the trigger execution. -pub fn delete_withdrawal_data_trigger_v0( +#[inline(always)] +pub(super) fn delete_withdrawal_data_trigger_v0( document_transition: &DocumentTransitionAction, context: &DataTriggerExecutionContext<'_>, platform_version: &PlatformVersion, ) -> Result { - let data_contract_fetch_info = document_transition.base().data_contract_fetch_info(); + let data_contract_fetch_info = document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base", + )))? + .data_contract_fetch_info(); let data_contract = &data_contract_fetch_info.contract; let mut result = DataTriggerExecutionResult::default(); @@ -46,7 +52,12 @@ pub fn delete_withdrawal_data_trigger_v0( return Err(Error::Execution(ExecutionError::DataTriggerExecutionError( format!( "the Document Transition {} isn't 'DELETE", - document_transition.base().id() + document_transition + .base() + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expecting action to have a base" + )))? + .id() ), ))); }; @@ -87,7 +98,7 @@ pub fn delete_withdrawal_data_trigger_v0( )? .documents_owned(); - let Some(withdrawal) = withdrawals.get(0) else { + let Some(withdrawal) = withdrawals.first() else { let err = DataTriggerConditionError::new( data_contract.id(), dt_delete.base().id(), @@ -104,13 +115,11 @@ pub fn delete_withdrawal_data_trigger_v0( .get_integer("status") .map_err(ProtocolError::ValueError)?; - if status != withdrawals_contract::WithdrawalStatus::COMPLETE as u8 - || status != withdrawals_contract::WithdrawalStatus::EXPIRED as u8 - { + if status != withdrawals_contract::WithdrawalStatus::COMPLETE as u8 { let err = DataTriggerConditionError::new( data_contract.id(), dt_delete.base().id(), - "withdrawal deletion is allowed only for COMPLETE and EXPIRED statuses".to_string(), + "withdrawal deletion is allowed only for COMPLETE statuses".to_string(), ); result.add_error(err); @@ -131,7 +140,7 @@ mod tests { use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; use dpp::document::{Document, DocumentV0Getters}; - use dpp::platform_value::{platform_value, Bytes32}; + use dpp::platform_value::platform_value; use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::{DocumentBaseTransitionAction, DocumentBaseTransitionActionV0}; use drive::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::DocumentDeleteTransitionAction; use drive::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::v0::DocumentDeleteTransitionActionV0; @@ -150,7 +159,7 @@ mod tests { let platform = TestPlatformBuilder::new() .build_with_mock_rpc() .set_initial_state_structure(); - let state_read_guard = platform.state.read().unwrap(); + let state_read_guard = platform.state.load(); let platform_ref = PlatformStateRef { drive: &platform.drive, state: &state_read_guard, @@ -159,12 +168,13 @@ mod tests { let platform_version = state_read_guard.current_platform_version().unwrap(); let transition_execution_context = StateTransitionExecutionContextV0::default(); - let data_contract = get_data_contract_fixture(None, platform_version.protocol_version) + let data_contract = get_data_contract_fixture(None, 0, platform_version.protocol_version) .data_contract_owned(); let owner_id = data_contract.owner_id(); let base_transition: DocumentBaseTransitionAction = DocumentBaseTransitionActionV0 { id: Default::default(), + identity_contract_nonce: 1, document_type_name: "".to_string(), data_contract: Arc::new(DataContractFetchInfo::dpns_contract_fixture(1)), } @@ -202,11 +212,9 @@ mod tests { fn can_serialize_and_deserialize_withdrawal() { let platform_version = PlatformVersion::first(); - let data_contract = load_system_data_contract( - SystemDataContract::Withdrawals, - platform_version.protocol_version, - ) - .expect("to load system data contract"); + let data_contract = + load_system_data_contract(SystemDataContract::Withdrawals, platform_version) + .expect("to load system data contract"); let owner_id = data_contract.owner_id(); let document_type = data_contract @@ -223,7 +231,6 @@ mod tests { "status": withdrawals_contract::WithdrawalStatus::BROADCASTED as u8, "transactionIndex": 1u64, "transactionSignHeight": 93u64, - "transactionId": Bytes32::new([1;32]), }), None, platform_version.protocol_version, @@ -242,7 +249,7 @@ mod tests { let platform = TestPlatformBuilder::new() .build_with_mock_rpc() .set_genesis_state(); - let state_read_guard = platform.state.read().unwrap(); + let state_read_guard = platform.state.load(); let platform_ref = PlatformStateRef { drive: &platform.drive, @@ -257,11 +264,9 @@ mod tests { .current_platform_version() .expect("should return a platform version"); - let data_contract = load_system_data_contract( - SystemDataContract::Withdrawals, - platform_version.protocol_version, - ) - .expect("to load system data contract"); + let data_contract = + load_system_data_contract(SystemDataContract::Withdrawals, platform_version) + .expect("to load system data contract"); let owner_id = data_contract.owner_id(); let document_type = data_contract @@ -279,7 +284,6 @@ mod tests { "status": withdrawals_contract::WithdrawalStatus::BROADCASTED as u8, "transactionIndex": 1u64, "transactionSignHeight": 93u64, - "transactionId": Bytes32::new([1;32]), }), None, platform_version.protocol_version, @@ -309,6 +313,7 @@ mod tests { DocumentDeleteTransitionAction::V0(DocumentDeleteTransitionActionV0 { base: DocumentBaseTransitionAction::V0(DocumentBaseTransitionActionV0 { id: document.id(), + identity_contract_nonce: 1, document_type_name: "withdrawal".to_string(), data_contract: Arc::new(DataContractFetchInfo::withdrawals_contract_fixture( platform_version.protocol_version, @@ -336,7 +341,7 @@ mod tests { assert_eq!( error.to_string(), - "withdrawal deletion is allowed only for COMPLETE and EXPIRED statuses" + "withdrawal deletion is allowed only for COMPLETE statuses" ); } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/base_structure/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/identity_contract_nonce/mod.rs similarity index 100% rename from packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/base_structure/mod.rs rename to packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/identity_contract_nonce/mod.rs diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/identity_contract_nonce/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/identity_contract_nonce/v0/mod.rs new file mode 100644 index 00000000000..1487567a4bd --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/identity_contract_nonce/v0/mod.rs @@ -0,0 +1,68 @@ +use crate::error::Error; +use dpp::block::block_info::BlockInfo; +use dpp::identity::identity_nonce::{validate_identity_nonce_update, validate_new_identity_nonce}; +use dpp::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; +use dpp::state_transition::documents_batch_transition::document_transition::DocumentTransitionV0Methods; + +use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; +use dpp::state_transition::StateTransitionLike; + +use dpp::validation::SimpleConsensusValidationResult; + +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::platform_types::platform::PlatformStateRef; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(in crate::execution::validation::state_transition::state_transitions::documents_batch) trait DocumentsBatchStateTransitionIdentityContractNonceV0 +{ + fn validate_identity_contract_nonces_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl DocumentsBatchStateTransitionIdentityContractNonceV0 for DocumentsBatchTransition { + fn validate_identity_contract_nonces_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + // We should validate that all newly created documents have valid ids + for transition in self.transitions() { + let revision_nonce = transition.identity_contract_nonce(); + let identity_id = self.owner_id(); + let (existing_nonce, fee) = platform.drive.fetch_identity_contract_nonce_with_fees( + identity_id.to_buffer(), + transition.data_contract_id().to_buffer(), + block_info, + true, + tx, + platform_version, + )?; + + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee)); + + let result = if let Some(existing_nonce) = existing_nonce { + validate_identity_nonce_update(existing_nonce, revision_nonce, identity_id) + } else { + validate_new_identity_nonce(revision_nonce, identity_id) + }; + if !result.is_valid() { + return Ok(result); + } + } + + Ok(SimpleConsensusValidationResult::new()) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/mod.rs index 9e629b27724..da5d9701619 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/mod.rs @@ -1,9 +1,14 @@ mod action_validation; -mod base_structure; +mod advanced_structure; +mod balance; mod data_triggers; +mod identity_contract_nonce; mod state; mod transformer; +use dpp::block::block_info::BlockInfo; +use dpp::block::epoch::Epoch; +use dpp::identity::PartialIdentity; use dpp::prelude::*; use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; use dpp::validation::SimpleConsensusValidationResult; @@ -14,28 +19,45 @@ use drive::grovedb::TransactionArg; use crate::error::execution::ExecutionError; use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use crate::platform_types::platform::{PlatformRef, PlatformStateRef}; use crate::rpc::core::CoreRPCLike; -use crate::execution::validation::state_transition::documents_batch::base_structure::v0::DocumentsBatchStateTransitionStructureValidationV0; +use crate::execution::validation::state_transition::documents_batch::advanced_structure::v0::DocumentsBatchStateTransitionStructureValidationV0; +use crate::execution::validation::state_transition::documents_batch::identity_contract_nonce::v0::DocumentsBatchStateTransitionIdentityContractNonceV0; use crate::execution::validation::state_transition::documents_batch::state::v0::DocumentsBatchStateTransitionStateValidationV0; use crate::execution::validation::state_transition::processor::v0::{ - StateTransitionStateValidationV0, StateTransitionStructureValidationV0, + StateTransitionBasicStructureValidationV0, StateTransitionNonceValidationV0, + StateTransitionStateValidationV0, StateTransitionStructureKnownInStateValidationV0, }; use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::execution::validation::state_transition::ValidationMode; + +impl ValidationMode { + /// Returns a bool on whether we should validate that documents are valid against the state + pub fn should_validate_document_valid_against_state(&self) -> bool { + match self { + ValidationMode::CheckTx => false, + ValidationMode::RecheckTx => false, + ValidationMode::Validator => true, + ValidationMode::NoValidation => false, + } + } +} impl StateTransitionActionTransformerV0 for DocumentsBatchTransition { fn transform_into_action( &self, platform: &PlatformRef, - validate: bool, + block_info: &BlockInfo, + validation_mode: ValidationMode, + _execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing @@ -43,7 +65,7 @@ impl StateTransitionActionTransformerV0 for DocumentsBatchTransition { .documents_batch_state_transition .transform_into_action { - 0 => self.transform_into_action_v0(&platform.into(), validate, tx), + 0 => self.transform_into_action_v0(&platform.into(), block_info, validation_mode, tx), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "documents batch transition: transform_into_action".to_string(), known_versions: vec![0], @@ -53,25 +75,83 @@ impl StateTransitionActionTransformerV0 for DocumentsBatchTransition { } } -impl StateTransitionStructureValidationV0 for DocumentsBatchTransition { - fn validate_structure( +impl StateTransitionBasicStructureValidationV0 for DocumentsBatchTransition { + fn validate_basic_structure( + &self, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .documents_batch_state_transition + .basic_structure + { + 0 => { + // There is nothing expensive here + self.validate_base_structure(platform_version) + .map_err(Error::Protocol) + } + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "documents batch transition: base structure".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} + +impl StateTransitionNonceValidationV0 for DocumentsBatchTransition { + fn validate_nonces( &self, platform: &PlatformStateRef, - action: Option<&StateTransitionAction>, - protocol_version: u32, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, ) -> Result { - let platform_version = PlatformVersion::get(protocol_version)?; match platform_version .drive_abci .validation_and_processing .state_transitions .documents_batch_state_transition - .structure + .revision + { + 0 => self.validate_identity_contract_nonces_v0( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "documents batch transition: revision".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} + +impl StateTransitionStructureKnownInStateValidationV0 for DocumentsBatchTransition { + fn validate_advanced_structure_from_state( + &self, + action: &StateTransitionAction, + identity: Option<&PartialIdentity>, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .documents_batch_state_transition + .advanced_structure { 0 => { - let action = - action.ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( - "documents batch structure validation should have an action", + let identity = + identity.ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "The identity must be known on advanced structure validation", )))?; let StateTransitionAction::DocumentsBatchAction(documents_batch_transition_action) = action @@ -80,19 +160,28 @@ impl StateTransitionStructureValidationV0 for DocumentsBatchTransition { "action must be a documents batch transition action", ))); }; - self.validate_structure_v0( - platform, + self.validate_advanced_structure_from_state_v0( documents_batch_transition_action, + identity, + execution_context, platform_version, ) } version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "documents batch transition: base structure".to_string(), + method: "documents batch transition: advanced structure from state".to_string(), known_versions: vec![0], received: version, })), } } + + fn has_advanced_structure_validation_with_state(&self) -> bool { + true + } + + fn requires_advanced_structure_validation_with_state_on_check_tx(&self) -> bool { + true + } } impl StateTransitionStateValidationV0 for DocumentsBatchTransition { @@ -100,10 +189,12 @@ impl StateTransitionStateValidationV0 for DocumentsBatchTransition { &self, action: Option, platform: &PlatformRef, + _validation_mode: ValidationMode, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; match platform_version .drive_abci @@ -127,6 +218,8 @@ impl StateTransitionStateValidationV0 for DocumentsBatchTransition { self.validate_state_v0( documents_batch_transition_action, &platform.into(), + epoch, + execution_context, tx, platform_version, ) @@ -139,3 +232,4444 @@ impl StateTransitionStateValidationV0 for DocumentsBatchTransition { } } } + +#[cfg(test)] +mod tests { + use crate::platform_types::state_transitions_processing_result::StateTransitionExecutionResult; + use crate::rpc::core::MockCoreRPCLike; + use crate::test::helpers::setup::{TempPlatform, TestPlatformBuilder}; + use dpp::block::block_info::BlockInfo; + use dpp::dash_to_credits; + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; + use dpp::data_contract::document_type::random_document::{ + CreateRandomDocument, DocumentFieldFillSize, DocumentFieldFillType, + }; + use dpp::document::document_methods::DocumentMethodsV0; + use dpp::document::transfer::Transferable; + use dpp::document::{DocumentV0Getters, DocumentV0Setters}; + use dpp::fee::fee_result::BalanceChange; + use dpp::fee::Credits; + use dpp::identity::accessors::IdentityGettersV0; + use dpp::identity::{Identity, IdentityPublicKey, IdentityV0}; + use dpp::nft::TradeMode; + use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; + use dpp::platform_value::{Bytes32, Value}; + use dpp::prelude::Identifier; + use dpp::serialization::PlatformSerializable; + use dpp::state_transition::documents_batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; + use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; + use dpp::tests::json_document::json_document_to_contract; + use drive::drive::document::query::QueryDocumentsOutcomeV0Methods; + use drive::drive::flags::StorageFlags; + use drive::query::DriveQuery; + use platform_version::version::PlatformVersion; + use rand::prelude::StdRng; + use rand::SeedableRng; + use simple_signer::signer::SimpleSigner; + use std::collections::BTreeMap; + + fn setup_identity( + platform: &mut TempPlatform, + seed: u64, + credits: Credits, + ) -> (Identity, SimpleSigner, IdentityPublicKey) { + let platform_version = PlatformVersion::latest(); + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(seed); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key_with_rng( + 0, + &mut rng, + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (critical_public_key, private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key_with_rng( + 1, + &mut rng, + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(critical_public_key.clone(), private_key.clone()); + + let identity: Identity = IdentityV0 { + id: Identifier::random_with_rng(&mut rng), + public_keys: BTreeMap::from([ + (0, master_key.clone()), + (1, critical_public_key.clone()), + ]), + balance: credits, + revision: 0, + } + .into(); + + // We just add this identity to the system first + + platform + .drive + .add_new_identity( + identity.clone(), + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to add a new identity"); + + (identity, signer, critical_public_key) + } + + mod creation_tests { + use super::*; + use dpp::data_contract::accessors::v0::DataContractV0Setters; + use dpp::data_contract::document_type::restricted_creation::CreationRestrictionMode; + + #[test] + fn test_document_creation() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + let dashpay_contract = dashpay.clone(); + + let profile = dashpay_contract + .document_type_for_name("profile") + .expect("expected a profile document type"); + + assert!(profile.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("avatarUrl", "http://test.com/bob.jpg".into()); + + let mut altered_document = document.clone(); + + altered_document.increment_revision().unwrap(); + altered_document.set("displayName", "Samuel".into()); + altered_document.set("avatarUrl", "http://test.com/cat.jpg".into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + profile, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + } + + #[test] + fn test_document_creation_on_restricted_document_type_that_only_allows_contract_owner_to_create( + ) { + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (another_identity, another_identity_signer, another_identity_key) = + setup_identity(&mut platform, 450, dash_to_credits!(0.1)); + + let card_game_path = "tests/supporting_files/contract/crypto-card-game/crypto-card-game-direct-purchase-creation-restricted-to-owner.json"; + + let platform_version = platform + .state + .load() + .current_platform_version() + .expect("expected to get current platform version"); + + // let's construct the grovedb structure for the card game data contract + let mut contract = json_document_to_contract(card_game_path, true, platform_version) + .expect("expected to get data contract"); + + contract.set_owner_id(identity.id()); + + platform + .drive + .apply_contract( + &contract, + BlockInfo::default(), + true, + StorageFlags::optional_default_as_cow(), + None, + platform_version, + ) + .expect("expected to apply contract successfully"); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert_eq!( + card_document_type.creation_restriction_mode(), + CreationRestrictionMode::OwnerOnly + ); + + let mut rng = StdRng::seed_from_u64(433); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + // There is no issue because the creator of the contract made the document + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // Now let's try for another identity + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + another_identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 8.into()); + document.set("defense", 2.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &another_identity_key, + 2, + 0, + &another_identity_signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + // There is no issue because the creator of the contract made the document + + assert_eq!(processing_result.invalid_paid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let result = processing_result.into_execution_results().remove(0); + + let StateTransitionExecutionResult::PaidConsensusError(consensus_error, _) = result + else { + panic!("expected a paid consensus error"); + }; + assert_eq!(consensus_error.to_string(), "Document Creation on 86LHvdC1Tqx5P97LQUSibGFqf2vnKFpB6VkqQ7oso86e:card is not allowed because of the document type's creation restriction mode Owner Only"); + } + } + + mod replacement_tests { + use super::*; + + #[test] + fn test_document_replace_on_document_type_that_is_mutable() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + let dashpay_contract = dashpay.clone(); + + let profile = dashpay_contract + .document_type_for_name("profile") + .expect("expected a profile document type"); + + assert!(profile.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("avatarUrl", "http://test.com/bob.jpg".into()); + + let mut altered_document = document.clone(); + + altered_document.increment_revision().unwrap(); + altered_document.set("displayName", "Samuel".into()); + altered_document.set("avatarUrl", "http://test.com/cat.jpg".into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + profile, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let documents_batch_update_transition = + DocumentsBatchTransition::new_document_replacement_transition_from_document( + altered_document, + profile, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_update_serialized_transition = documents_batch_update_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_update_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 3810570); + } + + #[test] + fn test_document_replace_on_document_type_that_is_not_mutable() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(437); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (other_identity, ..) = setup_identity(&mut platform, 495, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + let dashpay_contract = dashpay.clone(); + + let contact_request_document_type = dashpay_contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type"); + + assert!(!contact_request_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = contact_request_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set( + "toUserId", + Value::Identifier(other_identity.id().to_buffer()), + ); + document.set("recipientKeyIndex", Value::U32(1)); + document.set("senderKeyIndex", Value::U32(1)); + document.set("accountReference", Value::U32(0)); + document.set("coreHeightCreatedAt", Value::U32(5)); + + let mut altered_document = document.clone(); + + altered_document.set_revision(Some(1)); + altered_document.set("senderKeyIndex", Value::U32(2)); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + contact_request_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let documents_batch_update_transition = + DocumentsBatchTransition::new_document_replacement_transition_from_document( + altered_document, + contact_request_document_type, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_update_serialized_transition = documents_batch_update_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_update_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 102690); + } + + #[test] + fn test_document_replace_on_document_type_that_is_not_mutable_but_is_transferable() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_transfer_only(Transferable::Always); + + let mut rng = StdRng::seed_from_u64(435); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (receiver, _, _) = setup_identity(&mut platform, 452, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let receiver_documents_sql_string = + format!("select * from card where $ownerId == '{}'", receiver.id()); + + let query_receiver_identity_documents = DriveQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to have 1 document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + document.set_revision(Some(2)); + + document.set("attack", 6.into()); + document.set("defense", 0.into()); + + let documents_batch_transfer_transition = + DocumentsBatchTransition::new_document_replacement_transition_from_document( + document, + card_document_type, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for transfer"); + + let documents_batch_transfer_serialized_transition = + documents_batch_transfer_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 1253950); + + let query_sender_results = platform + .drive + .query_documents(query_sender_identity_documents, None, false, None, None) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents(query_receiver_identity_documents, None, false, None, None) + .expect("expected query result"); + + // We expect the sender to still have their document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + } + + #[test] + fn test_document_replace_that_does_not_yet_exist() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + let dashpay_contract = dashpay.clone(); + + let profile = dashpay_contract + .document_type_for_name("profile") + .expect("expected a profile document type"); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("avatarUrl", "http://test.com/bob.jpg".into()); + + let mut altered_document = document.clone(); + + altered_document.increment_revision().unwrap(); + altered_document.set("displayName", "Samuel".into()); + altered_document.set("avatarUrl", "http://test.com/cat.jpg".into()); + + let documents_batch_update_transition = + DocumentsBatchTransition::new_document_replacement_transition_from_document( + altered_document, + profile, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_update_serialized_transition = documents_batch_update_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_update_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 1244470); + } + } + + mod deletion_tests { + use super::*; + + #[test] + fn test_document_delete_on_document_type_that_is_mutable_and_can_be_deleted() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + let dashpay_contract = dashpay.clone(); + + let profile = dashpay_contract + .document_type_for_name("profile") + .expect("expected a profile document type"); + + assert!(profile.documents_mutable()); + + assert!(profile.documents_can_be_deleted()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("avatarUrl", "http://test.com/bob.jpg".into()); + + let mut altered_document = document.clone(); + + altered_document.increment_revision().unwrap(); + altered_document.set("displayName", "Samuel".into()); + altered_document.set("avatarUrl", "http://test.com/cat.jpg".into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + profile, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let documents_batch_deletion_transition = + DocumentsBatchTransition::new_document_deletion_transition_from_document( + altered_document, + profile, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_update_serialized_transition = documents_batch_deletion_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_update_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 5588830); + } + + #[test] + fn test_document_delete_on_document_type_that_is_mutable_and_can_not_be_deleted() { + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + let contract_path = "tests/supporting_files/contract/dashpay/dashpay-contract-contact-request-mutable-and-can-not-be-deleted.json"; + + let platform_version = platform + .state + .load() + .current_platform_version() + .expect("expected to get current platform version"); + + // let's construct the grovedb structure for the card game data contract + let dashpay_contract = json_document_to_contract(contract_path, true, platform_version) + .expect("expected to get data contract"); + platform + .drive + .apply_contract( + &dashpay_contract, + BlockInfo::default(), + true, + StorageFlags::optional_default_as_cow(), + None, + platform_version, + ) + .expect("expected to apply contract successfully"); + + let mut rng = StdRng::seed_from_u64(437); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (other_identity, ..) = setup_identity(&mut platform, 495, dash_to_credits!(0.1)); + + let contact_request_document_type = dashpay_contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type"); + + assert!(contact_request_document_type.documents_mutable()); + + assert!(!contact_request_document_type.documents_can_be_deleted()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = contact_request_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set( + "toUserId", + Value::Identifier(other_identity.id().to_buffer()), + ); + document.set("recipientKeyIndex", Value::U32(1)); + document.set("senderKeyIndex", Value::U32(1)); + document.set("accountReference", Value::U32(0)); + document.set("coreHeightCreatedAt", Value::U32(5)); + + let mut altered_document = document.clone(); + + altered_document.set_revision(Some(1)); + altered_document.set("senderKeyIndex", Value::U32(2)); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + contact_request_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let documents_batch_deletion_transition = + DocumentsBatchTransition::new_document_deletion_transition_from_document( + altered_document, + contact_request_document_type, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_deletion_serialized_transition = + documents_batch_deletion_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_deletion_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 1253950); + } + + #[test] + fn test_document_delete_on_document_type_that_is_not_mutable_and_can_be_deleted() { + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + let contract_path = "tests/supporting_files/contract/dashpay/dashpay-contract-contact-request-not-mutable-and-can-be-deleted.json"; + + let platform_version = platform + .state + .load() + .current_platform_version() + .expect("expected to get current platform version"); + + // let's construct the grovedb structure for the card game data contract + let dashpay_contract = json_document_to_contract(contract_path, true, platform_version) + .expect("expected to get data contract"); + platform + .drive + .apply_contract( + &dashpay_contract, + BlockInfo::default(), + true, + StorageFlags::optional_default_as_cow(), + None, + platform_version, + ) + .expect("expected to apply contract successfully"); + + let mut rng = StdRng::seed_from_u64(437); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (other_identity, ..) = setup_identity(&mut platform, 495, dash_to_credits!(0.1)); + + let contact_request_document_type = dashpay_contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type"); + + assert!(!contact_request_document_type.documents_mutable()); + + assert!(contact_request_document_type.documents_can_be_deleted()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = contact_request_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set( + "toUserId", + Value::Identifier(other_identity.id().to_buffer()), + ); + document.set("recipientKeyIndex", Value::U32(1)); + document.set("senderKeyIndex", Value::U32(1)); + document.set("accountReference", Value::U32(0)); + document.set("coreHeightCreatedAt", Value::U32(5)); + + let mut altered_document = document.clone(); + + altered_document.set_revision(Some(1)); + altered_document.set("senderKeyIndex", Value::U32(2)); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + contact_request_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let documents_batch_deletion_transition = + DocumentsBatchTransition::new_document_deletion_transition_from_document( + altered_document, + contact_request_document_type, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_deletion_serialized_transition = + documents_batch_deletion_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_deletion_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 9951520); + } + + #[test] + fn test_document_delete_on_document_type_that_is_not_mutable_and_can_not_be_deleted() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(437); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (other_identity, ..) = setup_identity(&mut platform, 495, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + let dashpay_contract = dashpay.clone(); + + let contact_request_document_type = dashpay_contract + .document_type_for_name("contactRequest") + .expect("expected a profile document type"); + + assert!(!contact_request_document_type.documents_mutable()); + + assert!(!contact_request_document_type.documents_can_be_deleted()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = contact_request_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set( + "toUserId", + Value::Identifier(other_identity.id().to_buffer()), + ); + document.set("recipientKeyIndex", Value::U32(1)); + document.set("senderKeyIndex", Value::U32(1)); + document.set("accountReference", Value::U32(0)); + document.set("coreHeightCreatedAt", Value::U32(5)); + + let mut altered_document = document.clone(); + + altered_document.set_revision(Some(1)); + altered_document.set("senderKeyIndex", Value::U32(2)); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document, + contact_request_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let documents_batch_deletion_transition = + DocumentsBatchTransition::new_document_deletion_transition_from_document( + altered_document, + contact_request_document_type, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_deletion_serialized_transition = + documents_batch_deletion_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_deletion_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 1507670); + } + + #[test] + fn test_document_delete_that_does_not_yet_exist() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let dashpay = platform.drive.cache.system_data_contracts.load_dashpay(); + let dashpay_contract = dashpay.clone(); + + let profile = dashpay_contract + .document_type_for_name("profile") + .expect("expected a profile document type"); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = profile + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("avatarUrl", "http://test.com/bob.jpg".into()); + + let mut altered_document = document.clone(); + + altered_document.increment_revision().unwrap(); + altered_document.set("displayName", "Samuel".into()); + altered_document.set("avatarUrl", "http://test.com/cat.jpg".into()); + + let documents_batch_delete_transition = + DocumentsBatchTransition::new_document_deletion_transition_from_document( + altered_document, + profile, + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_delete_serialized_transition = documents_batch_delete_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_delete_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 1244470); + } + } + + mod transfer_tests { + use super::*; + + #[test] + fn test_document_transfer_on_document_type_that_is_transferable_that_has_no_owner_indices() + { + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + let card_game_path = "tests/supporting_files/contract/crypto-card-game/crypto-card-game-all-transferable-no-owner-indexes.json"; + + let platform_version = platform + .state + .load() + .current_platform_version() + .expect("expected to get current platform version"); + + // let's construct the grovedb structure for the card game data contract + let contract = json_document_to_contract(card_game_path, true, platform_version) + .expect("expected to get data contract"); + platform + .drive + .apply_contract( + &contract, + BlockInfo::default(), + true, + StorageFlags::optional_default_as_cow(), + None, + platform_version, + ) + .expect("expected to apply contract successfully"); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (receiver, _, _) = setup_identity(&mut platform, 450, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + document.set_revision(Some(2)); + + let documents_batch_transfer_transition = + DocumentsBatchTransition::new_document_transfer_transition_from_document( + document, + card_document_type, + receiver.id(), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for transfer"); + + let documents_batch_transfer_serialized_transition = + documents_batch_transfer_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().storage_fee, 0); // There is no storage fee, as there are no indexes that will change + + assert_eq!(processing_result.aggregated_fees().processing_fee, 4926670); + } + + #[test] + fn test_document_transfer_on_document_type_that_is_transferable() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_transfer_only(Transferable::Always); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (receiver, _, _) = setup_identity(&mut platform, 450, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let receiver_documents_sql_string = + format!("select * from card where $ownerId == '{}'", receiver.id()); + + let query_receiver_identity_documents = DriveQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to have 1 document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + document.set_revision(Some(2)); + + let documents_batch_transfer_transition = + DocumentsBatchTransition::new_document_transfer_transition_from_document( + document, + card_document_type, + receiver.id(), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for transfer"); + + let documents_batch_transfer_serialized_transition = + documents_batch_transfer_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().storage_fee, 37341000); // 1383 bytes added + + // todo: we should expect these numbers to be closer + + assert_eq!( + processing_result + .aggregated_fees() + .fee_refunds + .calculate_refunds_amount_for_identity(identity.id()), + Some(14992395) + ); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 8622720); + + let query_sender_results = platform + .drive + .query_documents(query_sender_identity_documents, None, false, None, None) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents(query_receiver_identity_documents, None, false, None, None) + .expect("expected query result"); + + // We expect the sender to have no documents, and the receiver to have 1 + assert_eq!(query_sender_results.documents().len(), 0); + + assert_eq!(query_receiver_results.documents().len(), 1); + } + + #[test] + fn test_document_transfer_on_document_type_that_is_not_transferable() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_transfer_only(Transferable::Never); + + let mut rng = StdRng::seed_from_u64(435); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (receiver, _, _) = setup_identity(&mut platform, 452, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let receiver_documents_sql_string = + format!("select * from card where $ownerId == '{}'", receiver.id()); + + let query_receiver_identity_documents = DriveQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to have 1 document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + document.set_revision(Some(2)); + + let documents_batch_transfer_transition = + DocumentsBatchTransition::new_document_transfer_transition_from_document( + document, + card_document_type, + receiver.id(), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for transfer"); + + let documents_batch_transfer_serialized_transition = + documents_batch_transfer_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 1253950); + + let query_sender_results = platform + .drive + .query_documents(query_sender_identity_documents, None, false, None, None) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents(query_receiver_identity_documents, None, false, None, None) + .expect("expected query result"); + + // We expect the sender to still have their document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + } + + #[test] + fn test_document_transfer_that_does_not_yet_exist() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_transfer_only(Transferable::Never); + + let mut rng = StdRng::seed_from_u64(435); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (receiver, _, _) = setup_identity(&mut platform, 452, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let receiver_documents_sql_string = + format!("select * from card where $ownerId == '{}'", receiver.id()); + + let query_receiver_identity_documents = DriveQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to have 0 documents, and the receiver to also have none + assert_eq!(query_sender_results.documents().len(), 0); + + assert_eq!(query_receiver_results.documents().len(), 0); + + document.set_revision(Some(2)); + + let documents_batch_transfer_transition = + DocumentsBatchTransition::new_document_transfer_transition_from_document( + document, + card_document_type, + receiver.id(), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for transfer"); + + let documents_batch_transfer_serialized_transition = + documents_batch_transfer_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 25090); + + let query_sender_results = platform + .drive + .query_documents(query_sender_identity_documents, None, false, None, None) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents(query_receiver_identity_documents, None, false, None, None) + .expect("expected query result"); + + // We expect the sender to still have no document, and the receiver to have none as well + assert_eq!(query_sender_results.documents().len(), 0); + + assert_eq!(query_receiver_results.documents().len(), 0); + } + + #[test] + fn test_document_delete_after_transfer() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_transfer_only(Transferable::Always); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (receiver, recipient_signer, recipient_key) = + setup_identity(&mut platform, 450, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let receiver_documents_sql_string = + format!("select * from card where $ownerId == '{}'", receiver.id()); + + let query_receiver_identity_documents = DriveQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to have 1 document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + document.set_revision(Some(2)); + + let documents_batch_transfer_transition = + DocumentsBatchTransition::new_document_transfer_transition_from_document( + document.clone(), + card_document_type, + receiver.id(), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for transfer"); + + let documents_batch_transfer_serialized_transition = + documents_batch_transfer_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 9549440); + + let query_sender_results = platform + .drive + .query_documents(query_sender_identity_documents, None, false, None, None) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents(query_receiver_identity_documents, None, false, None, None) + .expect("expected query result"); + + // We expect the sender to have no documents, and the receiver to have 1 + assert_eq!(query_sender_results.documents().len(), 0); + + assert_eq!(query_receiver_results.documents().len(), 1); + + // Now let's try to delete the transferred document + + document.set_owner_id(receiver.id()); + + let documents_batch_deletion_transition = + DocumentsBatchTransition::new_document_deletion_transition_from_document( + document, + card_document_type, + &recipient_key, + 2, + 0, + &recipient_signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_deletion_serialized_transition = + documents_batch_deletion_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_deletion_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 1107610); + } + } + + mod nft_tests { + use super::*; + #[test] + fn test_document_set_price_on_document_without_ability_to_purchase() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_transfer_only(Transferable::Always); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to have 1 document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + document.set_revision(Some(2)); + + let documents_batch_update_price_transition = + DocumentsBatchTransition::new_document_update_price_transition_from_document( + document.clone(), + card_document_type, + dash_to_credits!(0.1), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the update price"); + + let documents_batch_transfer_serialized_transition = + documents_batch_update_price_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let result = processing_result.into_execution_results().remove(0); + + let StateTransitionExecutionResult::PaidConsensusError(consensus_error, _) = result + else { + panic!("expected a paid consensus error"); + }; + assert_eq!(consensus_error.to_string(), "Document transition action card is in trade mode No Trading that does not support the seller setting the price is not supported"); + } + + #[test] + fn test_document_set_price() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_nft(TradeMode::DirectPurchase); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (receiver, _, _) = setup_identity(&mut platform, 450, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let receiver_documents_sql_string = + format!("select * from card where $ownerId == '{}'", receiver.id()); + + let query_receiver_identity_documents = DriveQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to have 1 document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + document.set_revision(Some(2)); + + let documents_batch_update_price_transition = + DocumentsBatchTransition::new_document_update_price_transition_from_document( + document.clone(), + card_document_type, + dash_to_credits!(0.1), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the update price"); + + let documents_batch_transfer_serialized_transition = + documents_batch_update_price_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 6075290); + + let query_sender_results = platform + .drive + .query_documents(query_sender_identity_documents, None, false, None, None) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents(query_receiver_identity_documents, None, false, None, None) + .expect("expected query result"); + + // We expect the sender to still have their document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + // The sender document should have the desired price + + let document = query_sender_results.documents().first().unwrap(); + + let price: Credits = document + .properties() + .get_integer("$price") + .expect("expected to get back price"); + + assert_eq!(dash_to_credits!(0.1), price); + + assert_eq!(document.revision(), Some(2)); + } + + #[test] + fn test_document_set_price_and_purchase() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_nft(TradeMode::DirectPurchase); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (purchaser, recipient_signer, recipient_key) = + setup_identity(&mut platform, 450, dash_to_credits!(1.0)); + + let seller_balance = platform + .drive + .fetch_identity_balance(identity.id().to_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected that identity exists"); + + assert_eq!(seller_balance, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!( + processing_result + .aggregated_fees() + .clone() + .into_balance_change(identity.id()) + .change(), + &BalanceChange::RemoveFromBalance { + required_removed_balance: 123579000, + desired_removed_balance: 127933560, + } + ); + + let original_creation_cost = 127933560; + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let seller_balance = platform + .drive + .fetch_identity_balance(identity.id().to_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected that identity exists"); + + // the seller should have received 0.1 and already had 0.1 minus the processing fee and storage fee + assert_eq!( + seller_balance, + dash_to_credits!(0.1) - original_creation_cost + ); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let receiver_documents_sql_string = + format!("select * from card where $ownerId == '{}'", purchaser.id()); + + let query_receiver_identity_documents = DriveQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to have 1 document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + document.set_revision(Some(2)); + + let documents_batch_update_price_transition = + DocumentsBatchTransition::new_document_update_price_transition_from_document( + document.clone(), + card_document_type, + dash_to_credits!(0.1), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the update price"); + + let documents_batch_transfer_serialized_transition = + documents_batch_update_price_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().storage_fee, 216000); // we added 8 bytes for the price + + assert_eq!( + processing_result + .aggregated_fees() + .fee_refunds + .calculate_refunds_amount_for_identity(identity.id()), + None + ); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 6075290); + + let seller_balance = platform + .drive + .fetch_identity_balance(identity.id().to_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected that identity exists"); + + // the seller should have received 0.1 and already had 0.1 minus the processing fee and storage fee + assert_eq!( + seller_balance, + dash_to_credits!(0.1) - 6075290 - 216000 - original_creation_cost + ); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to still have their document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + // The sender document should have the desired price + + let mut document = query_sender_results.documents_owned().remove(0); + + let price: Credits = document + .properties() + .get_integer("$price") + .expect("expected to get back price"); + + assert_eq!(dash_to_credits!(0.1), price); + + // At this point we want to have the receiver purchase the document + + document.set_revision(Some(3)); + + let documents_batch_purchase_transition = + DocumentsBatchTransition::new_document_purchase_transition_from_document( + document.clone(), + card_document_type, + purchaser.id(), + dash_to_credits!(0.1), //same price as requested + &recipient_key, + 1, // 1 because he's never done anything + 0, + &recipient_signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the purchase"); + + let documents_batch_purchase_serialized_transition = + documents_batch_purchase_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_purchase_serialized_transition], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().storage_fee, 64611000); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 10134040); + + assert_eq!( + processing_result + .aggregated_fees() + .fee_refunds + .calculate_refunds_amount_for_identity(identity.id()), + Some(22704503) + ); + + let query_sender_results = platform + .drive + .query_documents(query_sender_identity_documents, None, false, None, None) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents(query_receiver_identity_documents, None, false, None, None) + .expect("expected query result"); + + // We expect the sender to have no documents, and the receiver to have 1 + assert_eq!(query_sender_results.documents().len(), 0); + + assert_eq!(query_receiver_results.documents().len(), 1); + + let seller_balance = platform + .drive + .fetch_identity_balance(identity.id().to_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected that identity exists"); + + // the seller should have received 0.1 and already had 0.1 minus the processing fee and storage fee + assert_eq!( + seller_balance, + dash_to_credits!(0.2) - 6075290 - 216000 - original_creation_cost + 22704503 + ); + + let buyers_balance = platform + .drive + .fetch_identity_balance(purchaser.id().to_buffer(), None, platform_version) + .expect("expected to get purchaser balance") + .expect("expected that purchaser exists"); + + // the buyer payed 0.1, but also storage and processing fees + assert_eq!(buyers_balance, dash_to_credits!(0.9) - 10134040 - 64611000); + } + + #[test] + fn test_document_set_price_and_try_purchase_at_different_amount() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_nft(TradeMode::DirectPurchase); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (purchaser, recipient_signer, recipient_key) = + setup_identity(&mut platform, 450, dash_to_credits!(1.0)); + + let seller_balance = platform + .drive + .fetch_identity_balance(identity.id().to_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected that identity exists"); + + assert_eq!(seller_balance, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + document.set_revision(Some(2)); + + let documents_batch_update_price_transition = + DocumentsBatchTransition::new_document_update_price_transition_from_document( + document.clone(), + card_document_type, + dash_to_credits!(0.5), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the update price"); + + let documents_batch_transfer_serialized_transition = + documents_batch_update_price_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 1); + + // At this point we want to have the receiver purchase the document + + document.set_revision(Some(3)); + + let documents_batch_purchase_transition = + DocumentsBatchTransition::new_document_purchase_transition_from_document( + document.clone(), + card_document_type, + purchaser.id(), + dash_to_credits!(0.35), //different than requested price + &recipient_key, + 1, // 1 because he's never done anything + 0, + &recipient_signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the purchase"); + + let documents_batch_purchase_serialized_transition = + documents_batch_purchase_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_purchase_serialized_transition], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + let result = processing_result.into_execution_results().remove(0); + + let StateTransitionExecutionResult::PaidConsensusError(consensus_error, _) = result + else { + panic!("expected a paid consensus error"); + }; + assert_eq!(consensus_error.to_string(), "5rJccTdtJfg6AxSKyrptWUug3PWjveEitTTLqBn9wHdk document can not be purchased for 35000000000, it's sale price is 50000000000 (in credits)"); + } + + #[test] + fn test_document_set_price_and_purchase_from_ones_self() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_nft(TradeMode::DirectPurchase); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.5)); + + let seller_balance = platform + .drive + .fetch_identity_balance(identity.id().to_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected that identity exists"); + + assert_eq!(seller_balance, dash_to_credits!(0.5)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + document.set_revision(Some(2)); + + let documents_batch_update_price_transition = + DocumentsBatchTransition::new_document_update_price_transition_from_document( + document.clone(), + card_document_type, + dash_to_credits!(0.1), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the update price"); + + let documents_batch_transfer_serialized_transition = + documents_batch_update_price_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 1); + + // At this point we want to have the receiver purchase the document + + document.set_revision(Some(3)); + + let documents_batch_purchase_transition = + DocumentsBatchTransition::new_document_purchase_transition_from_document( + document.clone(), + card_document_type, + identity.id(), + dash_to_credits!(0.1), //same price as requested + &key, + 1, // 1 because he's never done anything + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the purchase"); + + let documents_batch_purchase_serialized_transition = + documents_batch_purchase_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_purchase_serialized_transition], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + let result = processing_result.into_execution_results().remove(0); + + let StateTransitionExecutionResult::PaidConsensusError(consensus_error, _) = result + else { + panic!("expected a paid consensus error"); + }; + assert_eq!(consensus_error.to_string(), "Document transition action on document type: card identity trying to purchase a document that is already owned by the purchaser is not supported"); + } + + #[test] + fn test_document_set_price_and_purchase_then_try_buy_back() { + // In this test we try to buy back a document after it has been sold + + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_nft(TradeMode::DirectPurchase); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (purchaser, recipient_signer, recipient_key) = + setup_identity(&mut platform, 450, dash_to_credits!(1.0)); + + let seller_balance = platform + .drive + .fetch_identity_balance(identity.id().to_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected that identity exists"); + + assert_eq!(seller_balance, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + document.set_revision(Some(2)); + + let documents_batch_update_price_transition = + DocumentsBatchTransition::new_document_update_price_transition_from_document( + document.clone(), + card_document_type, + dash_to_credits!(0.1), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the update price"); + + let documents_batch_transfer_serialized_transition = + documents_batch_update_price_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 1); + + // At this point we want to have the receiver purchase the document + + document.set_revision(Some(3)); + + let documents_batch_purchase_transition = + DocumentsBatchTransition::new_document_purchase_transition_from_document( + document.clone(), + card_document_type, + purchaser.id(), + dash_to_credits!(0.1), //same price as requested + &recipient_key, + 1, // 1 because he's never done anything + 0, + &recipient_signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the purchase"); + + let documents_batch_purchase_serialized_transition = + documents_batch_purchase_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_purchase_serialized_transition], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.valid_count(), 1); + + // Let's verify some stuff + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let receiver_documents_sql_string = + format!("select * from card where $ownerId == '{}'", purchaser.id()); + + let query_receiver_identity_documents = DriveQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to still have their document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 0); + + assert_eq!(query_receiver_results.documents().len(), 1); + + // The sender document should have the desired price + + let mut document = query_receiver_results.documents_owned().remove(0); + + let price: Option = document + .properties() + .get_optional_integer("$price") + .expect("expected to get back price"); + + assert_eq!(price, None); + + assert_eq!(document.owner_id(), purchaser.id()); + + // At this point we want to have the sender to try to buy back the document + + document.set_revision(Some(4)); + + let documents_batch_purchase_transition = + DocumentsBatchTransition::new_document_purchase_transition_from_document( + document.clone(), + card_document_type, + identity.id(), + dash_to_credits!(0.1), //same price as old requested + &key, + 4, // 1 because he's never done anything + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the purchase"); + + let documents_batch_purchase_serialized_transition = + documents_batch_purchase_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_purchase_serialized_transition], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + let result = processing_result.into_execution_results().remove(0); + + let StateTransitionExecutionResult::PaidConsensusError(consensus_error, _) = result + else { + panic!("expected a paid consensus error"); + }; + assert_eq!( + consensus_error.to_string(), + "5rJccTdtJfg6AxSKyrptWUug3PWjveEitTTLqBn9wHdk document not for sale" + ); + } + + #[test] + fn test_document_set_price_and_purchase_with_enough_credits_to_buy_but_not_enough_to_pay_for_processing( + ) { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_nft(TradeMode::DirectPurchase); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (receiver, recipient_signer, recipient_key) = + setup_identity(&mut platform, 450, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let receiver_documents_sql_string = + format!("select * from card where $ownerId == '{}'", receiver.id()); + + let query_receiver_identity_documents = DriveQuery::from_sql_expr( + receiver_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to have 1 document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + document.set_revision(Some(2)); + + let documents_batch_update_price_transition = + DocumentsBatchTransition::new_document_update_price_transition_from_document( + document.clone(), + card_document_type, + dash_to_credits!(0.1), + &key, + 3, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the update price"); + + let documents_batch_transfer_serialized_transition = + documents_batch_update_price_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 6075290); + + let query_sender_results = platform + .drive + .query_documents( + query_sender_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + let query_receiver_results = platform + .drive + .query_documents( + query_receiver_identity_documents.clone(), + None, + false, + None, + None, + ) + .expect("expected query result"); + + // We expect the sender to still have their document, and the receiver to have none + assert_eq!(query_sender_results.documents().len(), 1); + + assert_eq!(query_receiver_results.documents().len(), 0); + + // The sender document should have the desired price + + let mut document = query_sender_results.documents_owned().remove(0); + + let price: Credits = document + .properties() + .get_integer("$price") + .expect("expected to get back price"); + + assert_eq!(dash_to_credits!(0.1), price); + + // At this point we want to have the receiver purchase the document + + document.set_revision(Some(3)); + + let documents_batch_purchase_transition = + DocumentsBatchTransition::new_document_purchase_transition_from_document( + document.clone(), + card_document_type, + receiver.id(), + dash_to_credits!(0.1), //same price as requested + &recipient_key, + 1, // 1 because he's never done anything + 0, + &recipient_signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the purchase"); + + let documents_batch_purchase_serialized_transition = + documents_batch_purchase_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_purchase_serialized_transition], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + // nothing can go through because the purchaser doesn't have enough balance + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 1); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 0); + } + + #[test] + fn test_document_set_price_on_not_owned_document() { + let platform_version = PlatformVersion::latest(); + let (mut platform, contract) = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure() + .with_crypto_card_game_nft(TradeMode::DirectPurchase); + + let mut rng = StdRng::seed_from_u64(433); + + let platform_state = platform.state.load(); + + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let (other_identity, other_identity_signer, other_identity_key) = + setup_identity(&mut platform, 450, dash_to_credits!(0.1)); + + let card_document_type = contract + .document_type_for_name("card") + .expect("expected a profile document type"); + + assert!(!card_document_type.documents_mutable()); + + let entropy = Bytes32::random_with_rng(&mut rng); + + let mut document = card_document_type + .random_document_with_identifier_and_entropy( + &mut rng, + identity.id(), + entropy, + DocumentFieldFillType::DoNotFillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + platform_version, + ) + .expect("expected a random document"); + + document.set("attack", 4.into()); + document.set("defense", 7.into()); + + let documents_batch_create_transition = + DocumentsBatchTransition::new_document_creation_transition_from_document( + document.clone(), + card_document_type, + entropy.0, + &key, + 2, + 0, + &signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition"); + + let documents_batch_create_serialized_transition = documents_batch_create_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + document.set_revision(Some(2)); + + document.set_owner_id(other_identity.id()); // we do this to trick the system + + let documents_batch_update_price_transition = + DocumentsBatchTransition::new_document_update_price_transition_from_document( + document.clone(), + card_document_type, + dash_to_credits!(0.1), + &other_identity_key, + 1, + 0, + &other_identity_signer, + platform_version, + None, + None, + None, + ) + .expect("expect to create documents batch transition for the update price"); + + let documents_batch_transfer_serialized_transition = + documents_batch_update_price_transition + .serialize_to_bytes() + .expect("expected documents batch serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![documents_batch_transfer_serialized_transition.clone()], + &platform_state, + &BlockInfo::default_with_time(50000000), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit transaction"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 25090); + + let sender_documents_sql_string = + format!("select * from card where $ownerId == '{}'", identity.id()); + + let query_sender_identity_documents = DriveQuery::from_sql_expr( + sender_documents_sql_string.as_str(), + &contract, + Some(&platform.config.drive), + ) + .expect("expected document query"); + + let query_sender_results = platform + .drive + .query_documents(query_sender_identity_documents, None, false, None, None) + .expect("expected query result"); + + // The sender document should not have the desired price + + let document = query_sender_results.documents().first().unwrap(); + + assert_eq!( + document + .properties() + .get_optional_integer::("$price") + .expect("expected None"), + None + ); + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/data_triggers.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/data_triggers.rs index 32f99e179e2..47a71a2e699 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/data_triggers.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/data_triggers.rs @@ -7,6 +7,9 @@ use dpp::version::PlatformVersion; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; +#[allow(dead_code)] +#[deprecated(note = "This function is marked as unused.")] +#[allow(deprecated)] pub(super) fn execute_data_triggers( document_transition_actions: &Vec, context: &DataTriggerExecutionContext, @@ -15,6 +18,12 @@ pub(super) fn execute_data_triggers( let data_trigger_bindings = data_trigger_bindings_list(platform_version)?; for document_transition_action in document_transition_actions { + if matches!( + document_transition_action, + DocumentTransitionAction::BumpIdentityDataContractNonce(_) + ) { + continue; + } let data_trigger_execution_result = document_transition_action .validate_with_data_triggers(&data_trigger_bindings, context, platform_version)?; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/fetch_documents.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/fetch_documents.rs index 1b55ac6a673..e61e0bdc37e 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/fetch_documents.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/fetch_documents.rs @@ -25,6 +25,8 @@ use drive::grovedb::TransactionArg; use drive::query::{DriveQuery, InternalClauses, WhereClause, WhereOperator}; #[allow(dead_code)] +#[deprecated(note = "This function is marked as unused.")] +#[allow(deprecated)] pub(crate) fn fetch_documents_for_transitions( platform: &PlatformStateRef, document_transitions: &[&DocumentTransition], @@ -82,7 +84,7 @@ pub(crate) fn fetch_documents_for_transitions_knowing_contract_id_and_document_t let add_to_cache_if_pulled = transaction.is_some(); let (_, contract_fetch_info) = drive.get_contract_with_fetch_info_and_fee( contract_id.to_buffer(), - Some(&platform.state.epoch()), + Some(platform.state.last_committed_block_epoch_ref()), add_to_cache_if_pulled, transaction, platform_version, diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/mod.rs index 066402e2c09..ad7ed837616 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/mod.rs @@ -1,5 +1,8 @@ +use dpp::block::block_info::BlockInfo; +use dpp::block::epoch::Epoch; +use dpp::consensus::ConsensusError; +use dpp::consensus::state::state_error::StateError; use dpp::prelude::ConsensusValidationResult; -use dpp::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; use dpp::state_transition::StateTransitionLike; use drive::state_transition_action::StateTransitionAction; @@ -7,15 +10,20 @@ use dpp::version::{DefaultForPlatformVersion, PlatformVersion}; use drive::grovedb::TransactionArg; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; use drive::state_transition_action::document::documents_batch::DocumentsBatchTransitionAction; +use drive::state_transition_action::system::bump_identity_data_contract_nonce_action::BumpIdentityDataContractNonceAction; use crate::error::Error; +use crate::error::execution::ExecutionError; use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use crate::execution::validation::state_transition::documents_batch::action_validation::document_create_transition_action::DocumentCreateTransitionActionValidation; use crate::execution::validation::state_transition::documents_batch::action_validation::document_delete_transition_action::DocumentDeleteTransitionActionValidation; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_purchase_transition_action::DocumentPurchaseTransitionActionValidation; use crate::execution::validation::state_transition::documents_batch::action_validation::document_replace_transition_action::DocumentReplaceTransitionActionValidation; -use crate::execution::validation::state_transition::documents_batch::data_triggers::DataTriggerExecutionContext; -use crate::execution::validation::state_transition::documents_batch::state::v0::data_triggers::execute_data_triggers; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_transfer_transition_action::DocumentTransferTransitionActionValidation; +use crate::execution::validation::state_transition::documents_batch::action_validation::document_update_price_transition_action::DocumentUpdatePriceTransitionActionValidation; +use crate::execution::validation::state_transition::documents_batch::data_triggers::{data_trigger_bindings_list, DataTriggerExecutionContext, DataTriggerExecutor}; use crate::platform_types::platform::{PlatformStateRef}; use crate::execution::validation::state_transition::state_transitions::documents_batch::transformer::v0::DocumentsBatchTransitionTransformerV0; +use crate::execution::validation::state_transition::ValidationMode; mod data_triggers; pub mod fetch_documents; @@ -26,6 +34,8 @@ pub(in crate::execution::validation::state_transition::state_transitions::docume &self, action: DocumentsBatchTransitionAction, platform: &PlatformStateRef, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error>; @@ -33,7 +43,8 @@ pub(in crate::execution::validation::state_transition::state_transitions::docume fn transform_into_action_v0( &self, platform: &PlatformStateRef, - validate: bool, + block_info: &BlockInfo, + validation_mode: ValidationMode, tx: TransactionArg, ) -> Result, Error>; } @@ -41,8 +52,10 @@ pub(in crate::execution::validation::state_transition::state_transitions::docume impl DocumentsBatchStateTransitionStateValidationV0 for DocumentsBatchTransition { fn validate_state_v0( &self, - state_transition_action: DocumentsBatchTransitionAction, + mut state_transition_action: DocumentsBatchTransitionAction, platform: &PlatformStateRef, + epoch: &Epoch, + execution_context: &mut StateTransitionExecutionContext, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error> { @@ -53,40 +66,144 @@ impl DocumentsBatchStateTransitionStateValidationV0 for DocumentsBatchTransition let owner_id = state_transition_action.owner_id(); + let mut validated_transitions = vec![]; + + let data_trigger_bindings = if platform.config.execution.use_document_triggers { + data_trigger_bindings_list(platform_version)? + } else { + vec![] + }; + // Next we need to validate the structure of all actions (this means with the data contract) - for transition in state_transition_action.transitions() { - let transition_validation_result = match transition { + for transition in state_transition_action.transitions_take() { + let transition_validation_result = match &transition { DocumentTransitionAction::CreateAction(create_action) => create_action - .validate_state(platform, owner_id, transaction, platform_version)?, + .validate_state( + platform, + owner_id, + epoch, + execution_context, + transaction, + platform_version, + )?, DocumentTransitionAction::ReplaceAction(replace_action) => replace_action - .validate_state(platform, owner_id, transaction, platform_version)?, + .validate_state( + platform, + owner_id, + epoch, + execution_context, + transaction, + platform_version, + )?, + DocumentTransitionAction::TransferAction(transfer_action) => transfer_action + .validate_state( + platform, + owner_id, + epoch, + execution_context, + transaction, + platform_version, + )?, DocumentTransitionAction::DeleteAction(delete_action) => delete_action - .validate_state(platform, owner_id, transaction, platform_version)?, + .validate_state( + platform, + owner_id, + epoch, + execution_context, + transaction, + platform_version, + )?, + DocumentTransitionAction::UpdatePriceAction(update_price_action) => { + update_price_action.validate_state( + platform, + owner_id, + epoch, + execution_context, + transaction, + platform_version, + )? + } + DocumentTransitionAction::PurchaseAction(purchase_action) => purchase_action + .validate_state( + platform, + owner_id, + epoch, + execution_context, + transaction, + platform_version, + )?, + DocumentTransitionAction::BumpIdentityDataContractNonce(..) => { + return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( + "we should never start with a bump identity data contract nonce", + ))); + } }; if !transition_validation_result.is_valid() { + // If a state transition isn't valid we still need to bump the identity data contract nonce validation_result.add_errors(transition_validation_result.errors); + validated_transitions.push( + DocumentTransitionAction::BumpIdentityDataContractNonce( + BumpIdentityDataContractNonceAction::from_document_base_transition_action( + transition.base_owned().ok_or(Error::Execution( + ExecutionError::CorruptedCodeExecution( + "base should always exist on transition", + ), + ))?, + owner_id, + state_transition_action.user_fee_increase(), + ), + ), + ); + } else if platform.config.execution.use_document_triggers { + // we should also validate document triggers + let data_trigger_execution_context = DataTriggerExecutionContext { + platform, + transaction, + owner_id: &self.owner_id(), + state_transition_execution_context: &state_transition_execution_context, + }; + let data_trigger_execution_result = transition.validate_with_data_triggers( + &data_trigger_bindings, + &data_trigger_execution_context, + platform_version, + )?; - return Ok(validation_result); + if !data_trigger_execution_result.is_valid() { + tracing::debug!( + "{:?} state transition data trigger was not valid, errors are {:?}", + transition, + data_trigger_execution_result.errors, + ); + // If a state transition isn't valid because of data triggers we still need + // to bump the identity data contract nonce + let consensus_errors: Vec = data_trigger_execution_result + .errors + .into_iter() + .map(|e| ConsensusError::StateError(StateError::DataTriggerError(e))) + .collect(); + validation_result.add_errors(consensus_errors); + validated_transitions + .push(DocumentTransitionAction::BumpIdentityDataContractNonce( + BumpIdentityDataContractNonceAction::from_document_base_transition_action( + transition.base_owned().ok_or(Error::Execution( + ExecutionError::CorruptedCodeExecution( + "base should always exist on transition", + ), + ))?, + owner_id, + state_transition_action.user_fee_increase(), + ), + )); + } else { + validated_transitions.push(transition); + } + } else { + validated_transitions.push(transition); } } - let data_trigger_execution_context = DataTriggerExecutionContext { - platform, - transaction, - owner_id: &self.owner_id(), - state_transition_execution_context: &state_transition_execution_context, - }; - - if platform.config.execution.use_document_triggers { - let data_triggers_validation_result = execute_data_triggers( - state_transition_action.transitions(), - &data_trigger_execution_context, - platform.state.current_platform_version()?, - )?; - - validation_result.add_errors_into(data_triggers_validation_result.errors); - } + state_transition_action.set_transitions(validated_transitions); validation_result.set_data(state_transition_action.into()); @@ -96,14 +213,23 @@ impl DocumentsBatchStateTransitionStateValidationV0 for DocumentsBatchTransition fn transform_into_action_v0( &self, platform: &PlatformStateRef, - validate: bool, + block_info: &BlockInfo, + validation_mode: ValidationMode, tx: TransactionArg, ) -> Result, Error> { let platform_version = platform.state.current_platform_version()?; + let mut execution_context = StateTransitionExecutionContext::default_for_platform_version(platform_version)?; - let validation_result = - self.try_into_action_v0(platform, validate, tx, &mut execution_context)?; + + let validation_result = self.try_into_action_v0( + platform, + block_info, + validation_mode.should_validate_document_valid_against_state(), + tx, + &mut execution_context, + )?; + Ok(validation_result.map(Into::into)) } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/transformer/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/transformer/v0/mod.rs index c7b8a06bd22..a191567e56f 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/transformer/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/transformer/v0/mod.rs @@ -14,18 +14,26 @@ use dpp::consensus::state::document::invalid_document_revision_error::InvalidDoc use dpp::consensus::state::state_error::StateError; use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::block::block_info::BlockInfo; +use dpp::consensus::state::document::document_incorrect_purchase_price_error::DocumentIncorrectPurchasePriceError; +use dpp::consensus::state::document::document_not_for_sale_error::DocumentNotForSaleError; +use dpp::document::property_names::PRICE; use dpp::document::{Document, DocumentV0Getters}; +use dpp::fee::Credits; +use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; +use dpp::prelude::Revision; use dpp::validation::SimpleConsensusValidationResult; use dpp::{consensus::ConsensusError, prelude::Identifier, validation::ConsensusValidationResult}; -use dpp::state_transition::documents_batch_transition::{DocumentsBatchTransition}; +use dpp::state_transition::documents_batch_transition::DocumentsBatchTransition; use dpp::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; use dpp::state_transition::documents_batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods; -use dpp::state_transition::documents_batch_transition::document_transition::{DocumentTransition, DocumentReplaceTransition, DocumentTransitionV0Methods}; +use dpp::state_transition::documents_batch_transition::document_transition::{DocumentTransition, DocumentTransitionV0Methods}; +use dpp::state_transition::documents_batch_transition::document_transition::document_purchase_transition::v0::v0_methods::DocumentPurchaseTransitionV0Methods; use dpp::state_transition::StateTransitionLike; use drive::state_transition_action::document::documents_batch::document_transition::document_create_transition_action::DocumentCreateTransitionAction; use drive::state_transition_action::document::documents_batch::document_transition::document_delete_transition_action::DocumentDeleteTransitionAction; -use drive::state_transition_action::document::documents_batch::document_transition::document_replace_transition_action::{DocumentReplaceTransitionAction, DocumentReplaceTransitionActionAccessorsV0}; +use drive::state_transition_action::document::documents_batch::document_transition::document_replace_transition_action::DocumentReplaceTransitionAction; use drive::state_transition_action::document::documents_batch::document_transition::DocumentTransitionAction; use drive::state_transition_action::document::documents_batch::DocumentsBatchTransitionAction; use drive::state_transition_action::document::documents_batch::v0::DocumentsBatchTransitionActionV0; @@ -35,16 +43,22 @@ use dpp::version::PlatformVersion; use drive::grovedb::TransactionArg; use dpp::state_transition::documents_batch_transition::document_transition::document_replace_transition::v0::v0_methods::DocumentReplaceTransitionV0Methods; +use dpp::state_transition::documents_batch_transition::document_transition::document_transfer_transition::v0::v0_methods::DocumentTransferTransitionV0Methods; +use dpp::state_transition::documents_batch_transition::document_transition::document_update_price_transition::v0::v0_methods::DocumentUpdatePriceTransitionV0Methods; use drive::drive::contract::DataContractFetchInfo; -use drive::state_transition_action::document::documents_batch::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; -use crate::execution::types::state_transition_execution_context::{StateTransitionExecutionContext}; +use drive::state_transition_action::document::documents_batch::document_transition::document_purchase_transition_action::DocumentPurchaseTransitionAction; +use drive::state_transition_action::document::documents_batch::document_transition::document_transfer_transition_action::DocumentTransferTransitionAction; +use drive::state_transition_action::document::documents_batch::document_transition::document_update_price_transition_action::DocumentUpdatePriceTransitionAction; +use drive::state_transition_action::system::bump_identity_data_contract_nonce_action::BumpIdentityDataContractNonceAction; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; pub(in crate::execution::validation::state_transition::state_transitions::documents_batch) trait DocumentsBatchTransitionTransformerV0 { fn try_into_action_v0( &self, platform: &PlatformStateRef, - validate: bool, + block_info: &BlockInfo, + full_validation: bool, transaction: TransactionArg, execution_context: &mut StateTransitionExecutionContext, ) -> Result, Error>; @@ -53,7 +67,8 @@ pub(in crate::execution::validation::state_transition::state_transitions::docume trait DocumentsBatchTransitionInternalTransformerV0 { fn transform_document_transitions_within_contract_v0( platform: &PlatformStateRef, - validate: bool, + block_info: &BlockInfo, + full_validation: bool, data_contract_id: &Identifier, owner_id: Identifier, document_transitions: &BTreeMap<&String, Vec<&DocumentTransition>>, @@ -63,7 +78,8 @@ trait DocumentsBatchTransitionInternalTransformerV0 { ) -> Result>, Error>; fn transform_document_transitions_within_document_type_v0( platform: &PlatformStateRef, - validate: bool, + block_info: &BlockInfo, + full_validation: bool, data_contract_fetch_info: Arc, document_type_name: &str, owner_id: Identifier, @@ -73,8 +89,9 @@ trait DocumentsBatchTransitionInternalTransformerV0 { platform_version: &PlatformVersion, ) -> Result>, Error>; /// The data contract can be of multiple difference versions - fn transform_transition_v0<'a>( - validate: bool, + fn transform_transition_v0( + full_validation: bool, + block_info: &BlockInfo, data_contract_fetch_info: Arc, transition: &DocumentTransition, replaced_documents: &[Document], @@ -85,12 +102,13 @@ trait DocumentsBatchTransitionInternalTransformerV0 { fetched_documents: &'a [Document], ) -> ConsensusValidationResult<&'a Document>; fn check_ownership_of_old_replaced_document_v0( - document_transition: &DocumentReplaceTransition, + document_id: Identifier, fetched_document: &Document, owner_id: &Identifier, ) -> SimpleConsensusValidationResult; fn check_revision_is_bumped_by_one_during_replace_v0( - document_transition: &DocumentReplaceTransition, + transition_revision: Revision, + document_id: Identifier, original_document: &Document, ) -> SimpleConsensusValidationResult; } @@ -99,11 +117,13 @@ impl DocumentsBatchTransitionTransformerV0 for DocumentsBatchTransition { fn try_into_action_v0( &self, platform: &PlatformStateRef, - validate: bool, + block_info: &BlockInfo, + validate_against_state: bool, transaction: TransactionArg, execution_context: &mut StateTransitionExecutionContext, ) -> Result, Error> { let owner_id = self.owner_id(); + let user_fee_increase = self.user_fee_increase(); let platform_version = platform.state.current_platform_version()?; let mut transitions_by_contracts_and_types: BTreeMap< &Identifier, @@ -139,7 +159,8 @@ impl DocumentsBatchTransitionTransformerV0 for DocumentsBatchTransition { |(data_contract_id, document_transitions_by_document_type)| { Self::transform_document_transitions_within_contract_v0( platform, - validate, + block_info, + validate_against_state, data_contract_id, owner_id, document_transitions_by_document_type, @@ -152,14 +173,17 @@ impl DocumentsBatchTransitionTransformerV0 for DocumentsBatchTransition { .collect::>>, Error>>()?; let validation_result = ConsensusValidationResult::flatten(validation_result); - if validation_result.is_valid() { + if validation_result.has_data() { + let (transitions, errors) = validation_result.into_data_and_errors()?; let batch_transition_action = DocumentsBatchTransitionActionV0 { owner_id, - transitions: validation_result.into_data()?, + transitions, + user_fee_increase, } .into(); - Ok(ConsensusValidationResult::new_with_data( + Ok(ConsensusValidationResult::new_with_data_and_errors( batch_transition_action, + errors, )) } else { Ok(ConsensusValidationResult::new_with_errors( @@ -172,7 +196,8 @@ impl DocumentsBatchTransitionTransformerV0 for DocumentsBatchTransition { impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition { fn transform_document_transitions_within_contract_v0( platform: &PlatformStateRef, - validate: bool, + block_info: &BlockInfo, + validate_against_state: bool, data_contract_id: &Identifier, owner_id: Identifier, document_transitions: &BTreeMap<&String, Vec<&DocumentTransition>>, @@ -205,7 +230,8 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition .map(|(document_type_name, document_transitions)| { Self::transform_document_transitions_within_document_type_v0( platform, - validate, + block_info, + validate_against_state, data_contract_fetch_info.clone(), document_type_name, owner_id, @@ -222,7 +248,8 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition fn transform_document_transitions_within_document_type_v0( platform: &PlatformStateRef, - validate: bool, + block_info: &BlockInfo, + validate_against_state: bool, data_contract_fetch_info: Arc, document_type_name: &str, owner_id: Identifier, @@ -250,15 +277,23 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition )); }; - let replace_transitions = document_transitions + let replace_and_transfer_transitions = document_transitions .iter() - .filter(|transition| matches!(transition, DocumentTransition::Replace(_))) + .filter(|transition| { + matches!( + transition, + DocumentTransition::Replace(_) + | DocumentTransition::Transfer(_) + | DocumentTransition::Purchase(_) + | DocumentTransition::UpdatePrice(_) + ) + }) .copied() .collect::>(); - // We fetch documents only for replace transitions + // We fetch documents only for replace and transfer transitions // since we need them to create transition actions - // Below we also perform state validation for replace transitions only + // Below we also perform state validation for replace and transfer transitions only // other transitions are validated in their validate_state functions // TODO: Think more about this architecture let fetched_documents_validation_result = @@ -266,7 +301,7 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition platform.drive, data_contract, document_type, - replace_transitions.as_slice(), + replace_and_transfer_transitions.as_slice(), transaction, platform_version, )?; @@ -279,13 +314,14 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition let replaced_documents = fetched_documents_validation_result.into_data()?; - let document_transition_actions_result = if !dry_run { + Ok(if !dry_run { let document_transition_actions_validation_result = document_transitions .iter() .map(|transition| { // we validate every transition in this document type Self::transform_transition_v0( - validate, + validate_against_state, + block_info, data_contract_fetch_info.clone(), transition, &replaced_documents, @@ -305,22 +341,13 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition result } else { ConsensusValidationResult::default() - }; - - if !document_transition_actions_result.is_valid() { - return Ok(document_transition_actions_result); - } - - let document_transition_actions = document_transition_actions_result.into_data()?; - - Ok(ConsensusValidationResult::new_with_data( - document_transition_actions, - )) + }) } /// The data contract can be of multiple difference versions fn transform_transition_v0<'a>( - validate: bool, + validate_against_state: bool, + block_info: &BlockInfo, data_contract_fetch_info: Arc, transition: &DocumentTransition, replaced_documents: &[Document], @@ -330,9 +357,10 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition DocumentTransition::Create(document_create_transition) => { let result = ConsensusValidationResult::::new(); - let document_create_action = DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup(document_create_transition, |_identifier| { - Ok(data_contract_fetch_info.clone()) - })?; + let document_create_action = DocumentCreateTransitionAction::from_document_borrowed_create_transition_with_contract_lookup( + document_create_transition, block_info, |_identifier| { + Ok(data_contract_fetch_info.clone()) + })?; if result.is_valid() { Ok(DocumentTransitionAction::CreateAction(document_create_action).into()) @@ -347,8 +375,18 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition Self::find_replaced_document_v0(transition, replaced_documents); if !validation_result.is_valid_with_data() { - result.merge(validation_result); - return Ok(result); + // We can set the user fee increase to 0 here because it is decided by the Documents Batch instead + let bump_action = + BumpIdentityDataContractNonceAction::from_borrowed_document_base_transition( + document_replace_transition.base(), + owner_id, + 0, + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action.into(), + validation_result.errors, + )); } let original_document = validation_result.into_data()?; @@ -357,8 +395,22 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition // In this case we don't care about the created at let original_document_created_at = original_document.created_at(); + let original_document_created_at_block_height = + original_document.created_at_block_height(); + + let original_document_created_at_core_block_height = + original_document.created_at_core_block_height(); + + let original_document_transferred_at = original_document.transferred_at(); + + let original_document_transferred_at_block_height = + original_document.transferred_at_block_height(); + + let original_document_transferred_at_core_block_height = + original_document.transferred_at_core_block_height(); + let validation_result = Self::check_ownership_of_old_replaced_document_v0( - document_replace_transition, + document_replace_transition.base().id(), original_document, &owner_id, ); @@ -368,12 +420,13 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition return Ok(result); } - if validate { + if validate_against_state { //there are situations where we don't want to validate this against the state // for example when we already applied the state transition action // and we are just validating it happened let validation_result = Self::check_revision_is_bumped_by_one_during_replace_v0( - document_replace_transition, + document_replace_transition.revision(), + document_replace_transition.base().id(), original_document, ); @@ -387,6 +440,12 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition DocumentReplaceTransitionAction::try_from_borrowed_document_replace_transition( document_replace_transition, original_document_created_at, + original_document_created_at_block_height, + original_document_created_at_core_block_height, + original_document_transferred_at, + original_document_transferred_at_block_height, + original_document_transferred_at_core_block_height, + block_info, |_identifier| Ok(data_contract_fetch_info.clone()), )?; @@ -402,6 +461,182 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition })?; Ok(DocumentTransitionAction::DeleteAction(action).into()) } + DocumentTransition::Transfer(document_transfer_transition) => { + let mut result = ConsensusValidationResult::::new(); + + let validation_result = + Self::find_replaced_document_v0(transition, replaced_documents); + + if !validation_result.is_valid_with_data() { + result.merge(validation_result); + return Ok(result); + } + + let original_document = validation_result.into_data()?; + + let validation_result = Self::check_ownership_of_old_replaced_document_v0( + document_transfer_transition.base().id(), + original_document, + &owner_id, + ); + + if !validation_result.is_valid() { + result.merge(validation_result); + return Ok(result); + } + + if validate_against_state { + //there are situations where we don't want to validate this against the state + // for example when we already applied the state transition action + // and we are just validating it happened + let validation_result = Self::check_revision_is_bumped_by_one_during_replace_v0( + document_transfer_transition.revision(), + document_transfer_transition.base().id(), + original_document, + ); + + if !validation_result.is_valid() { + result.merge(validation_result); + return Ok(result); + } + } + + let document_transfer_action = + DocumentTransferTransitionAction::try_from_borrowed_document_transfer_transition( + document_transfer_transition, + original_document.clone(), //todo: remove clone + block_info, + |_identifier| Ok(data_contract_fetch_info.clone()), + )?; + + if result.is_valid() { + Ok(DocumentTransitionAction::TransferAction(document_transfer_action).into()) + } else { + Ok(result) + } + } + DocumentTransition::UpdatePrice(document_update_price_transition) => { + let mut result = ConsensusValidationResult::::new(); + + let validation_result = + Self::find_replaced_document_v0(transition, replaced_documents); + + if !validation_result.is_valid_with_data() { + result.merge(validation_result); + return Ok(result); + } + + let original_document = validation_result.into_data()?; + + let validation_result = Self::check_ownership_of_old_replaced_document_v0( + document_update_price_transition.base().id(), + original_document, + &owner_id, + ); + + if !validation_result.is_valid() { + result.merge(validation_result); + return Ok(result); + } + + if validate_against_state { + //there are situations where we don't want to validate this against the state + // for example when we already applied the state transition action + // and we are just validating it happened + let validation_result = Self::check_revision_is_bumped_by_one_during_replace_v0( + document_update_price_transition.revision(), + document_update_price_transition.base().id(), + original_document, + ); + + if !validation_result.is_valid() { + result.merge(validation_result); + return Ok(result); + } + } + + let document_update_price_action = + DocumentUpdatePriceTransitionAction::try_from_borrowed_document_update_price_transition( + document_update_price_transition, + original_document.clone(), //todo: find a way to not have to use cloning + block_info, + |_identifier| Ok(data_contract_fetch_info.clone()), + )?; + + if result.is_valid() { + Ok( + DocumentTransitionAction::UpdatePriceAction(document_update_price_action) + .into(), + ) + } else { + Ok(result) + } + } + DocumentTransition::Purchase(document_purchase_transition) => { + let mut result = ConsensusValidationResult::::new(); + + let validation_result = + Self::find_replaced_document_v0(transition, replaced_documents); + + if !validation_result.is_valid_with_data() { + result.merge(validation_result); + return Ok(result); + } + + let original_document = validation_result.into_data()?; + + let Some(listed_price) = original_document + .properties() + .get_optional_integer::(PRICE)? + else { + result.add_error(StateError::DocumentNotForSaleError( + DocumentNotForSaleError::new(original_document.id()), + )); + return Ok(result); + }; + + if listed_price != document_purchase_transition.price() { + result.add_error(StateError::DocumentIncorrectPurchasePriceError( + DocumentIncorrectPurchasePriceError::new( + original_document.id(), + document_purchase_transition.price(), + listed_price, + ), + )); + return Ok(result); + } + + if validate_against_state { + //there are situations where we don't want to validate this against the state + // for example when we already applied the state transition action + // and we are just validating it happened + let validation_result = Self::check_revision_is_bumped_by_one_during_replace_v0( + document_purchase_transition.revision(), + document_purchase_transition.base().id(), + original_document, + ); + + if !validation_result.is_valid() { + result.merge(validation_result); + return Ok(result); + } + } + + let document_purchase_action = + DocumentPurchaseTransitionAction::try_from_borrowed_document_purchase_transition( + document_purchase_transition, + original_document.clone(), //todo: find a way to not have to use cloning + owner_id, + block_info, + |_identifier| Ok(data_contract_fetch_info.clone()), + )?; + + if result.is_valid() { + Ok(DocumentTransitionAction::PurchaseAction(document_purchase_action).into()) + } else { + Ok(result) + } + } } } @@ -425,7 +660,7 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition } fn check_ownership_of_old_replaced_document_v0( - document_transition: &DocumentReplaceTransition, + document_id: Identifier, fetched_document: &Document, owner_id: &Identifier, ) -> SimpleConsensusValidationResult { @@ -433,7 +668,7 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition if fetched_document.owner_id() != owner_id { result.add_error(ConsensusError::StateError( StateError::DocumentOwnerIdMismatchError(DocumentOwnerIdMismatchError::new( - document_transition.base().id(), + document_id, owner_id.to_owned(), fetched_document.owner_id(), )), @@ -442,33 +677,32 @@ impl DocumentsBatchTransitionInternalTransformerV0 for DocumentsBatchTransition result } fn check_revision_is_bumped_by_one_during_replace_v0( - document_transition: &DocumentReplaceTransition, + transition_revision: Revision, + document_id: Identifier, original_document: &Document, ) -> SimpleConsensusValidationResult { let mut result = SimpleConsensusValidationResult::default(); - let revision = document_transition.revision(); - // If there was no previous revision this means that the document_type is not update-able // However this should have been caught earlier let Some(previous_revision) = original_document.revision() else { result.add_error(ConsensusError::StateError( StateError::InvalidDocumentRevisionError(InvalidDocumentRevisionError::new( - document_transition.base().id(), + document_id, None, - revision, + transition_revision, )), )); return result; }; // no need to check bounds here, because it would be impossible to hit the end on a u64 let expected_revision = previous_revision + 1; - if revision != expected_revision { + if transition_revision != expected_revision { result.add_error(ConsensusError::StateError( StateError::InvalidDocumentRevisionError(InvalidDocumentRevisionError::new( - document_transition.base().id(), + document_id, Some(previous_revision), - revision, + transition_revision, )), )) } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/structure/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/advanced_structure/mod.rs similarity index 100% rename from packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/structure/mod.rs rename to packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/advanced_structure/mod.rs diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/advanced_structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/advanced_structure/v0/mod.rs new file mode 100644 index 00000000000..10ccad492ba --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/advanced_structure/v0/mod.rs @@ -0,0 +1,144 @@ +use crate::error::Error; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::execution::validation::state_transition::identity_create::identity_and_signatures::v0::IdentityCreateStateTransitionIdentityAndSignaturesValidationV0; +use dpp::consensus::basic::invalid_identifier_error::InvalidIdentifierError; +use dpp::consensus::basic::BasicError; +use dpp::consensus::ConsensusError; +use dpp::identity::state_transition::AssetLockProved; +use dpp::state_transition::identity_create_transition::accessors::IdentityCreateTransitionAccessorsV0; +use dpp::state_transition::identity_create_transition::IdentityCreateTransition; +use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; +use dpp::validation::ConsensusValidationResult; +use dpp::version::PlatformVersion; +use dpp::ProtocolError; +use drive::state_transition_action::identity::identity_create::IdentityCreateTransitionAction; +use drive::state_transition_action::system::partially_use_asset_lock_action::PartiallyUseAssetLockAction; +use drive::state_transition_action::StateTransitionAction; + +pub(in crate::execution::validation::state_transition::state_transitions::identity_create) trait IdentityCreateStateTransitionAdvancedStructureValidationV0 +{ + fn validate_advanced_structure_from_state_v0( + &self, + action: &IdentityCreateTransitionAction, + signable_bytes: Vec, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error>; +} + +impl IdentityCreateStateTransitionAdvancedStructureValidationV0 for IdentityCreateTransition { + fn validate_advanced_structure_from_state_v0( + &self, + action: &IdentityCreateTransitionAction, + signable_bytes: Vec, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + // We should validate that the identity id is created from the asset lock proof + + // We don't need to return a consensus error here because the outpoint will already have been checked in the transformation into an action + let identifier_from_outpoint = self.asset_lock_proof().create_identifier()?; + + // Creating an identifier costs 1 block hash (64 bytes) + // The cost should come here after, as the protocol error is just if no outpoint exists + + execution_context.add_operation(ValidationOperation::DoubleSha256(1)); + + if identifier_from_outpoint != self.identity_id() { + let penalty = platform_version + .drive_abci + .validation_and_processing + .penalties + .identity_id_not_correct; + + let used_credits = penalty + .checked_add(execution_context.fee_cost(platform_version)?.processing_fee) + .ok_or(ProtocolError::Overflow("processing fee overflow error"))?; + + // Most probably an attempted attack + let bump_action = StateTransitionAction::PartiallyUseAssetLockAction( + PartiallyUseAssetLockAction::from_borrowed_identity_create_transition_action( + action, + used_credits, + ), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![ConsensusError::BasicError( + BasicError::InvalidIdentifierError(InvalidIdentifierError::new( + "identity_id".to_string(), + "does not match created identifier from asset lock".to_string(), + )), + )], + )); + } + + let validation_result = + IdentityPublicKeyInCreation::validate_identity_public_keys_structure( + self.public_keys(), + true, + platform_version, + ) + .map_err(Error::Protocol)?; + + if !validation_result.is_valid() { + let penalty = platform_version + .drive_abci + .validation_and_processing + .penalties + .validation_of_added_keys_structure_failure; + + let used_credits = penalty + .checked_add(execution_context.fee_cost(platform_version)?.processing_fee) + .ok_or(ProtocolError::Overflow("processing fee overflow error"))?; + + let bump_action = StateTransitionAction::PartiallyUseAssetLockAction( + PartiallyUseAssetLockAction::from_borrowed_identity_create_transition_action( + action, + used_credits, + ), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + validation_result.errors, + )); + } + + // Now we should validate proof of possession + let validation_result = self.validate_identity_create_state_transition_signatures_v0( + signable_bytes, + execution_context, + ); + + if !validation_result.is_valid() { + let penalty = platform_version + .drive_abci + .validation_and_processing + .penalties + .validation_of_added_keys_proof_of_possession_failure; + + let used_credits = penalty + .checked_add(execution_context.fee_cost(platform_version)?.processing_fee) + .ok_or(ProtocolError::Overflow("processing fee overflow error"))?; + + let bump_action = StateTransitionAction::PartiallyUseAssetLockAction( + PartiallyUseAssetLockAction::from_borrowed_identity_create_transition_action( + action, + used_credits, + ), + ); + + Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + validation_result.errors, + )) + } else { + Ok(ConsensusValidationResult::new()) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/state/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/basic_structure/mod.rs similarity index 100% rename from packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/state/mod.rs rename to packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/basic_structure/mod.rs diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/basic_structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/basic_structure/v0/mod.rs new file mode 100644 index 00000000000..9ac16266842 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/basic_structure/v0/mod.rs @@ -0,0 +1,54 @@ +use crate::error::Error; +use dpp::consensus::state::identity::max_identity_public_key_limit_reached_error::MaxIdentityPublicKeyLimitReachedError; +use dpp::consensus::state::state_error::StateError; +use dpp::identity::state_transition::AssetLockProved; +use dpp::state_transition::identity_create_transition::accessors::IdentityCreateTransitionAccessorsV0; +use dpp::state_transition::identity_create_transition::IdentityCreateTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; + +pub(in crate::execution::validation::state_transition::state_transitions::identity_create) trait IdentityCreateStateTransitionBasicStructureValidationV0 +{ + fn validate_basic_structure_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl IdentityCreateStateTransitionBasicStructureValidationV0 for IdentityCreateTransition { + fn validate_basic_structure_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result { + let result = self + .asset_lock_proof() + .validate_structure(platform_version)?; + + if !result.is_valid() { + return Ok(result); + } + + if self.public_keys().len() + > platform_version + .dpp + .state_transitions + .identities + .max_public_keys_in_creation as usize + { + Ok(SimpleConsensusValidationResult::new_with_error( + StateError::MaxIdentityPublicKeyLimitReachedError( + MaxIdentityPublicKeyLimitReachedError::new( + platform_version + .dpp + .state_transitions + .identities + .max_public_keys_in_creation as usize, + ), + ) + .into(), + )) + } else { + Ok(SimpleConsensusValidationResult::new()) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/identity_and_signatures/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/identity_and_signatures/v0/mod.rs index 4ab68979bac..5d09fedb7ee 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/identity_and_signatures/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/identity_and_signatures/v0/mod.rs @@ -1,11 +1,8 @@ -use crate::error::Error; -use dpp::consensus::basic::identity::IdentityAssetLockTransactionOutputNotFoundError; -use dpp::consensus::basic::invalid_identifier_error::InvalidIdentifierError; -use dpp::consensus::basic::BasicError; -use dpp::consensus::ConsensusError; -use dpp::identity::state_transition::AssetLockProved; - -use dpp::prelude::ConsensusValidationResult; +use crate::execution::types::execution_operation::signature_verification_operation::SignatureVerificationOperation; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; use dpp::serialization::PlatformMessageSignable; use dpp::state_transition::identity_create_transition::accessors::IdentityCreateTransitionAccessorsV0; use dpp::state_transition::identity_create_transition::IdentityCreateTransition; @@ -16,58 +13,30 @@ pub(crate) trait IdentityCreateStateTransitionIdentityAndSignaturesValidationV0 fn validate_identity_create_state_transition_signatures_v0( &self, signable_bytes: Vec, - ) -> Result; + execution_context: &mut StateTransitionExecutionContext, + ) -> SimpleConsensusValidationResult; } impl IdentityCreateStateTransitionIdentityAndSignaturesValidationV0 for IdentityCreateTransition { fn validate_identity_create_state_transition_signatures_v0( &self, signable_bytes: Vec, - ) -> Result { - let mut validation_result = SimpleConsensusValidationResult::default(); + execution_context: &mut StateTransitionExecutionContext, + ) -> SimpleConsensusValidationResult { for key in self.public_keys().iter() { let result = signable_bytes.as_slice().verify_signature( key.key_type(), key.data().as_slice(), key.signature().as_slice(), - )?; + ); + execution_context.add_operation(ValidationOperation::SignatureVerification( + SignatureVerificationOperation::new(key.key_type()), + )); if !result.is_valid() { - validation_result.add_errors(result.errors); - } - } - - if !validation_result.is_valid() { - return Ok(validation_result); - } - - // We should validate that the identity id is created from the asset lock proof - - let identifier_from_outpoint = match self.asset_lock_proof().create_identifier() { - Ok(identifier) => identifier, - Err(_) => { - return Ok(ConsensusValidationResult::new_with_error( - ConsensusError::BasicError( - BasicError::IdentityAssetLockTransactionOutputNotFoundError( - IdentityAssetLockTransactionOutputNotFoundError::new( - self.asset_lock_proof().output_index() as usize, - ), - ), - ), - )) + return result; } - }; - - if identifier_from_outpoint != self.identity_id() { - return Ok(ConsensusValidationResult::new_with_error( - ConsensusError::BasicError(BasicError::InvalidIdentifierError( - InvalidIdentifierError::new( - "identity_id".to_string(), - "does not match created identifier from asset lock".to_string(), - ), - )), - )); } - Ok(validation_result) + SimpleConsensusValidationResult::new() } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/mod.rs index ad40672612a..f68781b6b13 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/mod.rs @@ -1,18 +1,16 @@ +mod advanced_structure; +mod basic_structure; pub(crate) mod identity_and_signatures; mod state; -mod structure; use crate::error::Error; use crate::error::execution::ExecutionError; +use crate::execution::validation::state_transition::identity_create::basic_structure::v0::IdentityCreateStateTransitionBasicStructureValidationV0; use crate::execution::validation::state_transition::identity_create::state::v0::IdentityCreateStateTransitionStateValidationV0; -use crate::execution::validation::state_transition::identity_create::structure::v0::IdentityCreateStateTransitionStructureValidationV0; -use crate::execution::validation::state_transition::processor::v0::{ - StateTransitionStateValidationV0, StateTransitionStructureValidationV0, -}; -use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; -use crate::platform_types::platform::{PlatformRef, PlatformStateRef}; +use crate::execution::validation::state_transition::processor::v0::StateTransitionBasicStructureValidationV0; +use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; @@ -22,15 +20,34 @@ use dpp::state_transition::identity_create_transition::IdentityCreateTransition; use dpp::validation::SimpleConsensusValidationResult; use dpp::version::PlatformVersion; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::identity_create::advanced_structure::v0::IdentityCreateStateTransitionAdvancedStructureValidationV0; +use crate::execution::validation::state_transition::ValidationMode; use drive::grovedb::TransactionArg; +use drive::state_transition_action::identity::identity_create::IdentityCreateTransitionAction; use drive::state_transition_action::StateTransitionAction; -impl StateTransitionActionTransformerV0 for IdentityCreateTransition { - fn transform_into_action( +/// A trait for transforming into an action for the identity create transition +pub trait StateTransitionActionTransformerForIdentityCreateTransitionV0 { + /// Transforming into the action + fn transform_into_action_for_identity_create_transition( &self, platform: &PlatformRef, - _validate: bool, - _tx: TransactionArg, + signable_bytes: Vec, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, + tx: TransactionArg, + ) -> Result, Error>; +} + +impl StateTransitionActionTransformerForIdentityCreateTransitionV0 for IdentityCreateTransition { + fn transform_into_action_for_identity_create_transition( + &self, + platform: &PlatformRef, + signable_bytes: Vec, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, + tx: TransactionArg, ) -> Result, Error> { let platform_version = platform.state.current_platform_version()?; match platform_version @@ -40,7 +57,14 @@ impl StateTransitionActionTransformerV0 for IdentityCreateTransition { .identity_create_state_transition .transform_into_action { - 0 => self.transform_into_action_v0(platform, platform_version), + 0 => self.transform_into_action_v0( + platform, + signable_bytes, + validation_mode, + execution_context, + tx, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "identity create transition: transform_into_action".to_string(), known_versions: vec![0], @@ -50,36 +74,103 @@ impl StateTransitionActionTransformerV0 for IdentityCreateTransition { } } -impl StateTransitionStructureValidationV0 for IdentityCreateTransition { - fn validate_structure( +impl StateTransitionBasicStructureValidationV0 for IdentityCreateTransition { + fn validate_basic_structure( &self, - _platform: &PlatformStateRef, - _action: Option<&StateTransitionAction>, - protocol_version: u32, + platform_version: &PlatformVersion, ) -> Result { - let platform_version = PlatformVersion::get(protocol_version)?; match platform_version .drive_abci .validation_and_processing .state_transitions .identity_create_state_transition - .structure + .basic_structure { - 0 => self.validate_base_structure_v0(platform_version), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity create transition: validate_structure".to_string(), + Some(0) => { + // There is nothing expensive to add as validation methods to the execution context + self.validate_basic_structure_v0(platform_version) + } + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity create transition: validate_basic_structure".to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity create transition: validate_basic_structure".to_string(), + known_versions: vec![0], + })), + } + } +} + +/// A trait for advanced structure validation after transforming into an action +pub trait StateTransitionStructureKnownInStateValidationForIdentityCreateTransitionV0 { + /// Validation of the advanced structure + fn validate_advanced_structure_from_state_for_identity_create_transition( + &self, + action: &IdentityCreateTransitionAction, + signable_bytes: Vec, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error>; +} + +impl StateTransitionStructureKnownInStateValidationForIdentityCreateTransitionV0 + for IdentityCreateTransition +{ + fn validate_advanced_structure_from_state_for_identity_create_transition( + &self, + action: &IdentityCreateTransitionAction, + signable_bytes: Vec, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .identity_create_state_transition + .advanced_structure + { + Some(0) => self.validate_advanced_structure_from_state_v0( + action, + signable_bytes, + execution_context, + platform_version, + ), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity create transition: validate_advanced_structure_from_state" + .to_string(), known_versions: vec![0], received: version, })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity create transition: validate_advanced_structure_from_state" + .to_string(), + known_versions: vec![0], + })), } } } -impl StateTransitionStateValidationV0 for IdentityCreateTransition { - fn validate_state( +/// A trait for state validation for the identity create transition +pub trait StateTransitionStateValidationForIdentityCreateTransitionV0 { + /// Validate state + fn validate_state_for_identity_create_transition( &self, - _action: Option, + action: IdentityCreateTransitionAction, platform: &PlatformRef, + execution_context: &mut StateTransitionExecutionContext, + tx: TransactionArg, + ) -> Result, Error>; +} + +impl StateTransitionStateValidationForIdentityCreateTransitionV0 for IdentityCreateTransition { + fn validate_state_for_identity_create_transition( + &self, + action: IdentityCreateTransitionAction, + platform: &PlatformRef, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error> { let platform_version = platform.state.current_platform_version()?; @@ -90,7 +181,7 @@ impl StateTransitionStateValidationV0 for IdentityCreateTransition { .identity_create_state_transition .state { - 0 => self.validate_state_v0(platform, tx, platform_version), + 0 => self.validate_state_v0(platform, action, execution_context, tx, platform_version), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "identity create transition: validate_state".to_string(), known_versions: vec![0], @@ -99,3 +190,1024 @@ impl StateTransitionStateValidationV0 for IdentityCreateTransition { } } } + +#[cfg(test)] +mod tests { + use crate::test::helpers::setup::TestPlatformBuilder; + use dpp::block::block_info::BlockInfo; + use dpp::dashcore::{Network, PrivateKey}; + use dpp::identity::accessors::{IdentityGettersV0, IdentitySettersV0}; + use dpp::identity::KeyType::ECDSA_SECP256K1; + use dpp::identity::{Identity, IdentityPublicKey, IdentityV0}; + use dpp::native_bls::NativeBlsModule; + use dpp::prelude::Identifier; + use dpp::serialization::PlatformSerializable; + use dpp::state_transition::identity_create_transition::methods::IdentityCreateTransitionMethodsV0; + use dpp::state_transition::identity_create_transition::IdentityCreateTransition; + use dpp::state_transition::StateTransition; + use dpp::tests::fixtures::instant_asset_lock_proof_fixture; + use platform_version::version::PlatformVersion; + use rand::prelude::StdRng; + use rand::SeedableRng; + use simple_signer::signer::SimpleSigner; + use std::collections::BTreeMap; + + #[test] + fn test_identity_create_validation() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + platform + .core_rpc + .expect_verify_instant_lock() + .returning(|_, _| Ok(true)); + + let platform_state = platform.state.load(); + + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(567); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(58), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (key, private_key) = IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(999), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(key.clone(), private_key.clone()); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identifier = asset_lock_proof + .create_identifier() + .expect("expected an identifier"); + + let identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([(0, master_key.clone()), (1, key.clone())]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof, + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 2566730); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let identity_balance = platform + .drive + .fetch_identity_balance(identity.id().into_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected there to be an identity balance for this identity"); + + assert_eq!(identity_balance, 99916163270); + } + + #[test] + fn test_identity_create_asset_lock_reuse_after_issue() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + platform + .core_rpc + .expect_verify_instant_lock() + .returning(|_, _| Ok(true)); + + let platform_state = platform.state.load(); + + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(567); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(58), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (critical_public_key_that_is_already_in_system, private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(999), + platform_version, + ) + .expect("expected to get key pair"); + + // Let's start by adding this critical key to another identity + + let (another_master_key, _) = IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(53), + platform_version, + ) + .expect("expected to get key pair"); + + let identity_already_in_system: Identity = IdentityV0 { + id: Identifier::random_with_rng(&mut rng), + public_keys: BTreeMap::from([ + (0, another_master_key.clone()), + (1, critical_public_key_that_is_already_in_system.clone()), + ]), + balance: 100000, + revision: 0, + } + .into(); + + // We just add this identity to the system first + + platform + .drive + .add_new_identity( + identity_already_in_system, + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to add a new identity"); + + signer.add_key( + critical_public_key_that_is_already_in_system.clone(), + private_key.clone(), + ); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identifier = asset_lock_proof + .create_identifier() + .expect("expected an identifier"); + + let mut identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([ + (0, master_key.clone()), + (1, critical_public_key_that_is_already_in_system.clone()), + ]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof.clone(), + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 10013800); // 10000000 penalty + 13800 processing + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + // Okay now let us try to reuse the asset lock + + let (new_public_key, new_private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(13), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(new_public_key.clone(), new_private_key.clone()); + + // let's set the new key to the identity (replacing the one that was causing the issue + identity.set_public_keys(BTreeMap::from([ + (0, master_key.clone()), + (1, new_public_key.clone()), + ])); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof, + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 3170170); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let identity_balance = platform + .drive + .fetch_identity_balance(identity.id().into_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected there to be an identity balance for this identity"); + + assert_eq!(identity_balance, 99911297030); // The identity balance is smaller than if there hadn't been any issue + } + + #[test] + fn test_identity_create_asset_lock_reuse_after_max_issues() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + platform + .core_rpc + .expect_verify_instant_lock() + .returning(|_, _| Ok(true)); + + let platform_state = platform.state.load(); + + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(567); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(58), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (critical_public_key_that_is_already_in_system, private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(999), + platform_version, + ) + .expect("expected to get key pair"); + + // Let's start by adding this critical key to another identity + + let (another_master_key, _) = IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(53), + platform_version, + ) + .expect("expected to get key pair"); + + let identity_already_in_system: Identity = IdentityV0 { + id: Identifier::random_with_rng(&mut rng), + public_keys: BTreeMap::from([ + (0, another_master_key.clone()), + (1, critical_public_key_that_is_already_in_system.clone()), + ]), + balance: 100000, + revision: 0, + } + .into(); + + // We just add this identity to the system first + + platform + .drive + .add_new_identity( + identity_already_in_system, + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to add a new identity"); + + signer.add_key( + critical_public_key_that_is_already_in_system.clone(), + private_key.clone(), + ); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identifier = asset_lock_proof + .create_identifier() + .expect("expected an identifier"); + + for i in 0..16 { + let (new_master_key, new_master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(58 + i), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(new_master_key.clone(), new_master_private_key.clone()); + + let identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([ + (0, new_master_key.clone()), + (1, critical_public_key_that_is_already_in_system.clone()), + ]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof.clone(), + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 10013800); // 10000000 penalty + 13800 processing + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + } + + // Okay now let us try to reuse the asset lock, there should be no balance + + let (new_public_key, new_private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(13), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(new_public_key.clone(), new_private_key.clone()); + + let identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([(0, master_key.clone()), (1, new_public_key.clone())]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof, + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 1); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 0); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + } + + #[test] + fn test_identity_create_asset_lock_use_all_funds() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + platform + .core_rpc + .expect_verify_instant_lock() + .returning(|_, _| Ok(true)); + + let platform_state = platform.state.load(); + + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(567); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(58), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (critical_public_key_that_is_already_in_system, private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(999), + platform_version, + ) + .expect("expected to get key pair"); + + // Let's start by adding this critical key to another identity + + let (another_master_key, _) = IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(53), + platform_version, + ) + .expect("expected to get key pair"); + + let identity_already_in_system: Identity = IdentityV0 { + id: Identifier::random_with_rng(&mut rng), + public_keys: BTreeMap::from([ + (0, another_master_key.clone()), + (1, critical_public_key_that_is_already_in_system.clone()), + ]), + balance: 100000, + revision: 0, + } + .into(); + + // We just add this identity to the system first + + platform + .drive + .add_new_identity( + identity_already_in_system, + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to add a new identity"); + + signer.add_key( + critical_public_key_that_is_already_in_system.clone(), + private_key.clone(), + ); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + Some(220000), + ); + + let identifier = asset_lock_proof + .create_identifier() + .expect("expected an identifier"); + + // this should work for 2 times only + for i in 0..2 { + let (new_master_key, new_master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(58 + i), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(new_master_key.clone(), new_master_private_key.clone()); + + let identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([ + (0, new_master_key.clone()), + (1, critical_public_key_that_is_already_in_system.clone()), + ]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof.clone(), + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 10013800); // 10000000 penalty + 13800 processing + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + } + + // Okay now let us try to reuse the asset lock, there should be no balance + + let (new_public_key, new_private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(13), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(new_public_key.clone(), new_private_key.clone()); + + let identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([(0, master_key.clone()), (1, new_public_key.clone())]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof, + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 1); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 0); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + } + + #[test] + fn test_identity_create_asset_lock_replay_attack() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + platform + .core_rpc + .expect_verify_instant_lock() + .returning(|_, _| Ok(true)); + + let platform_state = platform.state.load(); + + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(567); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(58), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (critical_public_key_that_is_already_in_system, private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(999), + platform_version, + ) + .expect("expected to get key pair"); + + // Let's start by adding this critical key to another identity + + let (another_master_key, _) = IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(53), + platform_version, + ) + .expect("expected to get key pair"); + + let identity_already_in_system: Identity = IdentityV0 { + id: Identifier::random_with_rng(&mut rng), + public_keys: BTreeMap::from([ + (0, another_master_key.clone()), + (1, critical_public_key_that_is_already_in_system.clone()), + ]), + balance: 100000, + revision: 0, + } + .into(); + + // We just add this identity to the system first + + platform + .drive + .add_new_identity( + identity_already_in_system, + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to add a new identity"); + + signer.add_key( + critical_public_key_that_is_already_in_system.clone(), + private_key.clone(), + ); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identifier = asset_lock_proof + .create_identifier() + .expect("expected an identifier"); + + let mut identity: Identity = IdentityV0 { + id: identifier, + public_keys: BTreeMap::from([ + (0, master_key.clone()), + (1, critical_public_key_that_is_already_in_system.clone()), + ]), + balance: 1000000000, + revision: 0, + } + .into(); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof.clone(), + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.invalid_paid_count(), 1); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 10013800); // 10000000 penalty + 13800 processing + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + // let's try to replay the bad transaction + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 1); + + assert_eq!(processing_result.valid_count(), 0); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 0); + + // Okay now let us try to reuse the asset lock + + let (new_public_key, new_private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(13), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(new_public_key.clone(), new_private_key.clone()); + + // let's set the new key to the identity (replacing the one that was causing the issue + identity.set_public_keys(BTreeMap::from([ + (0, master_key.clone()), + (1, new_public_key.clone()), + ])); + + let identity_create_transition: StateTransition = + IdentityCreateTransition::try_from_identity_with_signer( + &identity, + asset_lock_proof, + pk.as_slice(), + &signer, + &NativeBlsModule, + 0, + platform_version, + ) + .expect("expected an identity create transition"); + + let identity_create_serialized_transition = identity_create_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_create_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.invalid_paid_count(), 0); + + assert_eq!(processing_result.invalid_unpaid_count(), 0); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 3170170); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let identity_balance = platform + .drive + .fetch_identity_balance(identity.id().into_buffer(), None, platform_version) + .expect("expected to get identity balance") + .expect("expected there to be an identity balance for this identity"); + + assert_eq!(identity_balance, 99911297030); // The identity balance is smaller than if there hadn't been any issue + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/state/v0/mod.rs index d4ce9661856..bea657b54eb 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/state/v0/mod.rs @@ -1,43 +1,61 @@ use crate::error::Error; use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; +use dpp::asset_lock::reduced_asset_lock_value::{AssetLockValue, AssetLockValueGettersV0}; +use dpp::balances::credits::CREDITS_PER_DUFF; +use dpp::consensus::basic::identity::IdentityAssetLockTransactionOutPointNotEnoughBalanceError; use dpp::consensus::signature::{BasicECDSAError, SignatureError}; use dpp::consensus::state::identity::IdentityAlreadyExistsError; -use dpp::dashcore::signer; -use dpp::dashcore::signer::double_sha; +use dpp::dashcore::hashes::Hash; +use dpp::dashcore::{signer, ScriptBuf, Txid}; +use dpp::identity::KeyType; use dpp::identity::state_transition::AssetLockProved; use dpp::prelude::ConsensusValidationResult; -use dpp::serialization::Signable; use dpp::state_transition::identity_create_transition::accessors::IdentityCreateTransitionAccessorsV0; +use dpp::ProtocolError; + use dpp::state_transition::identity_create_transition::IdentityCreateTransition; -use dpp::state_transition::{StateTransition, StateTransitionLike}; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; +use dpp::state_transition::StateTransitionLike; use dpp::version::PlatformVersion; use drive::state_transition_action::identity::identity_create::IdentityCreateTransitionAction; use drive::state_transition_action::StateTransitionAction; -use drive::grovedb::TransactionArg; -use dpp::version::DefaultForPlatformVersion; use crate::error::execution::ExecutionError; -use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; -use crate::execution::validation::state_transition::common::asset_lock::proof::AssetLockProofStateValidation; +use crate::execution::types::execution_operation::signature_verification_operation::SignatureVerificationOperation; +use crate::execution::types::execution_operation::{ValidationOperation, SHA256_BLOCK_SIZE}; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::execution::validation::state_transition::common::asset_lock::proof::validate::AssetLockProofValidation; +use drive::grovedb::TransactionArg; +use drive::state_transition_action::system::partially_use_asset_lock_action::PartiallyUseAssetLockAction; + use crate::execution::validation::state_transition::common::asset_lock::transaction::fetch_asset_lock_transaction_output_sync::fetch_asset_lock_transaction_output_sync; -use crate::execution::validation::state_transition::common::validate_unique_identity_public_key_hashes_in_state::validate_unique_identity_public_key_hashes_in_state; +use crate::execution::validation::state_transition::common::validate_unique_identity_public_key_hashes_in_state::validate_unique_identity_public_key_hashes_not_in_state; +use crate::execution::validation::state_transition::ValidationMode; pub(in crate::execution::validation::state_transition::state_transitions::identity_create) trait IdentityCreateStateTransitionStateValidationV0 { fn validate_state_v0( &self, platform: &PlatformRef, - tx: TransactionArg, + action: IdentityCreateTransitionAction, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error>; fn transform_into_action_v0( &self, platform: &PlatformRef, + signable_bytes: Vec, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error>; } @@ -46,108 +64,207 @@ impl IdentityCreateStateTransitionStateValidationV0 for IdentityCreateTransition fn validate_state_v0( &self, platform: &PlatformRef, - tx: TransactionArg, + action: IdentityCreateTransitionAction, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error> { let drive = platform.drive; - let mut state_transition_execution_context = - StateTransitionExecutionContext::default_for_platform_version(platform_version)?; - let mut validation_result = ConsensusValidationResult::::default(); let identity_id = self.identity_id(); let balance = - drive.fetch_identity_balance(identity_id.to_buffer(), tx, platform_version)?; + drive.fetch_identity_balance(identity_id.to_buffer(), transaction, platform_version)?; // Balance is here to check if the identity does already exist if balance.is_some() { + // Since the id comes from the state transition this should never be reachable return Ok(ConsensusValidationResult::new_with_error( IdentityAlreadyExistsError::new(identity_id.to_owned()).into(), )); } - // Validate asset lock proof state - validation_result.merge(self.asset_lock_proof().validate_state( - platform, - tx, - platform_version, - )?); - - if !validation_result.is_valid() { - return Ok(validation_result); - } - // Now we should check the state of added keys to make sure there aren't any that already exist - validation_result.add_errors( - validate_unique_identity_public_key_hashes_in_state( + let unique_public_key_validation_result = + validate_unique_identity_public_key_hashes_not_in_state( self.public_keys(), drive, - &mut state_transition_execution_context, - tx, + execution_context, + transaction, platform_version, - )? - .errors, - ); + )?; - if !validation_result.is_valid() { - return Ok(validation_result); - } + if unique_public_key_validation_result.is_valid() { + // We just pass the action that was given to us + Ok(ConsensusValidationResult::new_with_data( + StateTransitionAction::IdentityCreateAction(action), + )) + } else { + // It's not valid, we need to give back the action that partially uses the asset lock + + let penalty = platform_version + .drive_abci + .validation_and_processing + .penalties + .unique_key_already_present; - self.transform_into_action_v0(platform, platform_version) + let used_credits = penalty + .checked_add(execution_context.fee_cost(platform_version)?.processing_fee) + .ok_or(ProtocolError::Overflow("processing fee overflow error"))?; + + let bump_action = PartiallyUseAssetLockAction::from_identity_create_transition_action( + action, + used_credits, + ); + Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action.into(), + unique_public_key_validation_result.errors, + )) + } } fn transform_into_action_v0( &self, platform: &PlatformRef, + signable_bytes: Vec, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error> { - let mut validation_result = ConsensusValidationResult::::default(); + // Todo: we might want a lowered required balance + let required_balance = platform_version + .dpp + .state_transitions + .identities + .asset_locks + .required_asset_lock_duff_balance_for_processing_start_for_identity_create + * CREDITS_PER_DUFF; - let tx_out_validation = fetch_asset_lock_transaction_output_sync( - platform.core_rpc, - self.asset_lock_proof(), - platform_version, - )?; + let signable_bytes_len = signable_bytes.len(); - if !tx_out_validation.is_valid() { + let mut signable_bytes_hasher = SignableBytesHasher::Bytes(signable_bytes); + // Validate asset lock proof state + // The required balance is in credits because we verify the asset lock value (which is in credits) + let asset_lock_proof_validation = if validation_mode != ValidationMode::NoValidation { + self.asset_lock_proof().validate( + platform, + &mut signable_bytes_hasher, + required_balance, + validation_mode, + transaction, + platform_version, + )? + } else { + ConsensusValidationResult::new() + }; + + if !asset_lock_proof_validation.is_valid() { return Ok(ConsensusValidationResult::new_with_errors( - tx_out_validation.errors, + asset_lock_proof_validation.errors, )); } - let tx_out = tx_out_validation.into_data()?; + let mut needs_signature_verification = true; + + let asset_lock_value_to_be_consumed = if asset_lock_proof_validation.has_data() { + let asset_lock_value = asset_lock_proof_validation.into_data()?; + + if validation_mode == ValidationMode::RecheckTx { + needs_signature_verification = false; + } + asset_lock_value + } else { + let tx_out_validation = fetch_asset_lock_transaction_output_sync( + platform.core_rpc, + self.asset_lock_proof(), + platform_version, + )?; + + if !tx_out_validation.is_valid() { + return Ok(ConsensusValidationResult::new_with_errors( + tx_out_validation.errors, + )); + } - // Verify one time signature + let tx_out = tx_out_validation.into_data()?; - let singable_bytes = StateTransition::IdentityCreate(self.clone()).signable_bytes()?; + let min_value = platform_version + .dpp + .state_transitions + .identities + .asset_locks + .required_asset_lock_duff_balance_for_processing_start_for_identity_create; + if tx_out.value < min_value { + return Ok(ConsensusValidationResult::new_with_error( + IdentityAssetLockTransactionOutPointNotEnoughBalanceError::new( + self.asset_lock_proof() + .out_point() + .map(|outpoint| outpoint.txid) + .unwrap_or(Txid::all_zeros()), + self.asset_lock_proof().output_index() as usize, + tx_out.value, + tx_out.value, + min_value, + ) + .into(), + )); + } - let public_key_hash = tx_out - .script_pubkey - .p2pkh_public_key_hash_bytes() - .ok_or_else(|| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "output must be a valid p2pkh already", - )) - })?; + // Verify one time signature - if let Err(e) = signer::verify_hash_signature( - &double_sha(singable_bytes), - self.signature().as_slice(), - public_key_hash, - ) { - return Ok(ConsensusValidationResult::new_with_error( - SignatureError::BasicECDSAError(BasicECDSAError::new(e.to_string())).into(), + if validation_mode == ValidationMode::RecheckTx { + needs_signature_verification = false; + } + + let initial_balance_amount = tx_out.value * CREDITS_PER_DUFF; + AssetLockValue::new( + initial_balance_amount, + tx_out.script_pubkey.0, + initial_balance_amount, + vec![], + platform_version, + )? + }; + + if needs_signature_verification { + let tx_out_script_pubkey = + ScriptBuf(asset_lock_value_to_be_consumed.tx_out_script().clone()); + + // Verify one time signature + + let public_key_hash = tx_out_script_pubkey + .p2pkh_public_key_hash_bytes() + .ok_or_else(|| { + Error::Execution(ExecutionError::CorruptedCachedState( + "the script inside the state must be a p2pkh".to_string(), + )) + })?; + + let block_count = signable_bytes_len as u16 / SHA256_BLOCK_SIZE; + + execution_context.add_operation(ValidationOperation::DoubleSha256(block_count)); + execution_context.add_operation(ValidationOperation::SignatureVerification( + SignatureVerificationOperation::new(KeyType::ECDSA_HASH160), )); - } - match IdentityCreateTransitionAction::try_from_borrowed(self, tx_out.value * 1000) { - Ok(action) => { - validation_result.set_data(action.into()); - } - Err(error) => { - validation_result.add_error(error); + if let Err(e) = signer::verify_hash_signature( + &signable_bytes_hasher.hash_bytes().as_slice(), + self.signature().as_slice(), + public_key_hash, + ) { + return Ok(ConsensusValidationResult::new_with_error( + SignatureError::BasicECDSAError(BasicECDSAError::new(e.to_string())).into(), + )); } } - Ok(validation_result) + match IdentityCreateTransitionAction::try_from_borrowed( + self, + signable_bytes_hasher, + asset_lock_value_to_be_consumed, + ) { + Ok(action) => Ok(ConsensusValidationResult::new_with_data(action.into())), + Err(error) => Ok(ConsensusValidationResult::new_with_error(error)), + } } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/structure/v0/mod.rs deleted file mode 100644 index 502f1c6d3a6..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_create/structure/v0/mod.rs +++ /dev/null @@ -1,36 +0,0 @@ -use crate::error::Error; -use dpp::identity::state_transition::AssetLockProved; -use dpp::state_transition::identity_create_transition::accessors::IdentityCreateTransitionAccessorsV0; -use dpp::state_transition::identity_create_transition::IdentityCreateTransition; -use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; -use dpp::validation::SimpleConsensusValidationResult; -use dpp::version::PlatformVersion; - -pub(in crate::execution::validation::state_transition::state_transitions::identity_create) trait IdentityCreateStateTransitionStructureValidationV0 -{ - fn validate_base_structure_v0( - &self, - platform_version: &PlatformVersion, - ) -> Result; -} - -impl IdentityCreateStateTransitionStructureValidationV0 for IdentityCreateTransition { - fn validate_base_structure_v0( - &self, - platform_version: &PlatformVersion, - ) -> Result { - let result = self - .asset_lock_proof() - .validate_structure(platform_version)?; - - if !result.is_valid() { - return Ok(result); - } - - IdentityPublicKeyInCreation::validate_identity_public_keys_structure( - self.public_keys(), - platform_version, - ) - .map_err(Error::Protocol) - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/balance/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/balance/mod.rs new file mode 100644 index 00000000000..da04bb187be --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/balance/mod.rs @@ -0,0 +1,38 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::validation::state_transition::identity_credit_transfer::balance::v0::IdentityCreditTransferTransitionBalanceValidationV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionBalanceValidationV0; +use dpp::identity::PartialIdentity; +use dpp::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; + +pub(crate) mod v0; +impl StateTransitionBalanceValidationV0 for IdentityCreditTransferTransition { + fn validate_minimum_balance_pre_check( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .identity_credit_transfer_state_transition + .advanced_minimum_balance_pre_check + { + Some(0) => { + self.validate_advanced_minimum_balance_pre_check_v0(identity, platform_version) + } + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity credit transfer transition: validate_balance".to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity credit transfer transition: validate_balance".to_string(), + known_versions: vec![0], + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/balance/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/balance/v0/mod.rs new file mode 100644 index 00000000000..6ea45ee35e2 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/balance/v0/mod.rs @@ -0,0 +1,43 @@ +use crate::error::Error; +use dpp::consensus::state::identity::IdentityInsufficientBalanceError; +use dpp::identity::PartialIdentity; +use dpp::state_transition::identity_credit_transfer_transition::accessors::IdentityCreditTransferTransitionAccessorsV0; +use dpp::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; + +use dpp::validation::SimpleConsensusValidationResult; + +use crate::error::execution::ExecutionError; +use dpp::version::PlatformVersion; + +pub(in crate::execution::validation::state_transition::state_transitions) trait IdentityCreditTransferTransitionBalanceValidationV0 +{ + fn validate_advanced_minimum_balance_pre_check_v0( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl IdentityCreditTransferTransitionBalanceValidationV0 for IdentityCreditTransferTransition { + fn validate_advanced_minimum_balance_pre_check_v0( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result { + let balance = + identity + .balance + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expected to have a balance on identity for credit transfer transition", + )))?; + + if balance < self.amount().checked_add(platform_version.fee_version.state_transition_min_fees.credit_transfer).ok_or(Error::Execution(ExecutionError::Overflow("overflow when adding amount and min_leftover_credits_before_processing in identity credit transfer")))? { + return Ok(SimpleConsensusValidationResult::new_with_error( + IdentityInsufficientBalanceError::new(self.identity_id(), balance, self.amount()) + .into(), + )); + } + + Ok(SimpleConsensusValidationResult::new()) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/mod.rs index 797eef6760c..d13319d1281 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/mod.rs @@ -1,6 +1,10 @@ +mod balance; +mod nonce; mod state; mod structure; +use dpp::block::block_info::BlockInfo; +use dpp::block::epoch::Epoch; use dpp::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; use dpp::validation::{ConsensusValidationResult, SimpleConsensusValidationResult}; use dpp::version::PlatformVersion; @@ -10,26 +14,29 @@ use drive::grovedb::TransactionArg; use crate::error::execution::ExecutionError; use crate::error::Error; -use crate::platform_types::platform::{PlatformRef, PlatformStateRef}; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; use crate::execution::validation::state_transition::identity_credit_transfer::state::v0::IdentityCreditTransferStateTransitionStateValidationV0; use crate::execution::validation::state_transition::identity_credit_transfer::structure::v0::IdentityCreditTransferStateTransitionStructureValidationV0; use crate::execution::validation::state_transition::processor::v0::{ - StateTransitionStateValidationV0, StateTransitionStructureValidationV0, + StateTransitionBasicStructureValidationV0, StateTransitionStateValidationV0, }; use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::execution::validation::state_transition::ValidationMode; impl StateTransitionActionTransformerV0 for IdentityCreditTransferTransition { fn transform_into_action( &self, platform: &PlatformRef, - _validate: bool, + _block_info: &BlockInfo, + _validation_mode: ValidationMode, + _execution_context: &mut StateTransitionExecutionContext, _tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing @@ -47,27 +54,31 @@ impl StateTransitionActionTransformerV0 for IdentityCreditTransferTransition { } } -impl StateTransitionStructureValidationV0 for IdentityCreditTransferTransition { - fn validate_structure( +impl StateTransitionBasicStructureValidationV0 for IdentityCreditTransferTransition { + fn validate_basic_structure( &self, - _platform: &PlatformStateRef, - _action: Option<&StateTransitionAction>, - protocol_version: u32, + platform_version: &PlatformVersion, ) -> Result { - let platform_version = PlatformVersion::get(protocol_version)?; match platform_version .drive_abci .validation_and_processing .state_transitions .identity_credit_transfer_state_transition - .structure + .basic_structure { - 0 => self.validate_base_structure_v0(), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity credit transfer transition: validate_structure".to_string(), + Some(0) => { + // There is nothing expensive here + self.validate_basic_structure_v0() + } + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity credit transfer transition: validate_basic_structure".to_string(), known_versions: vec![0], received: version, })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity credit transfer transition: validate_basic_structure".to_string(), + known_versions: vec![0], + })), } } } @@ -77,10 +88,13 @@ impl StateTransitionStateValidationV0 for IdentityCreditTransferTransition { &self, _action: Option, platform: &PlatformRef, + _validation_mode: ValidationMode, + _epoch: &Epoch, + _execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/nonce/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/nonce/mod.rs new file mode 100644 index 00000000000..b6a24435f92 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/nonce/mod.rs @@ -0,0 +1,48 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::identity_credit_transfer::nonce::v0::IdentityCreditTransferTransitionIdentityNonceV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionNonceValidationV0; +use crate::platform_types::platform::PlatformStateRef; +use dpp::block::block_info::BlockInfo; +use dpp::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(crate) mod v0; +impl StateTransitionNonceValidationV0 for IdentityCreditTransferTransition { + fn validate_nonces( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .identity_credit_transfer_state_transition + .nonce + { + Some(0) => self.validate_nonce_v0( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity credit transfer transition: validate_nonces".to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity credit transfer transition: validate_nonces".to_string(), + known_versions: vec![0], + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/nonce/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/nonce/v0/mod.rs new file mode 100644 index 00000000000..290f8a33179 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/nonce/v0/mod.rs @@ -0,0 +1,71 @@ +use crate::error::Error; +use dpp::block::block_info::BlockInfo; +use dpp::consensus::basic::document::NonceOutOfBoundsError; +use dpp::consensus::basic::BasicError; +use dpp::identity::identity_nonce::{ + validate_identity_nonce_update, validate_new_identity_nonce, MISSING_IDENTITY_REVISIONS_FILTER, +}; +use dpp::state_transition::identity_credit_transfer_transition::accessors::IdentityCreditTransferTransitionAccessorsV0; +use dpp::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; + +use dpp::validation::SimpleConsensusValidationResult; + +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::platform_types::platform::PlatformStateRef; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(in crate::execution::validation::state_transition::state_transitions) trait IdentityCreditTransferTransitionIdentityNonceV0 +{ + fn validate_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl IdentityCreditTransferTransitionIdentityNonceV0 for IdentityCreditTransferTransition { + fn validate_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + let revision_nonce = self.nonce(); + + if revision_nonce & MISSING_IDENTITY_REVISIONS_FILTER > 0 { + return Ok(SimpleConsensusValidationResult::new_with_error( + BasicError::NonceOutOfBoundsError(NonceOutOfBoundsError::new(revision_nonce)) + .into(), + )); + } + + let identity_id = self.identity_id(); + + let (existing_nonce, fee) = platform.drive.fetch_identity_nonce_with_fees( + identity_id.to_buffer(), + block_info, + true, + tx, + platform_version, + )?; + + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee)); + + let result = if let Some(existing_nonce) = existing_nonce { + validate_identity_nonce_update(existing_nonce, revision_nonce, identity_id) + } else { + validate_new_identity_nonce(revision_nonce, identity_id) + }; + + Ok(result) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/structure/v0/mod.rs index 9a0951d43aa..2d19799dccd 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/structure/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_transfer/structure/v0/mod.rs @@ -8,16 +8,16 @@ use dpp::state_transition::identity_credit_transfer_transition::accessors::Ident use dpp::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition; use dpp::validation::SimpleConsensusValidationResult; -const MIN_TRANSFER_AMOUNT: u64 = 1000; +const MIN_TRANSFER_AMOUNT: u64 = 100000; pub(in crate::execution::validation::state_transition::state_transitions::identity_credit_transfer) trait IdentityCreditTransferStateTransitionStructureValidationV0 { - fn validate_base_structure_v0(&self) -> Result; + fn validate_basic_structure_v0(&self) -> Result; } impl IdentityCreditTransferStateTransitionStructureValidationV0 for IdentityCreditTransferTransition { - fn validate_base_structure_v0(&self) -> Result { + fn validate_basic_structure_v0(&self) -> Result { let result = SimpleConsensusValidationResult::new(); if self.identity_id() == self.recipient_id() { diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/balance/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/balance/mod.rs new file mode 100644 index 00000000000..60eeb8047b5 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/balance/mod.rs @@ -0,0 +1,38 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::validation::state_transition::identity_credit_withdrawal::balance::v0::IdentityCreditTransferTransitionBalanceValidationV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionBalanceValidationV0; +use dpp::identity::PartialIdentity; +use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; + +pub(crate) mod v0; +impl StateTransitionBalanceValidationV0 for IdentityCreditWithdrawalTransition { + fn validate_minimum_balance_pre_check( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .identity_credit_withdrawal_state_transition + .advanced_minimum_balance_pre_check + { + Some(0) => { + self.validate_advanced_minimum_balance_pre_check_v0(identity, platform_version) + } + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity credit withdrawal transition: validate_balance".to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity credit withdrawal transition: validate_balance".to_string(), + known_versions: vec![0], + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/balance/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/balance/v0/mod.rs new file mode 100644 index 00000000000..0c1b879b0f9 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/balance/v0/mod.rs @@ -0,0 +1,42 @@ +use crate::error::Error; +use dpp::consensus::state::identity::IdentityInsufficientBalanceError; +use dpp::identity::PartialIdentity; +use dpp::state_transition::identity_credit_withdrawal_transition::accessors::IdentityCreditWithdrawalTransitionAccessorsV0; +use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; + +use crate::error::execution::ExecutionError; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; + +pub(in crate::execution::validation::state_transition::state_transitions) trait IdentityCreditTransferTransitionBalanceValidationV0 +{ + fn validate_advanced_minimum_balance_pre_check_v0( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl IdentityCreditTransferTransitionBalanceValidationV0 for IdentityCreditWithdrawalTransition { + fn validate_advanced_minimum_balance_pre_check_v0( + &self, + identity: &PartialIdentity, + platform_version: &PlatformVersion, + ) -> Result { + let balance = + identity + .balance + .ok_or(Error::Execution(ExecutionError::CorruptedCodeExecution( + "expected to have a balance on identity for credit withdrawal transition", + )))?; + + if balance < self.amount().checked_add(platform_version.fee_version.state_transition_min_fees.credit_withdrawal).ok_or(Error::Execution(ExecutionError::Overflow("overflow when adding amount and min_leftover_credits_before_processing in identity credit withdrawal")))? { + return Ok(SimpleConsensusValidationResult::new_with_error( + IdentityInsufficientBalanceError::new(self.identity_id(), balance, self.amount()) + .into(), + )); + } + + Ok(SimpleConsensusValidationResult::new()) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/mod.rs index 7b91a82a282..e83a4f37e79 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/mod.rs @@ -1,6 +1,10 @@ +mod balance; +mod nonce; mod state; mod structure; +use dpp::block::block_info::BlockInfo; +use dpp::block::epoch::Epoch; use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; use dpp::validation::{ConsensusValidationResult, SimpleConsensusValidationResult}; use dpp::version::PlatformVersion; @@ -10,27 +14,30 @@ use drive::grovedb::TransactionArg; use crate::error::execution::ExecutionError; use crate::error::Error; -use crate::platform_types::platform::{PlatformRef, PlatformStateRef}; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; use crate::execution::validation::state_transition::identity_credit_withdrawal::state::v0::IdentityCreditWithdrawalStateTransitionStateValidationV0; use crate::execution::validation::state_transition::identity_credit_withdrawal::structure::v0::IdentityCreditWithdrawalStateTransitionStructureValidationV0; use crate::execution::validation::state_transition::processor::v0::{ - StateTransitionStateValidationV0, StateTransitionStructureValidationV0, + StateTransitionBasicStructureValidationV0, StateTransitionStateValidationV0, }; use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::execution::validation::state_transition::ValidationMode; impl StateTransitionActionTransformerV0 for IdentityCreditWithdrawalTransition { fn transform_into_action( &self, platform: &PlatformRef, - _validate: bool, + _block_info: &BlockInfo, + _validation_mode: ValidationMode, + _execution_context: &mut StateTransitionExecutionContext, _tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing @@ -48,27 +55,33 @@ impl StateTransitionActionTransformerV0 for IdentityCreditWithdrawalTransition { } } -impl StateTransitionStructureValidationV0 for IdentityCreditWithdrawalTransition { - fn validate_structure( +impl StateTransitionBasicStructureValidationV0 for IdentityCreditWithdrawalTransition { + fn validate_basic_structure( &self, - _platform: &PlatformStateRef, - _action: Option<&StateTransitionAction>, - protocol_version: u32, + platform_version: &PlatformVersion, ) -> Result { - let platform_version = PlatformVersion::get(protocol_version)?; match platform_version .drive_abci .validation_and_processing .state_transitions .identity_credit_withdrawal_state_transition - .structure + .basic_structure { - 0 => self.validate_base_structure_v0(), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity credit withdrawal transition: validate_structure".to_string(), + Some(0) => { + // There is nothing expensive here + self.validate_basic_structure_v0() + } + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity credit withdrawal transition: validate_basic_structure" + .to_string(), known_versions: vec![0], received: version, })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity credit withdrawal transition: validate_basic_structure" + .to_string(), + known_versions: vec![0], + })), } } } @@ -78,10 +91,13 @@ impl StateTransitionStateValidationV0 for IdentityCreditWithdrawalTransition { &self, _action: Option, platform: &PlatformRef, + _validation_mode: ValidationMode, + _epoch: &Epoch, + _execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/nonce/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/nonce/mod.rs new file mode 100644 index 00000000000..8676f0eb75e --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/nonce/mod.rs @@ -0,0 +1,48 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::identity_credit_withdrawal::nonce::v0::IdentityCreditWithdrawalTransitionIdentityContractNonceV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionNonceValidationV0; +use crate::platform_types::platform::PlatformStateRef; +use dpp::block::block_info::BlockInfo; +use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(crate) mod v0; +impl StateTransitionNonceValidationV0 for IdentityCreditWithdrawalTransition { + fn validate_nonces( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .identity_credit_withdrawal_state_transition + .nonce + { + Some(0) => self.validate_nonce_v0( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity credit withdrawal transition: validate_nonces".to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity credit withdrawal transition: validate_nonces".to_string(), + known_versions: vec![0], + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/nonce/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/nonce/v0/mod.rs new file mode 100644 index 00000000000..f99d11d9a80 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/nonce/v0/mod.rs @@ -0,0 +1,73 @@ +use crate::error::Error; +use dpp::block::block_info::BlockInfo; +use dpp::consensus::basic::document::NonceOutOfBoundsError; +use dpp::consensus::basic::BasicError; +use dpp::identity::identity_nonce::{ + validate_identity_nonce_update, validate_new_identity_nonce, MISSING_IDENTITY_REVISIONS_FILTER, +}; +use dpp::state_transition::identity_credit_withdrawal_transition::accessors::IdentityCreditWithdrawalTransitionAccessorsV0; +use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; + +use dpp::validation::SimpleConsensusValidationResult; + +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::platform_types::platform::PlatformStateRef; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(in crate::execution::validation::state_transition::state_transitions) trait IdentityCreditWithdrawalTransitionIdentityContractNonceV0 +{ + fn validate_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl IdentityCreditWithdrawalTransitionIdentityContractNonceV0 + for IdentityCreditWithdrawalTransition +{ + fn validate_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + let revision_nonce = self.nonce(); + + if revision_nonce & MISSING_IDENTITY_REVISIONS_FILTER > 0 { + return Ok(SimpleConsensusValidationResult::new_with_error( + BasicError::NonceOutOfBoundsError(NonceOutOfBoundsError::new(revision_nonce)) + .into(), + )); + } + + let identity_id = self.identity_id(); + + let (existing_nonce, fee) = platform.drive.fetch_identity_nonce_with_fees( + identity_id.to_buffer(), + block_info, + true, + tx, + platform_version, + )?; + + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee)); + + let result = if let Some(existing_nonce) = existing_nonce { + validate_identity_nonce_update(existing_nonce, revision_nonce, identity_id) + } else { + validate_new_identity_nonce(revision_nonce, identity_id) + }; + + Ok(result) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/state/v0/mod.rs index 335bec12a72..cecf5edb3d6 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/state/v0/mod.rs @@ -5,9 +5,7 @@ use crate::rpc::core::CoreRPCLike; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use dpp::consensus::signature::IdentityNotFoundError; -use dpp::consensus::state::identity::invalid_identity_revision_error::InvalidIdentityRevisionError; use dpp::consensus::state::identity::IdentityInsufficientBalanceError; -use dpp::consensus::state::state_error::StateError; use dpp::prelude::ConsensusValidationResult; use dpp::state_transition::identity_credit_withdrawal_transition::accessors::IdentityCreditWithdrawalTransitionAccessorsV0; use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; @@ -61,29 +59,6 @@ impl IdentityCreditWithdrawalStateTransitionStateValidationV0 )); } - let Some(revision) = platform.drive.fetch_identity_revision( - self.identity_id().to_buffer(), - true, - tx, - platform_version, - )? - else { - return Ok(ConsensusValidationResult::new_with_error( - IdentityNotFoundError::new(self.identity_id()).into(), - )); - }; - - // Check revision - if revision + 1 != self.revision() { - return Ok(ConsensusValidationResult::new_with_error( - StateError::InvalidIdentityRevisionError(InvalidIdentityRevisionError::new( - self.identity_id(), - revision, - )) - .into(), - )); - } - self.transform_into_action_v0(platform) } @@ -91,11 +66,13 @@ impl IdentityCreditWithdrawalStateTransitionStateValidationV0 &self, platform: &PlatformRef, ) -> Result, Error> { - let last_block_time = platform.state.last_block_time_ms().ok_or(Error::Execution( - ExecutionError::StateNotInitialized( - "expected a last platform block during identity update validation", - ), - ))?; + let last_block_time = + platform + .state + .last_committed_block_time_ms() + .ok_or(Error::Execution(ExecutionError::StateNotInitialized( + "expected a last platform block during identity update validation", + )))?; Ok(ConsensusValidationResult::new_with_data( IdentityCreditWithdrawalTransitionAction::from_identity_credit_withdrawal( diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/structure/v0/mod.rs index d50df91f7c7..e06dbfd8288 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/structure/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/structure/v0/mod.rs @@ -8,21 +8,22 @@ use dpp::consensus::ConsensusError; use crate::error::Error; use dpp::state_transition::identity_credit_withdrawal_transition::accessors::IdentityCreditWithdrawalTransitionAccessorsV0; +use dpp::state_transition::identity_credit_withdrawal_transition::v0::{ + MIN_CORE_FEE_PER_BYTE, MIN_WITHDRAWAL_AMOUNT, +}; use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; use dpp::util::is_fibonacci_number::is_fibonacci_number; use dpp::validation::SimpleConsensusValidationResult; use dpp::withdrawal::Pooling; -const MIN_WITHDRAWAL_AMOUNT: u64 = 1000; - pub(in crate::execution::validation::state_transition::state_transitions::identity_credit_withdrawal) trait IdentityCreditWithdrawalStateTransitionStructureValidationV0 { - fn validate_base_structure_v0(&self) -> Result; + fn validate_basic_structure_v0(&self) -> Result; } impl IdentityCreditWithdrawalStateTransitionStructureValidationV0 for IdentityCreditWithdrawalTransition { - fn validate_base_structure_v0(&self) -> Result { + fn validate_basic_structure_v0(&self) -> Result { let mut result = SimpleConsensusValidationResult::default(); if self.amount() < MIN_WITHDRAWAL_AMOUNT { @@ -47,10 +48,10 @@ impl IdentityCreditWithdrawalStateTransitionStructureValidationV0 } // validate core_fee is in fibonacci sequence - - if !is_fibonacci_number(self.core_fee_per_byte()) { + if !is_fibonacci_number(self.core_fee_per_byte() as u64) { result.add_error(InvalidIdentityCreditWithdrawalTransitionCoreFeeError::new( self.core_fee_per_byte(), + MIN_CORE_FEE_PER_BYTE, )); return Ok(result); diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/identity_retrieval/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/identity_retrieval/v0/mod.rs index 6c90b2a9cbd..2b49d301aa7 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/identity_retrieval/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/identity_retrieval/v0/mod.rs @@ -8,6 +8,10 @@ use dpp::state_transition::identity_topup_transition::accessors::IdentityTopUpTr use dpp::state_transition::identity_topup_transition::IdentityTopUpTransition; use dpp::version::PlatformVersion; +use crate::execution::types::execution_operation::{RetrieveIdentityInfo, ValidationOperation}; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; use drive::drive::Drive; use drive::grovedb::TransactionArg; @@ -17,6 +21,7 @@ pub(in crate::execution::validation::state_transition) trait IdentityTopUpStateT &self, drive: &Drive, tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, ) -> Result, Error>; } @@ -26,10 +31,15 @@ impl IdentityTopUpStateTransitionIdentityRetrievalV0 for IdentityTopUpTransition &self, drive: &Drive, tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, platform_version: &PlatformVersion, ) -> Result, Error> { let mut validation_result = ConsensusValidationResult::::default(); + execution_context.add_operation(ValidationOperation::RetrieveIdentity( + RetrieveIdentityInfo::only_balance(), + )); + let maybe_partial_identity = drive.fetch_identity_with_balance( self.identity_id().to_buffer(), tx, diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/mod.rs index f5969bea524..670a1ac80cb 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/mod.rs @@ -1,8 +1,6 @@ pub(crate) mod identity_retrieval; -mod state; mod structure; - -use dpp::state_transition::identity_create_transition::IdentityCreateTransition; +mod transform_into_action; use dpp::state_transition::identity_topup_transition::IdentityTopUpTransition; use dpp::validation::{ConsensusValidationResult, SimpleConsensusValidationResult}; use dpp::version::PlatformVersion; @@ -12,28 +10,41 @@ use drive::state_transition_action::StateTransitionAction; use crate::error::execution::ExecutionError; use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; -use crate::platform_types::platform::{PlatformRef, PlatformStateRef}; +use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; -use crate::execution::validation::state_transition::identity_top_up::state::v0::IdentityTopUpStateTransitionStateValidationV0; use crate::execution::validation::state_transition::identity_top_up::structure::v0::IdentityTopUpStateTransitionStructureValidationV0; -use crate::execution::validation::state_transition::processor::v0::{ - StateTransitionStateValidationV0, StateTransitionStructureValidationV0, -}; +use crate::execution::validation::state_transition::identity_top_up::transform_into_action::v0::IdentityTopUpStateTransitionStateValidationV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionBasicStructureValidationV0; + +use crate::execution::validation::state_transition::ValidationMode; -use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +/// A trait to transform into a top up action +pub trait StateTransitionIdentityTopUpTransitionActionTransformer { + /// Transform into a top up action + fn transform_into_action_for_identity_top_up_transition( + &self, + platform: &PlatformRef, + signable_bytes: Vec, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, + tx: TransactionArg, + ) -> Result, Error>; +} -impl StateTransitionActionTransformerV0 for IdentityTopUpTransition { - fn transform_into_action( +impl StateTransitionIdentityTopUpTransitionActionTransformer for IdentityTopUpTransition { + fn transform_into_action_for_identity_top_up_transition( &self, platform: &PlatformRef, - _validate: bool, - _tx: TransactionArg, + signable_bytes: Vec, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, + tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing @@ -41,9 +52,16 @@ impl StateTransitionActionTransformerV0 for IdentityTopUpTransition { .identity_top_up_state_transition .transform_into_action { - 0 => self.transform_into_action_v0(platform, platform_version), + 0 => self.transform_into_action_v0( + platform, + signable_bytes, + validation_mode, + execution_context, + tx, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity top up transition: transform_into_action".to_string(), + method: "identity top up transition: transform_top_up_into_action".to_string(), known_versions: vec![0], received: version, })), @@ -51,53 +69,176 @@ impl StateTransitionActionTransformerV0 for IdentityTopUpTransition { } } -impl StateTransitionStructureValidationV0 for IdentityTopUpTransition { - fn validate_structure( +impl StateTransitionBasicStructureValidationV0 for IdentityTopUpTransition { + fn validate_basic_structure( &self, - _platform: &PlatformStateRef, - _action: Option<&StateTransitionAction>, - protocol_version: u32, + platform_version: &PlatformVersion, ) -> Result { - let platform_version = PlatformVersion::get(protocol_version)?; match platform_version .drive_abci .validation_and_processing .state_transitions .identity_top_up_state_transition - .structure + .basic_structure { - 0 => self.validate_base_structure_v0(platform_version), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity top up transition: validate_structure".to_string(), + Some(0) => { + // There is nothing expensive here, so need to ask users to pay for anything + self.validate_basic_structure_v0(platform_version) + } + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity top up transition: validate_basic_structure".to_string(), known_versions: vec![0], received: version, })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity top up transition: validate_basic_structure".to_string(), + known_versions: vec![0], + })), } } } -impl StateTransitionStateValidationV0 for IdentityTopUpTransition { - fn validate_state( - &self, - _action: Option, - platform: &PlatformRef, - tx: TransactionArg, - ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; - match platform_version - .drive_abci - .validation_and_processing - .state_transitions - .identity_top_up_state_transition - .state - { - 0 => self.validate_state_v0(platform, tx, platform_version), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity top up transition: validate_state".to_string(), - known_versions: vec![0], - received: version, - })), +#[cfg(test)] +mod tests { + use crate::test::helpers::setup::TestPlatformBuilder; + use dpp::block::block_info::BlockInfo; + use dpp::dashcore::{Network, PrivateKey}; + use dpp::identity::accessors::IdentityGettersV0; + use dpp::identity::KeyType::ECDSA_SECP256K1; + use dpp::identity::{Identity, IdentityPublicKey, IdentityV0}; + use dpp::prelude::Identifier; + use dpp::serialization::PlatformSerializable; + use dpp::state_transition::identity_topup_transition::methods::IdentityTopUpTransitionMethodsV0; + use dpp::state_transition::identity_topup_transition::IdentityTopUpTransition; + use dpp::state_transition::StateTransition; + use dpp::tests::fixtures::instant_asset_lock_proof_fixture; + use platform_version::version::PlatformVersion; + use rand::prelude::StdRng; + use rand::SeedableRng; + use simple_signer::signer::SimpleSigner; + use std::collections::BTreeMap; + + #[test] + fn test_identity_top_up_validation() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_initial_state_structure(); + + platform + .core_rpc + .expect_verify_instant_lock() + .returning(|_, _| Ok(true)); + + let platform_state = platform.state.load(); + + let mut signer = SimpleSigner::default(); + + let mut rng = StdRng::seed_from_u64(567); + + let (master_key, master_private_key) = + IdentityPublicKey::random_ecdsa_master_authentication_key( + 0, + Some(58), + platform_version, + ) + .expect("expected to get key pair"); + + signer.add_key(master_key.clone(), master_private_key.clone()); + + let (critical_public_key, private_key) = + IdentityPublicKey::random_ecdsa_critical_level_authentication_key( + 1, + Some(999), + platform_version, + ) + .expect("expected to get key pair"); + + let identity_already_in_system: Identity = IdentityV0 { + id: Identifier::random_with_rng(&mut rng), + public_keys: BTreeMap::from([ + (0, master_key.clone()), + (1, critical_public_key.clone()), + ]), + balance: 50000000000, + revision: 0, } + .into(); + + // We just add this identity to the system first + + platform + .drive + .add_new_identity( + identity_already_in_system.clone(), + false, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("expected to add a new identity"); + + signer.add_key(critical_public_key.clone(), private_key.clone()); + + let (_, pk) = ECDSA_SECP256K1 + .random_public_and_private_key_data(&mut rng, platform_version) + .unwrap(); + + let asset_lock_proof = instant_asset_lock_proof_fixture( + Some(PrivateKey::from_slice(pk.as_slice(), Network::Testnet).unwrap()), + None, + ); + + let identity_top_up_transition: StateTransition = + IdentityTopUpTransition::try_from_identity( + &identity_already_in_system, + asset_lock_proof, + pk.as_slice(), + 0, + platform_version, + None, + ) + .expect("expected an identity create transition"); + + let identity_top_up_serialized_transition = identity_top_up_transition + .serialize_to_bytes() + .expect("serialized state transition"); + + let transaction = platform.drive.grove.start_transaction(); + + let processing_result = platform + .platform + .process_raw_state_transitions( + &vec![identity_top_up_serialized_transition.clone()], + &platform_state, + &BlockInfo::default(), + &transaction, + platform_version, + ) + .expect("expected to process state transition"); + + assert_eq!(processing_result.valid_count(), 1); + + assert_eq!(processing_result.aggregated_fees().processing_fee, 1146640); + + platform + .drive + .grove + .commit_transaction(transaction) + .unwrap() + .expect("expected to commit"); + + let identity_balance = platform + .drive + .fetch_identity_balance( + identity_already_in_system.id().into_buffer(), + None, + platform_version, + ) + .expect("expected to get identity balance") + .expect("expected there to be an identity balance for this identity"); + + assert_eq!(identity_balance, 149993048360); // about 0.5 Dash starting balance + 1 Dash asset lock top up } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/state/v0/mod.rs deleted file mode 100644 index 1e4c2886a44..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/state/v0/mod.rs +++ /dev/null @@ -1,117 +0,0 @@ -use crate::error::Error; -use crate::platform_types::platform::PlatformRef; -use crate::rpc::core::CoreRPCLike; - -use dpp::consensus::signature::{BasicECDSAError, SignatureError}; -use dpp::dashcore::signer; -use dpp::dashcore::signer::double_sha; -use dpp::identity::state_transition::AssetLockProved; - -use dpp::prelude::ConsensusValidationResult; -use dpp::serialization::Signable; -use dpp::state_transition::identity_topup_transition::IdentityTopUpTransition; -use dpp::state_transition::{StateTransition, StateTransitionLike}; - -use dpp::version::PlatformVersion; -use drive::state_transition_action::identity::identity_topup::IdentityTopUpTransitionAction; -use drive::state_transition_action::StateTransitionAction; - -use drive::grovedb::TransactionArg; -use crate::error::execution::ExecutionError; -use crate::execution::validation::state_transition::common::asset_lock::proof::AssetLockProofStateValidation; -use crate::execution::validation::state_transition::common::asset_lock::transaction::fetch_asset_lock_transaction_output_sync::fetch_asset_lock_transaction_output_sync; - -pub(in crate::execution::validation::state_transition::state_transitions::identity_top_up) trait IdentityTopUpStateTransitionStateValidationV0 -{ - fn validate_state_v0( - &self, - platform: &PlatformRef, - tx: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result, Error>; - - fn transform_into_action_v0( - &self, - platform: &PlatformRef, - platform_version: &PlatformVersion, - ) -> Result, Error>; -} - -impl IdentityTopUpStateTransitionStateValidationV0 for IdentityTopUpTransition { - fn validate_state_v0( - &self, - platform: &PlatformRef, - tx: TransactionArg, - platform_version: &PlatformVersion, - ) -> Result, Error> { - let mut validation_result = ConsensusValidationResult::::default(); - - validation_result.merge(self.asset_lock_proof().validate_state( - platform, - tx, - platform_version, - )?); - - if !validation_result.is_valid() { - return Ok(validation_result); - } - - self.transform_into_action_v0(platform, platform_version) - } - - fn transform_into_action_v0( - &self, - platform: &PlatformRef, - platform_version: &PlatformVersion, - ) -> Result, Error> { - let mut validation_result = ConsensusValidationResult::::default(); - - let tx_out_validation = fetch_asset_lock_transaction_output_sync( - platform.core_rpc, - self.asset_lock_proof(), - platform_version, - )?; - - if !tx_out_validation.is_valid() { - return Ok(ConsensusValidationResult::new_with_errors( - tx_out_validation.errors, - )); - } - - let tx_out = tx_out_validation.into_data()?; - - // Verify one time signature - - let singable_bytes = StateTransition::IdentityTopUp(self.clone()).signable_bytes()?; - - let public_key_hash = tx_out - .script_pubkey - .p2pkh_public_key_hash_bytes() - .ok_or_else(|| { - Error::Execution(ExecutionError::CorruptedCodeExecution( - "output must be a valid p2pkh already", - )) - })?; - - if let Err(e) = signer::verify_hash_signature( - &double_sha(singable_bytes), - self.signature().as_slice(), - public_key_hash, - ) { - return Ok(ConsensusValidationResult::new_with_error( - SignatureError::BasicECDSAError(BasicECDSAError::new(e.to_string())).into(), - )); - } - - match IdentityTopUpTransitionAction::try_from_borrowed(self, &tx_out.value * 1000) { - Ok(action) => { - validation_result.set_data(action.into()); - } - Err(error) => { - validation_result.add_error(error); - } - } - - Ok(validation_result) - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/structure/v0/mod.rs index 28bdf9425d0..6a8be703cff 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/structure/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/structure/v0/mod.rs @@ -7,19 +7,17 @@ use dpp::version::PlatformVersion; pub(in crate::execution::validation::state_transition::state_transitions::identity_top_up) trait IdentityTopUpStateTransitionStructureValidationV0 { - fn validate_base_structure_v0( + fn validate_basic_structure_v0( &self, platform_version: &PlatformVersion, ) -> Result; } impl IdentityTopUpStateTransitionStructureValidationV0 for IdentityTopUpTransition { - fn validate_base_structure_v0( + fn validate_basic_structure_v0( &self, platform_version: &PlatformVersion, ) -> Result { - // TODO: Add validation for the structure of the IdentityTopUpTransition - self.asset_lock_proof() .validate_structure(platform_version) .map_err(Error::Protocol) diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/identity_and_signatures/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/transform_into_action/mod.rs similarity index 100% rename from packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/identity_and_signatures/mod.rs rename to packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/transform_into_action/mod.rs diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/transform_into_action/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/transform_into_action/v0/mod.rs new file mode 100644 index 00000000000..003b05567d4 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_top_up/transform_into_action/v0/mod.rs @@ -0,0 +1,197 @@ +use crate::error::Error; +use crate::platform_types::platform::PlatformRef; +use crate::rpc::core::CoreRPCLike; +use dpp::asset_lock::reduced_asset_lock_value::{AssetLockValue, AssetLockValueGettersV0}; +use dpp::balances::credits::CREDITS_PER_DUFF; +use dpp::consensus::basic::identity::IdentityAssetLockTransactionOutPointNotEnoughBalanceError; + +use dpp::consensus::signature::{BasicECDSAError, SignatureError}; +use dpp::dashcore::hashes::Hash; +use dpp::dashcore::{signer, ScriptBuf, Txid}; +use dpp::identity::state_transition::AssetLockProved; +use dpp::identity::KeyType; + +use dpp::prelude::ConsensusValidationResult; + +use dpp::state_transition::identity_topup_transition::IdentityTopUpTransition; +use dpp::state_transition::signable_bytes_hasher::SignableBytesHasher; +use dpp::state_transition::StateTransitionLike; + +use dpp::version::PlatformVersion; +use drive::state_transition_action::identity::identity_topup::IdentityTopUpTransitionAction; +use drive::state_transition_action::StateTransitionAction; + +use crate::error::execution::ExecutionError; +use drive::grovedb::TransactionArg; + +use crate::execution::types::execution_operation::{SHA256_BLOCK_SIZE, ValidationOperation}; +use crate::execution::types::execution_operation::signature_verification_operation::SignatureVerificationOperation; +use crate::execution::types::state_transition_execution_context::{StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0}; +use crate::execution::validation::state_transition::common::asset_lock::proof::validate::AssetLockProofValidation; +use crate::execution::validation::state_transition::common::asset_lock::transaction::fetch_asset_lock_transaction_output_sync::fetch_asset_lock_transaction_output_sync; +use crate::execution::validation::state_transition::ValidationMode; + +pub(in crate::execution::validation::state_transition::state_transitions::identity_top_up) trait IdentityTopUpStateTransitionStateValidationV0 +{ + fn transform_into_action_v0( + &self, + platform: &PlatformRef, + signable_bytes: Vec, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error>; +} + +impl IdentityTopUpStateTransitionStateValidationV0 for IdentityTopUpTransition { + fn transform_into_action_v0( + &self, + platform: &PlatformRef, + signable_bytes: Vec, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + // Todo: we might want a lowered required balance + let required_balance = platform_version + .dpp + .state_transitions + .identities + .asset_locks + .required_asset_lock_duff_balance_for_processing_start_for_identity_top_up; + + let signable_bytes_len = signable_bytes.len(); + + let mut signable_bytes_hasher = SignableBytesHasher::Bytes(signable_bytes); + + // Validate asset lock proof state + let asset_lock_proof_validation = if validation_mode != ValidationMode::NoValidation { + self.asset_lock_proof().validate( + platform, + &mut signable_bytes_hasher, + required_balance, + validation_mode, + transaction, + platform_version, + )? + } else { + ConsensusValidationResult::new() + }; + + if !asset_lock_proof_validation.is_valid() { + return Ok(ConsensusValidationResult::new_with_errors( + asset_lock_proof_validation.errors, + )); + } + + let mut needs_signature_verification = true; + + let asset_lock_value_to_be_consumed = if asset_lock_proof_validation.has_data() { + let asset_lock_value = asset_lock_proof_validation.into_data()?; + // There is no needed to recheck signatures on recheck tx + if validation_mode == ValidationMode::RecheckTx { + needs_signature_verification = false; + } + asset_lock_value + } else { + let tx_out_validation = fetch_asset_lock_transaction_output_sync( + platform.core_rpc, + self.asset_lock_proof(), + platform_version, + )?; + + if !tx_out_validation.is_valid() { + return Ok(ConsensusValidationResult::new_with_errors( + tx_out_validation.errors, + )); + } + + let tx_out = tx_out_validation.into_data()?; + + // We should always check that the balance is enough as it's very cheap and we could have + // had a version change that would have changed the minimum duff balance for processing + // start + + let min_value = platform_version + .dpp + .state_transitions + .identities + .asset_locks + .required_asset_lock_duff_balance_for_processing_start_for_identity_top_up; + if tx_out.value < min_value { + return Ok(ConsensusValidationResult::new_with_error( + IdentityAssetLockTransactionOutPointNotEnoughBalanceError::new( + self.asset_lock_proof() + .out_point() + .map(|outpoint| outpoint.txid) + .unwrap_or(Txid::all_zeros()), + self.asset_lock_proof().output_index() as usize, + tx_out.value, + tx_out.value, + min_value, + ) + .into(), + )); + } + + // Verify one time signature + // This is not necessary on recheck + + if validation_mode == ValidationMode::RecheckTx { + needs_signature_verification = false; + } + + let initial_balance_amount = tx_out.value * CREDITS_PER_DUFF; + AssetLockValue::new( + initial_balance_amount, + tx_out.script_pubkey.0, + initial_balance_amount, + vec![], + platform_version, + )? + }; + + if needs_signature_verification { + let tx_out_script_pubkey = + ScriptBuf(asset_lock_value_to_be_consumed.tx_out_script().clone()); + + // Verify one time signature + + let public_key_hash = tx_out_script_pubkey + .p2pkh_public_key_hash_bytes() + .ok_or_else(|| { + Error::Execution(ExecutionError::CorruptedCachedState( + "the script inside the state must be a p2pkh".to_string(), + )) + })?; + + let block_count = signable_bytes_len as u16 / SHA256_BLOCK_SIZE; + + execution_context.add_operation(ValidationOperation::DoubleSha256(block_count)); + execution_context.add_operation(ValidationOperation::SignatureVerification( + SignatureVerificationOperation::new(KeyType::ECDSA_HASH160), + )); + + if let Err(e) = signer::verify_hash_signature( + &signable_bytes_hasher.hash_bytes().as_slice(), + self.signature().as_slice(), + public_key_hash, + ) { + return Ok(ConsensusValidationResult::new_with_error( + SignatureError::BasicECDSAError(BasicECDSAError::new(e.to_string())).into(), + )); + } + } + + match IdentityTopUpTransitionAction::try_from_borrowed( + self, + signable_bytes_hasher, + asset_lock_value_to_be_consumed, + ) { + Ok(action) => Ok(ConsensusValidationResult::new_with_data(action.into())), + Err(error) => Ok(ConsensusValidationResult::new_with_error(error)), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/structure/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/advanced_structure/mod.rs similarity index 100% rename from packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/structure/mod.rs rename to packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/advanced_structure/mod.rs diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/advanced_structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/advanced_structure/v0/mod.rs new file mode 100644 index 00000000000..a5071a5d3a0 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/advanced_structure/v0/mod.rs @@ -0,0 +1,86 @@ +use crate::error::execution::ExecutionError::CorruptedCodeExecution; +use crate::error::Error; + +use dpp::consensus::state::identity::invalid_identity_revision_error::InvalidIdentityRevisionError; +use dpp::consensus::state::state_error::StateError; + +use dpp::identity::PartialIdentity; + +use crate::execution::types::execution_operation::signature_verification_operation::SignatureVerificationOperation; +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use dpp::serialization::PlatformMessageSignable; +use dpp::state_transition::identity_update_transition::accessors::IdentityUpdateTransitionAccessorsV0; +use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; +use dpp::state_transition::public_key_in_creation::accessors::IdentityPublicKeyInCreationV0Getters; +use dpp::validation::ConsensusValidationResult; +use drive::state_transition_action::system::bump_identity_nonce_action::BumpIdentityNonceAction; +use drive::state_transition_action::StateTransitionAction; + +pub(in crate::execution::validation::state_transition) trait IdentityUpdateStateTransitionIdentityAndSignaturesValidationV0 +{ + fn validate_identity_update_state_transition_signatures_v0( + &self, + signable_bytes: Vec, + partial_identity: &PartialIdentity, + execution_context: &mut StateTransitionExecutionContext, + ) -> Result, Error>; +} + +impl IdentityUpdateStateTransitionIdentityAndSignaturesValidationV0 for IdentityUpdateTransition { + fn validate_identity_update_state_transition_signatures_v0( + &self, + signable_bytes: Vec, + partial_identity: &PartialIdentity, + execution_context: &mut StateTransitionExecutionContext, + ) -> Result, Error> { + let Some(revision) = partial_identity.revision else { + return Err(Error::Execution(CorruptedCodeExecution( + "revision should exist", + ))); + }; + + // Check revision + if revision + 1 != self.revision() { + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_identity_update_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![ + StateError::InvalidIdentityRevisionError(InvalidIdentityRevisionError::new( + self.identity_id(), + revision, + )) + .into(), + ], + )); + } + + for key in self.public_keys_to_add().iter() { + let validation_result = signable_bytes.as_slice().verify_signature( + key.key_type(), + key.data().as_slice(), + key.signature().as_slice(), + ); + execution_context.add_operation(ValidationOperation::SignatureVerification( + SignatureVerificationOperation::new(key.key_type()), + )); + if !validation_result.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_identity_update_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + validation_result.errors, + )); + } + } + + Ok(ConsensusValidationResult::new()) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/basic_structure/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/basic_structure/mod.rs new file mode 100644 index 00000000000..9a1925de7fc --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/basic_structure/mod.rs @@ -0,0 +1 @@ +pub(crate) mod v0; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/basic_structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/basic_structure/v0/mod.rs new file mode 100644 index 00000000000..2252d0192c4 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/basic_structure/v0/mod.rs @@ -0,0 +1,89 @@ +use crate::error::Error; +use dpp::consensus::basic::identity::{ + DisablingKeyIdAlsoBeingAddedInSameTransitionError, DuplicatedIdentityPublicKeyIdBasicError, + InvalidIdentityUpdateTransitionEmptyError, +}; +use dpp::consensus::state::identity::max_identity_public_key_limit_reached_error::MaxIdentityPublicKeyLimitReachedError; +use dpp::consensus::ConsensusError; +use dpp::state_transition::identity_update_transition::accessors::IdentityUpdateTransitionAccessorsV0; +use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; +use dpp::state_transition::public_key_in_creation::accessors::IdentityPublicKeyInCreationV0Getters; +use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; +use std::collections::HashSet; + +const MAX_KEYS_TO_DISABLE: usize = 10; + +pub(in crate::execution::validation::state_transition::state_transitions::identity_update) trait IdentityUpdateStateTransitionStructureValidationV0 +{ + fn validate_basic_structure_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl IdentityUpdateStateTransitionStructureValidationV0 for IdentityUpdateTransition { + fn validate_basic_structure_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result { + let mut result = SimpleConsensusValidationResult::default(); + + // Ensure that either disablePublicKeys or addPublicKeys is present + if self.public_key_ids_to_disable().is_empty() && self.public_keys_to_add().is_empty() { + result.add_error(ConsensusError::from( + InvalidIdentityUpdateTransitionEmptyError::new(), + )); + } + + if !result.is_valid() { + return Ok(result); + } + + // Validate public keys to disable + if !self.public_key_ids_to_disable().is_empty() { + // Ensure max items + if self.public_key_ids_to_disable().len() > MAX_KEYS_TO_DISABLE { + result.add_error(ConsensusError::from( + MaxIdentityPublicKeyLimitReachedError::new(MAX_KEYS_TO_DISABLE), + )); + } + + // Check key id duplicates + let mut ids = HashSet::new(); + for key_id in self.public_key_ids_to_disable() { + if ids.contains(key_id) { + result.add_error(ConsensusError::from( + DuplicatedIdentityPublicKeyIdBasicError::new(vec![*key_id]), + )); + break; + } + + if self + .public_keys_to_add() + .iter() + .any(|public_key_in_creation| public_key_in_creation.id() == *key_id) + { + result.add_error(ConsensusError::from( + DisablingKeyIdAlsoBeingAddedInSameTransitionError::new(*key_id), + )); + break; + } + + ids.insert(key_id); + } + } + + if !result.is_valid() { + return Ok(result); + } + + IdentityPublicKeyInCreation::validate_identity_public_keys_structure( + self.public_keys_to_add(), + false, + platform_version, + ) + .map_err(Error::Protocol) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/identity_and_signatures/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/identity_and_signatures/v0/mod.rs deleted file mode 100644 index cc845dc0e8a..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/identity_and_signatures/v0/mod.rs +++ /dev/null @@ -1,59 +0,0 @@ -use crate::error::execution::ExecutionError::CorruptedCodeExecution; -use crate::error::Error; - -use dpp::consensus::state::identity::invalid_identity_revision_error::InvalidIdentityRevisionError; -use dpp::consensus::state::state_error::StateError; - -use dpp::identity::PartialIdentity; - -use dpp::serialization::PlatformMessageSignable; -use dpp::state_transition::identity_update_transition::accessors::IdentityUpdateTransitionAccessorsV0; -use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; -use dpp::state_transition::public_key_in_creation::accessors::IdentityPublicKeyInCreationV0Getters; -use dpp::validation::SimpleConsensusValidationResult; - -pub(in crate::execution::validation::state_transition) trait IdentityUpdateStateTransitionIdentityAndSignaturesValidationV0 -{ - fn validate_identity_update_state_transition_signatures_v0( - &self, - signable_bytes: Vec, - partial_identity: &PartialIdentity, - ) -> Result; -} - -impl IdentityUpdateStateTransitionIdentityAndSignaturesValidationV0 for IdentityUpdateTransition { - fn validate_identity_update_state_transition_signatures_v0( - &self, - signable_bytes: Vec, - partial_identity: &PartialIdentity, - ) -> Result { - let mut result = SimpleConsensusValidationResult::default(); - - for key in self.public_keys_to_add().iter() { - let validation_result = signable_bytes.as_slice().verify_signature( - key.key_type(), - key.data().as_slice(), - key.signature().as_slice(), - )?; - if !validation_result.is_valid() { - result.add_errors(validation_result.errors); - } - } - - let Some(revision) = partial_identity.revision else { - return Err(Error::Execution(CorruptedCodeExecution( - "revision should exist", - ))); - }; - - // Check revision - if revision + 1 != self.revision() { - result.add_error(StateError::InvalidIdentityRevisionError( - InvalidIdentityRevisionError::new(self.identity_id(), revision), - )); - return Ok(result); - } - - Ok(result) - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs index 73bde66a799..073bbeab2d3 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs @@ -1,7 +1,10 @@ -pub(crate) mod identity_and_signatures; +pub(crate) mod advanced_structure; +mod basic_structure; +mod nonce; mod state; -mod structure; +use dpp::block::block_info::BlockInfo; +use dpp::block::epoch::Epoch; use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; use dpp::validation::{ConsensusValidationResult, SimpleConsensusValidationResult}; use dpp::version::PlatformVersion; @@ -11,28 +14,31 @@ use drive::grovedb::TransactionArg; use crate::error::execution::ExecutionError; use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; -use crate::platform_types::platform::{PlatformRef, PlatformStateRef}; +use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; +use crate::execution::validation::state_transition::identity_update::basic_structure::v0::IdentityUpdateStateTransitionStructureValidationV0; use crate::execution::validation::state_transition::identity_update::state::v0::IdentityUpdateStateTransitionStateValidationV0; -use crate::execution::validation::state_transition::identity_update::structure::v0::IdentityUpdateStateTransitionStructureValidationV0; use crate::execution::validation::state_transition::processor::v0::{ - StateTransitionStateValidationV0, StateTransitionStructureValidationV0, + StateTransitionBasicStructureValidationV0, StateTransitionStateValidationV0, }; use crate::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::execution::validation::state_transition::ValidationMode; impl StateTransitionActionTransformerV0 for IdentityUpdateTransition { fn transform_into_action( &self, platform: &PlatformRef, - _validate: bool, + _block_info: &BlockInfo, + _validation_mode: ValidationMode, + _execution_context: &mut StateTransitionExecutionContext, _tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; + match platform_version .drive_abci .validation_and_processing @@ -50,27 +56,28 @@ impl StateTransitionActionTransformerV0 for IdentityUpdateTransition { } } -impl StateTransitionStructureValidationV0 for IdentityUpdateTransition { - fn validate_structure( +impl StateTransitionBasicStructureValidationV0 for IdentityUpdateTransition { + fn validate_basic_structure( &self, - _platform: &PlatformStateRef, - _action: Option<&StateTransitionAction>, - protocol_version: u32, + platform_version: &PlatformVersion, ) -> Result { - let platform_version = PlatformVersion::get(protocol_version)?; match platform_version .drive_abci .validation_and_processing .state_transitions .identity_update_state_transition - .structure + .basic_structure { - 0 => self.validate_base_structure_v0(platform_version), - version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "identity update transition: validate_structure".to_string(), + Some(0) => self.validate_basic_structure_v0(platform_version), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity update transition: validate_basic_structure".to_string(), known_versions: vec![0], received: version, })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity update transition: validate_basic_structure".to_string(), + known_versions: vec![0], + })), } } } @@ -80,10 +87,12 @@ impl StateTransitionStateValidationV0 for IdentityUpdateTransition { &self, _action: Option, platform: &PlatformRef, + _validation_mode: ValidationMode, + _epoch: &Epoch, + _execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error> { - let platform_version = - PlatformVersion::get(platform.state.current_protocol_version_in_consensus())?; + let platform_version = platform.state.current_platform_version()?; match platform_version .drive_abci .validation_and_processing diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/nonce/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/nonce/mod.rs new file mode 100644 index 00000000000..30f81ef9996 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/nonce/mod.rs @@ -0,0 +1,48 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::identity_update::nonce::v0::IdentityUpdateTransitionIdentityContractNonceV0; +use crate::execution::validation::state_transition::processor::v0::StateTransitionNonceValidationV0; +use crate::platform_types::platform::PlatformStateRef; +use dpp::block::block_info::BlockInfo; +use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; +use dpp::validation::SimpleConsensusValidationResult; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(crate) mod v0; +impl StateTransitionNonceValidationV0 for IdentityUpdateTransition { + fn validate_nonces( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive_abci + .validation_and_processing + .state_transitions + .identity_update_state_transition + .nonce + { + Some(0) => self.validate_nonce_v0( + platform, + block_info, + tx, + execution_context, + platform_version, + ), + Some(version) => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "identity update transition: validate_nonces".to_string(), + known_versions: vec![0], + received: version, + })), + None => Err(Error::Execution(ExecutionError::VersionNotActive { + method: "identity update transition: validate_nonces".to_string(), + known_versions: vec![0], + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/nonce/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/nonce/v0/mod.rs new file mode 100644 index 00000000000..fc51a636c58 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/nonce/v0/mod.rs @@ -0,0 +1,71 @@ +use crate::error::Error; +use dpp::block::block_info::BlockInfo; +use dpp::consensus::basic::document::NonceOutOfBoundsError; +use dpp::consensus::basic::BasicError; +use dpp::identity::identity_nonce::{ + validate_identity_nonce_update, validate_new_identity_nonce, MISSING_IDENTITY_REVISIONS_FILTER, +}; +use dpp::state_transition::identity_update_transition::accessors::IdentityUpdateTransitionAccessorsV0; +use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; + +use dpp::validation::SimpleConsensusValidationResult; + +use crate::execution::types::execution_operation::ValidationOperation; +use crate::execution::types::state_transition_execution_context::{ + StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, +}; +use crate::platform_types::platform::PlatformStateRef; +use dpp::version::PlatformVersion; +use drive::grovedb::TransactionArg; + +pub(in crate::execution::validation::state_transition::state_transitions) trait IdentityUpdateTransitionIdentityContractNonceV0 +{ + fn validate_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result; +} + +impl IdentityUpdateTransitionIdentityContractNonceV0 for IdentityUpdateTransition { + fn validate_nonce_v0( + &self, + platform: &PlatformStateRef, + block_info: &BlockInfo, + tx: TransactionArg, + execution_context: &mut StateTransitionExecutionContext, + platform_version: &PlatformVersion, + ) -> Result { + let revision_nonce = self.nonce(); + + if revision_nonce & MISSING_IDENTITY_REVISIONS_FILTER > 0 { + return Ok(SimpleConsensusValidationResult::new_with_error( + BasicError::NonceOutOfBoundsError(NonceOutOfBoundsError::new(revision_nonce)) + .into(), + )); + } + + let identity_id = self.identity_id(); + + let (existing_nonce, fee) = platform.drive.fetch_identity_nonce_with_fees( + identity_id.to_buffer(), + block_info, + true, + tx, + platform_version, + )?; + + execution_context.add_operation(ValidationOperation::PrecalculatedOperation(fee)); + + let result = if let Some(existing_nonce) = existing_nonce { + validate_identity_nonce_update(existing_nonce, revision_nonce, identity_id) + } else { + validate_new_identity_nonce(revision_nonce, identity_id) + }; + + Ok(result) + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v0/mod.rs index 7619699f122..08997950bf5 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v0/mod.rs @@ -1,30 +1,25 @@ -use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; -use dpp::consensus::state::identity::identity_public_key_disabled_at_window_violation_error::IdentityPublicKeyDisabledAtWindowViolationError; -use dpp::consensus::state::state_error::StateError; - use dpp::prelude::ConsensusValidationResult; use dpp::state_transition::identity_update_transition::accessors::IdentityUpdateTransitionAccessorsV0; use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; -use dpp::validation::block_time_window::validate_time_in_block_time_window::validate_time_in_block_time_window; use dpp::version::PlatformVersion; -use dpp::ProtocolError; use drive::state_transition_action::identity::identity_update::IdentityUpdateTransitionAction; use drive::state_transition_action::StateTransitionAction; use drive::grovedb::TransactionArg; use dpp::version::DefaultForPlatformVersion; +use drive::state_transition_action::system::bump_identity_nonce_action::BumpIdentityNonceAction; use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; use crate::execution::validation::state_transition::common::validate_identity_public_key_contract_bounds::validate_identity_public_keys_contract_bounds; use crate::execution::validation::state_transition::common::validate_identity_public_key_ids_dont_exist_in_state::validate_identity_public_key_ids_dont_exist_in_state; use crate::execution::validation::state_transition::common::validate_identity_public_key_ids_exist_in_state::validate_identity_public_key_ids_exist_in_state; -use crate::execution::validation::state_transition::common::validate_unique_identity_public_key_hashes_in_state::validate_unique_identity_public_key_hashes_in_state; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::execution::validation::state_transition::common::validate_not_disabling_last_master_key::validate_master_key_uniqueness; +use crate::execution::validation::state_transition::common::validate_unique_identity_public_key_hashes_in_state::validate_unique_identity_public_key_hashes_not_in_state; pub(in crate::execution::validation::state_transition::state_transitions::identity_update) trait IdentityUpdateStateTransitionStateValidationV0 { @@ -54,7 +49,7 @@ impl IdentityUpdateStateTransitionStateValidationV0 for IdentityUpdateTransition // Now we should check the state of added keys to make sure there aren't any that already exist validation_result.add_errors( - validate_unique_identity_public_key_hashes_in_state( + validate_unique_identity_public_key_hashes_not_in_state( self.public_keys_to_add(), drive, &mut state_transition_execution_context, @@ -65,7 +60,14 @@ impl IdentityUpdateStateTransitionStateValidationV0 for IdentityUpdateTransition ); if !validation_result.is_valid() { - return Ok(validation_result); + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_identity_update_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + validation_result.errors, + )); } validation_result.add_errors( @@ -81,7 +83,14 @@ impl IdentityUpdateStateTransitionStateValidationV0 for IdentityUpdateTransition ); if !validation_result.is_valid() { - return Ok(validation_result); + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_identity_update_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + validation_result.errors, + )); } // Now we should check to make sure any keys that are added are valid for the contract @@ -99,12 +108,18 @@ impl IdentityUpdateStateTransitionStateValidationV0 for IdentityUpdateTransition ); if !validation_result.is_valid() { - return Ok(validation_result); + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_identity_update_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + validation_result.errors, + )); } if !self.public_key_ids_to_disable().is_empty() { - // We need to validate that all keys removed existed - validation_result.add_errors( + let validation_result_and_keys_to_disable = validate_identity_public_key_ids_exist_in_state( self.identity_id(), self.public_key_ids_to_disable(), @@ -112,43 +127,35 @@ impl IdentityUpdateStateTransitionStateValidationV0 for IdentityUpdateTransition &mut state_transition_execution_context, tx, platform_version, - )? - .errors, - ); - - if !validation_result.is_valid() { - return Ok(validation_result); + )?; + // We need to validate that all keys removed existed + if !validation_result_and_keys_to_disable.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_identity_update_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + validation_result_and_keys_to_disable.errors, + )); } - if let Some(disabled_at_ms) = self.public_keys_disabled_at() { - // We need to verify the time the keys were disabled - - let last_block_time = platform.state.last_block_time_ms().ok_or( - Error::Execution(ExecutionError::StateNotInitialized( - "expected a last platform block during identity update validation", - )), - )?; + let keys_to_disable = validation_result_and_keys_to_disable.into_data()?; - let window_validation_result = validate_time_in_block_time_window( - last_block_time, - disabled_at_ms, - platform.config.block_spacing_ms, - platform_version, - ) - .map_err(|e| Error::Protocol(ProtocolError::NonConsensusError(e)))?; - - if !window_validation_result.valid { - validation_result.add_error( - StateError::IdentityPublicKeyDisabledAtWindowViolationError( - IdentityPublicKeyDisabledAtWindowViolationError::new( - disabled_at_ms, - window_validation_result.time_window_start, - window_validation_result.time_window_end, - ), - ), - ); - return Ok(validation_result); - } + let validation_result = validate_master_key_uniqueness( + self.public_keys_to_add(), + keys_to_disable.as_slice(), + platform_version, + )?; + if !validation_result.is_valid() { + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_identity_update_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + validation_result.errors, + )); } } self.transform_into_action_v0() diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/structure/v0/mod.rs deleted file mode 100644 index 3c7ce366d68..00000000000 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/structure/v0/mod.rs +++ /dev/null @@ -1,88 +0,0 @@ -use crate::error::Error; -use dpp::consensus::basic::identity::{ - DuplicatedIdentityPublicKeyIdBasicError, InvalidIdentityUpdateTransitionDisableKeysError, - InvalidIdentityUpdateTransitionEmptyError, -}; -use dpp::consensus::state::identity::max_identity_public_key_limit_reached_error::MaxIdentityPublicKeyLimitReachedError; -use dpp::consensus::ConsensusError; -use dpp::state_transition::identity_update_transition::accessors::IdentityUpdateTransitionAccessorsV0; -use dpp::state_transition::identity_update_transition::IdentityUpdateTransition; -use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation; -use dpp::validation::SimpleConsensusValidationResult; -use dpp::version::PlatformVersion; -use std::collections::HashSet; - -const MAX_KEYS_TO_DISABLE: usize = 10; - -pub(in crate::execution::validation::state_transition::state_transitions::identity_update) trait IdentityUpdateStateTransitionStructureValidationV0 -{ - fn validate_base_structure_v0( - &self, - platform_version: &PlatformVersion, - ) -> Result; -} - -impl IdentityUpdateStateTransitionStructureValidationV0 for IdentityUpdateTransition { - fn validate_base_structure_v0( - &self, - platform_version: &PlatformVersion, - ) -> Result { - let mut result = SimpleConsensusValidationResult::default(); - - // Ensure that either disablePublicKeys or addPublicKeys is present - if self.public_key_ids_to_disable().is_empty() && self.public_keys_to_add().is_empty() { - result.add_error(ConsensusError::from( - InvalidIdentityUpdateTransitionEmptyError::new(), - )); - } - - if !result.is_valid() { - return Ok(result); - } - - // Validate public keys to disable - if !self.public_key_ids_to_disable().is_empty() { - // Ensure max items - if self.public_key_ids_to_disable().len() > MAX_KEYS_TO_DISABLE { - result.add_error(ConsensusError::from( - MaxIdentityPublicKeyLimitReachedError::new(MAX_KEYS_TO_DISABLE), - )); - } - - // Check key id duplicates - let mut ids = HashSet::new(); - for key_id in self.public_key_ids_to_disable() { - if ids.contains(key_id) { - result.add_error(ConsensusError::from( - DuplicatedIdentityPublicKeyIdBasicError::new(vec![*key_id]), - )); - break; - } - - ids.insert(key_id); - } - - // Ensure disable at timestamp is present - if self.public_keys_disabled_at().is_none() { - result.add_error(ConsensusError::from( - InvalidIdentityUpdateTransitionDisableKeysError::new(), - )) - } - } else if self.public_keys_disabled_at().is_some() { - // Ensure there are public keys to disable when disable at timestamp is present - result.add_error(ConsensusError::from( - InvalidIdentityUpdateTransitionDisableKeysError::new(), - )) - } - - if !result.is_valid() { - return Ok(result); - } - - IdentityPublicKeyInCreation::validate_identity_public_keys_structure( - self.public_keys_to_add(), - platform_version, - ) - .map_err(Error::Protocol) - } -} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/mod.rs index 39b3dee515e..7ad97da3a41 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/mod.rs @@ -21,3 +21,28 @@ pub mod data_contract_create; /// Module for updating an existing data contract entity. pub mod data_contract_update; + +/// The validation mode we are using +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum ValidationMode { + /// The basic checktx before the state transition is put into mempool + CheckTx, + /// Rechecking a state transition every block + RecheckTx, + /// The validation during block execution by a proposer or validator + Validator, + /// A validation mode used to get the action with no validation + NoValidation, +} + +impl ValidationMode { + /// Can this validation mode alter cache on drive? + pub fn can_alter_cache(&self) -> bool { + match self { + ValidationMode::CheckTx => false, + ValidationMode::RecheckTx => false, + ValidationMode::Validator => true, + ValidationMode::NoValidation => false, + } + } +} diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/transformer/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/transformer/mod.rs index a96ba6b8361..c02a228d5dd 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/transformer/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/transformer/mod.rs @@ -1,7 +1,13 @@ use crate::error::Error; +use crate::execution::types::state_transition_execution_context::StateTransitionExecutionContext; +use crate::execution::validation::state_transition::identity_create::StateTransitionActionTransformerForIdentityCreateTransitionV0; +use crate::execution::validation::state_transition::identity_top_up::StateTransitionIdentityTopUpTransitionActionTransformer; +use crate::execution::validation::state_transition::ValidationMode; use crate::platform_types::platform::PlatformRef; use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; use dpp::prelude::ConsensusValidationResult; +use dpp::serialization::Signable; use dpp::state_transition::StateTransition; use drive::grovedb::TransactionArg; use drive::state_transition_action::StateTransitionAction; @@ -27,7 +33,9 @@ pub trait StateTransitionActionTransformerV0 { fn transform_into_action( &self, platform: &PlatformRef, - validate: bool, + block_info: &BlockInfo, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error>; } @@ -36,26 +44,74 @@ impl StateTransitionActionTransformerV0 for StateTransition { fn transform_into_action( &self, platform: &PlatformRef, - validate: bool, + block_info: &BlockInfo, + validation_mode: ValidationMode, + execution_context: &mut StateTransitionExecutionContext, tx: TransactionArg, ) -> Result, Error> { match self { - StateTransition::DataContractCreate(st) => { - st.transform_into_action(platform, validate, tx) + StateTransition::DataContractCreate(st) => st.transform_into_action( + platform, + block_info, + validation_mode, + execution_context, + tx, + ), + StateTransition::DataContractUpdate(st) => st.transform_into_action( + platform, + block_info, + validation_mode, + execution_context, + tx, + ), + StateTransition::IdentityCreate(st) => { + let signable_bytes = self.signable_bytes()?; + st.transform_into_action_for_identity_create_transition( + platform, + signable_bytes, + validation_mode, + execution_context, + tx, + ) } - StateTransition::DataContractUpdate(st) => { - st.transform_into_action(platform, validate, tx) - } - StateTransition::IdentityCreate(st) => st.transform_into_action(platform, validate, tx), - StateTransition::IdentityUpdate(st) => st.transform_into_action(platform, validate, tx), - StateTransition::IdentityTopUp(st) => st.transform_into_action(platform, validate, tx), - StateTransition::IdentityCreditWithdrawal(st) => { - st.transform_into_action(platform, validate, tx) - } - StateTransition::DocumentsBatch(st) => st.transform_into_action(platform, validate, tx), - StateTransition::IdentityCreditTransfer(st) => { - st.transform_into_action(platform, validate, tx) + StateTransition::IdentityUpdate(st) => st.transform_into_action( + platform, + block_info, + validation_mode, + execution_context, + tx, + ), + StateTransition::IdentityTopUp(st) => { + let signable_bytes = self.signable_bytes()?; + st.transform_into_action_for_identity_top_up_transition( + platform, + signable_bytes, + validation_mode, + execution_context, + tx, + ) } + StateTransition::IdentityCreditWithdrawal(st) => st.transform_into_action( + platform, + block_info, + validation_mode, + execution_context, + tx, + ), + StateTransition::DocumentsBatch(st) => st.transform_into_action( + platform, + block_info, + validation_mode, + execution_context, + tx, + ), + StateTransition::IdentityCreditTransfer(st) => st.transform_into_action( + platform, + block_info, + validation_mode, + execution_context, + tx, + ), } } } diff --git a/packages/rs-drive-abci/src/lib.rs b/packages/rs-drive-abci/src/lib.rs index ac645f7582f..5e475d189aa 100644 --- a/packages/rs-drive-abci/src/lib.rs +++ b/packages/rs-drive-abci/src/lib.rs @@ -37,9 +37,14 @@ pub mod metrics; pub mod test; /// Mimic of block execution for tests -#[cfg(all(feature = "server", any(feature = "mocks", test)))] +#[cfg(any(feature = "mocks", test))] pub mod mimic; /// Platform module pub mod platform_types; /// Querying pub mod query; +/// Various utils +pub mod utils; + +/// Drive server +pub mod server; diff --git a/packages/rs-drive-abci/src/logging/destination.rs b/packages/rs-drive-abci/src/logging/destination.rs index 200a2b538d2..4f318926206 100644 --- a/packages/rs-drive-abci/src/logging/destination.rs +++ b/packages/rs-drive-abci/src/logging/destination.rs @@ -219,7 +219,7 @@ impl LogDestinationWriter { } LogDestinationWriter::RotationWriter(w) => { let paths = w.0.lock().unwrap().log_paths(); - let path = paths.get(0).expect("exactly one path excepted"); + let path = paths.first().expect("exactly one path excepted"); fs::read_to_string(path).unwrap() } _ => todo!(), @@ -258,7 +258,6 @@ impl TryFrom<&LogConfig> for Reopen { let open_fn = move || { OpenOptions::new() .create(true) - .write(true) .append(true) .mode(mode) .open(&opened_path) diff --git a/packages/rs-drive-abci/src/logging/level.rs b/packages/rs-drive-abci/src/logging/level.rs index 4986c11f643..a914e45d30d 100644 --- a/packages/rs-drive-abci/src/logging/level.rs +++ b/packages/rs-drive-abci/src/logging/level.rs @@ -110,7 +110,7 @@ impl TryFrom<&LogLevel> for EnvFilter { .expect("should be a valid log specification") } LogLevel::Debug => EnvFilter::try_new( - "info,tenderdash_abci=debug,drive_abci=debug,drive=debug,dpp=debug", + "info,tenderdash_abci=debug,drive_abci=debug,drive=debug,dpp=debug,dapi_grpc=debug,tonic=debug", ) .expect("should be a valid log specification"), LogLevel::Trace => EnvFilter::try_new( diff --git a/packages/rs-drive-abci/src/logging/logger.rs b/packages/rs-drive-abci/src/logging/logger.rs index ea04a2f74b3..121ce76b933 100644 --- a/packages/rs-drive-abci/src/logging/logger.rs +++ b/packages/rs-drive-abci/src/logging/logger.rs @@ -2,8 +2,6 @@ use crate::logging::config::LogConfig; use crate::logging::destination::{LogDestinationWriter, Writer}; use crate::logging::error::Error; use crate::logging::{LogConfigs, LogFormat, LogLevel}; - -use itertools::Itertools; use lazy_static::__Deref; use std::collections::HashMap; use std::fmt::Debug; @@ -14,7 +12,6 @@ use tracing_subscriber::fmt; use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt; use tracing_subscriber::registry; use tracing_subscriber::util::SubscriberInitExt; -use tracing_subscriber::util::TryInitError; use tracing_subscriber::EnvFilter; use tracing_subscriber::Layer; use tracing_subscriber::Registry; @@ -180,19 +177,24 @@ impl Loggers { /// drive_abci::logging::Loggers::default().try_install().ok(); /// ``` pub fn try_install(&self) -> Result<(), Error> { - // Based on examples from https://docs.rs/tracing-subscriber/0.3.17/tracing_subscriber/layer/index.html - let loggers = self - .0 - .values() - .map(|l| Ok(Box::new(l.layer()?))) - .collect::, _>>()?; + let layers = self.tracing_subscriber_layers()?; registry() - .with(loggers) + .with(layers) .try_init() .map_err(Error::TryInitError) } + /// Returns tracing subscriber layers + pub fn tracing_subscriber_layers(&self) -> Result>>, Error> { + // Based on examples from https://docs.rs/tracing-subscriber/0.3.17/tracing_subscriber/layer/index.html + + self.0 + .values() + .map(|l| Ok(Box::new(l.layer()?))) + .collect::, _>>() + } + /// Flushes all loggers. /// /// In case of multiple errors, returns only the last one. @@ -316,7 +318,9 @@ impl Logger { let formatter = fmt::layer::() .with_writer(make_writer) - .with_ansi(ansi); + .with_ansi(ansi) + .with_thread_names(true) + .with_thread_ids(true); let formatter = match self.format { LogFormat::Full => formatter.with_filter(filter).boxed(), diff --git a/packages/rs-drive-abci/src/main.rs b/packages/rs-drive-abci/src/main.rs index 051fc53e689..b9e07c6ea1b 100644 --- a/packages/rs-drive-abci/src/main.rs +++ b/packages/rs-drive-abci/src/main.rs @@ -5,19 +5,26 @@ use clap::{Parser, Subcommand}; use drive_abci::config::{FromEnv, PlatformConfig}; use drive_abci::core::wait_for_core_to_sync::v0::wait_for_core_to_sync_v0; -use drive_abci::logging; use drive_abci::logging::{LogBuilder, LogConfig, LogDestination, Loggers}; use drive_abci::metrics::{Prometheus, DEFAULT_PROMETHEUS_PORT}; +use drive_abci::platform_types::platform::Platform; use drive_abci::rpc::core::DefaultCoreRPC; +use drive_abci::{logging, server}; use itertools::Itertools; use std::fs::remove_file; +#[cfg(tokio_unstable)] +use std::net::SocketAddr; use std::path::PathBuf; use std::process::ExitCode; -use tokio::runtime::Builder; +use std::sync::Arc; +use tokio::runtime::{Builder, Runtime}; use tokio::signal::unix::{signal, SignalKind}; use tokio::time::Duration; use tokio_util::sync::CancellationToken; -use tracing::warn; +#[cfg(tokio_unstable)] +use tracing_subscriber::layer::SubscriberExt; +#[cfg(tokio_unstable)] +use tracing_subscriber::util::SubscriberInitExt; const SHUTDOWN_TIMEOUT_MILIS: u64 = 5000; // 5s; Docker defaults to 10s @@ -60,7 +67,7 @@ struct Cli { command: Commands, /// Path to the config (.env) file. #[arg(short, long, value_hint = clap::ValueHint::FilePath) ] - config: Option, + config: Option, /// Enable verbose logging. Use multiple times for even more logs. /// @@ -82,7 +89,12 @@ struct Cli { } impl Cli { - fn run(self, config: PlatformConfig, cancel: CancellationToken) -> Result<(), String> { + fn run( + self, + runtime: &Runtime, + config: PlatformConfig, + cancel: CancellationToken, + ) -> Result<(), String> { match self.command { Commands::Start => { verify_grovedb(&config.db_path, false)?; @@ -99,9 +111,21 @@ impl Cli { // Drive and Tenderdash rely on Core. Various functions will fail if Core is not synced. // We need to make sure that Core is ready before we start Drive ABCI app // Tenderdash won't start too until ABCI port is open. - wait_for_core_to_sync_v0(&core_rpc, cancel.clone()).unwrap(); + wait_for_core_to_sync_v0(&core_rpc, cancel.clone()).map_err(|e| e.to_string())?; + + if cancel.is_cancelled() { + return Ok(()); + } + + let platform: Platform = Platform::open_with_client( + config.db_path.clone(), + Some(config.clone()), + core_rpc, + ) + .expect("Failed to open platform"); + + server::start(runtime, Arc::new(platform), config, cancel); - drive_abci::abci::start(&config, core_rpc, cancel).map_err(|e| e.to_string())?; return Ok(()); } Commands::Config => dump_config(&config)?, @@ -116,46 +140,86 @@ impl Cli { fn main() -> Result<(), ExitCode> { let cli = Cli::parse(); let config = load_config(&cli.config); - // We use `cancel` to notify other subsystems that the server is shutting down - let cancel = tokio_util::sync::CancellationToken::new(); - - let loggers = configure_logging(&cli, &config).expect("failed to configure logging"); - - install_panic_hook(cancel.clone()); // Start tokio runtime and thread listening for signals. // The runtime will be reused by Prometheus and rs-tenderdash-abci. - - // TODO: 8 MB stack threads as some recursions in GroveDB can be pretty deep - // We could remove such a stack stack size once deletion of a node doesn't recurse in grovedb - let runtime = Builder::new_multi_thread() - .enable_all() + // TODO: 8 MB stack threads as some recursions in GroveDB can be pretty deep + // We could remove such a stack stack size once deletion of a node doesn't recurse in grovedb .thread_stack_size(8 * 1024 * 1024) + .enable_all() .build() .expect("cannot initialize tokio runtime"); - let rt_guard = runtime.enter(); + + // We use `cancel` to notify other subsystems that the server is shutting down + let cancel = CancellationToken::new(); + + let loggers = configure_logging(&cli, &config).expect("failed to configure logging"); + + // If tokio console is enabled, we install loggers together with tokio console + // due to type compatibility issue + + #[cfg(not(feature = "console"))] + loggers.install(); + + #[cfg(feature = "console")] + if config.tokio_console_enabled { + #[cfg(not(tokio_unstable))] + panic!("tokio_unstable flag should be set"); + + // Initialize Tokio console subscriber + #[cfg(tokio_unstable)] + { + let socket_addr: SocketAddr = config + .tokio_console_address + .parse() + .expect("cannot parse tokio console address"); + + let console_layer = console_subscriber::ConsoleLayer::builder() + .retention(Duration::from_secs(config.tokio_console_retention_secs)) + .server_addr(socket_addr) + .spawn(); + + tracing_subscriber::registry() + .with( + loggers + .tracing_subscriber_layers() + .expect("should return layers"), + ) + .with(console_layer) + .try_init() + .expect("can't init tracing subscribers"); + } + } else { + loggers.install(); + } + + // Log panics + + install_panic_hook(cancel.clone()); + + // Start runtime in the main thread + + let runtime_guard = runtime.enter(); runtime.spawn(handle_signals(cancel.clone(), loggers)); - // Main thread is not started in runtime, as it is synchronous and we don't want to run into - // potential, hard to debug, issues. - let status = match cli.run(config, cancel) { + let result = match cli.run(&runtime, config, cancel) { Ok(()) => { tracing::debug!("shutdown complete"); - ExitCode::SUCCESS + Ok(()) } Err(e) => { tracing::error!(error = e, "drive-abci failed"); - ExitCode::FAILURE + Err(ExitCode::FAILURE) } }; - drop(rt_guard); + drop(runtime_guard); runtime.shutdown_timeout(Duration::from_millis(SHUTDOWN_TIMEOUT_MILIS)); tracing::info!("drive-abci server is stopped"); - Err(status) + result } /// Handle signals received from operating system @@ -193,16 +257,15 @@ async fn handle_signals(cancel: CancellationToken, logs: Loggers) -> Result<(), /// Start prometheus exporter if it's configured. fn start_prometheus(config: &PlatformConfig) -> Result, String> { let prometheus_addr = config - .abci .prometheus_bind_address .clone() .filter(|s| !s.is_empty()); if let Some(addr) = prometheus_addr { + tracing::info!("Expose prometheus metrics on {}", addr); + let addr = url::Url::parse(&addr).map_err(|e| e.to_string())?; - Ok(Some( - drive_abci::metrics::Prometheus::new(addr).map_err(|e| e.to_string())?, - )) + Ok(Some(Prometheus::new(addr).map_err(|e| e.to_string())?)) } else { Ok(None) } @@ -219,7 +282,7 @@ fn dump_config(config: &PlatformConfig) -> Result<(), String> { /// Check status of ABCI server. fn check_status(config: &PlatformConfig) -> Result<(), String> { - if let Some(prometheus_addr) = &config.abci.prometheus_bind_address { + if let Some(prometheus_addr) = &config.prometheus_bind_address { let url = url::Url::parse(prometheus_addr).expect("cannot parse ABCI_PROMETHEUS_BIND_ADDRESS"); @@ -302,7 +365,7 @@ fn load_config(path: &Option) -> PlatformConfig { } } else if let Err(e) = dotenvy::dotenv() { if e.not_found() { - warn!("cannot find any matching .env file"); + tracing::warn!("cannot find any matching .env file"); } else { panic!("cannot load config file: {}", e); } @@ -333,7 +396,6 @@ fn configure_logging(cli: &Cli, config: &PlatformConfig) -> Result std::time::Duration { + self.start.elapsed() + } + + /// Add label to the histrgram + pub fn add_label(&mut self, label: Label) { + self.key = self.key.with_extra_labels(vec![label]); + } + + /// Cancel timing measurement and discard the metric. + pub fn cancel(mut self) { + self.skip = true; + + drop(self); + } } impl Drop for HistogramTiming { @@ -65,11 +98,15 @@ impl Drop for HistogramTiming { /// since the start time. #[inline] fn drop(&mut self) { + if self.skip { + return; + } + let stop = self.start.elapsed(); let key = self.key.name().to_string(); let labels: Vec